diff --git a/HISTORY.rst b/HISTORY.rst index 109d0b33cd..020ffbcc56 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -209,7 +209,10 @@ * Add user logged in and logged out events. * Add transaction handling in more places. * Update ACLs tests to use ephimeral models. - +* Add new app to handle all dependencies. +* Remove the licenses.py module and replace + it with a dependencies.py module. + 3.1.11 (2019-04-XX) =================== * Fix multiple tag selection wizard step. diff --git a/docs/releases/3.2.rst b/docs/releases/3.2.rst index 090556a73d..d8d222844e 100644 --- a/docs/releases/3.2.rst +++ b/docs/releases/3.2.rst @@ -242,6 +242,9 @@ Other changes * Add transaction handling in more places: Checkouts, documents, metadata, tags. * Update ACLs tests to use ephimeral models. +* Add new app to handle all dependencies. +* Remove the licenses.py module and replace + it with a dependencies.py module. Removals -------- diff --git a/mayan/apps/appearance/apps.py b/mayan/apps/appearance/apps.py index 7a7d35bca3..cd345d4acb 100644 --- a/mayan/apps/appearance/apps.py +++ b/mayan/apps/appearance/apps.py @@ -4,7 +4,7 @@ from django.utils.translation import ugettext_lazy as _ from mayan.apps.common.apps import MayanAppConfig -from .licenses import * # NOQA +from .dependencies import * # NOQA class AppearanceApp(MayanAppConfig): diff --git a/mayan/apps/appearance/dependencies.py b/mayan/apps/appearance/dependencies.py new file mode 100644 index 0000000000..0673cfcf15 --- /dev/null +++ b/mayan/apps/appearance/dependencies.py @@ -0,0 +1,47 @@ +from __future__ import unicode_literals + +from django.utils.translation import ugettext_lazy as _ + +from mayan.apps.dependencies.classes import JavaScriptDependency + +JavaScriptDependency( + label=_('Bootstrap'), module=__name__, name='bootstrap', + version_string='=3.3.7' +) +JavaScriptDependency( + label=_('Bootswatch'), module=__name__, name='bootswatch', + version_string='=3.3.7' +) +JavaScriptDependency( + label=_('Fancybox'), module=__name__, name='@fancyapps/fancybox', + version_string='=3.3.0' +) +JavaScriptDependency( + label=_('FontAwesome'), module=__name__, + name='@fortawesome/fontawesome-free', version_string='=5.6.3' +) +JavaScriptDependency( + label=_('jQuery'), module=__name__, name='jquery', version_string='=3.3.1' +) +JavaScriptDependency( + label=_('JQuery Form'), module=__name__, name='jquery-form', + version_string='=4.2.2' +) +JavaScriptDependency( + label=_('jQuery Lazy Load'), module=__name__, name='jquery-lazyload', + version_string='=1.9.3' +) +JavaScriptDependency( + label=_('JQuery Match Height'), module=__name__, name='jquery-match-height', + version_string='=0.7.2' +) +JavaScriptDependency( + label=_('Select 2'), module=__name__, name='select2', + version_string='=4.0.3' +) +JavaScriptDependency( + label=_('Toastr'), module=__name__, name='toastr', version_string='=2.1.4' +) +JavaScriptDependency( + label=_('URI.js'), module=__name__, name='urijs', version_string='=1.19.1' +) diff --git a/mayan/apps/appearance/licenses.py b/mayan/apps/appearance/licenses.py deleted file mode 100644 index db12e997c9..0000000000 --- a/mayan/apps/appearance/licenses.py +++ /dev/null @@ -1,141 +0,0 @@ -from __future__ import unicode_literals - -from mayan.apps.common.classes import Package - -Package(label='Bootstrap', license_text=''' -The MIT License (MIT) - -Copyright (c) 2011-2015 Twitter, Inc - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -''') - - -Package(label='Bootswatch', license_text=''' -The MIT License (MIT) - -Copyright (c) 2013 Thomas Park - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -''') - -Package(label='fancyBox', license_text=''' -fancyBox licensed under Creative Commons Attribution-NonCommercial 3.0 license. -''') - -Package(label='jquery_lazyload', license_text=''' -All code licensed under the MIT License. All images licensed under Creative Commons Attribution 3.0 Unported License. In other words you are basically free to do whatever you want. Just don't remove my name from the source. -''') - -Package(label='ScrollView', license_text=''' -Copyright (c) 2009 Toshimitsu Takahashi -Released under the MIT license. -''') - -Package(label='Font Awesome', license_text=''' -Font License - -Applies to all desktop and webfont files in the following directory: font-awesome/fonts/. -License: SIL OFL 1.1 -URL: http://scripts.sil.org/OFL - -Code License - -Applies to all CSS and LESS files in the following directories: font-awesome/css/, font-awesome/less/, and font-awesome/scss/. -License: MIT License -URL: http://opensource.org/licenses/mit-license.html - -''') - -Package(label='jQuery', license_text=''' -Copyright jQuery Foundation and other contributors, https://jquery.org/ - -This software consists of voluntary contributions made by many -individuals. For exact contribution history, see the revision history -available at https://github.com/jquery/jquery - -The following license applies to all parts of this software except as -documented below: - -==== - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -==== - -All files located in the node_modules and external directories are -externally maintained libraries used by this software which have their -own licenses; we recommend you read them, as their terms may differ from -the terms above. -''') - -Package(label='django-widget-tweaks', license_text=''' -Copyright (c) 2011-2015 Mikhail Korobov - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -''') diff --git a/mayan/apps/appearance/static/appearance/package-lock.json b/mayan/apps/appearance/static/appearance/package-lock.json deleted file mode 100644 index 4e8db8dd9f..0000000000 --- a/mayan/apps/appearance/static/appearance/package-lock.json +++ /dev/null @@ -1,1308 +0,0 @@ -{ - "name": "appearance", - "version": "1.0.0", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "@fortawesome/fontawesome-free": { - "version": "5.6.3", - "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-5.6.3.tgz", - "integrity": "sha512-s5PLdI9NYgjBvfrv6rhirPHlAHWx+Sfo/IjsAeiXYfmemC/GSjwsyz1wLnGPazbLPXWfk62ks980o9AmsxYUEQ==" - }, - "abbrev": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", - "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" - }, - "almond": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/almond/-/almond-0.3.3.tgz", - "integrity": "sha1-oOfJWsdiTWQXtElLHmi/9pMWiiA=" - }, - "amdefine": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", - "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=" - }, - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" - }, - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=" - }, - "argparse": { - "version": "0.1.16", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-0.1.16.tgz", - "integrity": "sha1-z9AeD7uj1srtBJ+9dY1A9lGW9Xw=", - "requires": { - "underscore": "1.7.0", - "underscore.string": "2.4.0" - }, - "dependencies": { - "underscore.string": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-2.4.0.tgz", - "integrity": "sha1-jN2PusTi0uoefi6Al8QvRCKA+Fs=" - } - } - }, - "asn1": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", - "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=" - }, - "assert-plus": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz", - "integrity": "sha1-104bh+ev/A24qttwIfP+SBAasjQ=" - }, - "async": { - "version": "0.1.22", - "resolved": "https://registry.npmjs.org/async/-/async-0.1.22.tgz", - "integrity": "sha1-D8GqoIig4+8Ovi2IMbqw3PiEUGE=" - }, - "aws-sign2": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz", - "integrity": "sha1-FDQt0428yU0OW4fXY81jYSwOeU8=" - }, - "bcrypt-pbkdf": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz", - "integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=", - "optional": true, - "requires": { - "tweetnacl": "0.14.5" - } - }, - "bl": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/bl/-/bl-1.0.3.tgz", - "integrity": "sha1-/FQhoo/UImA2w7OJGmaiW8ZNIm4=", - "requires": { - "readable-stream": "2.0.6" - } - }, - "boom": { - "version": "2.10.1", - "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", - "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", - "requires": { - "hoek": "2.16.3" - } - }, - "bootstrap": { - "version": "3.3.7", - "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-3.3.7.tgz", - "integrity": "sha1-WjiTlFSfIzMIdaOxUGVldPip63E=" - }, - "bootswatch": { - "version": "3.3.7", - "resolved": "https://registry.npmjs.org/bootswatch/-/bootswatch-3.3.7.tgz", - "integrity": "sha1-62+amoUjuHpwbqkd7sPg1+qoqx8=" - }, - "camelcase": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", - "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=" - }, - "caseless": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz", - "integrity": "sha1-cVuW6phBWTzDMGeSP17GDr2k99c=" - }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "requires": { - "ansi-styles": "2.2.1", - "escape-string-regexp": "1.0.5", - "has-ansi": "2.0.0", - "strip-ansi": "3.0.1", - "supports-color": "2.0.0" - } - }, - "cli": { - "version": "0.4.5", - "resolved": "https://registry.npmjs.org/cli/-/cli-0.4.5.tgz", - "integrity": "sha1-ePlIXNFhtWbppsctcXDEJw6B22E=", - "requires": { - "glob": "3.1.21" - } - }, - "coffee-script": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/coffee-script/-/coffee-script-1.3.3.tgz", - "integrity": "sha1-FQ1rTLUiiUNp7+1qIQHCC8f0pPQ=" - }, - "colors": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/colors/-/colors-0.6.2.tgz", - "integrity": "sha1-JCP+ZnisDF2uiFLl0OW+CMmXq8w=" - }, - "combined-stream": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", - "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", - "requires": { - "delayed-stream": "1.0.0" - } - }, - "commander": { - "version": "2.15.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", - "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==" - }, - "concat-stream": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.5.0.tgz", - "integrity": "sha1-U/fUPFHF5D+ByP3QMyHGMb5o1hE=", - "requires": { - "inherits": "2.0.3", - "readable-stream": "2.0.6", - "typedarray": "0.0.6" - } - }, - "console-browserify": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-0.1.6.tgz", - "integrity": "sha1-0SijwLuINQ61YmxufHGm8P1ImDw=" - }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" - }, - "cryptiles": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", - "integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=", - "requires": { - "boom": "2.10.1" - } - }, - "dashdash": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", - "requires": { - "assert-plus": "1.0.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" - } - } - }, - "dateformat": { - "version": "1.0.2-1.2.3", - "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-1.0.2-1.2.3.tgz", - "integrity": "sha1-sCIMAt6YYXQztyhRz0fePfLNvuk=" - }, - "debug": { - "version": "0.7.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-0.7.4.tgz", - "integrity": "sha1-BuHqgILCyxTjmAbiLi9vdX+Srzk=" - }, - "decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" - }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" - }, - "ecc-jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", - "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", - "optional": true, - "requires": { - "jsbn": "0.1.1" - } - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" - }, - "esprima": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-1.0.4.tgz", - "integrity": "sha1-n1V+CPw7TSbs6d00+Pv0drYlha0=" - }, - "eventemitter2": { - "version": "0.4.14", - "resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-0.4.14.tgz", - "integrity": "sha1-j2G3XN4BKy6esoTUVFWDtWQ7Yas=" - }, - "exit": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", - "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=" - }, - "extend": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", - "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=" - }, - "extract-zip": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.5.0.tgz", - "integrity": "sha1-ksz22B73Cp+kwXRxFMzvbYaIpsQ=", - "requires": { - "concat-stream": "1.5.0", - "debug": "0.7.4", - "mkdirp": "0.5.0", - "yauzl": "2.4.1" - } - }, - "extsprintf": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" - }, - "faye-websocket": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.4.4.tgz", - "integrity": "sha1-wUxbO/FNdBf/v9mQwKdJXNnzN7w=" - }, - "fd-slicer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.0.1.tgz", - "integrity": "sha1-i1vL2ewyfFBBv5qwI/1nUPEXfmU=", - "requires": { - "pend": "1.2.0" - } - }, - "findup-sync": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.1.3.tgz", - "integrity": "sha1-fz56l7gjksZTvwZYm9hRkOk8NoM=", - "requires": { - "glob": "3.2.11", - "lodash": "2.4.2" - }, - "dependencies": { - "glob": { - "version": "3.2.11", - "resolved": "https://registry.npmjs.org/glob/-/glob-3.2.11.tgz", - "integrity": "sha1-Spc/Y1uRkPcV0QmH1cAP0oFevj0=", - "requires": { - "inherits": "2.0.3", - "minimatch": "0.3.0" - } - }, - "lodash": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz", - "integrity": "sha1-+t2DS5aDBz2hebPq5tnA0VBT9z4=" - }, - "minimatch": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.3.0.tgz", - "integrity": "sha1-J12O2qxPG7MyZHIInnlJyDlGmd0=", - "requires": { - "lru-cache": "2.7.3", - "sigmund": "1.0.1" - } - } - } - }, - "forever-agent": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" - }, - "form-data": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-1.0.1.tgz", - "integrity": "sha1-rjFduaSQf6BlUCMEpm13M0de43w=", - "requires": { - "async": "2.6.0", - "combined-stream": "1.0.6", - "mime-types": "2.1.18" - }, - "dependencies": { - "async": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.0.tgz", - "integrity": "sha512-xAfGg1/NTLBBKlHFmnd7PlmUW9KhVQIUuSrYem9xzFUZy13ScvtyGGejaae9iAVRiRq9+Cx7DPFaAAhCpyxyPw==", - "requires": { - "lodash": "4.17.5" - } - }, - "lodash": { - "version": "4.17.5", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.5.tgz", - "integrity": "sha512-svL3uiZf1RwhH+cWrfZn3A4+U58wbP0tGVTLQPbjplZxZ8ROD9VLuNgsRniTlLe7OlSqR79RUehXgpBW/s0IQw==" - } - } - }, - "fs-extra": { - "version": "0.26.7", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.26.7.tgz", - "integrity": "sha1-muH92UiXeY7at20JGM9C0MMYT6k=", - "requires": { - "graceful-fs": "4.1.11", - "jsonfile": "2.4.0", - "klaw": "1.3.1", - "path-is-absolute": "1.0.1", - "rimraf": "2.2.8" - }, - "dependencies": { - "graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=" - } - } - }, - "gaze": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/gaze/-/gaze-0.4.3.tgz", - "integrity": "sha1-5Tj0/15P5kj0c6l+HrslPS3hJ7U=", - "requires": { - "globule": "0.1.0" - } - }, - "generate-function": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.0.0.tgz", - "integrity": "sha1-aFj+fAlpt9TpCTM3ZHrHn2DfvnQ=" - }, - "generate-object-property": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/generate-object-property/-/generate-object-property-1.2.0.tgz", - "integrity": "sha1-nA4cQDCM6AT0eDYYuTf6iPmdUNA=", - "requires": { - "is-property": "1.0.2" - } - }, - "getobject": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/getobject/-/getobject-0.1.0.tgz", - "integrity": "sha1-BHpEl4n6Fg0Bj1SG7ZEyC27HiFw=" - }, - "getpass": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", - "requires": { - "assert-plus": "1.0.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" - } - } - }, - "glob": { - "version": "3.1.21", - "resolved": "https://registry.npmjs.org/glob/-/glob-3.1.21.tgz", - "integrity": "sha1-0p4KBV3qUTj00H7UDomC6DwgZs0=", - "requires": { - "graceful-fs": "1.2.3", - "inherits": "1.0.2", - "minimatch": "0.2.14" - }, - "dependencies": { - "inherits": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-1.0.2.tgz", - "integrity": "sha1-ykMJ2t7mtUzAuNJH6NfHoJdb3Js=" - } - } - }, - "globule": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/globule/-/globule-0.1.0.tgz", - "integrity": "sha1-2cjt3h2nnRJaFRt5UzuXhnY0auU=", - "requires": { - "glob": "3.1.21", - "lodash": "1.0.2", - "minimatch": "0.2.14" - }, - "dependencies": { - "lodash": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-1.0.2.tgz", - "integrity": "sha1-j1dWDIO1n8JwvT1WG2kAQ0MOJVE=" - } - } - }, - "graceful-fs": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-1.2.3.tgz", - "integrity": "sha1-FaSAaldUfLLS2/J/QuiajDRRs2Q=" - }, - "grunt": { - "version": "0.4.5", - "resolved": "https://registry.npmjs.org/grunt/-/grunt-0.4.5.tgz", - "integrity": "sha1-VpN81RlDJK3/bSB2MYMqnWuk5/A=", - "requires": { - "async": "0.1.22", - "coffee-script": "1.3.3", - "colors": "0.6.2", - "dateformat": "1.0.2-1.2.3", - "eventemitter2": "0.4.14", - "exit": "0.1.2", - "findup-sync": "0.1.3", - "getobject": "0.1.0", - "glob": "3.1.21", - "grunt-legacy-log": "0.1.3", - "grunt-legacy-util": "0.2.0", - "hooker": "0.2.3", - "iconv-lite": "0.2.11", - "js-yaml": "2.0.5", - "lodash": "0.9.2", - "minimatch": "0.2.14", - "nopt": "1.0.10", - "rimraf": "2.2.8", - "underscore.string": "2.2.1", - "which": "1.0.9" - } - }, - "grunt-contrib-jasmine": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/grunt-contrib-jasmine/-/grunt-contrib-jasmine-0.5.3.tgz", - "integrity": "sha1-jwNNBut6IxnBLGhRW1kDBK+G3+M=", - "requires": { - "grunt-lib-phantomjs": "0.5.0", - "rimraf": "2.1.4" - }, - "dependencies": { - "rimraf": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.1.4.tgz", - "integrity": "sha1-Wm62Lu2gaPUe3lDymz5c0i89m7I=", - "requires": { - "graceful-fs": "1.2.3" - } - } - } - }, - "grunt-contrib-jshint": { - "version": "0.6.5", - "resolved": "https://registry.npmjs.org/grunt-contrib-jshint/-/grunt-contrib-jshint-0.6.5.tgz", - "integrity": "sha1-OvtGdnRTZMxKGe7nk0wOBgCLVm4=", - "requires": { - "jshint": "2.1.11" - } - }, - "grunt-contrib-uglify": { - "version": "0.2.7", - "resolved": "https://registry.npmjs.org/grunt-contrib-uglify/-/grunt-contrib-uglify-0.2.7.tgz", - "integrity": "sha1-5r2lHgxAoUWfbOrUI8Ze/XJaG/c=", - "requires": { - "grunt-lib-contrib": "0.6.1", - "uglify-js": "2.4.24" - } - }, - "grunt-contrib-watch": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/grunt-contrib-watch/-/grunt-contrib-watch-0.5.3.tgz", - "integrity": "sha1-fZ61Rl1Qb6FPqspH5uh5CoLBye4=", - "requires": { - "gaze": "0.4.3", - "tiny-lr": "0.0.4" - } - }, - "grunt-legacy-log": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/grunt-legacy-log/-/grunt-legacy-log-0.1.3.tgz", - "integrity": "sha1-7ClCboAwIa9ZAp+H0vnNczWgVTE=", - "requires": { - "colors": "0.6.2", - "grunt-legacy-log-utils": "0.1.1", - "hooker": "0.2.3", - "lodash": "2.4.2", - "underscore.string": "2.3.3" - }, - "dependencies": { - "lodash": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz", - "integrity": "sha1-+t2DS5aDBz2hebPq5tnA0VBT9z4=" - }, - "underscore.string": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-2.3.3.tgz", - "integrity": "sha1-ccCL9rQosRM/N+ePo6Icgvcymw0=" - } - } - }, - "grunt-legacy-log-utils": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/grunt-legacy-log-utils/-/grunt-legacy-log-utils-0.1.1.tgz", - "integrity": "sha1-wHBrndkGThFvNvI/5OawSGcsD34=", - "requires": { - "colors": "0.6.2", - "lodash": "2.4.2", - "underscore.string": "2.3.3" - }, - "dependencies": { - "lodash": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz", - "integrity": "sha1-+t2DS5aDBz2hebPq5tnA0VBT9z4=" - }, - "underscore.string": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-2.3.3.tgz", - "integrity": "sha1-ccCL9rQosRM/N+ePo6Icgvcymw0=" - } - } - }, - "grunt-legacy-util": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/grunt-legacy-util/-/grunt-legacy-util-0.2.0.tgz", - "integrity": "sha1-kzJIhNv343qf98Am3/RR2UqeVUs=", - "requires": { - "async": "0.1.22", - "exit": "0.1.2", - "getobject": "0.1.0", - "hooker": "0.2.3", - "lodash": "0.9.2", - "underscore.string": "2.2.1", - "which": "1.0.9" - } - }, - "grunt-lib-contrib": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/grunt-lib-contrib/-/grunt-lib-contrib-0.6.1.tgz", - "integrity": "sha1-P1att9oG6BR5XuJBWw6+X7iQPrs=", - "requires": { - "zlib-browserify": "0.0.1" - } - }, - "grunt-lib-phantomjs": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/grunt-lib-phantomjs/-/grunt-lib-phantomjs-0.5.0.tgz", - "integrity": "sha1-38a9W6Ac0CNMSSDJFUpGVDku6q4=", - "requires": { - "eventemitter2": "0.4.14", - "phantomjs": "1.9.20", - "semver": "1.0.14", - "temporary": "0.0.8" - } - }, - "har-validator": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-2.0.6.tgz", - "integrity": "sha1-zcvAgYgmWtEZtqWnyKtw7s+10n0=", - "requires": { - "chalk": "1.1.3", - "commander": "2.15.1", - "is-my-json-valid": "2.17.2", - "pinkie-promise": "2.0.1" - } - }, - "has-ansi": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", - "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", - "requires": { - "ansi-regex": "2.1.1" - } - }, - "hasha": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/hasha/-/hasha-2.2.0.tgz", - "integrity": "sha1-eNfL/B5tZjA/55g3NlmEUXsvbuE=", - "requires": { - "is-stream": "1.1.0", - "pinkie-promise": "2.0.1" - } - }, - "hawk": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz", - "integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=", - "requires": { - "boom": "2.10.1", - "cryptiles": "2.0.5", - "hoek": "2.16.3", - "sntp": "1.0.9" - } - }, - "hoek": { - "version": "2.16.3", - "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", - "integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=" - }, - "hooker": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/hooker/-/hooker-0.2.3.tgz", - "integrity": "sha1-uDT3I8xKJCqmWWNFnfbZhMXT2Vk=" - }, - "http-signature": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz", - "integrity": "sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8=", - "requires": { - "assert-plus": "0.2.0", - "jsprim": "1.4.1", - "sshpk": "1.14.1" - } - }, - "iconv-lite": { - "version": "0.2.11", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.2.11.tgz", - "integrity": "sha1-HOYKOleGSiktEyH/RgnKS7llrcg=" - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" - }, - "is-my-ip-valid": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-my-ip-valid/-/is-my-ip-valid-1.0.0.tgz", - "integrity": "sha512-gmh/eWXROncUzRnIa1Ubrt5b8ep/MGSnfAUI3aRp+sqTCs1tv1Isl8d8F6JmkN3dXKc3ehZMrtiPN9eL03NuaQ==" - }, - "is-my-json-valid": { - "version": "2.17.2", - "resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.17.2.tgz", - "integrity": "sha512-IBhBslgngMQN8DDSppmgDv7RNrlFotuuDsKcrCP3+HbFaVivIBU7u9oiiErw8sH4ynx3+gOGQ3q2otkgiSi6kg==", - "requires": { - "generate-function": "2.0.0", - "generate-object-property": "1.2.0", - "is-my-ip-valid": "1.0.0", - "jsonpointer": "4.0.1", - "xtend": "4.0.1" - } - }, - "is-property": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", - "integrity": "sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ=" - }, - "is-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=" - }, - "is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" - }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" - }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" - }, - "isstream": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" - }, - "jquery": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.3.1.tgz", - "integrity": "sha512-Ubldcmxp5np52/ENotGxlLe6aGMvmF4R8S6tZjsP6Knsaxd/xp3Zrh50cG93lR6nPXyUFwzN3ZSOQI0wRJNdGg==" - }, - "jquery-form": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/jquery-form/-/jquery-form-4.2.2.tgz", - "integrity": "sha512-HJTef7DRBSg8ge/RNUw8rUTTtB3l8ozO0OhD16AzDl+eIXp4skgCqRTd9fYPsOzL+pN6+1B9wvbTLGjgikz8Tg==", - "requires": { - "jquery": "3.3.1" - } - }, - "jquery-lazyload": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/jquery-lazyload/-/jquery-lazyload-1.9.3.tgz", - "integrity": "sha1-wJSkc1F4FdJz752N/UBTBMUs8cE=", - "requires": { - "grunt": "0.4.5", - "grunt-contrib-jasmine": "0.5.3", - "grunt-contrib-jshint": "0.6.5", - "grunt-contrib-uglify": "0.2.7", - "grunt-contrib-watch": "0.5.3" - } - }, - "jquery-match-height": { - "version": "0.7.2", - "resolved": "https://registry.npmjs.org/jquery-match-height/-/jquery-match-height-0.7.2.tgz", - "integrity": "sha1-+NnzulMU2qsQnPB0CGdL4gS+Xw4=" - }, - "jquery-mousewheel": { - "version": "3.1.13", - "resolved": "https://registry.npmjs.org/jquery-mousewheel/-/jquery-mousewheel-3.1.13.tgz", - "integrity": "sha1-BvAzXxbjU6aV5yBr9QUDy1I6buU=" - }, - "js-yaml": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-2.0.5.tgz", - "integrity": "sha1-olrmUJmZ6X3yeMZxnaEb0Gh3Q6g=", - "requires": { - "argparse": "0.1.16", - "esprima": "1.0.4" - } - }, - "jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", - "optional": true - }, - "jshint": { - "version": "2.1.11", - "resolved": "https://registry.npmjs.org/jshint/-/jshint-2.1.11.tgz", - "integrity": "sha1-61EI/vm6Xd67gwmD9XLSQuSeP5Y=", - "requires": { - "cli": "0.4.5", - "console-browserify": "0.1.6", - "minimatch": "0.2.14", - "shelljs": "0.1.4", - "underscore": "1.4.4" - }, - "dependencies": { - "underscore": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.4.4.tgz", - "integrity": "sha1-YaajIBBiKvoHljvzJSA88SI51gQ=" - } - } - }, - "json-schema": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" - }, - "json-stringify-safe": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" - }, - "jsonfile": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", - "integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=", - "requires": { - "graceful-fs": "4.1.11" - }, - "dependencies": { - "graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", - "optional": true - } - } - }, - "jsonpointer": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-4.0.1.tgz", - "integrity": "sha1-T9kss04OnbPInIYi7PUfm5eMbLk=" - }, - "jsprim": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", - "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", - "requires": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.2.3", - "verror": "1.10.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" - } - } - }, - "kew": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/kew/-/kew-0.7.0.tgz", - "integrity": "sha1-edk9LTM2PW/dKXCzNdkUGtWR15s=" - }, - "klaw": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/klaw/-/klaw-1.3.1.tgz", - "integrity": "sha1-QIhDO0azsbolnXh4XY6W9zugJDk=", - "requires": { - "graceful-fs": "4.1.11" - }, - "dependencies": { - "graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", - "optional": true - } - } - }, - "lodash": { - "version": "0.9.2", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-0.9.2.tgz", - "integrity": "sha1-jzSZxSRdNG1oLlsNO0B2fgnxqSw=" - }, - "lru-cache": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.7.3.tgz", - "integrity": "sha1-bUUk6LlV+V1PW1iFHOId1y+06VI=" - }, - "mime-db": { - "version": "1.33.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz", - "integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ==" - }, - "mime-types": { - "version": "2.1.18", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz", - "integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==", - "requires": { - "mime-db": "1.33.0" - } - }, - "minimatch": { - "version": "0.2.14", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.2.14.tgz", - "integrity": "sha1-x054BXT2PG+aCQ6Q775u9TpqdWo=", - "requires": { - "lru-cache": "2.7.3", - "sigmund": "1.0.1" - } - }, - "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" - }, - "mkdirp": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.0.tgz", - "integrity": "sha1-HXMHam35hs2TROFecfzAWkyavxI=", - "requires": { - "minimist": "0.0.8" - } - }, - "node-uuid": { - "version": "1.4.8", - "resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.8.tgz", - "integrity": "sha1-sEDrCSOWivq/jTL7HxfxFn/auQc=" - }, - "nopt": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", - "integrity": "sha1-bd0hvSoxQXuScn3Vhfim83YI6+4=", - "requires": { - "abbrev": "1.1.1" - } - }, - "noptify": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/noptify/-/noptify-0.0.3.tgz", - "integrity": "sha1-WPZUpz2XU98MUdlobckhBKZ/S7s=", - "requires": { - "nopt": "2.0.0" - }, - "dependencies": { - "nopt": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-2.0.0.tgz", - "integrity": "sha1-ynQW8gpeP5w7hhgPlilfo9C1Lg0=", - "requires": { - "abbrev": "1.1.1" - } - } - } - }, - "oauth-sign": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", - "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=" - }, - "package": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/package/-/package-1.0.1.tgz", - "integrity": "sha1-0lofmeJQbcsn1nBLg9yooxLk7cw=" - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" - }, - "pend": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", - "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=" - }, - "phantomjs": { - "version": "1.9.20", - "resolved": "https://registry.npmjs.org/phantomjs/-/phantomjs-1.9.20.tgz", - "integrity": "sha1-RCSsog4U0lXAsIia9va4lz2hDg0=", - "requires": { - "extract-zip": "1.5.0", - "fs-extra": "0.26.7", - "hasha": "2.2.0", - "kew": "0.7.0", - "progress": "1.1.8", - "request": "2.67.0", - "request-progress": "2.0.1", - "which": "1.2.14" - }, - "dependencies": { - "which": { - "version": "1.2.14", - "resolved": "https://registry.npmjs.org/which/-/which-1.2.14.tgz", - "integrity": "sha1-mofEN48D6CfOyvGs31bHNsAcFOU=", - "requires": { - "isexe": "2.0.0" - } - } - } - }, - "pinkie": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", - "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=" - }, - "pinkie-promise": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", - "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", - "requires": { - "pinkie": "2.0.4" - } - }, - "process-nextick-args": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", - "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=" - }, - "progress": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/progress/-/progress-1.1.8.tgz", - "integrity": "sha1-4mDHj2Fhzdmw5WzD4Khd4Xx6V74=" - }, - "qs": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/qs/-/qs-5.2.1.tgz", - "integrity": "sha1-gB/uAw4LlFDWOFrcSKTMVbRK7fw=" - }, - "readable-stream": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz", - "integrity": "sha1-j5A0HmilPMySh4jaz80Rs265t44=", - "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "1.0.7", - "string_decoder": "0.10.31", - "util-deprecate": "1.0.2" - } - }, - "request": { - "version": "2.67.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.67.0.tgz", - "integrity": "sha1-ivdHgOK/EeoK6aqWXBHxGv0nJ0I=", - "requires": { - "aws-sign2": "0.6.0", - "bl": "1.0.3", - "caseless": "0.11.0", - "combined-stream": "1.0.6", - "extend": "3.0.1", - "forever-agent": "0.6.1", - "form-data": "1.0.1", - "har-validator": "2.0.6", - "hawk": "3.1.3", - "http-signature": "1.1.1", - "is-typedarray": "1.0.0", - "isstream": "0.1.2", - "json-stringify-safe": "5.0.1", - "mime-types": "2.1.18", - "node-uuid": "1.4.8", - "oauth-sign": "0.8.2", - "qs": "5.2.1", - "stringstream": "0.0.5", - "tough-cookie": "2.2.2", - "tunnel-agent": "0.4.3" - } - }, - "request-progress": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/request-progress/-/request-progress-2.0.1.tgz", - "integrity": "sha1-XTa7V5YcZzqlt4jbyBQf3yO0Tgg=", - "requires": { - "throttleit": "1.0.0" - } - }, - "rimraf": { - "version": "2.2.8", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz", - "integrity": "sha1-5Dm+Kq7jJzIZUnMPmaiSnk/FBYI=" - }, - "select2": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/select2/-/select2-4.0.3.tgz", - "integrity": "sha1-IHcz/pHqy5yxoT8SRjQB9HJEng8=", - "requires": { - "almond": "0.3.3", - "jquery-mousewheel": "3.1.13" - } - }, - "semver": { - "version": "1.0.14", - "resolved": "https://registry.npmjs.org/semver/-/semver-1.0.14.tgz", - "integrity": "sha1-ysXi1Vpvv5WMsiCuhEBFBxx49nY=" - }, - "shelljs": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.1.4.tgz", - "integrity": "sha1-37vnjVbDwBaNL7eeEOzR28sH7A4=" - }, - "sigmund": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz", - "integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=" - }, - "sntp": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz", - "integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=", - "requires": { - "hoek": "2.16.3" - } - }, - "source-map": { - "version": "0.1.34", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.1.34.tgz", - "integrity": "sha1-p8/omux7FoLDsZjQrPtH19CQVms=", - "requires": { - "amdefine": "1.0.1" - } - }, - "sshpk": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.1.tgz", - "integrity": "sha1-Ew9Zde3a2WPx1W+SuaxsUfqfg+s=", - "requires": { - "asn1": "0.2.3", - "assert-plus": "1.0.0", - "bcrypt-pbkdf": "1.0.1", - "dashdash": "1.14.1", - "ecc-jsbn": "0.1.1", - "getpass": "0.1.7", - "jsbn": "0.1.1", - "tweetnacl": "0.14.5" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" - } - } - }, - "string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" - }, - "stringstream": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", - "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=" - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "requires": { - "ansi-regex": "2.1.1" - } - }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=" - }, - "temporary": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/temporary/-/temporary-0.0.8.tgz", - "integrity": "sha1-oYqYHSi6jKNgJ/s8MFOMPst0CsA=", - "requires": { - "package": "1.0.1" - } - }, - "throttleit": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/throttleit/-/throttleit-1.0.0.tgz", - "integrity": "sha1-nnhYNtr0Z0MUWlmEtiaNgoUorGw=" - }, - "tiny-lr": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/tiny-lr/-/tiny-lr-0.0.4.tgz", - "integrity": "sha1-gGGFR/Y/aX0Fy0DEwsSwg1Ia77Y=", - "requires": { - "debug": "0.7.4", - "faye-websocket": "0.4.4", - "noptify": "0.0.3", - "qs": "0.5.6" - }, - "dependencies": { - "qs": { - "version": "0.5.6", - "resolved": "https://registry.npmjs.org/qs/-/qs-0.5.6.tgz", - "integrity": "sha1-MbGtBYVnZRxSaSFQa5qHk5EaA4Q=" - } - } - }, - "toastr": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/toastr/-/toastr-2.1.4.tgz", - "integrity": "sha1-i0O+ZPudDEFIcURvLbjoyk6V8YE=", - "requires": { - "jquery": "3.3.1" - } - }, - "tough-cookie": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.2.2.tgz", - "integrity": "sha1-yDoYMPTl7wuT7yo0iOck+N4Basc=" - }, - "tunnel-agent": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.3.tgz", - "integrity": "sha1-Y3PbdpCf5XDgjXNYM2Xtgop07us=" - }, - "tweetnacl": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", - "optional": true - }, - "typedarray": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", - "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" - }, - "uglify-js": { - "version": "2.4.24", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.4.24.tgz", - "integrity": "sha1-+tV1XB4Vd2WLsG/5q25UjJW+vW4=", - "requires": { - "async": "0.2.10", - "source-map": "0.1.34", - "uglify-to-browserify": "1.0.2", - "yargs": "3.5.4" - }, - "dependencies": { - "async": { - "version": "0.2.10", - "resolved": "https://registry.npmjs.org/async/-/async-0.2.10.tgz", - "integrity": "sha1-trvgsGdLnXGXCMo43owjfLUmw9E=" - } - } - }, - "uglify-to-browserify": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz", - "integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc=" - }, - "underscore": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.7.0.tgz", - "integrity": "sha1-a7rwh3UA02vjTsqlhODbn+8DUgk=" - }, - "underscore.string": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-2.2.1.tgz", - "integrity": "sha1-18D6KvXVoaZ/QlPa7pgTLnM/Dxk=" - }, - "urijs": { - "version": "1.19.1", - "resolved": "https://registry.npmjs.org/urijs/-/urijs-1.19.1.tgz", - "integrity": "sha512-xVrGVi94ueCJNrBSTjWqjvtgvl3cyOTThp2zaMaFNGp3F542TR6sM3f2o8RqZl+AwteClSVmoCyt0ka4RjQOQg==" - }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" - }, - "verror": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", - "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", - "requires": { - "assert-plus": "1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "1.3.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" - } - } - }, - "which": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/which/-/which-1.0.9.tgz", - "integrity": "sha1-RgwdoPgQED0DIam2M6+eV15kSG8=" - }, - "window-size": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz", - "integrity": "sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0=" - }, - "wordwrap": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", - "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=" - }, - "xtend": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", - "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" - }, - "yargs": { - "version": "3.5.4", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.5.4.tgz", - "integrity": "sha1-2K/49mXpTDS9JZvevRv68N3TU2E=", - "requires": { - "camelcase": "1.2.1", - "decamelize": "1.2.0", - "window-size": "0.1.0", - "wordwrap": "0.0.2" - } - }, - "yauzl": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.4.1.tgz", - "integrity": "sha1-lSj0QtqxsihOWLQ3m7GU4i4MQAU=", - "requires": { - "fd-slicer": "1.0.1" - } - }, - "zlib-browserify": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/zlib-browserify/-/zlib-browserify-0.0.1.tgz", - "integrity": "sha1-T6akXQDbwV8xikr6HZr8Aljhdsw=" - } - } -} diff --git a/mayan/apps/appearance/static/appearance/package.json b/mayan/apps/appearance/static/appearance/package.json deleted file mode 100644 index 62d0d5c293..0000000000 --- a/mayan/apps/appearance/static/appearance/package.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "appearance", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "author": "", - "license": "Apache-2.0", - "private": true, - "dependencies": { - "bootstrap": "=3.3.7", - "bootswatch": "=3.3.7", - "@fortawesome/fontawesome-free": "=5.6.3", - "jquery": "=3.3.1", - "jquery-form": "=4.2.2", - "jquery-lazyload": "=1.9.3", - "jquery-match-height": "=0.7.2", - "select2": "=4.0.3", - "toastr": "=2.1.4", - "urijs": "=1.19.1" - } -} diff --git a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/.gitignore b/mayan/apps/appearance/static/appearance/vendors/fancybox-master/.gitignore deleted file mode 100644 index 8d87b1d267..0000000000 --- a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/.gitignore +++ /dev/null @@ -1 +0,0 @@ -node_modules/* diff --git a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/README.md b/mayan/apps/appearance/static/appearance/vendors/fancybox-master/README.md deleted file mode 100644 index 983a304508..0000000000 --- a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/README.md +++ /dev/null @@ -1,62 +0,0 @@ -# fancyBox - -jQuery lightbox script for displaying images, videos and more. -Touch enabled, responsive and fully customizable. - -See the [project page](http://fancyapps.com/fancybox/3/) for documentation and a demonstration. - -Follow [@thefancyapps](//twitter.com/thefancyapps) for updates. - - -## Quick start - -1\. Add latest jQuery and fancyBox files - -```html - - - - -``` - - -2\. Create links - -```html - - - - - - - -``` - - -3\. Enjoy! - - -## License - -fancyBox is licensed under the [GPLv3](http://choosealicense.com/licenses/gpl-3.0) license for all open source applications. -A commercial license is required for all commercial applications (including sites, themes and apps you plan to sell). - -[Read more about fancyBox license](http://fancyapps.com/fancybox/#license). - -## Bugs and feature requests - -If you find a bug, please report it [here on Github](https://github.com/fancyapps/fancybox/issues). - -Guidelines for bug reports: - -1. Use the GitHub issue search — check if the issue has already been reported. -2. Check if the issue has been fixed — try to reproduce it using the latest master or development branch in the repository. -3. Isolate the problem — create a reduced test case and a live example. You can use CodePen to fork any demo found on documentation to use it as a template. - -A good bug report shouldn't leave others needing to chase you up for more information. -Please try to be as detailed as possible in your report. - - -Feature requests are welcome. Please look for existing ones and use GitHub's "reactions" feature to vote. - -Please do not use the issue tracker for personal support requests - use Stack Overflow ([fancybox-3](http://stackoverflow.com/questions/tagged/fancybox-3) tag) instead. diff --git a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/bower.json b/mayan/apps/appearance/static/appearance/vendors/fancybox-master/bower.json deleted file mode 100644 index dc50191bc0..0000000000 --- a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/bower.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "fancybox", - "description": "Touch enabled, responsive and fully customizable jQuery lightbox script", - "keywords": [ - "touch", - "responsive", - "lightbox", - "fancybox", - "gallery", - "jQuery", - "plugin" - ], - "homepage": "http://fancyapps.com/fancybox/", - "license": "GPL-3.0", - "moduleType": "globals", - "main": [ - "dist/jquery.fancybox.min.css", - "dist/jquery.fancybox.min.js" - ], - "dependencies": { - "jquery": ">=1.9.0" - } -} diff --git a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/dist/jquery.fancybox.css b/mayan/apps/appearance/static/appearance/vendors/fancybox-master/dist/jquery.fancybox.css deleted file mode 100644 index a98be247dd..0000000000 --- a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/dist/jquery.fancybox.css +++ /dev/null @@ -1,771 +0,0 @@ -@charset "UTF-8"; -body.fancybox-active { - overflow: hidden; } - -body.fancybox-iosfix { - position: fixed; - left: 0; - right: 0; } - -.fancybox-is-hidden { - position: absolute; - top: -9999px; - left: -9999px; - visibility: hidden; } - -.fancybox-container { - position: fixed; - top: 0; - left: 0; - width: 100%; - height: 100%; - z-index: 99992; - -webkit-tap-highlight-color: transparent; - -webkit-backface-visibility: hidden; - backface-visibility: hidden; - -webkit-transform: translateZ(0); - transform: translateZ(0); - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; } - -.fancybox-outer, -.fancybox-inner, -.fancybox-bg, -.fancybox-stage { - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; } - -.fancybox-outer { - overflow-y: auto; - -webkit-overflow-scrolling: touch; } - -.fancybox-bg { - background: #1e1e1e; - opacity: 0; - transition-duration: inherit; - transition-property: opacity; - transition-timing-function: cubic-bezier(0.47, 0, 0.74, 0.71); } - -.fancybox-is-open .fancybox-bg { - opacity: 0.87; - transition-timing-function: cubic-bezier(0.22, 0.61, 0.36, 1); } - -.fancybox-infobar, -.fancybox-toolbar, -.fancybox-caption-wrap { - position: absolute; - direction: ltr; - z-index: 99997; - opacity: 0; - visibility: hidden; - transition: opacity .25s, visibility 0s linear .25s; - box-sizing: border-box; } - -.fancybox-show-infobar .fancybox-infobar, -.fancybox-show-toolbar .fancybox-toolbar, -.fancybox-show-caption .fancybox-caption-wrap { - opacity: 1; - visibility: visible; - transition: opacity .25s, visibility 0s; } - -.fancybox-infobar { - top: 0; - left: 0; - font-size: 13px; - padding: 0 10px; - height: 44px; - min-width: 44px; - line-height: 44px; - color: #ccc; - text-align: center; - pointer-events: none; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - -webkit-touch-callout: none; - -webkit-tap-highlight-color: transparent; - -webkit-font-smoothing: subpixel-antialiased; - mix-blend-mode: exclusion; } - -.fancybox-toolbar { - top: 0; - right: 0; - margin: 0; - padding: 0; } - -.fancybox-stage { - overflow: hidden; - direction: ltr; - z-index: 99994; - -webkit-transform: translate3d(0, 0, 0); } - -.fancybox-is-closing .fancybox-stage { - overflow: visible; } - -.fancybox-slide { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - margin: 0; - padding: 0; - overflow: auto; - outline: none; - white-space: normal; - box-sizing: border-box; - text-align: center; - z-index: 99994; - -webkit-overflow-scrolling: touch; - display: none; - -webkit-backface-visibility: hidden; - backface-visibility: hidden; - transition-property: opacity, -webkit-transform; - transition-property: transform, opacity; - transition-property: transform, opacity, -webkit-transform; } - -.fancybox-slide::before { - content: ''; - display: inline-block; - vertical-align: middle; - height: 100%; - width: 0; } - -.fancybox-is-sliding .fancybox-slide, -.fancybox-slide--previous, -.fancybox-slide--current, -.fancybox-slide--next { - display: block; } - -.fancybox-slide--image { - overflow: visible; } - -.fancybox-slide--image::before { - display: none; } - -.fancybox-slide--video .fancybox-content, -.fancybox-slide--video iframe { - background: #000; } - -.fancybox-slide--map .fancybox-content, -.fancybox-slide--map iframe { - background: #E5E3DF; } - -.fancybox-slide--next { - z-index: 99995; } - -.fancybox-slide > * { - display: inline-block; - position: relative; - padding: 24px; - margin: 44px 0 44px; - border-width: 0; - vertical-align: middle; - text-align: left; - background-color: #fff; - overflow: auto; - box-sizing: border-box; } - -.fancybox-slide > title, -.fancybox-slide > style, -.fancybox-slide > meta, -.fancybox-slide > link, -.fancybox-slide > script, -.fancybox-slide > base { - display: none; } - -.fancybox-slide .fancybox-image-wrap { - position: absolute; - top: 0; - left: 0; - margin: 0; - padding: 0; - border: 0; - z-index: 99995; - background: transparent; - cursor: default; - overflow: visible; - -webkit-transform-origin: top left; - -ms-transform-origin: top left; - transform-origin: top left; - background-size: 100% 100%; - background-repeat: no-repeat; - -webkit-backface-visibility: hidden; - backface-visibility: hidden; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - transition-property: opacity, -webkit-transform; - transition-property: transform, opacity; - transition-property: transform, opacity, -webkit-transform; } - -.fancybox-can-zoomOut .fancybox-image-wrap { - cursor: -webkit-zoom-out; - cursor: zoom-out; } - -.fancybox-can-zoomIn .fancybox-image-wrap { - cursor: -webkit-zoom-in; - cursor: zoom-in; } - -.fancybox-can-drag .fancybox-image-wrap { - cursor: -webkit-grab; - cursor: grab; } - -.fancybox-is-dragging .fancybox-image-wrap { - cursor: -webkit-grabbing; - cursor: grabbing; } - -.fancybox-image, -.fancybox-spaceball { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - margin: 0; - padding: 0; - border: 0; - max-width: none; - max-height: none; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; } - -.fancybox-spaceball { - z-index: 1; } - -.fancybox-slide--iframe .fancybox-content { - padding: 0; - width: 80%; - height: 80%; - max-width: calc(100% - 100px); - max-height: calc(100% - 88px); - overflow: visible; - background: #fff; } - -.fancybox-iframe { - display: block; - margin: 0; - padding: 0; - border: 0; - width: 100%; - height: 100%; - background: #fff; } - -.fancybox-error { - margin: 0; - padding: 40px; - width: 100%; - max-width: 380px; - background: #fff; - cursor: default; } - -.fancybox-error p { - margin: 0; - padding: 0; - color: #444; - font-size: 16px; - line-height: 20px; } - -/* Buttons */ -.fancybox-button { - box-sizing: border-box; - display: inline-block; - vertical-align: top; - width: 44px; - height: 44px; - margin: 0; - padding: 10px; - border: 0; - border-radius: 0; - background: rgba(30, 30, 30, 0.6); - transition: color .3s ease; - cursor: pointer; - outline: none; } - -.fancybox-button, -.fancybox-button:visited, -.fancybox-button:link { - color: #ccc; } - -.fancybox-button:focus, -.fancybox-button:hover { - color: #fff; } - -.fancybox-button[disabled] { - color: #ccc; - cursor: default; - opacity: 0.6; } - -.fancybox-button svg { - display: block; - position: relative; - overflow: visible; - shape-rendering: geometricPrecision; } - -.fancybox-button svg path { - fill: currentColor; - stroke: currentColor; - stroke-linejoin: round; - stroke-width: 3; } - -.fancybox-button--share svg path { - stroke-width: 1; } - -.fancybox-button--play svg path:nth-child(2) { - display: none; } - -.fancybox-button--pause svg path:nth-child(1) { - display: none; } - -.fancybox-button--zoom svg path { - fill: transparent; } - -/* Navigation arrows */ -.fancybox-navigation { - display: none; } - -.fancybox-show-nav .fancybox-navigation { - display: block; } - -.fancybox-navigation button { - position: absolute; - top: 50%; - margin: -50px 0 0 0; - z-index: 99997; - background: transparent; - width: 60px; - height: 100px; - padding: 17px; } - -.fancybox-navigation button:before { - content: ""; - position: absolute; - top: 30px; - right: 10px; - width: 40px; - height: 40px; - background: rgba(30, 30, 30, 0.6); } - -.fancybox-navigation .fancybox-button--arrow_left { - left: 0; } - -.fancybox-navigation .fancybox-button--arrow_right { - right: 0; } - -/* Close button on the top right corner of html content */ -.fancybox-close-small { - position: absolute; - top: 0; - right: 0; - width: 40px; - height: 40px; - padding: 0; - margin: 0; - border: 0; - border-radius: 0; - background: transparent; - z-index: 10; - cursor: pointer; } - -.fancybox-close-small:after { - content: '×'; - position: absolute; - top: 5px; - right: 5px; - width: 30px; - height: 30px; - font: 22px/30px Arial,"Helvetica Neue",Helvetica,sans-serif; - color: #888; - font-weight: 300; - text-align: center; - border-radius: 50%; - border-width: 0; - background-color: transparent; - transition: background-color .25s; - box-sizing: border-box; - z-index: 2; } - -.fancybox-close-small:focus { - outline: none; } - -.fancybox-close-small:focus:after { - outline: 1px dotted #888; } - -.fancybox-close-small:hover:after { - color: #555; - background: #eee; } - -.fancybox-slide--image .fancybox-close-small, -.fancybox-slide--iframe .fancybox-close-small { - top: 0; - right: -40px; } - -.fancybox-slide--image .fancybox-close-small:after, -.fancybox-slide--iframe .fancybox-close-small:after { - font-size: 35px; - color: #aaa; } - -.fancybox-slide--image .fancybox-close-small:hover:after, -.fancybox-slide--iframe .fancybox-close-small:hover:after { - color: #fff; - background: transparent; } - -.fancybox-is-scaling .fancybox-close-small, -.fancybox-is-zoomable.fancybox-can-drag .fancybox-close-small { - display: none; } - -/* Caption */ -.fancybox-caption-wrap { - bottom: 0; - left: 0; - right: 0; - padding: 60px 2vw 0 2vw; - background: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.1) 20%, rgba(0, 0, 0, 0.2) 40%, rgba(0, 0, 0, 0.6) 80%, rgba(0, 0, 0, 0.8) 100%); - pointer-events: none; } - -.fancybox-caption { - padding: 30px 0; - border-top: 1px solid rgba(255, 255, 255, 0.4); - font-size: 14px; - color: #fff; - line-height: 20px; - -webkit-text-size-adjust: none; } - -.fancybox-caption a, -.fancybox-caption button, -.fancybox-caption select { - pointer-events: all; - position: relative; - /* Fix IE11 */ } - -.fancybox-caption a { - color: #fff; - text-decoration: underline; } - -/* Loading indicator */ -.fancybox-slide > .fancybox-loading { - border: 6px solid rgba(100, 100, 100, 0.4); - border-top: 6px solid rgba(255, 255, 255, 0.6); - border-radius: 100%; - height: 50px; - width: 50px; - -webkit-animation: fancybox-rotate .8s infinite linear; - animation: fancybox-rotate .8s infinite linear; - background: transparent; - position: absolute; - top: 50%; - left: 50%; - margin-top: -30px; - margin-left: -30px; - z-index: 99999; } - -@-webkit-keyframes fancybox-rotate { - from { - -webkit-transform: rotate(0deg); - transform: rotate(0deg); } - to { - -webkit-transform: rotate(359deg); - transform: rotate(359deg); } } - -@keyframes fancybox-rotate { - from { - -webkit-transform: rotate(0deg); - transform: rotate(0deg); } - to { - -webkit-transform: rotate(359deg); - transform: rotate(359deg); } } - -/* Transition effects */ -.fancybox-animated { - transition-timing-function: cubic-bezier(0, 0, 0.25, 1); } - -/* transitionEffect: slide */ -.fancybox-fx-slide.fancybox-slide--previous { - -webkit-transform: translate3d(-100%, 0, 0); - transform: translate3d(-100%, 0, 0); - opacity: 0; } - -.fancybox-fx-slide.fancybox-slide--next { - -webkit-transform: translate3d(100%, 0, 0); - transform: translate3d(100%, 0, 0); - opacity: 0; } - -.fancybox-fx-slide.fancybox-slide--current { - -webkit-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - opacity: 1; } - -/* transitionEffect: fade */ -.fancybox-fx-fade.fancybox-slide--previous, -.fancybox-fx-fade.fancybox-slide--next { - opacity: 0; - transition-timing-function: cubic-bezier(0.19, 1, 0.22, 1); } - -.fancybox-fx-fade.fancybox-slide--current { - opacity: 1; } - -/* transitionEffect: zoom-in-out */ -.fancybox-fx-zoom-in-out.fancybox-slide--previous { - -webkit-transform: scale3d(1.5, 1.5, 1.5); - transform: scale3d(1.5, 1.5, 1.5); - opacity: 0; } - -.fancybox-fx-zoom-in-out.fancybox-slide--next { - -webkit-transform: scale3d(0.5, 0.5, 0.5); - transform: scale3d(0.5, 0.5, 0.5); - opacity: 0; } - -.fancybox-fx-zoom-in-out.fancybox-slide--current { - -webkit-transform: scale3d(1, 1, 1); - transform: scale3d(1, 1, 1); - opacity: 1; } - -/* transitionEffect: rotate */ -.fancybox-fx-rotate.fancybox-slide--previous { - -webkit-transform: rotate(-360deg); - -ms-transform: rotate(-360deg); - transform: rotate(-360deg); - opacity: 0; } - -.fancybox-fx-rotate.fancybox-slide--next { - -webkit-transform: rotate(360deg); - -ms-transform: rotate(360deg); - transform: rotate(360deg); - opacity: 0; } - -.fancybox-fx-rotate.fancybox-slide--current { - -webkit-transform: rotate(0deg); - -ms-transform: rotate(0deg); - transform: rotate(0deg); - opacity: 1; } - -/* transitionEffect: circular */ -.fancybox-fx-circular.fancybox-slide--previous { - -webkit-transform: scale3d(0, 0, 0) translate3d(-100%, 0, 0); - transform: scale3d(0, 0, 0) translate3d(-100%, 0, 0); - opacity: 0; } - -.fancybox-fx-circular.fancybox-slide--next { - -webkit-transform: scale3d(0, 0, 0) translate3d(100%, 0, 0); - transform: scale3d(0, 0, 0) translate3d(100%, 0, 0); - opacity: 0; } - -.fancybox-fx-circular.fancybox-slide--current { - -webkit-transform: scale3d(1, 1, 1) translate3d(0, 0, 0); - transform: scale3d(1, 1, 1) translate3d(0, 0, 0); - opacity: 1; } - -/* transitionEffect: tube */ -.fancybox-fx-tube.fancybox-slide--previous { - -webkit-transform: translate3d(-100%, 0, 0) scale(0.1) skew(-10deg); - transform: translate3d(-100%, 0, 0) scale(0.1) skew(-10deg); } - -.fancybox-fx-tube.fancybox-slide--next { - -webkit-transform: translate3d(100%, 0, 0) scale(0.1) skew(10deg); - transform: translate3d(100%, 0, 0) scale(0.1) skew(10deg); } - -.fancybox-fx-tube.fancybox-slide--current { - -webkit-transform: translate3d(0, 0, 0) scale(1); - transform: translate3d(0, 0, 0) scale(1); } - -/* Share */ -.fancybox-share { - padding: 30px; - border-radius: 3px; - background: #f4f4f4; - max-width: 90%; - text-align: center; } - -.fancybox-share h1 { - color: #222; - margin: 0 0 20px 0; - font-size: 35px; - font-weight: 700; } - -.fancybox-share p { - margin: 0; - padding: 0; } - -p.fancybox-share__links { - margin-right: -10px; } - -.fancybox-share__button { - display: inline-block; - text-decoration: none; - margin: 0 10px 10px 0; - padding: 0 15px; - min-width: 130px; - border: 0; - border-radius: 3px; - background: #fff; - white-space: nowrap; - font-size: 14px; - font-weight: 700; - line-height: 40px; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - color: #fff; - transition: all .2s; } - -.fancybox-share__button:hover { - text-decoration: none; } - -.fancybox-share__button--fb { - background: #3b5998; } - -.fancybox-share__button--fb:hover { - background: #344e86; } - -.fancybox-share__button--pt { - background: #bd081d; } - -.fancybox-share__button--pt:hover { - background: #aa0719; } - -.fancybox-share__button--tw { - background: #1da1f2; } - -.fancybox-share__button--tw:hover { - background: #0d95e8; } - -.fancybox-share__button svg { - position: relative; - top: -1px; - width: 25px; - height: 25px; - margin-right: 7px; - vertical-align: middle; } - -.fancybox-share__button svg path { - fill: #fff; } - -.fancybox-share__input { - box-sizing: border-box; - width: 100%; - margin: 10px 0 0 0; - padding: 10px 15px; - background: transparent; - color: #5d5b5b; - font-size: 14px; - outline: none; - border: 0; - border-bottom: 2px solid #d7d7d7; } - -/* Thumbs */ -.fancybox-thumbs { - display: none; - position: absolute; - top: 0; - bottom: 0; - right: 0; - width: 212px; - margin: 0; - padding: 2px 2px 4px 2px; - background: #fff; - -webkit-tap-highlight-color: transparent; - -webkit-overflow-scrolling: touch; - -ms-overflow-style: -ms-autohiding-scrollbar; - box-sizing: border-box; - z-index: 99995; } - -.fancybox-thumbs-x { - overflow-y: hidden; - overflow-x: auto; } - -.fancybox-show-thumbs .fancybox-thumbs { - display: block; } - -.fancybox-show-thumbs .fancybox-inner { - right: 212px; } - -.fancybox-thumbs > ul { - list-style: none; - position: absolute; - position: relative; - width: 100%; - height: 100%; - margin: 0; - padding: 0; - overflow-x: hidden; - overflow-y: auto; - font-size: 0; - white-space: nowrap; } - -.fancybox-thumbs-x > ul { - overflow: hidden; } - -.fancybox-thumbs-y > ul::-webkit-scrollbar { - width: 7px; } - -.fancybox-thumbs-y > ul::-webkit-scrollbar-track { - background: #fff; - border-radius: 10px; - box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3); } - -.fancybox-thumbs-y > ul::-webkit-scrollbar-thumb { - background: #2a2a2a; - border-radius: 10px; } - -.fancybox-thumbs > ul > li { - float: left; - overflow: hidden; - padding: 0; - margin: 2px; - width: 100px; - height: 75px; - max-width: calc(50% - 4px); - max-height: calc(100% - 8px); - position: relative; - cursor: pointer; - outline: none; - -webkit-tap-highlight-color: transparent; - -webkit-backface-visibility: hidden; - backface-visibility: hidden; - box-sizing: border-box; } - -li.fancybox-thumbs-loading { - background: rgba(0, 0, 0, 0.1); } - -.fancybox-thumbs > ul > li > img { - position: absolute; - top: 0; - left: 0; - max-width: none; - max-height: none; - -webkit-touch-callout: none; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; } - -.fancybox-thumbs > ul > li:before { - content: ''; - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - border: 4px solid #4ea7f9; - z-index: 99991; - opacity: 0; - transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94); } - -.fancybox-thumbs > ul > li.fancybox-thumbs-active:before { - opacity: 1; } - -/* Styling for Small-Screen Devices */ -@media all and (max-width: 800px) { - .fancybox-thumbs { - width: 110px; } - .fancybox-show-thumbs .fancybox-inner { - right: 110px; } - .fancybox-thumbs > ul > li { - max-width: calc(100% - 10px); } } diff --git a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/dist/jquery.fancybox.js b/mayan/apps/appearance/static/appearance/vendors/fancybox-master/dist/jquery.fancybox.js deleted file mode 100644 index acc8bf187b..0000000000 --- a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/dist/jquery.fancybox.js +++ /dev/null @@ -1,5238 +0,0 @@ -// ================================================== -// fancyBox v3.2.10 -// -// Licensed GPLv3 for open source use -// or fancyBox Commercial License for commercial use -// -// http://fancyapps.com/fancybox/ -// Copyright 2017 fancyApps -// -// ================================================== -;(function (window, document, $, undefined) { - 'use strict'; - - // If there's no jQuery, fancyBox can't work - // ========================================= - - if ( !$ ) { - return; - } - - // Check if fancyBox is already initialized - // ======================================== - - if ( $.fn.fancybox ) { - - if ( 'console' in window ) { - console.log( 'fancyBox already initialized' ); - } - - return; - } - - // Private default settings - // ======================== - - var defaults = { - - // Enable infinite gallery navigation - loop : false, - - // Space around image, ignored if zoomed-in or viewport width is smaller than 800px - margin : [44, 0], - - // Horizontal space between slides - gutter : 50, - - // Enable keyboard navigation - keyboard : true, - - // Should display navigation arrows at the screen edges - arrows : true, - - // Should display infobar (counter and arrows at the top) - infobar : true, - - // Should display toolbar (buttons at the top) - toolbar : true, - - // What buttons should appear in the top right corner. - // Buttons will be created using templates from `btnTpl` option - // and they will be placed into toolbar (class="fancybox-toolbar"` element) - buttons : [ - 'slideShow', - 'fullScreen', - 'thumbs', - 'share', - //'download', - //'zoom', - 'close' - ], - - // Detect "idle" time in seconds - idleTime : 3, - - // Should display buttons at top right corner of the content - // If 'auto' - they will be created for content having type 'html', 'inline' or 'ajax' - // Use template from `btnTpl.smallBtn` for customization - smallBtn : 'auto', - - // Disable right-click and use simple image protection for images - protect : false, - - // Shortcut to make content "modal" - disable keyboard navigtion, hide buttons, etc - modal : false, - - image : { - - // Wait for images to load before displaying - // Requires predefined image dimensions - // If 'auto' - will zoom in thumbnail if 'width' and 'height' attributes are found - preload : "auto" - - }, - - ajax : { - - // Object containing settings for ajax request - settings : { - - // This helps to indicate that request comes from the modal - // Feel free to change naming - data : { - fancybox : true - } - } - - }, - - iframe : { - - // Iframe template - tpl : '', - - // Preload iframe before displaying it - // This allows to calculate iframe content width and height - // (note: Due to "Same Origin Policy", you can't get cross domain data). - preload : true, - - // Custom CSS styling for iframe wrapping element - // You can use this to set custom iframe dimensions - css : {}, - - // Iframe tag attributes - attr : { - scrolling : 'auto' - } - - }, - - // Default content type if cannot be detected automatically - defaultType : 'image', - - // Open/close animation type - // Possible values: - // false - disable - // "zoom" - zoom images from/to thumbnail - // "fade" - // "zoom-in-out" - // - animationEffect : "zoom", - - // Duration in ms for open/close animation - animationDuration : 500, - - // Should image change opacity while zooming - // If opacity is "auto", then opacity will be changed if image and thumbnail have different aspect ratios - zoomOpacity : "auto", - - // Transition effect between slides - // - // Possible values: - // false - disable - // "fade' - // "slide' - // "circular' - // "tube' - // "zoom-in-out' - // "rotate' - // - transitionEffect : "fade", - - // Duration in ms for transition animation - transitionDuration : 366, - - // Custom CSS class for slide element - slideClass : '', - - // Custom CSS class for layout - baseClass : '', - - // Base template for layout - baseTpl : - '', - - // Loading indicator template - spinnerTpl : '
', - - // Error message template - errorTpl : '

{{ERROR}}

', - - btnTpl : { - - download : '' + - '' + - '' + - '' + - '', - - zoom : '', - - close : '', - - // This small close button will be appended to your html/inline/ajax content by default, - // if "smallBtn" option is not set to false - smallBtn : '', - - // Arrows - arrowLeft : '', - - arrowRight : '' - }, - - // Container is injected into this element - parentEl : 'body', - - - // Focus handling - // ============== - - // Try to focus on the first focusable element after opening - autoFocus : false, - - // Put focus back to active element after closing - backFocus : true, - - // Do not let user to focus on element outside modal content - trapFocus : true, - - - // Module specific options - // ======================= - - fullScreen : { - autoStart : false, - }, - - // Set `touch: false` to disable dragging/swiping - touch : { - vertical : true, // Allow to drag content vertically - momentum : true // Continue movement after releasing mouse/touch when panning - }, - - // Hash value when initializing manually, - // set `false` to disable hash change - hash : null, - - // Customize or add new media types - // Example: - /* - media : { - youtube : { - params : { - autoplay : 0 - } - } - } - */ - media : {}, - - slideShow : { - autoStart : false, - speed : 4000 - }, - - thumbs : { - autoStart : false, // Display thumbnails on opening - hideOnClose : true, // Hide thumbnail grid when closing animation starts - parentEl : '.fancybox-container', // Container is injected into this element - axis : 'y' // Vertical (y) or horizontal (x) scrolling - }, - - // Use mousewheel to navigate gallery - // If 'auto' - enabled for images only - wheel : 'auto', - - // Callbacks - //========== - - // See Documentation/API/Events for more information - // Example: - /* - afterShow: function( instance, current ) { - console.info( 'Clicked element:' ); - console.info( current.opts.$orig ); - } - */ - - onInit : $.noop, // When instance has been initialized - - beforeLoad : $.noop, // Before the content of a slide is being loaded - afterLoad : $.noop, // When the content of a slide is done loading - - beforeShow : $.noop, // Before open animation starts - afterShow : $.noop, // When content is done loading and animating - - beforeClose : $.noop, // Before the instance attempts to close. Return false to cancel the close. - afterClose : $.noop, // After instance has been closed - - onActivate : $.noop, // When instance is brought to front - onDeactivate : $.noop, // When other instance has been activated - - - // Interaction - // =========== - - // Use options below to customize taken action when user clicks or double clicks on the fancyBox area, - // each option can be string or method that returns value. - // - // Possible values: - // "close" - close instance - // "next" - move to next gallery item - // "nextOrClose" - move to next gallery item or close if gallery has only one item - // "toggleControls" - show/hide controls - // "zoom" - zoom image (if loaded) - // false - do nothing - - // Clicked on the content - clickContent : function( current, event ) { - return current.type === 'image' ? 'zoom' : false; - }, - - // Clicked on the slide - clickSlide : 'close', - - // Clicked on the background (backdrop) element - clickOutside : 'close', - - // Same as previous two, but for double click - dblclickContent : false, - dblclickSlide : false, - dblclickOutside : false, - - - // Custom options when mobile device is detected - // ============================================= - - mobile : { - idleTime : false, - margin : 0, - - clickContent : function( current, event ) { - return current.type === 'image' ? 'toggleControls' : false; - }, - clickSlide : function( current, event ) { - return current.type === 'image' ? 'toggleControls' : 'close'; - }, - dblclickContent : function( current, event ) { - return current.type === 'image' ? 'zoom' : false; - }, - dblclickSlide : function( current, event ) { - return current.type === 'image' ? 'zoom' : false; - } - }, - - - // Internationalization - // ============ - - lang : 'en', - i18n : { - 'en' : { - CLOSE : 'Close', - NEXT : 'Next', - PREV : 'Previous', - ERROR : 'The requested content cannot be loaded.
Please try again later.', - PLAY_START : 'Start slideshow', - PLAY_STOP : 'Pause slideshow', - FULL_SCREEN : 'Full screen', - THUMBS : 'Thumbnails', - DOWNLOAD : 'Download', - SHARE : 'Share', - ZOOM : 'Zoom' - }, - 'de' : { - CLOSE : 'Schliessen', - NEXT : 'Weiter', - PREV : 'Zurück', - ERROR : 'Die angeforderten Daten konnten nicht geladen werden.
Bitte versuchen Sie es später nochmal.', - PLAY_START : 'Diaschau starten', - PLAY_STOP : 'Diaschau beenden', - FULL_SCREEN : 'Vollbild', - THUMBS : 'Vorschaubilder', - DOWNLOAD : 'Herunterladen', - SHARE : 'Teilen', - ZOOM : 'Maßstab' - } - } - - }; - - // Few useful variables and methods - // ================================ - - var $W = $(window); - var $D = $(document); - - var called = 0; - - - // Check if an object is a jQuery object and not a native JavaScript object - // ======================================================================== - - var isQuery = function ( obj ) { - return obj && obj.hasOwnProperty && obj instanceof $; - }; - - - // Handle multiple browsers for "requestAnimationFrame" and "cancelAnimationFrame" - // =============================================================================== - - var requestAFrame = (function () { - return window.requestAnimationFrame || - window.webkitRequestAnimationFrame || - window.mozRequestAnimationFrame || - window.oRequestAnimationFrame || - // if all else fails, use setTimeout - function (callback) { - return window.setTimeout(callback, 1000 / 60); - }; - })(); - - - // Detect the supported transition-end event property name - // ======================================================= - - var transitionEnd = (function () { - var t, el = document.createElement("fakeelement"); - - var transitions = { - "transition" : "transitionend", - "OTransition" : "oTransitionEnd", - "MozTransition" : "transitionend", - "WebkitTransition": "webkitTransitionEnd" - }; - - for (t in transitions) { - if (el.style[t] !== undefined){ - return transitions[t]; - } - } - - return 'transitionend'; - })(); - - - // Force redraw on an element. - // This helps in cases where the browser doesn't redraw an updated element properly. - // ================================================================================= - - var forceRedraw = function( $el ) { - return ( $el && $el.length && $el[0].offsetHeight ); - }; - - - // Class definition - // ================ - - var FancyBox = function( content, opts, index ) { - var self = this; - - self.opts = $.extend( true, { index : index }, $.fancybox.defaults, opts || {} ); - - if ( $.fancybox.isMobile ) { - self.opts = $.extend( true, {}, self.opts, self.opts.mobile ); - } - - // Exclude buttons option from deep merging - if ( opts && $.isArray( opts.buttons ) ) { - self.opts.buttons = opts.buttons; - } - - self.id = self.opts.id || ++called; - self.group = []; - - self.currIndex = parseInt( self.opts.index, 10 ) || 0; - self.prevIndex = null; - - self.prevPos = null; - self.currPos = 0; - - self.firstRun = null; - - // Create group elements from original item collection - self.createGroup( content ); - - if ( !self.group.length ) { - return; - } - - // Save last active element and current scroll position - self.$lastFocus = $(document.activeElement).blur(); - - // Collection of gallery objects - self.slides = {}; - - self.init(); - }; - - $.extend(FancyBox.prototype, { - - // Create DOM structure - // ==================== - - init : function() { - var self = this, - firstItem = self.group[ self.currIndex ], - firstItemOpts = firstItem.opts, - scrollbarWidth = $.fancybox.scrollbarWidth, - $scrollDiv, - $container, - buttonStr; - - self.scrollTop = $D.scrollTop(); - self.scrollLeft = $D.scrollLeft(); - - - // Hide scrollbars - // =============== - - if ( !$.fancybox.getInstance() ) { - - $( 'body' ).addClass( 'fancybox-active' ); - - // iOS hack - if ( /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream ) { - - // iOS has problems for input elements inside fixed containers, - // the workaround is to apply `position: fixed` to `` element, - // unfortunately, this makes it lose the scrollbars and forces address bar to appear. - - if ( firstItem.type !== 'image' ) { - $( 'body' ).css( 'top', $( 'body' ).scrollTop() * -1 ).addClass( 'fancybox-iosfix' ); - } - - } else if ( !$.fancybox.isMobile && document.body.scrollHeight > window.innerHeight ) { - - if ( scrollbarWidth === undefined ) { - $scrollDiv = $('
').appendTo( 'body' ); - - scrollbarWidth = $.fancybox.scrollbarWidth = $scrollDiv[0].offsetWidth - $scrollDiv[0].clientWidth; - - $scrollDiv.remove(); - } - - $( 'head' ).append( '' ); - $( 'body' ).addClass( 'compensate-for-scrollbar' ); - } - } - - - // Build html markup and set references - // ==================================== - - // Build html code for buttons and insert into main template - buttonStr = ''; - - $.each( firstItemOpts.buttons, function( index, value ) { - buttonStr += ( firstItemOpts.btnTpl[ value ] || '' ); - }); - - // Create markup from base template, it will be initially hidden to - // avoid unnecessary work like painting while initializing is not complete - $container = $( - self.translate( self, - firstItemOpts.baseTpl - .replace( '\{\{buttons\}\}', buttonStr ) - .replace( '\{\{arrows\}\}', firstItemOpts.btnTpl.arrowLeft + firstItemOpts.btnTpl.arrowRight ) - ) - ) - .attr( 'id', 'fancybox-container-' + self.id ) - .addClass( 'fancybox-is-hidden' ) - .addClass( firstItemOpts.baseClass ) - .data( 'FancyBox', self ) - .appendTo( firstItemOpts.parentEl ); - - // Create object holding references to jQuery wrapped nodes - self.$refs = { - container : $container - }; - - [ 'bg', 'inner', 'infobar', 'toolbar', 'stage', 'caption', 'navigation' ].forEach(function(item) { - self.$refs[ item ] = $container.find( '.fancybox-' + item ); - }); - - self.trigger( 'onInit' ); - - // Enable events, deactive previous instances - self.activate(); - - // Build slides, load and reveal content - self.jumpTo( self.currIndex ); - }, - - - // Simple i18n support - replaces object keys found in template - // with corresponding values - // ============================================================ - - translate : function( obj, str ) { - var arr = obj.opts.i18n[ obj.opts.lang ]; - - return str.replace(/\{\{(\w+)\}\}/g, function(match, n) { - var value = arr[n]; - - if ( value === undefined ) { - return match; - } - - return value; - }); - }, - - // Create array of gally item objects - // Check if each object has valid type and content - // =============================================== - - createGroup : function ( content ) { - var self = this; - var items = $.makeArray( content ); - - $.each(items, function( i, item ) { - var obj = {}, - opts = {}, - $item, - type, - found, - src, - srcParts; - - // Step 1 - Make sure we have an object - // ==================================== - - if ( $.isPlainObject( item ) ) { - - // We probably have manual usage here, something like - // $.fancybox.open( [ { src : "image.jpg", type : "image" } ] ) - - obj = item; - opts = item.opts || item; - - } else if ( $.type( item ) === 'object' && $( item ).length ) { - - // Here we probably have jQuery collection returned by some selector - $item = $( item ); - - opts = $item.data(); - opts = $.extend( {}, opts, opts.options || {} ); - - // Here we store clicked element - opts.$orig = $item; - - obj.src = opts.src || $item.attr( 'href' ); - - // Assume that simple syntax is used, for example: - // `$.fancybox.open( $("#test"), {} );` - if ( !obj.type && !obj.src ) { - obj.type = 'inline'; - obj.src = item; - } - - } else { - - // Assume we have a simple html code, for example: - // $.fancybox.open( '

Hi!

' ); - - obj = { - type : 'html', - src : item + '' - }; - - } - - // Each gallery object has full collection of options - obj.opts = $.extend( true, {}, self.opts, opts ); - - // Do not merge buttons array - if ( $.isArray( opts.buttons ) ) { - obj.opts.buttons = opts.buttons; - } - - - // Step 2 - Make sure we have content type, if not - try to guess - // ============================================================== - - type = obj.type || obj.opts.type; - src = obj.src || ''; - - if ( !type && src ) { - if ( src.match(/(^data:image\/[a-z0-9+\/=]*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg|ico)((\?|#).*)?$)/i) ) { - type = 'image'; - - } else if ( src.match(/\.(pdf)((\?|#).*)?$/i) ) { - type = 'pdf'; - - } else if ( found = src.match(/\.(mp4|mov|ogv)((\?|#).*)?$/i) ) { - type = 'video'; - - if ( !obj.opts.videoFormat ) { - obj.opts.videoFormat = 'video/' + ( found[1] === 'ogv' ? 'ogg' : found[1] ); - } - - } else if ( src.charAt(0) === '#' ) { - type = 'inline'; - } - } - - if ( type ) { - obj.type = type; - - } else { - self.trigger( 'objectNeedsType', obj ); - } - - - // Step 3 - Some adjustments - // ========================= - - obj.index = self.group.length; - - // Check if $orig and $thumb objects exist - if ( obj.opts.$orig && !obj.opts.$orig.length ) { - delete obj.opts.$orig; - } - - if ( !obj.opts.$thumb && obj.opts.$orig ) { - obj.opts.$thumb = obj.opts.$orig.find( 'img:first' ); - } - - if ( obj.opts.$thumb && !obj.opts.$thumb.length ) { - delete obj.opts.$thumb; - } - - // "caption" is a "special" option, it can be used to customize caption per gallery item .. - if ( $.type( obj.opts.caption ) === 'function' ) { - obj.opts.caption = obj.opts.caption.apply( item, [ self, obj ] ); - } - - if ( $.type( self.opts.caption ) === 'function' ) { - obj.opts.caption = self.opts.caption.apply( item, [ self, obj ] ); - } - - // Make sure we have caption as a string or jQuery object - if ( !( obj.opts.caption instanceof $ ) ) { - obj.opts.caption = obj.opts.caption === undefined ? '' : obj.opts.caption + ''; - } - - // Check if url contains "filter" used to filter the content - // Example: "ajax.html #something" - if ( type === 'ajax' ) { - srcParts = src.split(/\s+/, 2); - - if ( srcParts.length > 1 ) { - obj.src = srcParts.shift(); - - obj.opts.filter = srcParts.shift(); - } - } - - if ( obj.opts.smallBtn == 'auto' ) { - - if ( $.inArray( type, ['html', 'inline', 'ajax'] ) > -1 ) { - obj.opts.toolbar = false; - obj.opts.smallBtn = true; - - } else { - obj.opts.smallBtn = false; - } - - } - - // If the type is "pdf", then simply load file into iframe - if ( type === 'pdf' ) { - obj.type = 'iframe'; - - obj.opts.iframe.preload = false; - } - - // Hide all buttons and disable interactivity for modal items - if ( obj.opts.modal ) { - - obj.opts = $.extend(true, obj.opts, { - // Remove buttons - infobar : 0, - toolbar : 0, - - smallBtn : 0, - - // Disable keyboard navigation - keyboard : 0, - - // Disable some modules - slideShow : 0, - fullScreen : 0, - thumbs : 0, - touch : 0, - - // Disable click event handlers - clickContent : false, - clickSlide : false, - clickOutside : false, - dblclickContent : false, - dblclickSlide : false, - dblclickOutside : false - }); - - } - - // Step 4 - Add processed object to group - // ====================================== - - self.group.push( obj ); - - }); - - }, - - - // Attach an event handler functions for: - // - navigation buttons - // - browser scrolling, resizing; - // - focusing - // - keyboard - // - detect idle - // ====================================== - - addEvents : function() { - var self = this; - - self.removeEvents(); - - // Make navigation elements clickable - self.$refs.container.on('click.fb-close', '[data-fancybox-close]', function(e) { - e.stopPropagation(); - e.preventDefault(); - - self.close( e ); - - }).on( 'click.fb-prev touchend.fb-prev', '[data-fancybox-prev]', function(e) { - e.stopPropagation(); - e.preventDefault(); - - self.previous(); - - }).on( 'click.fb-next touchend.fb-next', '[data-fancybox-next]', function(e) { - e.stopPropagation(); - e.preventDefault(); - - self.next(); - - }).on( 'click.fb', '[data-fancybox-zoom]', function(e) { - // Click handler for zoom button - self[ self.isScaledDown() ? 'scaleToActual' : 'scaleToFit' ](); - }); - - - // Handle page scrolling and browser resizing - $W.on('orientationchange.fb resize.fb', function(e) { - - if ( e && e.originalEvent && e.originalEvent.type === "resize" ) { - - requestAFrame(function() { - self.update(); - }); - - } else { - - self.$refs.stage.hide(); - - setTimeout(function() { - self.$refs.stage.show(); - - self.update(); - }, 600); - - } - - }); - - // Trap keyboard focus inside of the modal, so the user does not accidentally tab outside of the modal - // (a.k.a. "escaping the modal") - $D.on('focusin.fb', function(e) { - var instance = $.fancybox ? $.fancybox.getInstance() : null; - - if ( instance.isClosing || !instance.current || !instance.current.opts.trapFocus || $( e.target ).hasClass( 'fancybox-container' ) || $( e.target ).is( document ) ) { - return; - } - - if ( instance && $( e.target ).css( 'position' ) !== 'fixed' && !instance.$refs.container.has( e.target ).length ) { - e.stopPropagation(); - - instance.focus(); - - // Sometimes page gets scrolled, set it back - $W.scrollTop( self.scrollTop ).scrollLeft( self.scrollLeft ); - } - }); - - - // Enable keyboard navigation - $D.on('keydown.fb', function (e) { - var current = self.current, - keycode = e.keyCode || e.which; - - if ( !current || !current.opts.keyboard ) { - return; - } - - if ( $(e.target).is('input') || $(e.target).is('textarea') ) { - return; - } - - // Backspace and Esc keys - if ( keycode === 8 || keycode === 27 ) { - e.preventDefault(); - - self.close( e ); - - return; - } - - // Left arrow and Up arrow - if ( keycode === 37 || keycode === 38 ) { - e.preventDefault(); - - self.previous(); - - return; - } - - // Righ arrow and Down arrow - if ( keycode === 39 || keycode === 40 ) { - e.preventDefault(); - - self.next(); - - return; - } - - self.trigger('afterKeydown', e, keycode); - }); - - - // Hide controls after some inactivity period - if ( self.group[ self.currIndex ].opts.idleTime ) { - self.idleSecondsCounter = 0; - - $D.on('mousemove.fb-idle mouseleave.fb-idle mousedown.fb-idle touchstart.fb-idle touchmove.fb-idle scroll.fb-idle keydown.fb-idle', function(e) { - self.idleSecondsCounter = 0; - - if ( self.isIdle ) { - self.showControls(); - } - - self.isIdle = false; - }); - - self.idleInterval = window.setInterval(function() { - self.idleSecondsCounter++; - - if ( self.idleSecondsCounter >= self.group[ self.currIndex ].opts.idleTime && !self.isDragging ) { - self.isIdle = true; - self.idleSecondsCounter = 0; - - self.hideControls(); - } - - }, 1000); - } - - }, - - - // Remove events added by the core - // =============================== - - removeEvents : function() { - var self = this; - - $W.off( 'orientationchange.fb resize.fb' ); - $D.off( 'focusin.fb keydown.fb .fb-idle' ); - - this.$refs.container.off( '.fb-close .fb-prev .fb-next' ); - - if ( self.idleInterval ) { - window.clearInterval( self.idleInterval ); - - self.idleInterval = null; - } - }, - - - // Change to previous gallery item - // =============================== - - previous : function( duration ) { - return this.jumpTo( this.currPos - 1, duration ); - }, - - - // Change to next gallery item - // =========================== - - next : function( duration ) { - return this.jumpTo( this.currPos + 1, duration ); - }, - - - // Switch to selected gallery item - // =============================== - - jumpTo : function ( pos, duration, slide ) { - var self = this, - firstRun, - loop, - current, - previous, - canvasWidth, - currentPos, - transitionProps; - - var groupLen = self.group.length; - - if ( self.isDragging || self.isClosing || ( self.isAnimating && self.firstRun ) ) { - return; - } - - pos = parseInt( pos, 10 ); - loop = self.current ? self.current.opts.loop : self.opts.loop; - - if ( !loop && ( pos < 0 || pos >= groupLen ) ) { - return false; - } - - firstRun = self.firstRun = ( self.firstRun === null ); - - if ( groupLen < 2 && !firstRun && !!self.isDragging ) { - return; - } - - previous = self.current; - - self.prevIndex = self.currIndex; - self.prevPos = self.currPos; - - // Create slides - current = self.createSlide( pos ); - - if ( groupLen > 1 ) { - if ( loop || current.index > 0 ) { - self.createSlide( pos - 1 ); - } - - if ( loop || current.index < groupLen - 1 ) { - self.createSlide( pos + 1 ); - } - } - - self.current = current; - self.currIndex = current.index; - self.currPos = current.pos; - - self.trigger( 'beforeShow', firstRun ); - - self.updateControls(); - - currentPos = $.fancybox.getTranslate( current.$slide ); - - current.isMoved = ( currentPos.left !== 0 || currentPos.top !== 0 ) && !current.$slide.hasClass( 'fancybox-animated' ); - current.forcedDuration = undefined; - - if ( $.isNumeric( duration ) ) { - current.forcedDuration = duration; - } else { - duration = current.opts[ firstRun ? 'animationDuration' : 'transitionDuration' ]; - } - - duration = parseInt( duration, 10 ); - - // Fresh start - reveal container, current slide and start loading content - if ( firstRun ) { - - if ( current.opts.animationEffect && duration ) { - self.$refs.container.css( 'transition-duration', duration + 'ms' ); - } - - self.$refs.container.removeClass( 'fancybox-is-hidden' ); - - forceRedraw( self.$refs.container ); - - self.$refs.container.addClass( 'fancybox-is-open' ); - - // Make first slide visible (to display loading icon, if needed) - current.$slide.addClass( 'fancybox-slide--current' ); - - self.loadSlide( current ); - - self.preload( 'image' ); - - return; - } - - // Clean up - $.each(self.slides, function( index, slide ) { - $.fancybox.stop( slide.$slide ); - }); - - // Make current that slide is visible even if content is still loading - current.$slide.removeClass( 'fancybox-slide--next fancybox-slide--previous' ).addClass( 'fancybox-slide--current' ); - - // If slides have been dragged, animate them to correct position - if ( current.isMoved ) { - canvasWidth = Math.round( current.$slide.width() ); - - $.each(self.slides, function( index, slide ) { - var pos = slide.pos - current.pos; - - $.fancybox.animate( slide.$slide, { - top : 0, - left : ( pos * canvasWidth ) + ( pos * slide.opts.gutter ) - }, duration, function() { - - slide.$slide.removeAttr('style').removeClass( 'fancybox-slide--next fancybox-slide--previous' ); - - if ( slide.pos === self.currPos ) { - current.isMoved = false; - - self.complete(); - } - }); - }); - - } else { - self.$refs.stage.children().removeAttr( 'style' ); - } - - // Start transition that reveals current content - // or wait when it will be loaded - - if ( current.isLoaded ) { - self.revealContent( current ); - - } else { - self.loadSlide( current ); - } - - self.preload( 'image' ); - - if ( previous.pos === current.pos ) { - return; - } - - // Handle previous slide - // ===================== - - transitionProps = 'fancybox-slide--' + ( previous.pos > current.pos ? 'next' : 'previous' ); - - previous.$slide.removeClass( 'fancybox-slide--complete fancybox-slide--current fancybox-slide--next fancybox-slide--previous' ); - - previous.isComplete = false; - - if ( !duration || ( !current.isMoved && !current.opts.transitionEffect ) ) { - return; - } - - if ( current.isMoved ) { - previous.$slide.addClass( transitionProps ); - - } else { - - transitionProps = 'fancybox-animated ' + transitionProps + ' fancybox-fx-' + current.opts.transitionEffect; - - $.fancybox.animate( previous.$slide, transitionProps, duration, function() { - previous.$slide.removeClass( transitionProps ).removeAttr( 'style' ); - }); - - } - - }, - - - // Create new "slide" element - // These are gallery items that are actually added to DOM - // ======================================================= - - createSlide : function( pos ) { - - var self = this; - var $slide; - var index; - - index = pos % self.group.length; - index = index < 0 ? self.group.length + index : index; - - if ( !self.slides[ pos ] && self.group[ index ] ) { - $slide = $('
').appendTo( self.$refs.stage ); - - self.slides[ pos ] = $.extend( true, {}, self.group[ index ], { - pos : pos, - $slide : $slide, - isLoaded : false, - }); - - self.updateSlide( self.slides[ pos ] ); - } - - return self.slides[ pos ]; - }, - - - // Scale image to the actual size of the image - // =========================================== - - scaleToActual : function( x, y, duration ) { - - var self = this; - - var current = self.current; - var $what = current.$content; - - var imgPos, posX, posY, scaleX, scaleY; - - var canvasWidth = parseInt( current.$slide.width(), 10 ); - var canvasHeight = parseInt( current.$slide.height(), 10 ); - - var newImgWidth = current.width; - var newImgHeight = current.height; - - if ( !( current.type == 'image' && !current.hasError) || !$what || self.isAnimating ) { - return; - } - - $.fancybox.stop( $what ); - - self.isAnimating = true; - - x = x === undefined ? canvasWidth * 0.5 : x; - y = y === undefined ? canvasHeight * 0.5 : y; - - imgPos = $.fancybox.getTranslate( $what ); - - scaleX = newImgWidth / imgPos.width; - scaleY = newImgHeight / imgPos.height; - - // Get center position for original image - posX = ( canvasWidth * 0.5 - newImgWidth * 0.5 ); - posY = ( canvasHeight * 0.5 - newImgHeight * 0.5 ); - - // Make sure image does not move away from edges - if ( newImgWidth > canvasWidth ) { - posX = imgPos.left * scaleX - ( ( x * scaleX ) - x ); - - if ( posX > 0 ) { - posX = 0; - } - - if ( posX < canvasWidth - newImgWidth ) { - posX = canvasWidth - newImgWidth; - } - } - - if ( newImgHeight > canvasHeight) { - posY = imgPos.top * scaleY - ( ( y * scaleY ) - y ); - - if ( posY > 0 ) { - posY = 0; - } - - if ( posY < canvasHeight - newImgHeight ) { - posY = canvasHeight - newImgHeight; - } - } - - self.updateCursor( newImgWidth, newImgHeight ); - - $.fancybox.animate( $what, { - top : posY, - left : posX, - scaleX : scaleX, - scaleY : scaleY - }, duration || 330, function() { - self.isAnimating = false; - }); - - // Stop slideshow - if ( self.SlideShow && self.SlideShow.isActive ) { - self.SlideShow.stop(); - } - }, - - - // Scale image to fit inside parent element - // ======================================== - - scaleToFit : function( duration ) { - - var self = this; - - var current = self.current; - var $what = current.$content; - var end; - - if ( !( current.type == 'image' && !current.hasError) || !$what || self.isAnimating ) { - return; - } - - $.fancybox.stop( $what ); - - self.isAnimating = true; - - end = self.getFitPos( current ); - - self.updateCursor( end.width, end.height ); - - $.fancybox.animate( $what, { - top : end.top, - left : end.left, - scaleX : end.width / $what.width(), - scaleY : end.height / $what.height() - }, duration || 330, function() { - self.isAnimating = false; - }); - - }, - - // Calculate image size to fit inside viewport - // =========================================== - - getFitPos : function( slide ) { - var self = this; - var $what = slide.$content; - - var imgWidth = slide.width; - var imgHeight = slide.height; - - var margin = slide.opts.margin; - - var canvasWidth, canvasHeight, minRatio, width, height; - - if ( !$what || !$what.length || ( !imgWidth && !imgHeight) ) { - return false; - } - - // Convert "margin to CSS style: [ top, right, bottom, left ] - if ( $.type( margin ) === "number" ) { - margin = [ margin, margin ]; - } - - if ( margin.length == 2 ) { - margin = [ margin[0], margin[1], margin[0], margin[1] ]; - } - - // We can not use $slide width here, because it can have different diemensions while in transiton - canvasWidth = parseInt( self.$refs.stage.width(), 10 ) - ( margin[ 1 ] + margin[ 3 ] ); - canvasHeight = parseInt( self.$refs.stage.height(), 10 ) - ( margin[ 0 ] + margin[ 2 ] ); - - minRatio = Math.min(1, canvasWidth / imgWidth, canvasHeight / imgHeight ); - - width = Math.floor( minRatio * imgWidth ); - height = Math.floor( minRatio * imgHeight ); - - // Use floor rounding to make sure it really fits - return { - top : Math.floor( ( canvasHeight - height ) * 0.5 ) + margin[ 0 ], - left : Math.floor( ( canvasWidth - width ) * 0.5 ) + margin[ 3 ], - width : width, - height : height - }; - - }, - - - // Update content size and position for all slides - // ============================================== - - update : function() { - var self = this; - - $.each( self.slides, function( key, slide ) { - self.updateSlide( slide ); - }); - }, - - - // Update slide content position and size - // ====================================== - - updateSlide : function( slide, duration ) { - var self = this, - $what = slide && slide.$content; - - if ( $what && ( slide.width || slide.height ) ) { - self.isAnimating = false; - - $.fancybox.stop( $what ); - - $.fancybox.setTranslate( $what, self.getFitPos( slide ) ); - - if ( slide.pos === self.currPos ) { - self.updateCursor(); - } - } - - slide.$slide.trigger( 'refresh' ); - - self.trigger( 'onUpdate', slide ); - - }, - - - // Horizontally center slide - // ========================= - - centerSlide : function( slide, duration ) { - var self = this, canvasWidth, pos; - - if ( self.current ) { - canvasWidth = Math.round( slide.$slide.width() ); - pos = slide.pos - self.current.pos; - - $.fancybox.animate( slide.$slide, { - top : 0, - left : ( pos * canvasWidth ) + ( pos * slide.opts.gutter ), - opacity : 1 - }, duration === undefined ? 0 : duration, null, false); - } - }, - - - // Update cursor style depending if content can be zoomed - // ====================================================== - - updateCursor : function( nextWidth, nextHeight ) { - - var self = this; - var isScaledDown; - - var $container = self.$refs.container.removeClass( 'fancybox-is-zoomable fancybox-can-zoomIn fancybox-can-drag fancybox-can-zoomOut' ); - - if ( !self.current || self.isClosing ) { - return; - } - - if ( self.isZoomable() ) { - - $container.addClass( 'fancybox-is-zoomable' ); - - if ( nextWidth !== undefined && nextHeight !== undefined ) { - isScaledDown = nextWidth < self.current.width && nextHeight < self.current.height; - - } else { - isScaledDown = self.isScaledDown(); - } - - if ( isScaledDown ) { - - // If image is scaled down, then, obviously, it can be zoomed to full size - $container.addClass( 'fancybox-can-zoomIn' ); - - } else { - - if ( self.current.opts.touch ) { - - // If image size ir largen than available available and touch module is not disable, - // then user can do panning - $container.addClass( 'fancybox-can-drag' ); - - } else { - $container.addClass( 'fancybox-can-zoomOut' ); - } - - } - - } else if ( self.current.opts.touch ) { - $container.addClass( 'fancybox-can-drag' ); - } - - }, - - - // Check if current slide is zoomable - // ================================== - - isZoomable : function() { - - var self = this; - - var current = self.current; - var fitPos; - - if ( !current || self.isClosing ) { - return; - } - - // Assume that slide is zoomable if - // - image is loaded successfuly - // - click action is "zoom" - // - actual size of the image is smaller than available area - if ( current.type === 'image' && current.isLoaded && !current.hasError && - ( current.opts.clickContent === 'zoom' || ( $.isFunction( current.opts.clickContent ) && current.opts.clickContent( current ) === "zoom" ) ) - ) { - - fitPos = self.getFitPos( current ); - - if ( current.width > fitPos.width || current.height > fitPos.height ) { - return true; - } - - } - - return false; - - }, - - - // Check if current image dimensions are smaller than actual - // ========================================================= - - isScaledDown : function() { - - var self = this; - - var current = self.current; - var $what = current.$content; - - var rez = false; - - if ( $what ) { - rez = $.fancybox.getTranslate( $what ); - rez = rez.width < current.width || rez.height < current.height; - } - - return rez; - - }, - - - // Check if image dimensions exceed parent element - // =============================================== - - canPan : function() { - - var self = this; - - var current = self.current; - var $what = current.$content; - - var rez = false; - - if ( $what ) { - rez = self.getFitPos( current ); - rez = Math.abs( $what.width() - rez.width ) > 1 || Math.abs( $what.height() - rez.height ) > 1; - } - - return rez; - - }, - - - // Load content into the slide - // =========================== - - loadSlide : function( slide ) { - - var self = this, type, $slide; - var ajaxLoad; - - if ( slide.isLoading ) { - return; - } - - if ( slide.isLoaded ) { - return; - } - - slide.isLoading = true; - - self.trigger( 'beforeLoad', slide ); - - type = slide.type; - $slide = slide.$slide; - - $slide - .off( 'refresh' ) - .trigger( 'onReset' ) - .addClass( 'fancybox-slide--' + ( type || 'unknown' ) ) - .addClass( slide.opts.slideClass ); - - // Create content depending on the type - - switch ( type ) { - - case 'image': - - self.setImage( slide ); - - break; - - case 'iframe': - - self.setIframe( slide ); - - break; - - case 'html': - - self.setContent( slide, slide.src || slide.content ); - - break; - - case 'inline': - - if ( $( slide.src ).length ) { - self.setContent( slide, $( slide.src ) ); - - } else { - self.setError( slide ); - } - - break; - - case 'ajax': - - self.showLoading( slide ); - - ajaxLoad = $.ajax( $.extend( {}, slide.opts.ajax.settings, { - url : slide.src, - success : function ( data, textStatus ) { - - if ( textStatus === 'success' ) { - self.setContent( slide, data ); - } - - }, - error : function ( jqXHR, textStatus ) { - - if ( jqXHR && textStatus !== 'abort' ) { - self.setError( slide ); - } - - } - })); - - $slide.one( 'onReset', function () { - ajaxLoad.abort(); - }); - - break; - - case 'video' : - - self.setContent( slide, - '' - ); - - break; - - default: - - self.setError( slide ); - - break; - - } - - return true; - - }, - - - // Use thumbnail image, if possible - // ================================ - - setImage : function( slide ) { - - var self = this; - var srcset = slide.opts.srcset || slide.opts.image.srcset; - - var found, temp, pxRatio, windowWidth; - - // If we have "srcset", then we need to find matching "src" value. - // This is necessary, because when you set an src attribute, the browser will preload the image - // before any javascript or even CSS is applied. - if ( srcset ) { - pxRatio = window.devicePixelRatio || 1; - windowWidth = window.innerWidth * pxRatio; - - temp = srcset.split(',').map(function ( el ) { - var ret = {}; - - el.trim().split(/\s+/).forEach(function ( el, i ) { - var value = parseInt( el.substring(0, el.length - 1), 10 ); - - if ( i === 0 ) { - return ( ret.url = el ); - } - - if ( value ) { - ret.value = value; - ret.postfix = el[ el.length - 1 ]; - } - - }); - - return ret; - }); - - // Sort by value - temp.sort(function (a, b) { - return a.value - b.value; - }); - - // Ok, now we have an array of all srcset values - for ( var j = 0; j < temp.length; j++ ) { - var el = temp[ j ]; - - if ( ( el.postfix === 'w' && el.value >= windowWidth ) || ( el.postfix === 'x' && el.value >= pxRatio ) ) { - found = el; - break; - } - } - - // If not found, take the last one - if ( !found && temp.length ) { - found = temp[ temp.length - 1 ]; - } - - if ( found ) { - slide.src = found.url; - - // If we have default width/height values, we can calculate height for matching source - if ( slide.width && slide.height && found.postfix == 'w' ) { - slide.height = ( slide.width / slide.height ) * found.value; - slide.width = found.value; - } - } - } - - // This will be wrapper containing both ghost and actual image - slide.$content = $('
') - .addClass( 'fancybox-is-hidden' ) - .appendTo( slide.$slide ); - - - // If we have a thumbnail, we can display it while actual image is loading - // Users will not stare at black screen and actual image will appear gradually - if ( slide.opts.preload !== false && slide.opts.width && slide.opts.height && ( slide.opts.thumb || slide.opts.$thumb ) ) { - - slide.width = slide.opts.width; - slide.height = slide.opts.height; - - slide.$ghost = $('') - .one('error', function() { - - $(this).remove(); - - slide.$ghost = null; - - self.setBigImage( slide ); - - }) - .one('load', function() { - - self.afterLoad( slide ); - - self.setBigImage( slide ); - - }) - .addClass( 'fancybox-image' ) - .appendTo( slide.$content ) - .attr( 'src', slide.opts.thumb || slide.opts.$thumb.attr( 'src' ) ); - - } else { - - self.setBigImage( slide ); - - } - - }, - - - // Create full-size image - // ====================== - - setBigImage : function ( slide ) { - var self = this; - var $img = $(''); - - slide.$image = $img - .one('error', function() { - - self.setError( slide ); - - }) - .one('load', function() { - - // Clear timeout that checks if loading icon needs to be displayed - clearTimeout( slide.timouts ); - - slide.timouts = null; - - if ( self.isClosing ) { - return; - } - - slide.width = slide.opts.width || this.naturalWidth; - slide.height = slide.opts.height || this.naturalHeight; - - if ( slide.opts.image.srcset ) { - $img.attr( 'sizes', '100vw' ).attr( 'srcset', slide.opts.image.srcset ); - } - - self.hideLoading( slide ); - - if ( slide.$ghost ) { - - slide.timouts = setTimeout(function() { - slide.timouts = null; - - slide.$ghost.hide(); - - }, Math.min( 300, Math.max( 1000, slide.height / 1600 ) ) ); - - } else { - self.afterLoad( slide ); - } - - }) - .addClass( 'fancybox-image' ) - .attr('src', slide.src) - .appendTo( slide.$content ); - - if ( ( $img[0].complete || $img[0].readyState == "complete" ) && $img[0].naturalWidth && $img[0].naturalHeight ) { - $img.trigger( 'load' ); - - } else if( $img[0].error ) { - $img.trigger( 'error' ); - - } else { - - slide.timouts = setTimeout(function() { - if ( !$img[0].complete && !slide.hasError ) { - self.showLoading( slide ); - } - - }, 100); - - } - - }, - - - // Create iframe wrapper, iframe and bindings - // ========================================== - - setIframe : function( slide ) { - var self = this, - opts = slide.opts.iframe, - $slide = slide.$slide, - $iframe; - - slide.$content = $('
') - .css( opts.css ) - .appendTo( $slide ); - - $iframe = $( opts.tpl.replace(/\{rnd\}/g, new Date().getTime()) ) - .attr( opts.attr ) - .appendTo( slide.$content ); - - if ( opts.preload ) { - - self.showLoading( slide ); - - // Unfortunately, it is not always possible to determine if iframe is successfully loaded - // (due to browser security policy) - - $iframe.on('load.fb error.fb', function(e) { - this.isReady = 1; - - slide.$slide.trigger( 'refresh' ); - - self.afterLoad( slide ); - }); - - // Recalculate iframe content size - // =============================== - - $slide.on('refresh.fb', function() { - var $wrap = slide.$content, - frameWidth = opts.css.width, - frameHeight = opts.css.height, - scrollWidth, - $contents, - $body; - - if ( $iframe[0].isReady !== 1 ) { - return; - } - - // Check if content is accessible, - // it will fail if frame is not with the same origin - - try { - $contents = $iframe.contents(); - $body = $contents.find('body'); - - } catch (ignore) {} - - // Calculate dimensions for the wrapper - if ( $body && $body.length ) { - - if ( frameWidth === undefined ) { - scrollWidth = $iframe[0].contentWindow.document.documentElement.scrollWidth; - - frameWidth = Math.ceil( $body.outerWidth(true) + ( $wrap.width() - scrollWidth ) ); - frameWidth += $wrap.outerWidth() - $wrap.innerWidth(); - } - - if ( frameHeight === undefined ) { - frameHeight = Math.ceil( $body.outerHeight(true) ); - frameHeight += $wrap.outerHeight() - $wrap.innerHeight(); - } - - // Resize wrapper to fit iframe content - if ( frameWidth ) { - $wrap.width( frameWidth ); - } - - if ( frameHeight ) { - $wrap.height( frameHeight ); - } - } - - $wrap.removeClass( 'fancybox-is-hidden' ); - - }); - - } else { - - this.afterLoad( slide ); - - } - - $iframe.attr( 'src', slide.src ); - - if ( slide.opts.smallBtn === true ) { - slide.$content.prepend( self.translate( slide, slide.opts.btnTpl.smallBtn ) ); - } - - // Remove iframe if closing or changing gallery item - $slide.one( 'onReset', function () { - - // This helps IE not to throw errors when closing - try { - - $( this ).find( 'iframe' ).hide().attr( 'src', '//about:blank' ); - - } catch ( ignore ) {} - - $( this ).empty(); - - slide.isLoaded = false; - - }); - - }, - - - // Wrap and append content to the slide - // ====================================== - - setContent : function ( slide, content ) { - - var self = this; - - if ( self.isClosing ) { - return; - } - - self.hideLoading( slide ); - - slide.$slide.empty(); - - if ( isQuery( content ) && content.parent().length ) { - - // If content is a jQuery object, then it will be moved to the slide. - // The placeholder is created so we will know where to put it back. - // If user is navigating gallery fast, then the content might be already inside fancyBox - // ===================================================================================== - - // Make sure content is not already moved to fancyBox - content.parent( '.fancybox-slide--inline' ).trigger( 'onReset' ); - - // Create temporary element marking original place of the content - slide.$placeholder = $( '
' ).hide().insertAfter( content ); - - // Make sure content is visible - content.css('display', 'inline-block'); - - } else if ( !slide.hasError ) { - - // If content is just a plain text, try to convert it to html - if ( $.type( content ) === 'string' ) { - content = $('
').append( $.trim( content ) ).contents(); - - // If we have text node, then add wrapping element to make vertical alignment work - if ( content[0].nodeType === 3 ) { - content = $('
').html( content ); - } - } - - // If "filter" option is provided, then filter content - if ( slide.opts.filter ) { - content = $('
').html( content ).find( slide.opts.filter ); - } - - } - - slide.$slide.one('onReset', function () { - - // Pause all html5 video/audio - $( this ).find( 'video,audio' ).trigger( 'pause' ); - - // Put content back - if ( slide.$placeholder ) { - slide.$placeholder.after( content.hide() ).remove(); - - slide.$placeholder = null; - } - - // Remove custom close button - if ( slide.$smallBtn ) { - slide.$smallBtn.remove(); - - slide.$smallBtn = null; - } - - // Remove content and mark slide as not loaded - if ( !slide.hasError ) { - $(this).empty(); - - slide.isLoaded = false; - } - - }); - - slide.$content = $( content ).appendTo( slide.$slide ); - - this.afterLoad( slide ); - }, - - // Display error message - // ===================== - - setError : function ( slide ) { - - slide.hasError = true; - - slide.$slide.removeClass( 'fancybox-slide--' + slide.type ); - - this.setContent( slide, this.translate( slide, slide.opts.errorTpl ) ); - - }, - - - // Show loading icon inside the slide - // ================================== - - showLoading : function( slide ) { - - var self = this; - - slide = slide || self.current; - - if ( slide && !slide.$spinner ) { - slide.$spinner = $( self.opts.spinnerTpl ).appendTo( slide.$slide ); - } - - }, - - // Remove loading icon from the slide - // ================================== - - hideLoading : function( slide ) { - - var self = this; - - slide = slide || self.current; - - if ( slide && slide.$spinner ) { - slide.$spinner.remove(); - - delete slide.$spinner; - } - - }, - - - // Adjustments after slide content has been loaded - // =============================================== - - afterLoad : function( slide ) { - - var self = this; - - if ( self.isClosing ) { - return; - } - - slide.isLoading = false; - slide.isLoaded = true; - - self.trigger( 'afterLoad', slide ); - - self.hideLoading( slide ); - - if ( slide.opts.smallBtn && !slide.$smallBtn ) { - slide.$smallBtn = $( self.translate( slide, slide.opts.btnTpl.smallBtn ) ).appendTo( slide.$content.filter('div,form').first() ); - } - - if ( slide.opts.protect && slide.$content && !slide.hasError ) { - - // Disable right click - slide.$content.on( 'contextmenu.fb', function( e ) { - if ( e.button == 2 ) { - e.preventDefault(); - } - - return true; - }); - - // Add fake element on top of the image - // This makes a bit harder for user to select image - if ( slide.type === 'image' ) { - $( '
' ).appendTo( slide.$content ); - } - - } - - self.revealContent( slide ); - - }, - - - // Make content visible - // This method is called right after content has been loaded or - // user navigates gallery and transition should start - // ============================================================ - - revealContent : function( slide ) { - - var self = this; - var $slide = slide.$slide; - - var effect, effectClassName, duration, opacity, end, start = false; - - effect = slide.opts[ self.firstRun ? 'animationEffect' : 'transitionEffect' ]; - duration = slide.opts[ self.firstRun ? 'animationDuration' : 'transitionDuration' ]; - - duration = parseInt( slide.forcedDuration === undefined ? duration : slide.forcedDuration, 10 ); - - if ( slide.isMoved || slide.pos !== self.currPos || !duration ) { - effect = false; - } - - // Check if can zoom - if ( effect === 'zoom' && !( slide.pos === self.currPos && duration && slide.type === 'image' && !slide.hasError && ( start = self.getThumbPos( slide ) ) ) ) { - effect = 'fade'; - } - - // Zoom animation - // ============== - - if ( effect === 'zoom' ) { - end = self.getFitPos( slide ); - - end.scaleX = end.width / start.width; - end.scaleY = end.height / start.height; - - delete end.width; - delete end.height; - - // Check if we need to animate opacity - opacity = slide.opts.zoomOpacity; - - if ( opacity == 'auto' ) { - opacity = Math.abs( slide.width / slide.height - start.width / start.height ) > 0.1; - } - - if ( opacity ) { - start.opacity = 0.1; - end.opacity = 1; - } - - // Draw image at start position - $.fancybox.setTranslate( slide.$content.removeClass( 'fancybox-is-hidden' ), start ); - - forceRedraw( slide.$content ); - - // Start animation - $.fancybox.animate( slide.$content, end, duration, function() { - self.complete(); - }); - - return; - } - - self.updateSlide( slide ); - - - // Simply show content - // =================== - - if ( !effect ) { - forceRedraw( $slide ); - - slide.$content.removeClass( 'fancybox-is-hidden' ); - - if ( slide.pos === self.currPos ) { - self.complete(); - } - - return; - } - - $.fancybox.stop( $slide ); - - effectClassName = 'fancybox-animated fancybox-slide--' + ( slide.pos >= self.prevPos ? 'next' : 'previous' ) + ' fancybox-fx-' + effect; - - $slide.removeAttr( 'style' ).removeClass( 'fancybox-slide--current fancybox-slide--next fancybox-slide--previous' ).addClass( effectClassName ); - - slide.$content.removeClass( 'fancybox-is-hidden' ); - - //Force reflow for CSS3 transitions - forceRedraw( $slide ); - - $.fancybox.animate( $slide, 'fancybox-slide--current', duration, function(e) { - $slide.removeClass( effectClassName ).removeAttr( 'style' ); - - if ( slide.pos === self.currPos ) { - self.complete(); - } - - }, true); - - }, - - - // Check if we can and have to zoom from thumbnail - //================================================ - - getThumbPos : function( slide ) { - - var self = this; - var rez = false; - - // Check if element is inside the viewport by at least 1 pixel - var isElementVisible = function( $el ) { - var element = $el[0]; - - var elementRect = element.getBoundingClientRect(); - var parentRects = []; - - var visibleInAllParents; - - while ( element.parentElement !== null ) { - if ( $(element.parentElement).css('overflow') === 'hidden' || $(element.parentElement).css('overflow') === 'auto' ) { - parentRects.push(element.parentElement.getBoundingClientRect()); - } - - element = element.parentElement; - } - - visibleInAllParents = parentRects.every(function(parentRect){ - var visiblePixelX = Math.min(elementRect.right, parentRect.right) - Math.max(elementRect.left, parentRect.left); - var visiblePixelY = Math.min(elementRect.bottom, parentRect.bottom) - Math.max(elementRect.top, parentRect.top); - - return visiblePixelX > 0 && visiblePixelY > 0; - }); - - return visibleInAllParents && - elementRect.bottom > 0 && elementRect.right > 0 && - elementRect.left < $(window).width() && elementRect.top < $(window).height(); - }; - - var $thumb = slide.opts.$thumb; - var thumbPos = $thumb ? $thumb.offset() : 0; - var slidePos; - - if ( thumbPos && $thumb[0].ownerDocument === document && isElementVisible( $thumb ) ) { - slidePos = self.$refs.stage.offset(); - - rez = { - top : thumbPos.top - slidePos.top + parseFloat( $thumb.css( "border-top-width" ) || 0 ), - left : thumbPos.left - slidePos.left + parseFloat( $thumb.css( "border-left-width" ) || 0 ), - width : $thumb.width(), - height : $thumb.height(), - scaleX : 1, - scaleY : 1 - }; - } - - return rez; - }, - - - // Final adjustments after current gallery item is moved to position - // and it`s content is loaded - // ================================================================== - - complete : function() { - var self = this, - current = self.current, - slides = {}, - promise; - - if ( current.isMoved || !current.isLoaded || current.isComplete ) { - return; - } - - current.isComplete = true; - - current.$slide.siblings().trigger( 'onReset' ); - - self.preload( 'inline' ); - - // Trigger any CSS3 transiton inside the slide - forceRedraw( current.$slide ); - - current.$slide.addClass( 'fancybox-slide--complete' ); - - // Remove unnecessary slides - $.each( self.slides, function( key, slide ) { - if ( slide.pos >= self.currPos - 1 && slide.pos <= self.currPos + 1 ) { - slides[ slide.pos ] = slide; - - } else if ( slide ) { - $.fancybox.stop( slide.$slide ); - - slide.$slide.off().remove(); - } - }); - - self.slides = slides; - - self.updateCursor(); - - self.trigger( 'afterShow' ); - - // Play first html5 video/audio - current.$slide.find( 'video,audio' ).first().trigger( 'play' ); - - // Try to focus on the first focusable element - if ( $( document.activeElement ).is( '[disabled]' ) || ( current.opts.autoFocus && !( current.type == 'image' || current.type === 'iframe' ) ) ) { - self.focus(); - } - - }, - - - // Preload next and previous slides - // ================================ - - preload : function( type ) { - var self = this, - next = self.slides[ self.currPos + 1 ], - prev = self.slides[ self.currPos - 1 ]; - - if ( next && next.type === type ) { - self.loadSlide( next ); - } - - if ( prev && prev.type === type ) { - self.loadSlide( prev ); - } - }, - - - // Try to find and focus on the first focusable element - // ==================================================== - - focus : function() { - var current = this.current; - var $el; - - if ( this.isClosing ) { - return; - } - - if ( current && current.isComplete ) { - - // Look for first input with autofocus attribute - $el = current.$slide.find('input[autofocus]:enabled:visible:first'); - - if ( !$el.length ) { - $el = current.$slide.find('button,:input,[tabindex],a').filter(':enabled:visible:first'); - } - } - - $el = $el && $el.length ? $el : this.$refs.container; - - $el.focus(); - }, - - - // Activates current instance - brings container to the front and enables keyboard, - // notifies other instances about deactivating - // ================================================================================= - - activate : function () { - var self = this; - - // Deactivate all instances - $( '.fancybox-container' ).each(function () { - var instance = $(this).data( 'FancyBox' ); - - // Skip self and closing instances - if (instance && instance.id !== self.id && !instance.isClosing) { - instance.trigger( 'onDeactivate' ); - - instance.removeEvents(); - - instance.isVisible = false; - } - - }); - - self.isVisible = true; - - if ( self.current || self.isIdle ) { - self.update(); - - self.updateControls(); - } - - self.trigger( 'onActivate' ); - - self.addEvents(); - }, - - - // Start closing procedure - // This will start "zoom-out" animation if needed and clean everything up afterwards - // ================================================================================= - - close : function( e, d ) { - - var self = this; - var current = self.current; - - var effect, duration; - var $what, opacity, start, end; - - var done = function() { - self.cleanUp( e ); - }; - - if ( self.isClosing ) { - return false; - } - - self.isClosing = true; - - // If beforeClose callback prevents closing, make sure content is centered - if ( self.trigger( 'beforeClose', e ) === false ) { - self.isClosing = false; - - requestAFrame(function() { - self.update(); - }); - - return false; - } - - // Remove all events - // If there are multiple instances, they will be set again by "activate" method - self.removeEvents(); - - if ( current.timouts ) { - clearTimeout( current.timouts ); - } - - $what = current.$content; - effect = current.opts.animationEffect; - duration = $.isNumeric( d ) ? d : ( effect ? current.opts.animationDuration : 0 ); - - // Remove other slides - current.$slide.off( transitionEnd ).removeClass( 'fancybox-slide--complete fancybox-slide--next fancybox-slide--previous fancybox-animated' ); - - current.$slide.siblings().trigger( 'onReset' ).remove(); - - // Trigger animations - if ( duration ) { - self.$refs.container.removeClass( 'fancybox-is-open' ).addClass( 'fancybox-is-closing' ); - } - - // Clean up - self.hideLoading( current ); - - self.hideControls(); - - self.updateCursor(); - - // Check if possible to zoom-out - if ( effect === 'zoom' && !( e !== true && $what && duration && current.type === 'image' && !current.hasError && ( end = self.getThumbPos( current ) ) ) ) { - effect = 'fade'; - } - - if ( effect === 'zoom' ) { - $.fancybox.stop( $what ); - - start = $.fancybox.getTranslate( $what ); - - start.width = start.width * start.scaleX; - start.height = start.height * start.scaleY; - - // Check if we need to animate opacity - opacity = current.opts.zoomOpacity; - - if ( opacity == 'auto' ) { - opacity = Math.abs( current.width / current.height - end.width / end.height ) > 0.1; - } - - if ( opacity ) { - end.opacity = 0; - } - - start.scaleX = start.width / end.width; - start.scaleY = start.height / end.height; - - start.width = end.width; - start.height = end.height; - - $.fancybox.setTranslate( current.$content, start ); - - forceRedraw( current.$content ); - - $.fancybox.animate( current.$content, end, duration, done ); - - return true; - } - - if ( effect && duration ) { - - // If skip animation - if ( e === true ) { - setTimeout( done, duration ); - - } else { - $.fancybox.animate( current.$slide.removeClass( 'fancybox-slide--current' ), 'fancybox-animated fancybox-slide--previous fancybox-fx-' + effect, duration, done ); - } - - } else { - done(); - } - - return true; - }, - - - // Final adjustments after removing the instance - // ============================================= - - cleanUp : function( e ) { - var self = this, - $body = $( 'body' ), - instance, - offset; - - self.current.$slide.trigger( 'onReset' ); - - self.$refs.container.empty().remove(); - - self.trigger( 'afterClose', e ); - - // Place back focus - if ( self.$lastFocus && !!self.current.opts.backFocus ) { - self.$lastFocus.focus(); - } - - self.current = null; - - // Check if there are other instances - instance = $.fancybox.getInstance(); - - if ( instance ) { - instance.activate(); - - } else { - - $W.scrollTop( self.scrollTop ).scrollLeft( self.scrollLeft ); - - $body.removeClass( 'fancybox-active compensate-for-scrollbar' ); - - if ( $body.hasClass( 'fancybox-iosfix' ) ) { - offset = parseInt(document.body.style.top, 10); - - $body.removeClass( 'fancybox-iosfix' ).css( 'top', '' ).scrollTop( offset * -1 ); - } - - $( '#fancybox-style-noscroll' ).remove(); - - } - - }, - - - // Call callback and trigger an event - // ================================== - - trigger : function( name, slide ) { - var args = Array.prototype.slice.call(arguments, 1), - self = this, - obj = slide && slide.opts ? slide : self.current, - rez; - - if ( obj ) { - args.unshift( obj ); - - } else { - obj = self; - } - - args.unshift( self ); - - if ( $.isFunction( obj.opts[ name ] ) ) { - rez = obj.opts[ name ].apply( obj, args ); - } - - if ( rez === false ) { - return rez; - } - - if ( name === 'afterClose' || !self.$refs ) { - $D.trigger( name + '.fb', args ); - - } else { - self.$refs.container.trigger( name + '.fb', args ); - } - - }, - - - // Update infobar values, navigation button states and reveal caption - // ================================================================== - - updateControls : function ( force ) { - - var self = this; - - var current = self.current, - index = current.index, - caption = current.opts.caption, - $container = self.$refs.container, - $caption = self.$refs.caption; - - // Recalculate content dimensions - current.$slide.trigger( 'refresh' ); - - self.$caption = caption && caption.length ? $caption.html( caption ) : null; - - if ( !self.isHiddenControls && !self.isIdle ) { - self.showControls(); - } - - // Update info and navigation elements - $container.find('[data-fancybox-count]').html( self.group.length ); - $container.find('[data-fancybox-index]').html( index + 1 ); - - $container.find('[data-fancybox-prev]').prop( 'disabled', ( !current.opts.loop && index <= 0 ) ); - $container.find('[data-fancybox-next]').prop( 'disabled', ( !current.opts.loop && index >= self.group.length - 1 ) ); - - if ( current.type === 'image' ) { - - // Update download button source - $container.find('[data-fancybox-download]').attr( 'href', current.opts.image.src || current.src ).show(); - - } else { - $container.find('[data-fancybox-download],[data-fancybox-zoom]').hide(); - } - }, - - // Hide toolbar and caption - // ======================== - - hideControls : function () { - - this.isHiddenControls = true; - - this.$refs.container.removeClass( 'fancybox-show-infobar fancybox-show-toolbar fancybox-show-caption fancybox-show-nav' ); - - }, - - showControls : function() { - var self = this; - var opts = self.current ? self.current.opts : self.opts; - var $container = self.$refs.container; - - self.isHiddenControls = false; - self.idleSecondsCounter = 0; - - $container - .toggleClass( 'fancybox-show-toolbar', !!( opts.toolbar && opts.buttons ) ) - .toggleClass( 'fancybox-show-infobar', !!( opts.infobar && self.group.length > 1 ) ) - .toggleClass( 'fancybox-show-nav', !!( opts.arrows && self.group.length > 1 ) ) - .toggleClass( 'fancybox-is-modal', !!opts.modal ); - - if ( self.$caption ) { - $container.addClass( 'fancybox-show-caption '); - - } else { - $container.removeClass( 'fancybox-show-caption' ); - } - - }, - - - // Toggle toolbar and caption - // ========================== - - toggleControls : function() { - if ( this.isHiddenControls ) { - this.showControls(); - - } else { - this.hideControls(); - } - - }, - - - }); - - - $.fancybox = { - - version : "3.2.10", - defaults : defaults, - - - // Get current instance and execute a command. - // - // Examples of usage: - // - // $instance = $.fancybox.getInstance(); - // $.fancybox.getInstance().jumpTo( 1 ); - // $.fancybox.getInstance( 'jumpTo', 1 ); - // $.fancybox.getInstance( function() { - // console.info( this.currIndex ); - // }); - // ====================================================== - - getInstance : function ( command ) { - var instance = $('.fancybox-container:not(".fancybox-is-closing"):last').data( 'FancyBox' ); - var args = Array.prototype.slice.call(arguments, 1); - - if ( instance instanceof FancyBox ) { - - if ( $.type( command ) === 'string' ) { - instance[ command ].apply( instance, args ); - - } else if ( $.type( command ) === 'function' ) { - command.apply( instance, args ); - } - - return instance; - } - - return false; - - }, - - - // Create new instance - // =================== - - open : function ( items, opts, index ) { - return new FancyBox( items, opts, index ); - }, - - - // Close current or all instances - // ============================== - - close : function ( all ) { - var instance = this.getInstance(); - - if ( instance ) { - instance.close(); - - // Try to find and close next instance - - if ( all === true ) { - this.close(); - } - } - - }, - - // Close instances and unbind all events - // ============================== - - destroy : function() { - - this.close( true ); - - $D.off( 'click.fb-start' ); - - }, - - - // Try to detect mobile devices - // ============================ - - isMobile : document.createTouch !== undefined && /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent), - - - // Detect if 'translate3d' support is available - // ============================================ - - use3d : (function() { - var div = document.createElement('div'); - - return window.getComputedStyle && window.getComputedStyle( div ).getPropertyValue('transform') && !(document.documentMode && document.documentMode < 11); - }()), - - // Helper function to get current visual state of an element - // returns array[ top, left, horizontal-scale, vertical-scale, opacity ] - // ===================================================================== - - getTranslate : function( $el ) { - var matrix; - - if ( !$el || !$el.length ) { - return false; - } - - matrix = $el.eq( 0 ).css('transform'); - - if ( matrix && matrix.indexOf( 'matrix' ) !== -1 ) { - matrix = matrix.split('(')[1]; - matrix = matrix.split(')')[0]; - matrix = matrix.split(','); - } else { - matrix = []; - } - - if ( matrix.length ) { - - // If IE - if ( matrix.length > 10 ) { - matrix = [ matrix[13], matrix[12], matrix[0], matrix[5] ]; - - } else { - matrix = [ matrix[5], matrix[4], matrix[0], matrix[3]]; - } - - matrix = matrix.map(parseFloat); - - } else { - matrix = [ 0, 0, 1, 1 ]; - - var transRegex = /\.*translate\((.*)px,(.*)px\)/i; - var transRez = transRegex.exec( $el.eq( 0 ).attr('style') ); - - if ( transRez ) { - matrix[ 0 ] = parseFloat( transRez[2] ); - matrix[ 1 ] = parseFloat( transRez[1] ); - } - } - - return { - top : matrix[ 0 ], - left : matrix[ 1 ], - scaleX : matrix[ 2 ], - scaleY : matrix[ 3 ], - opacity : parseFloat( $el.css('opacity') ), - width : $el.width(), - height : $el.height() - }; - - }, - - - // Shortcut for setting "translate3d" properties for element - // Can set be used to set opacity, too - // ======================================================== - - setTranslate : function( $el, props ) { - var str = ''; - var css = {}; - - if ( !$el || !props ) { - return; - } - - if ( props.left !== undefined || props.top !== undefined ) { - str = ( props.left === undefined ? $el.position().left : props.left ) + 'px, ' + ( props.top === undefined ? $el.position().top : props.top ) + 'px'; - - if ( this.use3d ) { - str = 'translate3d(' + str + ', 0px)'; - - } else { - str = 'translate(' + str + ')'; - } - } - - if ( props.scaleX !== undefined && props.scaleY !== undefined ) { - str = (str.length ? str + ' ' : '') + 'scale(' + props.scaleX + ', ' + props.scaleY + ')'; - } - - if ( str.length ) { - css.transform = str; - } - - if ( props.opacity !== undefined ) { - css.opacity = props.opacity; - } - - if ( props.width !== undefined ) { - css.width = props.width; - } - - if ( props.height !== undefined ) { - css.height = props.height; - } - - return $el.css( css ); - }, - - - // Simple CSS transition handler - // ============================= - - animate : function ( $el, to, duration, callback, leaveAnimationName ) { - if ( $.isFunction( duration ) ) { - callback = duration; - duration = null; - } - - if ( !$.isPlainObject( to ) ) { - $el.removeAttr( 'style' ); - } - - $el.on( transitionEnd, function(e) { - - // Skip events from child elements and z-index change - if ( e && e.originalEvent && ( !$el.is( e.originalEvent.target ) || e.originalEvent.propertyName == 'z-index' ) ) { - return; - } - - $.fancybox.stop( $el ); - - if ( $.isPlainObject( to ) ) { - - if ( to.scaleX !== undefined && to.scaleY !== undefined ) { - $el.css( 'transition-duration', '' ); - - to.width = Math.round( $el.width() * to.scaleX ); - to.height = Math.round( $el.height() * to.scaleY ); - - to.scaleX = 1; - to.scaleY = 1; - - $.fancybox.setTranslate( $el, to ); - } - - if ( leaveAnimationName === false ) { - $el.removeAttr( 'style' ); - } - - } else if ( leaveAnimationName !== true ) { - $el.removeClass( to ); - } - - if ( $.isFunction( callback ) ) { - callback( e ); - } - - }); - - if ( $.isNumeric( duration ) ) { - $el.css( 'transition-duration', duration + 'ms' ); - } - - if ( $.isPlainObject( to ) ) { - $.fancybox.setTranslate( $el, to ); - - } else { - $el.addClass( to ); - } - - if ( to.scaleX && $el.hasClass( 'fancybox-image-wrap' ) ) { - $el.parent().addClass( 'fancybox-is-scaling' ); - } - - // Make sure that `transitionend` callback gets fired - $el.data("timer", setTimeout(function() { - $el.trigger( 'transitionend' ); - }, duration + 16)); - - }, - - stop : function( $el ) { - clearTimeout( $el.data("timer") ); - - $el.off( 'transitionend' ).css( 'transition-duration', '' ); - - if ( $el.hasClass( 'fancybox-image-wrap' ) ) { - $el.parent().removeClass( 'fancybox-is-scaling' ); - } - } - - }; - - - // Default click handler for "fancyboxed" links - // ============================================ - - function _run( e ) { - var $target = $( e.currentTarget ), - opts = e.data ? e.data.options : {}, - value = $target.attr( 'data-fancybox' ) || '', - index = 0, - items = []; - - // Avoid opening multiple times - if ( e.isDefaultPrevented() ) { - return; - } - - e.preventDefault(); - - // Get all related items and find index for clicked one - if ( value ) { - items = opts.selector ? $( opts.selector ) : ( e.data ? e.data.items : [] ); - items = items.length ? items.filter( '[data-fancybox="' + value + '"]' ) : $( '[data-fancybox="' + value + '"]' ); - - index = items.index( $target ); - - // Sometimes current item can not be found - // (for example, when slider clones items) - if ( index < 0 ) { - index = 0; - } - - } else { - items = [ $target ]; - } - - $.fancybox.open( items, opts, index ); - } - - - // Create a jQuery plugin - // ====================== - - $.fn.fancybox = function (options) { - var selector; - - options = options || {}; - selector = options.selector || false; - - if ( selector ) { - - $( 'body' ).off( 'click.fb-start', selector ).on( 'click.fb-start', selector, { - options : options - }, _run ); - - } else { - - this.off( 'click.fb-start' ).on( 'click.fb-start', { - items : this, - options : options - }, _run); - - } - - return this; - }; - - - // Self initializing plugin - // ======================== - - $D.on( 'click.fb-start', '[data-fancybox]', _run ); - -}( window, document, window.jQuery || jQuery )); - -// ========================================================================== -// -// Media -// Adds additional media type support -// -// ========================================================================== -;(function ($) { - - 'use strict'; - - // Formats matching url to final form - - var format = function (url, rez, params) { - if ( !url ) { - return; - } - - params = params || ''; - - if ( $.type(params) === "object" ) { - params = $.param(params, true); - } - - $.each(rez, function (key, value) { - url = url.replace('$' + key, value || ''); - }); - - if (params.length) { - url += (url.indexOf('?') > 0 ? '&' : '?') + params; - } - - return url; - }; - - // Object containing properties for each media type - - var defaults = { - youtube : { - matcher : /(youtube\.com|youtu\.be|youtube\-nocookie\.com)\/(watch\?(.*&)?v=|v\/|u\/|embed\/?)?(videoseries\?list=(.*)|[\w-]{11}|\?listType=(.*)&list=(.*))(.*)/i, - params : { - autoplay : 1, - autohide : 1, - fs : 1, - rel : 0, - hd : 1, - wmode : 'transparent', - enablejsapi : 1, - html5 : 1 - }, - paramPlace : 8, - type : 'iframe', - url : '//www.youtube.com/embed/$4', - thumb : '//img.youtube.com/vi/$4/hqdefault.jpg' - }, - - vimeo : { - matcher : /^.+vimeo.com\/(.*\/)?([\d]+)(.*)?/, - params : { - autoplay : 1, - hd : 1, - show_title : 1, - show_byline : 1, - show_portrait : 0, - fullscreen : 1, - api : 1 - }, - paramPlace : 3, - type : 'iframe', - url : '//player.vimeo.com/video/$2' - }, - - metacafe : { - matcher : /metacafe.com\/watch\/(\d+)\/(.*)?/, - type : 'iframe', - url : '//www.metacafe.com/embed/$1/?ap=1' - }, - - dailymotion : { - matcher : /dailymotion.com\/video\/(.*)\/?(.*)/, - params : { - additionalInfos : 0, - autoStart : 1 - }, - type : 'iframe', - url : '//www.dailymotion.com/embed/video/$1' - }, - - vine : { - matcher : /vine.co\/v\/([a-zA-Z0-9\?\=\-]+)/, - type : 'iframe', - url : '//vine.co/v/$1/embed/simple' - }, - - instagram : { - matcher : /(instagr\.am|instagram\.com)\/p\/([a-zA-Z0-9_\-]+)\/?/i, - type : 'image', - url : '//$1/p/$2/media/?size=l' - }, - - // Examples: - // http://maps.google.com/?ll=48.857995,2.294297&spn=0.007666,0.021136&t=m&z=16 - // https://www.google.com/maps/@37.7852006,-122.4146355,14.65z - // https://www.google.com/maps/place/Googleplex/@37.4220041,-122.0833494,17z/data=!4m5!3m4!1s0x0:0x6c296c66619367e0!8m2!3d37.4219998!4d-122.0840572 - gmap_place : { - matcher : /(maps\.)?google\.([a-z]{2,3}(\.[a-z]{2})?)\/(((maps\/(place\/(.*)\/)?\@(.*),(\d+.?\d+?)z))|(\?ll=))(.*)?/i, - type : 'iframe', - url : function (rez) { - return '//maps.google.' + rez[2] + '/?ll=' + ( rez[9] ? rez[9] + '&z=' + Math.floor( rez[10] ) + ( rez[12] ? rez[12].replace(/^\//, "&") : '' ) : rez[12] ) + '&output=' + ( rez[12] && rez[12].indexOf('layer=c') > 0 ? 'svembed' : 'embed' ); - } - }, - - // Examples: - // https://www.google.com/maps/search/Empire+State+Building/ - // https://www.google.com/maps/search/?api=1&query=centurylink+field - // https://www.google.com/maps/search/?api=1&query=47.5951518,-122.3316393 - gmap_search : { - matcher : /(maps\.)?google\.([a-z]{2,3}(\.[a-z]{2})?)\/(maps\/search\/)(.*)/i, - type : 'iframe', - url : function (rez) { - return '//maps.google.' + rez[2] + '/maps?q=' + rez[5].replace('query=', 'q=').replace('api=1', '') + '&output=embed'; - } - } - }; - - $(document).on('objectNeedsType.fb', function (e, instance, item) { - - var url = item.src || '', - type = false, - media, - thumb, - rez, - params, - urlParams, - paramObj, - provider; - - media = $.extend( true, {}, defaults, item.opts.media ); - - // Look for any matching media type - $.each(media, function ( providerName, providerOpts ) { - rez = url.match( providerOpts.matcher ); - - if ( !rez ) { - return; - } - - type = providerOpts.type; - paramObj = {}; - - if ( providerOpts.paramPlace && rez[ providerOpts.paramPlace ] ) { - urlParams = rez[ providerOpts.paramPlace ]; - - if ( urlParams[ 0 ] == '?' ) { - urlParams = urlParams.substring(1); - } - - urlParams = urlParams.split('&'); - - for ( var m = 0; m < urlParams.length; ++m ) { - var p = urlParams[ m ].split('=', 2); - - if ( p.length == 2 ) { - paramObj[ p[0] ] = decodeURIComponent( p[1].replace(/\+/g, " ") ); - } - } - } - - params = $.extend( true, {}, providerOpts.params, item.opts[ providerName ], paramObj ); - - url = $.type( providerOpts.url ) === "function" ? providerOpts.url.call( this, rez, params, item ) : format( providerOpts.url, rez, params ); - thumb = $.type( providerOpts.thumb ) === "function" ? providerOpts.thumb.call( this, rez, params, item ) : format( providerOpts.thumb, rez ); - - if ( providerName === 'vimeo' ) { - url = url.replace('&%23', '#'); - } - - return false; - }); - - // If it is found, then change content type and update the url - - if ( type ) { - item.src = url; - item.type = type; - - if ( !item.opts.thumb && !( item.opts.$thumb && item.opts.$thumb.length ) ) { - item.opts.thumb = thumb; - } - - if ( type === 'iframe' ) { - $.extend(true, item.opts, { - iframe : { - preload : false, - attr : { - scrolling : "no" - } - } - }); - - item.contentProvider = provider; - - item.opts.slideClass += ' fancybox-slide--' + ( provider == 'gmap_place' || provider == 'gmap_search' ? 'map' : 'video' ); - } - - } else if ( url ) { - item.type = item.opts.defaultType; - } - - }); - -}( window.jQuery || jQuery )); - -// ========================================================================== -// -// Guestures -// Adds touch guestures, handles click and tap events -// -// ========================================================================== -;(function (window, document, $) { - 'use strict'; - - var requestAFrame = (function () { - return window.requestAnimationFrame || - window.webkitRequestAnimationFrame || - window.mozRequestAnimationFrame || - window.oRequestAnimationFrame || - // if all else fails, use setTimeout - function (callback) { - return window.setTimeout(callback, 1000 / 60); - }; - })(); - - var cancelAFrame = (function () { - return window.cancelAnimationFrame || - window.webkitCancelAnimationFrame || - window.mozCancelAnimationFrame || - window.oCancelAnimationFrame || - function (id) { - window.clearTimeout(id); - }; - })(); - - var pointers = function( e ) { - var result = []; - - e = e.originalEvent || e || window.e; - e = e.touches && e.touches.length ? e.touches : ( e.changedTouches && e.changedTouches.length ? e.changedTouches : [ e ] ); - - for ( var key in e ) { - - if ( e[ key ].pageX ) { - result.push( { x : e[ key ].pageX, y : e[ key ].pageY } ); - - } else if ( e[ key ].clientX ) { - result.push( { x : e[ key ].clientX, y : e[ key ].clientY } ); - } - } - - return result; - }; - - var distance = function( point2, point1, what ) { - if ( !point1 || !point2 ) { - return 0; - } - - if ( what === 'x' ) { - return point2.x - point1.x; - - } else if ( what === 'y' ) { - return point2.y - point1.y; - } - - return Math.sqrt( Math.pow( point2.x - point1.x, 2 ) + Math.pow( point2.y - point1.y, 2 ) ); - }; - - var isClickable = function( $el ) { - if ( $el.is('a,area,button,[role="button"],input,label,select,summary,textarea') || $.isFunction( $el.get(0).onclick ) || $el.data('selectable') ) { - return true; - } - - // Check for attributes like data-fancybox-next or data-fancybox-close - for ( var i = 0, atts = $el[0].attributes, n = atts.length; i < n; i++ ) { - if ( atts[i].nodeName.substr(0, 14) === 'data-fancybox-' ) { - return true; - } - } - - return false; - }; - - var hasScrollbars = function( el ) { - var overflowY = window.getComputedStyle( el )['overflow-y']; - var overflowX = window.getComputedStyle( el )['overflow-x']; - - var vertical = (overflowY === 'scroll' || overflowY === 'auto') && el.scrollHeight > el.clientHeight; - var horizontal = (overflowX === 'scroll' || overflowX === 'auto') && el.scrollWidth > el.clientWidth; - - return vertical || horizontal; - }; - - var isScrollable = function ( $el ) { - var rez = false; - - while ( true ) { - rez = hasScrollbars( $el.get(0) ); - - if ( rez ) { - break; - } - - $el = $el.parent(); - - if ( !$el.length || $el.hasClass( 'fancybox-stage' ) || $el.is( 'body' ) ) { - break; - } - } - - return rez; - }; - - - var Guestures = function ( instance ) { - var self = this; - - self.instance = instance; - - self.$bg = instance.$refs.bg; - self.$stage = instance.$refs.stage; - self.$container = instance.$refs.container; - - self.destroy(); - - self.$container.on( 'touchstart.fb.touch mousedown.fb.touch', $.proxy(self, 'ontouchstart') ); - }; - - Guestures.prototype.destroy = function() { - this.$container.off( '.fb.touch' ); - }; - - Guestures.prototype.ontouchstart = function( e ) { - var self = this; - - var $target = $( e.target ); - var instance = self.instance; - var current = instance.current; - var $content = current.$content; - - var isTouchDevice = ( e.type == 'touchstart' ); - - // Do not respond to both (touch and mouse) events - if ( isTouchDevice ) { - self.$container.off( 'mousedown.fb.touch' ); - } - - // Ignore right click - if ( e.originalEvent && e.originalEvent.button == 2 ) { - return; - } - - // Ignore taping on links, buttons, input elements - if ( !$target.length || isClickable( $target ) || isClickable( $target.parent() ) ) { - return; - } - - // Ignore clicks on the scrollbar - if ( !$target.is('img') && e.originalEvent.clientX > $target[0].clientWidth + $target.offset().left ) { - return; - } - - // Ignore clicks while zooming or closing - if ( !current || self.instance.isAnimating || self.instance.isClosing ) { - e.stopPropagation(); - e.preventDefault(); - - return; - } - - self.realPoints = self.startPoints = pointers( e ); - - if ( !self.startPoints ) { - return; - } - - e.stopPropagation(); - - self.startEvent = e; - - self.canTap = true; - self.$target = $target; - self.$content = $content; - self.opts = current.opts.touch; - - self.isPanning = false; - self.isSwiping = false; - self.isZooming = false; - self.isScrolling = false; - - self.sliderStartPos = self.sliderLastPos || { top: 0, left: 0 }; - self.contentStartPos = $.fancybox.getTranslate( self.$content ); - self.contentLastPos = null; - - self.startTime = new Date().getTime(); - self.distanceX = self.distanceY = self.distance = 0; - - self.canvasWidth = Math.round( current.$slide[0].clientWidth ); - self.canvasHeight = Math.round( current.$slide[0].clientHeight ); - - $(document) - .off( '.fb.touch' ) - .on( isTouchDevice ? 'touchend.fb.touch touchcancel.fb.touch' : 'mouseup.fb.touch mouseleave.fb.touch', $.proxy(self, "ontouchend")) - .on( isTouchDevice ? 'touchmove.fb.touch' : 'mousemove.fb.touch', $.proxy(self, "ontouchmove")); - - if ( $.fancybox.isMobile ) { - document.addEventListener('scroll', self.onscroll, true); - } - - if ( !(self.opts || instance.canPan() ) || !( $target.is( self.$stage ) || self.$stage.find( $target ).length ) ) { - - // Prevent image ghosting while dragging - if ( $target.is('img') ) { - e.preventDefault(); - } - - return; - } - - if ( !( $.fancybox.isMobile && ( isScrollable( $target ) || isScrollable( $target.parent() ) ) ) ) { - e.preventDefault(); - } - - if ( self.startPoints.length === 1 ) { - if ( current.type === 'image' && ( self.contentStartPos.width > self.canvasWidth + 1 || self.contentStartPos.height > self.canvasHeight + 1 ) ) { - $.fancybox.stop( self.$content ); - - self.$content.css( 'transition-duration', '' ); - - self.isPanning = true; - - } else { - self.isSwiping = true; - } - - self.$container.addClass( 'fancybox-controls--isGrabbing' ); - } - - if ( self.startPoints.length === 2 && !instance.isAnimating && !current.hasError && current.type === 'image' && ( current.isLoaded || current.$ghost ) ) { - self.canTap = false; - self.isSwiping = false; - self.isPanning = false; - - self.isZooming = true; - - $.fancybox.stop( self.$content ); - - self.$content.css( 'transition-duration', '' ); - - self.centerPointStartX = ( ( self.startPoints[0].x + self.startPoints[1].x ) * 0.5 ) - $(window).scrollLeft(); - self.centerPointStartY = ( ( self.startPoints[0].y + self.startPoints[1].y ) * 0.5 ) - $(window).scrollTop(); - - self.percentageOfImageAtPinchPointX = ( self.centerPointStartX - self.contentStartPos.left ) / self.contentStartPos.width; - self.percentageOfImageAtPinchPointY = ( self.centerPointStartY - self.contentStartPos.top ) / self.contentStartPos.height; - - self.startDistanceBetweenFingers = distance( self.startPoints[0], self.startPoints[1] ); - } - - }; - - Guestures.prototype.onscroll = function(e) { - self.isScrolling = true; - }; - - Guestures.prototype.ontouchmove = function( e ) { - var self = this, - $target = $(e.target); - - if ( self.isScrolling || !( $target.is( self.$stage ) || self.$stage.find( $target ).length ) ) { - self.canTap = false; - - return; - } - - self.newPoints = pointers( e ); - - if ( !( self.opts || self.instance.canPan() ) || !self.newPoints || !self.newPoints.length ) { - return; - } - - if ( !(self.isSwiping && self.isSwiping === true) ) { - e.preventDefault(); - } - - self.distanceX = distance( self.newPoints[0], self.startPoints[0], 'x' ); - self.distanceY = distance( self.newPoints[0], self.startPoints[0], 'y' ); - - self.distance = distance( self.newPoints[0], self.startPoints[0] ) - - // Skip false ontouchmove events (Chrome) - if ( self.distance > 0 ) { - if ( self.isSwiping ) { - self.onSwipe(e); - - } else if ( self.isPanning ) { - self.onPan(); - - } else if ( self.isZooming ) { - self.onZoom(); - } - } - - }; - - Guestures.prototype.onSwipe = function(e) { - var self = this, - swiping = self.isSwiping, - left = self.sliderStartPos.left || 0, - angle; - - // If direction is not yet determined - if ( swiping === true ) { - - // We need at least 10px distance to correctly calculate an angle - if ( Math.abs( self.distance ) > 10 ) { - self.canTap = false; - - if ( self.instance.group.length < 2 && self.opts.vertical ) { - self.isSwiping = 'y'; - - } else if ( self.instance.isDragging || self.opts.vertical === false || ( self.opts.vertical === 'auto' && $( window ).width() > 800 ) ) { - self.isSwiping = 'x'; - - } else { - angle = Math.abs( Math.atan2( self.distanceY, self.distanceX ) * 180 / Math.PI ); - - self.isSwiping = ( angle > 45 && angle < 135 ) ? 'y' : 'x'; - } - - self.canTap = false; - - if ( self.isSwiping === 'y' && $.fancybox.isMobile && ( isScrollable( self.$target ) || isScrollable( self.$target.parent() ) ) ) { - self.isScrolling = true; - - return; - } - - self.instance.isDragging = self.isSwiping; - - // Reset points to avoid jumping, because we dropped first swipes to calculate the angle - self.startPoints = self.newPoints; - - $.each(self.instance.slides, function( index, slide ) { - $.fancybox.stop( slide.$slide ); - - slide.$slide.css( 'transition-duration', '' ); - - slide.inTransition = false; - - if ( slide.pos === self.instance.current.pos ) { - self.sliderStartPos.left = $.fancybox.getTranslate( slide.$slide ).left; - } - }); - - // Stop slideshow - if ( self.instance.SlideShow && self.instance.SlideShow.isActive ) { - self.instance.SlideShow.stop(); - } - } - - return; - } - - // Sticky edges - if ( swiping == 'x' ) { - if ( self.distanceX > 0 && ( self.instance.group.length < 2 || ( self.instance.current.index === 0 && !self.instance.current.opts.loop ) ) ) { - left = left + Math.pow( self.distanceX, 0.8 ); - - } else if ( self.distanceX < 0 && ( self.instance.group.length < 2 || ( self.instance.current.index === self.instance.group.length - 1 && !self.instance.current.opts.loop ) ) ) { - left = left - Math.pow( -self.distanceX, 0.8 ); - - } else { - left = left + self.distanceX; - } - } - - self.sliderLastPos = { - top : swiping == 'x' ? 0 : self.sliderStartPos.top + self.distanceY, - left : left - }; - - if ( self.requestId ) { - cancelAFrame( self.requestId ); - - self.requestId = null; - } - - self.requestId = requestAFrame(function() { - - if ( self.sliderLastPos ) { - $.each(self.instance.slides, function( index, slide ) { - var pos = slide.pos - self.instance.currPos; - - $.fancybox.setTranslate( slide.$slide, { - top : self.sliderLastPos.top, - left : self.sliderLastPos.left + ( pos * self.canvasWidth ) + ( pos * slide.opts.gutter ) - }); - }); - - self.$container.addClass( 'fancybox-is-sliding' ); - } - - }); - - }; - - Guestures.prototype.onPan = function() { - var self = this; - - // Sometimes, when tapping causally, image can move a bit and that breaks double tapping - if ( distance( self.newPoints[0], self.realPoints[0] ) < ($.fancybox.isMobile ? 10 : 5) ) { - self.startPoints = self.newPoints; - return; - } - - self.canTap = false; - - self.contentLastPos = self.limitMovement(); - - if ( self.requestId ) { - cancelAFrame( self.requestId ); - - self.requestId = null; - } - - self.requestId = requestAFrame(function() { - $.fancybox.setTranslate( self.$content, self.contentLastPos ); - }); - }; - - // Make panning sticky to the edges - Guestures.prototype.limitMovement = function() { - var self = this; - - var canvasWidth = self.canvasWidth; - var canvasHeight = self.canvasHeight; - - var distanceX = self.distanceX; - var distanceY = self.distanceY; - - var contentStartPos = self.contentStartPos; - - var currentOffsetX = contentStartPos.left; - var currentOffsetY = contentStartPos.top; - - var currentWidth = contentStartPos.width; - var currentHeight = contentStartPos.height; - - var minTranslateX, minTranslateY, - maxTranslateX, maxTranslateY, - newOffsetX, newOffsetY; - - if ( currentWidth > canvasWidth ) { - newOffsetX = currentOffsetX + distanceX; - - } else { - newOffsetX = currentOffsetX; - } - - newOffsetY = currentOffsetY + distanceY; - - // Slow down proportionally to traveled distance - minTranslateX = Math.max( 0, canvasWidth * 0.5 - currentWidth * 0.5 ); - minTranslateY = Math.max( 0, canvasHeight * 0.5 - currentHeight * 0.5 ); - - maxTranslateX = Math.min( canvasWidth - currentWidth, canvasWidth * 0.5 - currentWidth * 0.5 ); - maxTranslateY = Math.min( canvasHeight - currentHeight, canvasHeight * 0.5 - currentHeight * 0.5 ); - - if ( currentWidth > canvasWidth ) { - - // -> - if ( distanceX > 0 && newOffsetX > minTranslateX ) { - newOffsetX = minTranslateX - 1 + Math.pow( -minTranslateX + currentOffsetX + distanceX, 0.8 ) || 0; - } - - // <- - if ( distanceX < 0 && newOffsetX < maxTranslateX ) { - newOffsetX = maxTranslateX + 1 - Math.pow( maxTranslateX - currentOffsetX - distanceX, 0.8 ) || 0; - } - - } - - if ( currentHeight > canvasHeight ) { - - // \/ - if ( distanceY > 0 && newOffsetY > minTranslateY ) { - newOffsetY = minTranslateY - 1 + Math.pow(-minTranslateY + currentOffsetY + distanceY, 0.8 ) || 0; - } - - // /\ - if ( distanceY < 0 && newOffsetY < maxTranslateY ) { - newOffsetY = maxTranslateY + 1 - Math.pow ( maxTranslateY - currentOffsetY - distanceY, 0.8 ) || 0; - } - - } - - return { - top : newOffsetY, - left : newOffsetX, - scaleX : contentStartPos.scaleX, - scaleY : contentStartPos.scaleY - }; - - }; - - Guestures.prototype.limitPosition = function( newOffsetX, newOffsetY, newWidth, newHeight ) { - var self = this; - - var canvasWidth = self.canvasWidth; - var canvasHeight = self.canvasHeight; - - if ( newWidth > canvasWidth ) { - newOffsetX = newOffsetX > 0 ? 0 : newOffsetX; - newOffsetX = newOffsetX < canvasWidth - newWidth ? canvasWidth - newWidth : newOffsetX; - - } else { - - // Center horizontally - newOffsetX = Math.max( 0, canvasWidth / 2 - newWidth / 2 ); - - } - - if ( newHeight > canvasHeight ) { - newOffsetY = newOffsetY > 0 ? 0 : newOffsetY; - newOffsetY = newOffsetY < canvasHeight - newHeight ? canvasHeight - newHeight : newOffsetY; - - } else { - - // Center vertically - newOffsetY = Math.max( 0, canvasHeight / 2 - newHeight / 2 ); - - } - - return { - top : newOffsetY, - left : newOffsetX - }; - - }; - - Guestures.prototype.onZoom = function() { - var self = this; - - // Calculate current distance between points to get pinch ratio and new width and height - - var currentWidth = self.contentStartPos.width; - var currentHeight = self.contentStartPos.height; - - var currentOffsetX = self.contentStartPos.left; - var currentOffsetY = self.contentStartPos.top; - - var endDistanceBetweenFingers = distance( self.newPoints[0], self.newPoints[1] ); - - var pinchRatio = endDistanceBetweenFingers / self.startDistanceBetweenFingers; - - var newWidth = Math.floor( currentWidth * pinchRatio ); - var newHeight = Math.floor( currentHeight * pinchRatio ); - - // This is the translation due to pinch-zooming - var translateFromZoomingX = (currentWidth - newWidth) * self.percentageOfImageAtPinchPointX; - var translateFromZoomingY = (currentHeight - newHeight) * self.percentageOfImageAtPinchPointY; - - //Point between the two touches - - var centerPointEndX = ((self.newPoints[0].x + self.newPoints[1].x) / 2) - $(window).scrollLeft(); - var centerPointEndY = ((self.newPoints[0].y + self.newPoints[1].y) / 2) - $(window).scrollTop(); - - // And this is the translation due to translation of the centerpoint - // between the two fingers - - var translateFromTranslatingX = centerPointEndX - self.centerPointStartX; - var translateFromTranslatingY = centerPointEndY - self.centerPointStartY; - - // The new offset is the old/current one plus the total translation - - var newOffsetX = currentOffsetX + ( translateFromZoomingX + translateFromTranslatingX ); - var newOffsetY = currentOffsetY + ( translateFromZoomingY + translateFromTranslatingY ); - - var newPos = { - top : newOffsetY, - left : newOffsetX, - scaleX : self.contentStartPos.scaleX * pinchRatio, - scaleY : self.contentStartPos.scaleY * pinchRatio - }; - - self.canTap = false; - - self.newWidth = newWidth; - self.newHeight = newHeight; - - self.contentLastPos = newPos; - - if ( self.requestId ) { - cancelAFrame( self.requestId ); - - self.requestId = null; - } - - self.requestId = requestAFrame(function() { - $.fancybox.setTranslate( self.$content, self.contentLastPos ); - }); - - }; - - Guestures.prototype.ontouchend = function( e ) { - var self = this; - var dMs = Math.max( (new Date().getTime() ) - self.startTime, 1); - - var swiping = self.isSwiping; - var panning = self.isPanning; - var zooming = self.isZooming; - var scrolling = self.isScrolling; - - self.endPoints = pointers( e ); - - self.$container.removeClass( 'fancybox-controls--isGrabbing' ); - - $(document).off( '.fb.touch' ); - - document.removeEventListener('scroll', self.onscroll, true); - - if ( self.requestId ) { - cancelAFrame( self.requestId ); - - self.requestId = null; - } - - self.isSwiping = false; - self.isPanning = false; - self.isZooming = false; - self.isScrolling = false; - - self.instance.isDragging = false; - - if ( self.canTap ) { - return self.onTap( e ); - } - - self.speed = 366; - - // Speed in px/ms - self.velocityX = self.distanceX / dMs * 0.5; - self.velocityY = self.distanceY / dMs * 0.5; - - self.speedX = Math.max( self.speed * 0.5, Math.min( self.speed * 1.5, ( 1 / Math.abs( self.velocityX ) ) * self.speed ) ); - - if ( panning ) { - self.endPanning(); - - } else if ( zooming ) { - self.endZooming(); - - } else { - self.endSwiping( swiping, scrolling ); - } - - return; - }; - - Guestures.prototype.endSwiping = function( swiping, scrolling ) { - var self = this, - ret = false, - len = self.instance.group.length; - - self.sliderLastPos = null; - - // Close if swiped vertically / navigate if horizontally - if ( swiping == 'y' && !scrolling && Math.abs( self.distanceY ) > 50 ) { - - // Continue vertical movement - $.fancybox.animate( self.instance.current.$slide, { - top : self.sliderStartPos.top + self.distanceY + ( self.velocityY * 150 ), - opacity : 0 - }, 150 ); - - ret = self.instance.close( true, 300 ); - - } else if ( swiping == 'x' && self.distanceX > 50 && len > 1 ) { - ret = self.instance.previous( self.speedX ); - - } else if ( swiping == 'x' && self.distanceX < -50 && len > 1 ) { - ret = self.instance.next( self.speedX ); - } - - if ( ret === false && ( swiping == 'x' || swiping == 'y' ) ) { - if ( scrolling || len < 2 ) { - self.instance.centerSlide( self.instance.current, 150 ); - } else { - self.instance.jumpTo( self.instance.current.index ); - } - } - - self.$container.removeClass( 'fancybox-is-sliding' ); - - }; - - // Limit panning from edges - // ======================== - - Guestures.prototype.endPanning = function() { - - var self = this; - var newOffsetX, newOffsetY, newPos; - - if ( !self.contentLastPos ) { - return; - } - - if ( self.opts.momentum === false ) { - newOffsetX = self.contentLastPos.left; - newOffsetY = self.contentLastPos.top; - - } else { - - // Continue movement - newOffsetX = self.contentLastPos.left + ( self.velocityX * self.speed ); - newOffsetY = self.contentLastPos.top + ( self.velocityY * self.speed ); - } - - newPos = self.limitPosition( newOffsetX, newOffsetY, self.contentStartPos.width, self.contentStartPos.height ); - - newPos.width = self.contentStartPos.width; - newPos.height = self.contentStartPos.height; - - $.fancybox.animate( self.$content, newPos, 330 ); - }; - - - Guestures.prototype.endZooming = function() { - var self = this; - - var current = self.instance.current; - - var newOffsetX, newOffsetY, newPos, reset; - - var newWidth = self.newWidth; - var newHeight = self.newHeight; - - if ( !self.contentLastPos ) { - return; - } - - newOffsetX = self.contentLastPos.left; - newOffsetY = self.contentLastPos.top; - - reset = { - top : newOffsetY, - left : newOffsetX, - width : newWidth, - height : newHeight, - scaleX : 1, - scaleY : 1 - }; - - // Reset scalex/scaleY values; this helps for perfomance and does not break animation - $.fancybox.setTranslate( self.$content, reset ); - - if ( newWidth < self.canvasWidth && newHeight < self.canvasHeight ) { - self.instance.scaleToFit( 150 ); - - } else if ( newWidth > current.width || newHeight > current.height ) { - self.instance.scaleToActual( self.centerPointStartX, self.centerPointStartY, 150 ); - - } else { - - newPos = self.limitPosition( newOffsetX, newOffsetY, newWidth, newHeight ); - - // Switch from scale() to width/height or animation will not work correctly - $.fancybox.setTranslate( self.content, $.fancybox.getTranslate( self.$content ) ); - - $.fancybox.animate( self.$content, newPos, 150 ); - } - - }; - - Guestures.prototype.onTap = function(e) { - var self = this; - var $target = $( e.target ); - - var instance = self.instance; - var current = instance.current; - - var endPoints = ( e && pointers( e ) ) || self.startPoints; - - var tapX = endPoints[0] ? endPoints[0].x - self.$stage.offset().left : 0; - var tapY = endPoints[0] ? endPoints[0].y - self.$stage.offset().top : 0; - - var where; - - var process = function ( prefix ) { - - var action = current.opts[ prefix ]; - - if ( $.isFunction( action ) ) { - action = action.apply( instance, [ current, e ] ); - } - - if ( !action) { - return; - } - - switch ( action ) { - - case "close" : - - instance.close( self.startEvent ); - - break; - - case "toggleControls" : - - instance.toggleControls( true ); - - break; - - case "next" : - - instance.next(); - - break; - - case "nextOrClose" : - - if ( instance.group.length > 1 ) { - instance.next(); - - } else { - instance.close( self.startEvent ); - } - - break; - - case "zoom" : - - if ( current.type == 'image' && ( current.isLoaded || current.$ghost ) ) { - - if ( instance.canPan() ) { - instance.scaleToFit(); - - } else if ( instance.isScaledDown() ) { - instance.scaleToActual( tapX, tapY ); - - } else if ( instance.group.length < 2 ) { - instance.close( self.startEvent ); - } - } - - break; - } - - }; - - // Ignore right click - if ( e.originalEvent && e.originalEvent.button == 2 ) { - return; - } - - // Skip if clicked on the scrollbar - if ( !$target.is('img') && tapX > $target[0].clientWidth + $target.offset().left ) { - return; - } - - // Check where is clicked - if ( $target.is( '.fancybox-bg,.fancybox-inner,.fancybox-outer,.fancybox-container' ) ) { - where = 'Outside'; - - } else if ( $target.is( '.fancybox-slide' ) ) { - where = 'Slide'; - - } else if ( instance.current.$content && instance.current.$content.find( $target ).addBack().filter( $target ).length ) { - where = 'Content'; - - } else { - return; - } - - // Check if this is a double tap - if ( self.tapped ) { - - // Stop previously created single tap - clearTimeout( self.tapped ); - self.tapped = null; - - // Skip if distance between taps is too big - if ( Math.abs( tapX - self.tapX ) > 50 || Math.abs( tapY - self.tapY ) > 50 ) { - return this; - } - - // OK, now we assume that this is a double-tap - process( 'dblclick' + where ); - - } else { - - // Single tap will be processed if user has not clicked second time within 300ms - // or there is no need to wait for double-tap - self.tapX = tapX; - self.tapY = tapY; - - if ( current.opts[ 'dblclick' + where ] && current.opts[ 'dblclick' + where ] !== current.opts[ 'click' + where ] ) { - - self.tapped = setTimeout(function() { - self.tapped = null; - - process( 'click' + where ); - - }, 500); - - } else { - process( 'click' + where ); - } - - } - - return this; - }; - - $(document).on('onActivate.fb', function (e, instance) { - if ( instance && !instance.Guestures ) { - instance.Guestures = new Guestures( instance ); - } - }); - -}( window, document, window.jQuery || jQuery )); - -// ========================================================================== -// -// SlideShow -// Enables slideshow functionality -// -// Example of usage: -// $.fancybox.getInstance().SlideShow.start() -// -// ========================================================================== -;(function (document, $) { - 'use strict'; - - $.extend(true, $.fancybox.defaults, { - btnTpl : { - slideShow : - '' - }, - slideShow : { - autoStart : false, - speed : 3000 - } - }); - - var SlideShow = function( instance ) { - this.instance = instance; - this.init(); - }; - - $.extend( SlideShow.prototype, { - timer : null, - isActive : false, - $button : null, - - init : function() { - var self = this; - - self.$button = self.instance.$refs.toolbar.find('[data-fancybox-play]').on('click', function() { - self.toggle(); - }); - - if ( self.instance.group.length < 2 || !self.instance.group[ self.instance.currIndex ].opts.slideShow ) { - self.$button.hide(); - } - }, - - set : function( force ) { - var self = this; - - // Check if reached last element - if ( self.instance && self.instance.current && (force === true || self.instance.current.opts.loop || self.instance.currIndex < self.instance.group.length - 1 )) { - self.timer = setTimeout(function() { - if ( self.isActive ) { - self.instance.jumpTo( (self.instance.currIndex + 1) % self.instance.group.length ); - } - - }, self.instance.current.opts.slideShow.speed); - - } else { - self.stop(); - self.instance.idleSecondsCounter = 0; - self.instance.showControls(); - } - }, - - clear : function() { - var self = this; - - clearTimeout( self.timer ); - - self.timer = null; - }, - - start : function() { - var self = this; - var current = self.instance.current; - - if ( current ) { - self.isActive = true; - - self.$button - .attr( 'title', current.opts.i18n[ current.opts.lang ].PLAY_STOP ) - .removeClass( 'fancybox-button--play' ) - .addClass( 'fancybox-button--pause' ); - - self.set( true ); - } - }, - - stop : function() { - var self = this; - var current = self.instance.current; - - self.clear(); - - self.$button - .attr( 'title', current.opts.i18n[ current.opts.lang ].PLAY_START ) - .removeClass( 'fancybox-button--pause' ) - .addClass( 'fancybox-button--play' ); - - self.isActive = false; - }, - - toggle : function() { - var self = this; - - if ( self.isActive ) { - self.stop(); - - } else { - self.start(); - } - } - - }); - - $(document).on({ - 'onInit.fb' : function(e, instance) { - if ( instance && !instance.SlideShow ) { - instance.SlideShow = new SlideShow( instance ); - } - }, - - 'beforeShow.fb' : function(e, instance, current, firstRun) { - var SlideShow = instance && instance.SlideShow; - - if ( firstRun ) { - - if ( SlideShow && current.opts.slideShow.autoStart ) { - SlideShow.start(); - } - - } else if ( SlideShow && SlideShow.isActive ) { - SlideShow.clear(); - } - }, - - 'afterShow.fb' : function(e, instance, current) { - var SlideShow = instance && instance.SlideShow; - - if ( SlideShow && SlideShow.isActive ) { - SlideShow.set(); - } - }, - - 'afterKeydown.fb' : function(e, instance, current, keypress, keycode) { - var SlideShow = instance && instance.SlideShow; - - // "P" or Spacebar - if ( SlideShow && current.opts.slideShow && ( keycode === 80 || keycode === 32 ) && !$(document.activeElement).is( 'button,a,input' ) ) { - keypress.preventDefault(); - - SlideShow.toggle(); - } - }, - - 'beforeClose.fb onDeactivate.fb' : function(e, instance) { - var SlideShow = instance && instance.SlideShow; - - if ( SlideShow ) { - SlideShow.stop(); - } - } - }); - - // Page Visibility API to pause slideshow when window is not active - $(document).on("visibilitychange", function() { - var instance = $.fancybox.getInstance(); - var SlideShow = instance && instance.SlideShow; - - if ( SlideShow && SlideShow.isActive ) { - if ( document.hidden ) { - SlideShow.clear(); - - } else { - SlideShow.set(); - } - } - }); - -}( document, window.jQuery || jQuery )); - -// ========================================================================== -// -// FullScreen -// Adds fullscreen functionality -// -// ========================================================================== -;(function (document, $) { - 'use strict'; - - // Collection of methods supported by user browser - var fn = (function () { - - var fnMap = [ - [ - 'requestFullscreen', - 'exitFullscreen', - 'fullscreenElement', - 'fullscreenEnabled', - 'fullscreenchange', - 'fullscreenerror' - ], - // new WebKit - [ - 'webkitRequestFullscreen', - 'webkitExitFullscreen', - 'webkitFullscreenElement', - 'webkitFullscreenEnabled', - 'webkitfullscreenchange', - 'webkitfullscreenerror' - - ], - // old WebKit (Safari 5.1) - [ - 'webkitRequestFullScreen', - 'webkitCancelFullScreen', - 'webkitCurrentFullScreenElement', - 'webkitCancelFullScreen', - 'webkitfullscreenchange', - 'webkitfullscreenerror' - - ], - [ - 'mozRequestFullScreen', - 'mozCancelFullScreen', - 'mozFullScreenElement', - 'mozFullScreenEnabled', - 'mozfullscreenchange', - 'mozfullscreenerror' - ], - [ - 'msRequestFullscreen', - 'msExitFullscreen', - 'msFullscreenElement', - 'msFullscreenEnabled', - 'MSFullscreenChange', - 'MSFullscreenError' - ] - ]; - - var val; - var ret = {}; - var i, j; - - for ( i = 0; i < fnMap.length; i++ ) { - val = fnMap[ i ]; - - if ( val && val[ 1 ] in document ) { - for ( j = 0; j < val.length; j++ ) { - ret[ fnMap[ 0 ][ j ] ] = val[ j ]; - } - - return ret; - } - } - - return false; - })(); - - // If browser does not have Full Screen API, then simply unset default button template and stop - if ( !fn ) { - - if ( $ && $.fancybox ) { - $.fancybox.defaults.btnTpl.fullScreen = false; - } - - return; - } - - var FullScreen = { - - request : function ( elem ) { - - elem = elem || document.documentElement; - - elem[ fn.requestFullscreen ]( elem.ALLOW_KEYBOARD_INPUT ); - - }, - exit : function () { - - document[ fn.exitFullscreen ](); - - }, - toggle : function ( elem ) { - - elem = elem || document.documentElement; - - if ( this.isFullscreen() ) { - this.exit(); - - } else { - this.request( elem ); - } - - }, - isFullscreen : function() { - - return Boolean( document[ fn.fullscreenElement ] ); - - }, - enabled : function() { - - return Boolean( document[ fn.fullscreenEnabled ] ); - - } - }; - - $.extend(true, $.fancybox.defaults, { - btnTpl : { - fullScreen : - '' - }, - fullScreen : { - autoStart : false - } - }); - - $(document).on({ - 'onInit.fb' : function(e, instance) { - var $container; - - if ( instance && instance.group[ instance.currIndex ].opts.fullScreen ) { - $container = instance.$refs.container; - - $container.on('click.fb-fullscreen', '[data-fancybox-fullscreen]', function(e) { - - e.stopPropagation(); - e.preventDefault(); - - FullScreen.toggle( $container[ 0 ] ); - - }); - - if ( instance.opts.fullScreen && instance.opts.fullScreen.autoStart === true ) { - FullScreen.request( $container[ 0 ] ); - } - - // Expose API - instance.FullScreen = FullScreen; - - } else if ( instance ) { - instance.$refs.toolbar.find('[data-fancybox-fullscreen]').hide(); - } - - }, - - 'afterKeydown.fb' : function(e, instance, current, keypress, keycode) { - - // "P" or Spacebar - if ( instance && instance.FullScreen && keycode === 70 ) { - keypress.preventDefault(); - - instance.FullScreen.toggle( instance.$refs.container[ 0 ] ); - } - - }, - - 'beforeClose.fb' : function( instance ) { - if ( instance && instance.FullScreen ) { - FullScreen.exit(); - } - } - }); - - $(document).on(fn.fullscreenchange, function() { - var isFullscreen = FullScreen.isFullscreen(), - instance = $.fancybox.getInstance(); - - if ( instance ) { - - // If image is zooming, then force to stop and reposition properly - if ( instance.current && instance.current.type === 'image' && instance.isAnimating ) { - instance.current.$content.css( 'transition', 'none' ); - - instance.isAnimating = false; - - instance.update( true, true, 0 ); - } - - instance.trigger( 'onFullscreenChange', isFullscreen ); - - instance.$refs.container.toggleClass( 'fancybox-is-fullscreen', isFullscreen ); - } - - }); - -}( document, window.jQuery || jQuery )); - -// ========================================================================== -// -// Thumbs -// Displays thumbnails in a grid -// -// ========================================================================== -;(function (document, $) { - 'use strict'; - - // Make sure there are default values - $.fancybox.defaults = $.extend(true, { - btnTpl : { - thumbs : - '' - }, - thumbs : { - autoStart : false, // Display thumbnails on opening - hideOnClose : true, // Hide thumbnail grid when closing animation starts - parentEl : '.fancybox-container', // Container is injected into this element - axis : 'y' // Vertical (y) or horizontal (x) scrolling - } - }, $.fancybox.defaults); - - var FancyThumbs = function( instance ) { - this.init( instance ); - }; - - $.extend( FancyThumbs.prototype, { - - $button : null, - $grid : null, - $list : null, - isVisible : false, - isActive : false, - - init : function( instance ) { - var self = this; - - self.instance = instance; - - instance.Thumbs = self; - - // Enable thumbs if at least two group items have thumbnails - var first = instance.group[0], - second = instance.group[1]; - - self.opts = instance.group[ instance.currIndex ].opts.thumbs; - - self.$button = instance.$refs.toolbar.find( '[data-fancybox-thumbs]' ); - - if ( self.opts && first && second && ( - ( first.type == 'image' || first.opts.thumb || first.opts.$thumb ) && - ( second.type == 'image' || second.opts.thumb || second.opts.$thumb ) - )) { - - self.$button.show().on('click', function() { - self.toggle(); - }); - - self.isActive = true; - - } else { - self.$button.hide(); - } - }, - - create : function() { - var self = this, - instance = self.instance, - parentEl = self.opts.parentEl, - list, - src; - - self.$grid = $('
').appendTo( instance.$refs.container.find( parentEl ).addBack().filter( parentEl ) ); - - // Build list HTML - list = '
    '; - - $.each(instance.group, function( i, item ) { - src = item.opts.thumb || ( item.opts.$thumb ? item.opts.$thumb.attr( 'src' ) : null ); - - if ( !src && item.type === 'image' ) { - src = item.src; - } - - if ( src && src.length ) { - list += '
  • '; - } - }); - - list += '
'; - - self.$list = $( list ).appendTo( self.$grid ).on('click', 'li', function() { - instance.jumpTo( $(this).data('index') ); - }); - - self.$list.find( 'img' ).hide().one('load', function() { - var $parent = $(this).parent().removeClass( 'fancybox-thumbs-loading' ), - thumbWidth = $parent.outerWidth(), - thumbHeight = $parent.outerHeight(), - width, - height, - widthRatio, - heightRatio; - - width = this.naturalWidth || this.width; - height = this.naturalHeight || this.height; - - // Calculate thumbnail dimensions; center vertically and horizontally - widthRatio = width / thumbWidth; - heightRatio = height / thumbHeight; - - if (widthRatio >= 1 && heightRatio >= 1) { - if (widthRatio > heightRatio) { - width = width / heightRatio; - height = thumbHeight; - - } else { - width = thumbWidth; - height = height / widthRatio; - } - } - - $(this).css({ - width : Math.floor(width), - height : Math.floor(height), - 'margin-top' : height > thumbHeight ? ( Math.floor(thumbHeight * 0.3 - height * 0.3 ) ) : Math.floor(thumbHeight * 0.5 - height * 0.5 ), - 'margin-left' : Math.floor(thumbWidth * 0.5 - width * 0.5 ) - }).show(); - - }) - .each(function() { - this.src = $( this ).data( 'src' ); - }); - - if ( self.opts.axis === 'x' ) { - self.$list.width( parseInt( self.$grid.css("padding-right") ) + ( instance.group.length * self.$list.children().eq(0).outerWidth(true) ) + 'px' ); - } - }, - - focus : function( duration ) { - var self = this, - $list = self.$list, - thumb, - thumbPos; - - if ( self.instance.current ) { - thumb = $list.children() - .removeClass( 'fancybox-thumbs-active' ) - .filter('[data-index="' + self.instance.current.index + '"]') - .addClass('fancybox-thumbs-active'); - - thumbPos = thumb.position(); - - // Check if need to scroll to make current thumb visible - if ( self.opts.axis === 'y' && ( thumbPos.top < 0 || thumbPos.top > ( $list.height() - thumb.outerHeight() ) ) ) { - $list.stop().animate({ 'scrollTop' : $list.scrollTop() + thumbPos.top }, duration); - - } else if ( self.opts.axis === 'x' && ( - thumbPos.left < $list.parent().scrollLeft() || - thumbPos.left > ( $list.parent().scrollLeft() + ( $list.parent().width() - thumb.outerWidth() ) ) - ) - ) { - $list.parent().stop().animate({ 'scrollLeft' : thumbPos.left }, duration); - } - } - }, - - update : function() { - this.instance.$refs.container.toggleClass( 'fancybox-show-thumbs', this.isVisible ); - - if ( this.isVisible ) { - if ( !this.$grid ) { - this.create(); - } - - this.instance.trigger( 'onThumbsShow' ); - - this.focus( 0 ); - - } else if ( this.$grid ) { - this.instance.trigger( 'onThumbsHide' ); - } - - // Update content position - this.instance.update(); - }, - - hide : function() { - this.isVisible = false; - this.update(); - }, - - show : function() { - this.isVisible = true; - this.update(); - }, - - toggle : function() { - this.isVisible = !this.isVisible; - this.update(); - } - }); - - $(document).on({ - - 'onInit.fb' : function(e, instance) { - var Thumbs; - - if ( instance && !instance.Thumbs ) { - Thumbs = new FancyThumbs( instance ); - - if ( Thumbs.isActive && Thumbs.opts.autoStart === true ) { - Thumbs.show(); - } - } - }, - - 'beforeShow.fb' : function(e, instance, item, firstRun) { - var Thumbs = instance && instance.Thumbs; - - if ( Thumbs && Thumbs.isVisible ) { - Thumbs.focus( firstRun ? 0 : 250 ); - } - }, - - 'afterKeydown.fb' : function(e, instance, current, keypress, keycode) { - var Thumbs = instance && instance.Thumbs; - - // "G" - if ( Thumbs && Thumbs.isActive && keycode === 71 ) { - keypress.preventDefault(); - - Thumbs.toggle(); - } - }, - - 'beforeClose.fb' : function( e, instance ) { - var Thumbs = instance && instance.Thumbs; - - if ( Thumbs && Thumbs.isVisible && Thumbs.opts.hideOnClose !== false ) { - Thumbs.$grid.hide(); - } - } - - }); - -}(document, window.jQuery)); - -//// ========================================================================== -// -// Share -// Displays simple form for sharing current url -// -// ========================================================================== -;(function (document, $) { - 'use strict'; - - $.extend(true, $.fancybox.defaults, { - btnTpl : { - share : - '' - }, - share : { - tpl : - '
' + - '

{{SHARE}}

' + - '' + - '

' + - '
' - } - }); - - function escapeHtml(string) { - var entityMap = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - "'": ''', - '/': '/', - '`': '`', - '=': '=' - }; - - return String(string).replace(/[&<>"'`=\/]/g, function (s) { - return entityMap[s]; - }); - } - - $(document).on('click', '[data-fancybox-share]', function() { - var f = $.fancybox.getInstance(), - url, - tpl; - - if ( f ) { - url = f.current.opts.hash === false ? f.current.src : window.location; - tpl = f.current.opts.share.tpl - .replace( /\{\{media\}\}/g, f.current.type === 'image' ? encodeURIComponent( f.current.src ) : '' ) - .replace( /\{\{url\}\}/g, encodeURIComponent( url ) ) - .replace( /\{\{url_raw\}\}/g, escapeHtml( url ) ) - .replace( /\{\{descr\}\}/g, f.$caption ? encodeURIComponent( f.$caption.text() ) : '' ); - - $.fancybox.open({ - src : f.translate( f, tpl ), - type : 'html', - opts : { - animationEffect : "fade", - animationDuration : 250, - afterLoad : function(instance, current) { - // Opening links in a popup window - current.$content.find('.fancybox-share__links a').click(function() { - window.open(this.href, "Share", "width=550, height=450"); - return false; - }); - } - } - }); - } - - }); - -}( document, window.jQuery || jQuery )); - -// ========================================================================== -// -// Hash -// Enables linking to each modal -// -// ========================================================================== -;(function (document, window, $) { - 'use strict'; - - // Simple $.escapeSelector polyfill (for jQuery prior v3) - if ( !$.escapeSelector ) { - $.escapeSelector = function( sel ) { - var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g; - var fcssescape = function( ch, asCodePoint ) { - if ( asCodePoint ) { - // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER - if ( ch === "\0" ) { - return "\uFFFD"; - } - - // Control characters and (dependent upon position) numbers get escaped as code points - return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; - } - - // Other potentially-special ASCII characters get backslash-escaped - return "\\" + ch; - }; - - return ( sel + "" ).replace( rcssescape, fcssescape ); - }; - } - - // Create new history entry only once - var shouldCreateHistory = true; - - // Variable containing last hash value set by fancyBox - // It will be used to determine if fancyBox needs to close after hash change is detected - var currentHash = null; - - // Throttling the history change - var timerID = null; - - // Get info about gallery name and current index from url - function parseUrl() { - var hash = window.location.hash.substr( 1 ); - var rez = hash.split( '-' ); - var index = rez.length > 1 && /^\+?\d+$/.test( rez[ rez.length - 1 ] ) ? parseInt( rez.pop( -1 ), 10 ) || 1 : 1; - var gallery = rez.join( '-' ); - - // Index is starting from 1 - if ( index < 1 ) { - index = 1; - } - - return { - hash : hash, - index : index, - gallery : gallery - }; - } - - // Trigger click evnt on links to open new fancyBox instance - function triggerFromUrl( url ) { - var $el; - - if ( url.gallery !== '' ) { - - // If we can find element matching 'data-fancybox' atribute, then trigger click event for that .. - $el = $( "[data-fancybox='" + $.escapeSelector( url.gallery ) + "']" ).eq( url.index - 1 ); - - if ( !$el.length ) { - // .. if not, try finding element by ID - $el = $( "#" + $.escapeSelector( url.gallery ) + "" ); - } - - if ( $el.length ) { - shouldCreateHistory = false; - - $el.trigger( 'click' ); - } - - } - } - - // Get gallery name from current instance - function getGalleryID( instance ) { - var opts; - - if ( !instance ) { - return false; - } - - opts = instance.current ? instance.current.opts : instance.opts; - - return opts.hash || ( opts.$orig ? opts.$orig.data( 'fancybox' ) : '' ); - } - - // Start when DOM becomes ready - $(function() { - - // Check if user has disabled this module - if ( $.fancybox.defaults.hash === false ) { - return; - } - - // Update hash when opening/closing fancyBox - $(document).on({ - 'onInit.fb' : function( e, instance ) { - var url, gallery; - - if ( instance.group[ instance.currIndex ].opts.hash === false ) { - return; - } - - url = parseUrl(); - gallery = getGalleryID( instance ); - - // Make sure gallery start index matches index from hash - if ( gallery && url.gallery && gallery == url.gallery ) { - instance.currIndex = url.index - 1; - } - }, - - 'beforeShow.fb' : function( e, instance, current ) { - var gallery; - - if ( !current || current.opts.hash === false ) { - return; - } - - gallery = getGalleryID( instance ); - - // Update window hash - if ( gallery && gallery !== '' ) { - - if ( window.location.hash.indexOf( gallery ) < 0 ) { - instance.opts.origHash = window.location.hash; - } - - currentHash = gallery + ( instance.group.length > 1 ? '-' + ( current.index + 1 ) : '' ); - - if ( 'replaceState' in window.history ) { - if ( timerID ) { - clearTimeout( timerID ); - } - - timerID = setTimeout(function() { - window.history[ shouldCreateHistory ? 'pushState' : 'replaceState' ]( {} , document.title, window.location.pathname + window.location.search + '#' + currentHash ); - - timerID = null; - - shouldCreateHistory = false; - - }, 300); - - } else { - window.location.hash = currentHash; - } - - } - - }, - - 'beforeClose.fb' : function( e, instance, current ) { - var gallery, origHash; - - if ( timerID ) { - clearTimeout( timerID ); - } - - if ( current.opts.hash === false ) { - return; - } - - gallery = getGalleryID( instance ); - origHash = instance && instance.opts.origHash ? instance.opts.origHash : ''; - - // Remove hash from location bar - if ( gallery && gallery !== '' ) { - - if ( 'replaceState' in history ) { - window.history.replaceState( {} , document.title, window.location.pathname + window.location.search + origHash ); - - } else { - window.location.hash = origHash; - - // Keep original scroll position - $( window ).scrollTop( instance.scrollTop ).scrollLeft( instance.scrollLeft ); - } - } - - currentHash = null; - } - }); - - // Check if need to close after url has changed - $(window).on('hashchange.fb', function() { - var url = parseUrl(); - - if ( $.fancybox.getInstance() ) { - if ( currentHash && currentHash !== url.gallery + '-' + url.index && !( url.index === 1 && currentHash == url.gallery ) ) { - currentHash = null; - - $.fancybox.close(); - } - - } else if ( url.gallery !== '' ) { - triggerFromUrl( url ); - } - }); - - // Check current hash and trigger click event on matching element to start fancyBox, if needed - setTimeout(function() { - triggerFromUrl( parseUrl() ); - }, 50); - }); - -}( document, window, window.jQuery || jQuery )); - -;(function (document, $) { - 'use strict'; - - var prevTime = new Date().getTime(); - - $(document).on({ - 'onInit.fb' : function( e, instance, current ) { - instance.$refs.stage.on('mousewheel DOMMouseScroll wheel MozMousePixelScroll', function(e) { - var current = instance.current, - currTime = new Date().getTime(); - - if ( instance.group.length < 1 || current.opts.wheel === false || ( current.opts.wheel === 'auto' && current.type !== 'image' ) ) { - return; - } - - e.preventDefault(); - e.stopPropagation(); - - if ( current.$slide.hasClass( 'fancybox-animated' ) ) { - return; - } - - e = e.originalEvent || e; - - if ( currTime - prevTime < 250 ) { - return; - } - - prevTime = currTime; - - instance[ ( -e.deltaY || -e.deltaX || e.wheelDelta || -e.detail ) < 0 ? 'next' : 'previous' ](); - - }); - } - }); - -}( document, window.jQuery || jQuery )); diff --git a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/dist/jquery.fancybox.min.css b/mayan/apps/appearance/static/appearance/vendors/fancybox-master/dist/jquery.fancybox.min.css deleted file mode 100644 index 5d804a59b0..0000000000 --- a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/dist/jquery.fancybox.min.css +++ /dev/null @@ -1 +0,0 @@ -@charset "UTF-8";body.fancybox-active{overflow:hidden}body.fancybox-iosfix{position:fixed;left:0;right:0}.fancybox-is-hidden{position:absolute;top:-9999px;left:-9999px;visibility:hidden}.fancybox-container{position:fixed;top:0;left:0;width:100%;height:100%;z-index:99992;-webkit-tap-highlight-color:transparent;-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-transform:translateZ(0);transform:translateZ(0);font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif}.fancybox-bg,.fancybox-inner,.fancybox-outer,.fancybox-stage{position:absolute;top:0;right:0;bottom:0;left:0}.fancybox-outer{overflow-y:auto;-webkit-overflow-scrolling:touch}.fancybox-bg{background:#1e1e1e;opacity:0;transition-duration:inherit;transition-property:opacity;transition-timing-function:cubic-bezier(.47,0,.74,.71)}.fancybox-is-open .fancybox-bg{opacity:.87;transition-timing-function:cubic-bezier(.22,.61,.36,1)}.fancybox-caption-wrap,.fancybox-infobar,.fancybox-toolbar{position:absolute;direction:ltr;z-index:99997;opacity:0;visibility:hidden;transition:opacity .25s,visibility 0s linear .25s;box-sizing:border-box}.fancybox-show-caption .fancybox-caption-wrap,.fancybox-show-infobar .fancybox-infobar,.fancybox-show-toolbar .fancybox-toolbar{opacity:1;visibility:visible;transition:opacity .25s,visibility 0s}.fancybox-infobar{top:0;left:0;font-size:13px;padding:0 10px;height:44px;min-width:44px;line-height:44px;color:#ccc;text-align:center;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:subpixel-antialiased;mix-blend-mode:exclusion}.fancybox-toolbar{top:0;right:0;margin:0;padding:0}.fancybox-stage{overflow:hidden;direction:ltr;z-index:99994;-webkit-transform:translateZ(0)}.fancybox-is-closing .fancybox-stage{overflow:visible}.fancybox-slide{position:absolute;top:0;left:0;width:100%;height:100%;margin:0;padding:0;overflow:auto;outline:none;white-space:normal;box-sizing:border-box;text-align:center;z-index:99994;-webkit-overflow-scrolling:touch;display:none;-webkit-backface-visibility:hidden;backface-visibility:hidden;transition-property:opacity,-webkit-transform;transition-property:transform,opacity;transition-property:transform,opacity,-webkit-transform}.fancybox-slide:before{content:"";display:inline-block;vertical-align:middle;height:100%;width:0}.fancybox-is-sliding .fancybox-slide,.fancybox-slide--current,.fancybox-slide--next,.fancybox-slide--previous{display:block}.fancybox-slide--image{overflow:visible}.fancybox-slide--image:before{display:none}.fancybox-slide--video .fancybox-content,.fancybox-slide--video iframe{background:#000}.fancybox-slide--map .fancybox-content,.fancybox-slide--map iframe{background:#e5e3df}.fancybox-slide--next{z-index:99995}.fancybox-slide>*{display:inline-block;position:relative;padding:24px;margin:44px 0;border-width:0;vertical-align:middle;text-align:left;background-color:#fff;overflow:auto;box-sizing:border-box}.fancybox-slide>base,.fancybox-slide>link,.fancybox-slide>meta,.fancybox-slide>script,.fancybox-slide>style,.fancybox-slide>title{display:none}.fancybox-slide .fancybox-image-wrap{position:absolute;top:0;left:0;margin:0;padding:0;border:0;z-index:99995;background:transparent;cursor:default;overflow:visible;-webkit-transform-origin:top left;transform-origin:top left;background-size:100% 100%;background-repeat:no-repeat;-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;transition-property:opacity,-webkit-transform;transition-property:transform,opacity;transition-property:transform,opacity,-webkit-transform}.fancybox-can-zoomOut .fancybox-image-wrap{cursor:zoom-out}.fancybox-can-zoomIn .fancybox-image-wrap{cursor:zoom-in}.fancybox-can-drag .fancybox-image-wrap{cursor:-webkit-grab;cursor:grab}.fancybox-is-dragging .fancybox-image-wrap{cursor:-webkit-grabbing;cursor:grabbing}.fancybox-image,.fancybox-spaceball{position:absolute;top:0;left:0;width:100%;height:100%;margin:0;padding:0;border:0;max-width:none;max-height:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.fancybox-spaceball{z-index:1}.fancybox-slide--iframe .fancybox-content{padding:0;width:80%;height:80%;max-width:calc(100% - 100px);max-height:calc(100% - 88px);overflow:visible;background:#fff}.fancybox-iframe{display:block;padding:0;border:0;height:100%}.fancybox-error,.fancybox-iframe{margin:0;width:100%;background:#fff}.fancybox-error{padding:40px;max-width:380px;cursor:default}.fancybox-error p{margin:0;padding:0;color:#444;font-size:16px;line-height:20px}.fancybox-button{box-sizing:border-box;display:inline-block;vertical-align:top;width:44px;height:44px;margin:0;padding:10px;border:0;border-radius:0;background:rgba(30,30,30,.6);transition:color .3s ease;cursor:pointer;outline:none}.fancybox-button,.fancybox-button:link,.fancybox-button:visited{color:#ccc}.fancybox-button:focus,.fancybox-button:hover{color:#fff}.fancybox-button[disabled]{color:#ccc;cursor:default;opacity:.6}.fancybox-button svg{display:block;position:relative;overflow:visible;shape-rendering:geometricPrecision}.fancybox-button svg path{fill:currentColor;stroke:currentColor;stroke-linejoin:round;stroke-width:3}.fancybox-button--share svg path{stroke-width:1}.fancybox-button--pause svg path:nth-child(1),.fancybox-button--play svg path:nth-child(2){display:none}.fancybox-button--zoom svg path{fill:transparent}.fancybox-navigation{display:none}.fancybox-show-nav .fancybox-navigation{display:block}.fancybox-navigation button{position:absolute;top:50%;margin:-50px 0 0;z-index:99997;background:transparent;width:60px;height:100px;padding:17px}.fancybox-navigation button:before{content:"";position:absolute;top:30px;right:10px;width:40px;height:40px;background:rgba(30,30,30,.6)}.fancybox-navigation .fancybox-button--arrow_left{left:0}.fancybox-navigation .fancybox-button--arrow_right{right:0}.fancybox-close-small{position:absolute;top:0;right:0;width:40px;height:40px;padding:0;margin:0;border:0;border-radius:0;background:transparent;z-index:10;cursor:pointer}.fancybox-close-small:after{content:"×";position:absolute;top:5px;right:5px;width:30px;height:30px;font:22px/30px Arial,Helvetica Neue,Helvetica,sans-serif;color:#888;font-weight:300;text-align:center;border-radius:50%;border-width:0;background-color:transparent;transition:background-color .25s;box-sizing:border-box;z-index:2}.fancybox-close-small:focus{outline:none}.fancybox-close-small:focus:after{outline:1px dotted #888}.fancybox-close-small:hover:after{color:#555;background:#eee}.fancybox-slide--iframe .fancybox-close-small,.fancybox-slide--image .fancybox-close-small{top:0;right:-40px}.fancybox-slide--iframe .fancybox-close-small:after,.fancybox-slide--image .fancybox-close-small:after{font-size:35px;color:#aaa}.fancybox-slide--iframe .fancybox-close-small:hover:after,.fancybox-slide--image .fancybox-close-small:hover:after{color:#fff;background:transparent}.fancybox-is-scaling .fancybox-close-small,.fancybox-is-zoomable.fancybox-can-drag .fancybox-close-small{display:none}.fancybox-caption-wrap{bottom:0;left:0;right:0;padding:60px 2vw 0;background:linear-gradient(180deg,transparent 0,rgba(0,0,0,.1) 20%,rgba(0,0,0,.2) 40%,rgba(0,0,0,.6) 80%,rgba(0,0,0,.8));pointer-events:none}.fancybox-caption{padding:30px 0;border-top:1px solid hsla(0,0%,100%,.4);font-size:14px;color:#fff;line-height:20px;-webkit-text-size-adjust:none}.fancybox-caption a,.fancybox-caption button,.fancybox-caption select{pointer-events:all;position:relative}.fancybox-caption a{color:#fff;text-decoration:underline}.fancybox-slide>.fancybox-loading{border:6px solid hsla(0,0%,39%,.4);border-top:6px solid hsla(0,0%,100%,.6);border-radius:100%;height:50px;width:50px;-webkit-animation:a .8s infinite linear;animation:a .8s infinite linear;background:transparent;position:absolute;top:50%;left:50%;margin-top:-30px;margin-left:-30px;z-index:99999}@-webkit-keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.fancybox-animated{transition-timing-function:cubic-bezier(0,0,.25,1)}.fancybox-fx-slide.fancybox-slide--previous{-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0);opacity:0}.fancybox-fx-slide.fancybox-slide--next{-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0);opacity:0}.fancybox-fx-slide.fancybox-slide--current{-webkit-transform:translateZ(0);transform:translateZ(0);opacity:1}.fancybox-fx-fade.fancybox-slide--next,.fancybox-fx-fade.fancybox-slide--previous{opacity:0;transition-timing-function:cubic-bezier(.19,1,.22,1)}.fancybox-fx-fade.fancybox-slide--current{opacity:1}.fancybox-fx-zoom-in-out.fancybox-slide--previous{-webkit-transform:scale3d(1.5,1.5,1.5);transform:scale3d(1.5,1.5,1.5);opacity:0}.fancybox-fx-zoom-in-out.fancybox-slide--next{-webkit-transform:scale3d(.5,.5,.5);transform:scale3d(.5,.5,.5);opacity:0}.fancybox-fx-zoom-in-out.fancybox-slide--current{-webkit-transform:scaleX(1);transform:scaleX(1);opacity:1}.fancybox-fx-rotate.fancybox-slide--previous{-webkit-transform:rotate(-1turn);transform:rotate(-1turn);opacity:0}.fancybox-fx-rotate.fancybox-slide--next{-webkit-transform:rotate(1turn);transform:rotate(1turn);opacity:0}.fancybox-fx-rotate.fancybox-slide--current{-webkit-transform:rotate(0deg);transform:rotate(0deg);opacity:1}.fancybox-fx-circular.fancybox-slide--previous{-webkit-transform:scale3d(0,0,0) translate3d(-100%,0,0);transform:scale3d(0,0,0) translate3d(-100%,0,0);opacity:0}.fancybox-fx-circular.fancybox-slide--next{-webkit-transform:scale3d(0,0,0) translate3d(100%,0,0);transform:scale3d(0,0,0) translate3d(100%,0,0);opacity:0}.fancybox-fx-circular.fancybox-slide--current{-webkit-transform:scaleX(1) translateZ(0);transform:scaleX(1) translateZ(0);opacity:1}.fancybox-fx-tube.fancybox-slide--previous{-webkit-transform:translate3d(-100%,0,0) scale(.1) skew(-10deg);transform:translate3d(-100%,0,0) scale(.1) skew(-10deg)}.fancybox-fx-tube.fancybox-slide--next{-webkit-transform:translate3d(100%,0,0) scale(.1) skew(10deg);transform:translate3d(100%,0,0) scale(.1) skew(10deg)}.fancybox-fx-tube.fancybox-slide--current{-webkit-transform:translateZ(0) scale(1);transform:translateZ(0) scale(1)}.fancybox-share{padding:30px;border-radius:3px;background:#f4f4f4;max-width:90%;text-align:center}.fancybox-share h1{color:#222;margin:0 0 20px;font-size:35px;font-weight:700}.fancybox-share p{margin:0;padding:0}p.fancybox-share__links{margin-right:-10px}.fancybox-share__button{display:inline-block;text-decoration:none;margin:0 10px 10px 0;padding:0 15px;min-width:130px;border:0;border-radius:3px;background:#fff;white-space:nowrap;font-size:14px;font-weight:700;line-height:40px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;color:#fff;transition:all .2s}.fancybox-share__button:hover{text-decoration:none}.fancybox-share__button--fb{background:#3b5998}.fancybox-share__button--fb:hover{background:#344e86}.fancybox-share__button--pt{background:#bd081d}.fancybox-share__button--pt:hover{background:#aa0719}.fancybox-share__button--tw{background:#1da1f2}.fancybox-share__button--tw:hover{background:#0d95e8}.fancybox-share__button svg{position:relative;top:-1px;width:25px;height:25px;margin-right:7px;vertical-align:middle}.fancybox-share__button svg path{fill:#fff}.fancybox-share__input{box-sizing:border-box;width:100%;margin:10px 0 0;padding:10px 15px;background:transparent;color:#5d5b5b;font-size:14px;outline:none;border:0;border-bottom:2px solid #d7d7d7}.fancybox-thumbs{display:none;position:absolute;top:0;bottom:0;right:0;width:212px;margin:0;padding:2px 2px 4px;background:#fff;-webkit-tap-highlight-color:transparent;-webkit-overflow-scrolling:touch;-ms-overflow-style:-ms-autohiding-scrollbar;box-sizing:border-box;z-index:99995}.fancybox-thumbs-x{overflow-y:hidden;overflow-x:auto}.fancybox-show-thumbs .fancybox-thumbs{display:block}.fancybox-show-thumbs .fancybox-inner{right:212px}.fancybox-thumbs>ul{list-style:none;position:absolute;position:relative;width:100%;height:100%;margin:0;padding:0;overflow-x:hidden;overflow-y:auto;font-size:0;white-space:nowrap}.fancybox-thumbs-x>ul{overflow:hidden}.fancybox-thumbs-y>ul::-webkit-scrollbar{width:7px}.fancybox-thumbs-y>ul::-webkit-scrollbar-track{background:#fff;border-radius:10px;box-shadow:inset 0 0 6px rgba(0,0,0,.3)}.fancybox-thumbs-y>ul::-webkit-scrollbar-thumb{background:#2a2a2a;border-radius:10px}.fancybox-thumbs>ul>li{float:left;overflow:hidden;padding:0;margin:2px;width:100px;height:75px;max-width:calc(50% - 4px);max-height:calc(100% - 8px);position:relative;cursor:pointer;outline:none;-webkit-tap-highlight-color:transparent;-webkit-backface-visibility:hidden;backface-visibility:hidden;box-sizing:border-box}li.fancybox-thumbs-loading{background:rgba(0,0,0,.1)}.fancybox-thumbs>ul>li>img{position:absolute;top:0;left:0;max-width:none;max-height:none;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.fancybox-thumbs>ul>li:before{content:"";position:absolute;top:0;right:0;bottom:0;left:0;border:4px solid #4ea7f9;z-index:99991;opacity:0;transition:all .2s cubic-bezier(.25,.46,.45,.94)}.fancybox-thumbs>ul>li.fancybox-thumbs-active:before{opacity:1}@media (max-width:800px){.fancybox-thumbs{width:110px}.fancybox-show-thumbs .fancybox-inner{right:110px}.fancybox-thumbs>ul>li{max-width:calc(100% - 10px)}} \ No newline at end of file diff --git a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/dist/jquery.fancybox.min.js b/mayan/apps/appearance/static/appearance/vendors/fancybox-master/dist/jquery.fancybox.min.js deleted file mode 100644 index 8a0c3e77e1..0000000000 --- a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/dist/jquery.fancybox.min.js +++ /dev/null @@ -1,12 +0,0 @@ -// ================================================== -// fancyBox v3.2.10 -// -// Licensed GPLv3 for open source use -// or fancyBox Commercial License for commercial use -// -// http://fancyapps.com/fancybox/ -// Copyright 2017 fancyApps -// -// ================================================== -!function(t,e,n,o){"use strict";function i(t){var e=n(t.currentTarget),o=t.data?t.data.options:{},i=e.attr("data-fancybox")||"",a=0,s=[];t.isDefaultPrevented()||(t.preventDefault(),i?(s=o.selector?n(o.selector):t.data?t.data.items:[],s=s.length?s.filter('[data-fancybox="'+i+'"]'):n('[data-fancybox="'+i+'"]'),a=s.index(e),a<0&&(a=0)):s=[e],n.fancybox.open(s,o,a))}if(n){if(n.fn.fancybox)return void("console"in t&&console.log("fancyBox already initialized"));var a={loop:!1,margin:[44,0],gutter:50,keyboard:!0,arrows:!0,infobar:!0,toolbar:!0,buttons:["slideShow","fullScreen","thumbs","share","close"],idleTime:3,smallBtn:"auto",protect:!1,modal:!1,image:{preload:"auto"},ajax:{settings:{data:{fancybox:!0}}},iframe:{tpl:'',preload:!0,css:{},attr:{scrolling:"auto"}},defaultType:"image",animationEffect:"zoom",animationDuration:500,zoomOpacity:"auto",transitionEffect:"fade",transitionDuration:366,slideClass:"",baseClass:"",baseTpl:'',spinnerTpl:'
',errorTpl:'

{{ERROR}}

',btnTpl:{download:'',zoom:'',close:'',smallBtn:'',arrowLeft:'',arrowRight:''},parentEl:"body",autoFocus:!1,backFocus:!0,trapFocus:!0,fullScreen:{autoStart:!1},touch:{vertical:!0,momentum:!0},hash:null,media:{},slideShow:{autoStart:!1,speed:4e3},thumbs:{autoStart:!1,hideOnClose:!0,parentEl:".fancybox-container",axis:"y"},wheel:"auto",onInit:n.noop,beforeLoad:n.noop,afterLoad:n.noop,beforeShow:n.noop,afterShow:n.noop,beforeClose:n.noop,afterClose:n.noop,onActivate:n.noop,onDeactivate:n.noop,clickContent:function(t,e){return"image"===t.type&&"zoom"},clickSlide:"close",clickOutside:"close",dblclickContent:!1,dblclickSlide:!1,dblclickOutside:!1,mobile:{idleTime:!1,margin:0,clickContent:function(t,e){return"image"===t.type&&"toggleControls"},clickSlide:function(t,e){return"image"===t.type?"toggleControls":"close"},dblclickContent:function(t,e){return"image"===t.type&&"zoom"},dblclickSlide:function(t,e){return"image"===t.type&&"zoom"}},lang:"en",i18n:{en:{CLOSE:"Close",NEXT:"Next",PREV:"Previous",ERROR:"The requested content cannot be loaded.
Please try again later.",PLAY_START:"Start slideshow",PLAY_STOP:"Pause slideshow",FULL_SCREEN:"Full screen",THUMBS:"Thumbnails",DOWNLOAD:"Download",SHARE:"Share",ZOOM:"Zoom"},de:{CLOSE:"Schliessen",NEXT:"Weiter",PREV:"Zurück",ERROR:"Die angeforderten Daten konnten nicht geladen werden.
Bitte versuchen Sie es später nochmal.",PLAY_START:"Diaschau starten",PLAY_STOP:"Diaschau beenden",FULL_SCREEN:"Vollbild",THUMBS:"Vorschaubilder",DOWNLOAD:"Herunterladen",SHARE:"Teilen",ZOOM:"Maßstab"}}},s=n(t),r=n(e),c=0,l=function(t){return t&&t.hasOwnProperty&&t instanceof n},u=function(){return t.requestAnimationFrame||t.webkitRequestAnimationFrame||t.mozRequestAnimationFrame||t.oRequestAnimationFrame||function(e){return t.setTimeout(e,1e3/60)}}(),d=function(){var t,n=e.createElement("fakeelement"),i={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(t in i)if(n.style[t]!==o)return i[t];return"transitionend"}(),f=function(t){return t&&t.length&&t[0].offsetHeight},p=function(t,o,i){var a=this;a.opts=n.extend(!0,{index:i},n.fancybox.defaults,o||{}),n.fancybox.isMobile&&(a.opts=n.extend(!0,{},a.opts,a.opts.mobile)),o&&n.isArray(o.buttons)&&(a.opts.buttons=o.buttons),a.id=a.opts.id||++c,a.group=[],a.currIndex=parseInt(a.opts.index,10)||0,a.prevIndex=null,a.prevPos=null,a.currPos=0,a.firstRun=null,a.createGroup(t),a.group.length&&(a.$lastFocus=n(e.activeElement).blur(),a.slides={},a.init())};n.extend(p.prototype,{init:function(){var i,a,s,c=this,l=c.group[c.currIndex],u=l.opts,d=n.fancybox.scrollbarWidth;c.scrollTop=r.scrollTop(),c.scrollLeft=r.scrollLeft(),n.fancybox.getInstance()||(n("body").addClass("fancybox-active"),/iPad|iPhone|iPod/.test(navigator.userAgent)&&!t.MSStream?"image"!==l.type&&n("body").css("top",n("body").scrollTop()*-1).addClass("fancybox-iosfix"):!n.fancybox.isMobile&&e.body.scrollHeight>t.innerHeight&&(d===o&&(i=n('
').appendTo("body"),d=n.fancybox.scrollbarWidth=i[0].offsetWidth-i[0].clientWidth,i.remove()),n("head").append('"),n("body").addClass("compensate-for-scrollbar"))),s="",n.each(u.buttons,function(t,e){s+=u.btnTpl[e]||""}),a=n(c.translate(c,u.baseTpl.replace("{{buttons}}",s).replace("{{arrows}}",u.btnTpl.arrowLeft+u.btnTpl.arrowRight))).attr("id","fancybox-container-"+c.id).addClass("fancybox-is-hidden").addClass(u.baseClass).data("FancyBox",c).appendTo(u.parentEl),c.$refs={container:a},["bg","inner","infobar","toolbar","stage","caption","navigation"].forEach(function(t){c.$refs[t]=a.find(".fancybox-"+t)}),c.trigger("onInit"),c.activate(),c.jumpTo(c.currIndex)},translate:function(t,e){var n=t.opts.i18n[t.opts.lang];return e.replace(/\{\{(\w+)\}\}/g,function(t,e){var i=n[e];return i===o?t:i})},createGroup:function(t){var e=this,i=n.makeArray(t);n.each(i,function(t,i){var a,s,r,c,l,u={},d={};n.isPlainObject(i)?(u=i,d=i.opts||i):"object"===n.type(i)&&n(i).length?(a=n(i),d=a.data(),d=n.extend({},d,d.options||{}),d.$orig=a,u.src=d.src||a.attr("href"),u.type||u.src||(u.type="inline",u.src=i)):u={type:"html",src:i+""},u.opts=n.extend(!0,{},e.opts,d),n.isArray(d.buttons)&&(u.opts.buttons=d.buttons),s=u.type||u.opts.type,c=u.src||"",!s&&c&&(c.match(/(^data:image\/[a-z0-9+\/=]*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg|ico)((\?|#).*)?$)/i)?s="image":c.match(/\.(pdf)((\?|#).*)?$/i)?s="pdf":(r=c.match(/\.(mp4|mov|ogv)((\?|#).*)?$/i))?(s="video",u.opts.videoFormat||(u.opts.videoFormat="video/"+("ogv"===r[1]?"ogg":r[1]))):"#"===c.charAt(0)&&(s="inline")),s?u.type=s:e.trigger("objectNeedsType",u),u.index=e.group.length,u.opts.$orig&&!u.opts.$orig.length&&delete u.opts.$orig,!u.opts.$thumb&&u.opts.$orig&&(u.opts.$thumb=u.opts.$orig.find("img:first")),u.opts.$thumb&&!u.opts.$thumb.length&&delete u.opts.$thumb,"function"===n.type(u.opts.caption)&&(u.opts.caption=u.opts.caption.apply(i,[e,u])),"function"===n.type(e.opts.caption)&&(u.opts.caption=e.opts.caption.apply(i,[e,u])),u.opts.caption instanceof n||(u.opts.caption=u.opts.caption===o?"":u.opts.caption+""),"ajax"===s&&(l=c.split(/\s+/,2),l.length>1&&(u.src=l.shift(),u.opts.filter=l.shift())),"auto"==u.opts.smallBtn&&(n.inArray(s,["html","inline","ajax"])>-1?(u.opts.toolbar=!1,u.opts.smallBtn=!0):u.opts.smallBtn=!1),"pdf"===s&&(u.type="iframe",u.opts.iframe.preload=!1),u.opts.modal&&(u.opts=n.extend(!0,u.opts,{infobar:0,toolbar:0,smallBtn:0,keyboard:0,slideShow:0,fullScreen:0,thumbs:0,touch:0,clickContent:!1,clickSlide:!1,clickOutside:!1,dblclickContent:!1,dblclickSlide:!1,dblclickOutside:!1})),e.group.push(u)})},addEvents:function(){var o=this;o.removeEvents(),o.$refs.container.on("click.fb-close","[data-fancybox-close]",function(t){t.stopPropagation(),t.preventDefault(),o.close(t)}).on("click.fb-prev touchend.fb-prev","[data-fancybox-prev]",function(t){t.stopPropagation(),t.preventDefault(),o.previous()}).on("click.fb-next touchend.fb-next","[data-fancybox-next]",function(t){t.stopPropagation(),t.preventDefault(),o.next()}).on("click.fb","[data-fancybox-zoom]",function(t){o[o.isScaledDown()?"scaleToActual":"scaleToFit"]()}),s.on("orientationchange.fb resize.fb",function(t){t&&t.originalEvent&&"resize"===t.originalEvent.type?u(function(){o.update()}):(o.$refs.stage.hide(),setTimeout(function(){o.$refs.stage.show(),o.update()},600))}),r.on("focusin.fb",function(t){var i=n.fancybox?n.fancybox.getInstance():null;i.isClosing||!i.current||!i.current.opts.trapFocus||n(t.target).hasClass("fancybox-container")||n(t.target).is(e)||i&&"fixed"!==n(t.target).css("position")&&!i.$refs.container.has(t.target).length&&(t.stopPropagation(),i.focus(),s.scrollTop(o.scrollTop).scrollLeft(o.scrollLeft))}),r.on("keydown.fb",function(t){var e=o.current,i=t.keyCode||t.which;if(e&&e.opts.keyboard&&!n(t.target).is("input")&&!n(t.target).is("textarea"))return 8===i||27===i?(t.preventDefault(),void o.close(t)):37===i||38===i?(t.preventDefault(),void o.previous()):39===i||40===i?(t.preventDefault(),void o.next()):void o.trigger("afterKeydown",t,i)}),o.group[o.currIndex].opts.idleTime&&(o.idleSecondsCounter=0,r.on("mousemove.fb-idle mouseleave.fb-idle mousedown.fb-idle touchstart.fb-idle touchmove.fb-idle scroll.fb-idle keydown.fb-idle",function(t){o.idleSecondsCounter=0,o.isIdle&&o.showControls(),o.isIdle=!1}),o.idleInterval=t.setInterval(function(){o.idleSecondsCounter++,o.idleSecondsCounter>=o.group[o.currIndex].opts.idleTime&&!o.isDragging&&(o.isIdle=!0,o.idleSecondsCounter=0,o.hideControls())},1e3))},removeEvents:function(){var e=this;s.off("orientationchange.fb resize.fb"),r.off("focusin.fb keydown.fb .fb-idle"),this.$refs.container.off(".fb-close .fb-prev .fb-next"),e.idleInterval&&(t.clearInterval(e.idleInterval),e.idleInterval=null)},previous:function(t){return this.jumpTo(this.currPos-1,t)},next:function(t){return this.jumpTo(this.currPos+1,t)},jumpTo:function(t,e,i){var a,s,r,c,l,u,d,p=this,h=p.group.length;if(!(p.isDragging||p.isClosing||p.isAnimating&&p.firstRun)){if(t=parseInt(t,10),s=p.current?p.current.opts.loop:p.opts.loop,!s&&(t<0||t>=h))return!1;if(a=p.firstRun=null===p.firstRun,!(h<2&&!a&&p.isDragging)){if(c=p.current,p.prevIndex=p.currIndex,p.prevPos=p.currPos,r=p.createSlide(t),h>1&&((s||r.index>0)&&p.createSlide(t-1),(s||r.indexr.pos?"next":"previous"),c.$slide.removeClass("fancybox-slide--complete fancybox-slide--current fancybox-slide--next fancybox-slide--previous"),c.isComplete=!1,e&&(r.isMoved||r.opts.transitionEffect)&&(r.isMoved?c.$slide.addClass(d):(d="fancybox-animated "+d+" fancybox-fx-"+r.opts.transitionEffect,n.fancybox.animate(c.$slide,d,e,function(){c.$slide.removeClass(d).removeAttr("style")}))))}}},createSlide:function(t){var e,o,i=this;return o=t%i.group.length,o=o<0?i.group.length+o:o,!i.slides[t]&&i.group[o]&&(e=n('
').appendTo(i.$refs.stage),i.slides[t]=n.extend(!0,{},i.group[o],{pos:t,$slide:e,isLoaded:!1}),i.updateSlide(i.slides[t])),i.slides[t]},scaleToActual:function(t,e,i){var a,s,r,c,l,u=this,d=u.current,f=d.$content,p=parseInt(d.$slide.width(),10),h=parseInt(d.$slide.height(),10),g=d.width,b=d.height;"image"!=d.type||d.hasError||!f||u.isAnimating||(n.fancybox.stop(f),u.isAnimating=!0,t=t===o?.5*p:t,e=e===o?.5*h:e,a=n.fancybox.getTranslate(f),c=g/a.width,l=b/a.height,s=.5*p-.5*g,r=.5*h-.5*b,g>p&&(s=a.left*c-(t*c-t),s>0&&(s=0),sh&&(r=a.top*l-(e*l-e),r>0&&(r=0),rt.width||o.height>t.height))},isScaledDown:function(){var t=this,e=t.current,o=e.$content,i=!1;return o&&(i=n.fancybox.getTranslate(o),i=i.width1||Math.abs(n.height()-o.height)>1),o},loadSlide:function(t){var e,o,i,a=this;if(!t.isLoading&&!t.isLoaded){switch(t.isLoading=!0,a.trigger("beforeLoad",t),e=t.type,o=t.$slide,o.off("refresh").trigger("onReset").addClass("fancybox-slide--"+(e||"unknown")).addClass(t.opts.slideClass),e){case"image":a.setImage(t);break;case"iframe":a.setIframe(t);break;case"html":a.setContent(t,t.src||t.content);break;case"inline":n(t.src).length?a.setContent(t,n(t.src)):a.setError(t);break;case"ajax":a.showLoading(t),i=n.ajax(n.extend({},t.opts.ajax.settings,{url:t.src,success:function(e,n){"success"===n&&a.setContent(t,e)},error:function(e,n){e&&"abort"!==n&&a.setError(t)}})),o.one("onReset",function(){i.abort()});break;case"video":a.setContent(t,'");break;default:a.setError(t)}return!0}},setImage:function(e){var o,i,a,s,r=this,c=e.opts.srcset||e.opts.image.srcset;if(c){a=t.devicePixelRatio||1,s=t.innerWidth*a,i=c.split(",").map(function(t){var e={};return t.trim().split(/\s+/).forEach(function(t,n){var o=parseInt(t.substring(0,t.length-1),10);return 0===n?e.url=t:void(o&&(e.value=o,e.postfix=t[t.length-1]))}),e}),i.sort(function(t,e){return t.value-e.value});for(var l=0;l=s||"x"===u.postfix&&u.value>=a){o=u;break}}!o&&i.length&&(o=i[i.length-1]),o&&(e.src=o.url,e.width&&e.height&&"w"==o.postfix&&(e.height=e.width/e.height*o.value,e.width=o.value))}e.$content=n('
').addClass("fancybox-is-hidden").appendTo(e.$slide),e.opts.preload!==!1&&e.opts.width&&e.opts.height&&(e.opts.thumb||e.opts.$thumb)?(e.width=e.opts.width,e.height=e.opts.height,e.$ghost=n("").one("error",function(){n(this).remove(),e.$ghost=null,r.setBigImage(e)}).one("load",function(){r.afterLoad(e),r.setBigImage(e)}).addClass("fancybox-image").appendTo(e.$content).attr("src",e.opts.thumb||e.opts.$thumb.attr("src"))):r.setBigImage(e)},setBigImage:function(t){var e=this,o=n("");t.$image=o.one("error",function(){e.setError(t)}).one("load",function(){clearTimeout(t.timouts),t.timouts=null,e.isClosing||(t.width=t.opts.width||this.naturalWidth,t.height=t.opts.height||this.naturalHeight,t.opts.image.srcset&&o.attr("sizes","100vw").attr("srcset",t.opts.image.srcset),e.hideLoading(t),t.$ghost?t.timouts=setTimeout(function(){t.timouts=null,t.$ghost.hide()},Math.min(300,Math.max(1e3,t.height/1600))):e.afterLoad(t))}).addClass("fancybox-image").attr("src",t.src).appendTo(t.$content),(o[0].complete||"complete"==o[0].readyState)&&o[0].naturalWidth&&o[0].naturalHeight?o.trigger("load"):o[0].error?o.trigger("error"):t.timouts=setTimeout(function(){o[0].complete||t.hasError||e.showLoading(t)},100)},setIframe:function(t){var e,i=this,a=t.opts.iframe,s=t.$slide;t.$content=n('
').css(a.css).appendTo(s),e=n(a.tpl.replace(/\{rnd\}/g,(new Date).getTime())).attr(a.attr).appendTo(t.$content),a.preload?(i.showLoading(t),e.on("load.fb error.fb",function(e){this.isReady=1,t.$slide.trigger("refresh"),i.afterLoad(t)}),s.on("refresh.fb",function(){var n,i,s,r=t.$content,c=a.css.width,l=a.css.height;if(1===e[0].isReady){try{i=e.contents(),s=i.find("body")}catch(t){}s&&s.length&&(c===o&&(n=e[0].contentWindow.document.documentElement.scrollWidth,c=Math.ceil(s.outerWidth(!0)+(r.width()-n)),c+=r.outerWidth()-r.innerWidth()),l===o&&(l=Math.ceil(s.outerHeight(!0)),l+=r.outerHeight()-r.innerHeight()),c&&r.width(c),l&&r.height(l)),r.removeClass("fancybox-is-hidden")}})):this.afterLoad(t),e.attr("src",t.src),t.opts.smallBtn===!0&&t.$content.prepend(i.translate(t,t.opts.btnTpl.smallBtn)),s.one("onReset",function(){try{n(this).find("iframe").hide().attr("src","//about:blank")}catch(t){}n(this).empty(),t.isLoaded=!1})},setContent:function(t,e){var o=this;o.isClosing||(o.hideLoading(t),t.$slide.empty(),l(e)&&e.parent().length?(e.parent(".fancybox-slide--inline").trigger("onReset"),t.$placeholder=n("
").hide().insertAfter(e),e.css("display","inline-block")):t.hasError||("string"===n.type(e)&&(e=n("
").append(n.trim(e)).contents(),3===e[0].nodeType&&(e=n("
").html(e))),t.opts.filter&&(e=n("
").html(e).find(t.opts.filter))),t.$slide.one("onReset",function(){n(this).find("video,audio").trigger("pause"),t.$placeholder&&(t.$placeholder.after(e.hide()).remove(),t.$placeholder=null),t.$smallBtn&&(t.$smallBtn.remove(),t.$smallBtn=null),t.hasError||(n(this).empty(),t.isLoaded=!1)}),t.$content=n(e).appendTo(t.$slide),this.afterLoad(t))},setError:function(t){t.hasError=!0,t.$slide.removeClass("fancybox-slide--"+t.type),this.setContent(t,this.translate(t,t.opts.errorTpl))},showLoading:function(t){var e=this;t=t||e.current,t&&!t.$spinner&&(t.$spinner=n(e.opts.spinnerTpl).appendTo(t.$slide))},hideLoading:function(t){var e=this;t=t||e.current,t&&t.$spinner&&(t.$spinner.remove(),delete t.$spinner)},afterLoad:function(t){var e=this;e.isClosing||(t.isLoading=!1,t.isLoaded=!0,e.trigger("afterLoad",t),e.hideLoading(t),t.opts.smallBtn&&!t.$smallBtn&&(t.$smallBtn=n(e.translate(t,t.opts.btnTpl.smallBtn)).appendTo(t.$content.filter("div,form").first())),t.opts.protect&&t.$content&&!t.hasError&&(t.$content.on("contextmenu.fb",function(t){return 2==t.button&&t.preventDefault(),!0}),"image"===t.type&&n('
').appendTo(t.$content)),e.revealContent(t))},revealContent:function(t){var e,i,a,s,r,c=this,l=t.$slide,u=!1;return e=t.opts[c.firstRun?"animationEffect":"transitionEffect"],a=t.opts[c.firstRun?"animationDuration":"transitionDuration"],a=parseInt(t.forcedDuration===o?a:t.forcedDuration,10),!t.isMoved&&t.pos===c.currPos&&a||(e=!1),"zoom"!==e||t.pos===c.currPos&&a&&"image"===t.type&&!t.hasError&&(u=c.getThumbPos(t))||(e="fade"),"zoom"===e?(r=c.getFitPos(t),r.scaleX=r.width/u.width,r.scaleY=r.height/u.height,delete r.width,delete r.height,s=t.opts.zoomOpacity,"auto"==s&&(s=Math.abs(t.width/t.height-u.width/u.height)>.1),s&&(u.opacity=.1,r.opacity=1),n.fancybox.setTranslate(t.$content.removeClass("fancybox-is-hidden"),u),f(t.$content),void n.fancybox.animate(t.$content,r,a,function(){c.complete()})):(c.updateSlide(t),e?(n.fancybox.stop(l),i="fancybox-animated fancybox-slide--"+(t.pos>=c.prevPos?"next":"previous")+" fancybox-fx-"+e,l.removeAttr("style").removeClass("fancybox-slide--current fancybox-slide--next fancybox-slide--previous").addClass(i),t.$content.removeClass("fancybox-is-hidden"),f(l),void n.fancybox.animate(l,"fancybox-slide--current",a,function(e){l.removeClass(i).removeAttr("style"),t.pos===c.currPos&&c.complete()},!0)):(f(l),t.$content.removeClass("fancybox-is-hidden"),void(t.pos===c.currPos&&c.complete())))},getThumbPos:function(o){var i,a=this,s=!1,r=function(e){for(var o,i=e[0],a=i.getBoundingClientRect(),s=[];null!==i.parentElement;)"hidden"!==n(i.parentElement).css("overflow")&&"auto"!==n(i.parentElement).css("overflow")||s.push(i.parentElement.getBoundingClientRect()),i=i.parentElement;return o=s.every(function(t){var e=Math.min(a.right,t.right)-Math.max(a.left,t.left),n=Math.min(a.bottom,t.bottom)-Math.max(a.top,t.top);return e>0&&n>0}),o&&a.bottom>0&&a.right>0&&a.left=t.currPos-1&&o.pos<=t.currPos+1?i[o.pos]=o:o&&(n.fancybox.stop(o.$slide),o.$slide.off().remove())}),t.slides=i,t.updateCursor(),t.trigger("afterShow"),o.$slide.find("video,audio").first().trigger("play"),(n(e.activeElement).is("[disabled]")||o.opts.autoFocus&&"image"!=o.type&&"iframe"!==o.type)&&t.focus())},preload:function(t){var e=this,n=e.slides[e.currPos+1],o=e.slides[e.currPos-1];n&&n.type===t&&e.loadSlide(n),o&&o.type===t&&e.loadSlide(o)},focus:function(){var t,e=this.current;this.isClosing||(e&&e.isComplete&&(t=e.$slide.find("input[autofocus]:enabled:visible:first"),t.length||(t=e.$slide.find("button,:input,[tabindex],a").filter(":enabled:visible:first"))),t=t&&t.length?t:this.$refs.container,t.focus())},activate:function(){var t=this;n(".fancybox-container").each(function(){var e=n(this).data("FancyBox");e&&e.id!==t.id&&!e.isClosing&&(e.trigger("onDeactivate"),e.removeEvents(),e.isVisible=!1)}),t.isVisible=!0,(t.current||t.isIdle)&&(t.update(),t.updateControls()),t.trigger("onActivate"),t.addEvents()},close:function(t,e){var o,i,a,s,r,c,l=this,p=l.current,h=function(){l.cleanUp(t)};return!l.isClosing&&(l.isClosing=!0,l.trigger("beforeClose",t)===!1?(l.isClosing=!1,u(function(){l.update()}),!1):(l.removeEvents(),p.timouts&&clearTimeout(p.timouts),a=p.$content,o=p.opts.animationEffect,i=n.isNumeric(e)?e:o?p.opts.animationDuration:0,p.$slide.off(d).removeClass("fancybox-slide--complete fancybox-slide--next fancybox-slide--previous fancybox-animated"),p.$slide.siblings().trigger("onReset").remove(),i&&l.$refs.container.removeClass("fancybox-is-open").addClass("fancybox-is-closing"),l.hideLoading(p),l.hideControls(),l.updateCursor(),"zoom"!==o||t!==!0&&a&&i&&"image"===p.type&&!p.hasError&&(c=l.getThumbPos(p))||(o="fade"),"zoom"===o?(n.fancybox.stop(a),r=n.fancybox.getTranslate(a),r.width=r.width*r.scaleX,r.height=r.height*r.scaleY,s=p.opts.zoomOpacity,"auto"==s&&(s=Math.abs(p.width/p.height-c.width/c.height)>.1),s&&(c.opacity=0),r.scaleX=r.width/c.width,r.scaleY=r.height/c.height,r.width=c.width,r.height=c.height,n.fancybox.setTranslate(p.$content,r),f(p.$content),n.fancybox.animate(p.$content,c,i,h),!0):(o&&i?t===!0?setTimeout(h,i):n.fancybox.animate(p.$slide.removeClass("fancybox-slide--current"),"fancybox-animated fancybox-slide--previous fancybox-fx-"+o,i,h):h(),!0)))},cleanUp:function(t){var o,i,a=this,r=n("body");a.current.$slide.trigger("onReset"),a.$refs.container.empty().remove(),a.trigger("afterClose",t),a.$lastFocus&&a.current.opts.backFocus&&a.$lastFocus.focus(),a.current=null,o=n.fancybox.getInstance(),o?o.activate():(s.scrollTop(a.scrollTop).scrollLeft(a.scrollLeft),r.removeClass("fancybox-active compensate-for-scrollbar"),r.hasClass("fancybox-iosfix")&&(i=parseInt(e.body.style.top,10),r.removeClass("fancybox-iosfix").css("top","").scrollTop(i*-1)),n("#fancybox-style-noscroll").remove())},trigger:function(t,e){var o,i=Array.prototype.slice.call(arguments,1),a=this,s=e&&e.opts?e:a.current;return s?i.unshift(s):s=a,i.unshift(a),n.isFunction(s.opts[t])&&(o=s.opts[t].apply(s,i)),o===!1?o:void("afterClose"!==t&&a.$refs?a.$refs.container.trigger(t+".fb",i):r.trigger(t+".fb",i))},updateControls:function(t){var e=this,n=e.current,o=n.index,i=n.opts.caption,a=e.$refs.container,s=e.$refs.caption;n.$slide.trigger("refresh"),e.$caption=i&&i.length?s.html(i):null,e.isHiddenControls||e.isIdle||e.showControls(),a.find("[data-fancybox-count]").html(e.group.length),a.find("[data-fancybox-index]").html(o+1),a.find("[data-fancybox-prev]").prop("disabled",!n.opts.loop&&o<=0),a.find("[data-fancybox-next]").prop("disabled",!n.opts.loop&&o>=e.group.length-1),"image"===n.type?a.find("[data-fancybox-download]").attr("href",n.opts.image.src||n.src).show():a.find("[data-fancybox-download],[data-fancybox-zoom]").hide()},hideControls:function(){this.isHiddenControls=!0,this.$refs.container.removeClass("fancybox-show-infobar fancybox-show-toolbar fancybox-show-caption fancybox-show-nav")},showControls:function(){var t=this,e=t.current?t.current.opts:t.opts,n=t.$refs.container;t.isHiddenControls=!1,t.idleSecondsCounter=0,n.toggleClass("fancybox-show-toolbar",!(!e.toolbar||!e.buttons)).toggleClass("fancybox-show-infobar",!!(e.infobar&&t.group.length>1)).toggleClass("fancybox-show-nav",!!(e.arrows&&t.group.length>1)).toggleClass("fancybox-is-modal",!!e.modal),t.$caption?n.addClass("fancybox-show-caption "):n.removeClass("fancybox-show-caption")},toggleControls:function(){this.isHiddenControls?this.showControls():this.hideControls()}}),n.fancybox={version:"3.2.10",defaults:a,getInstance:function(t){var e=n('.fancybox-container:not(".fancybox-is-closing"):last').data("FancyBox"),o=Array.prototype.slice.call(arguments,1);return e instanceof p&&("string"===n.type(t)?e[t].apply(e,o):"function"===n.type(t)&&t.apply(e,o),e)},open:function(t,e,n){return new p(t,e,n)},close:function(t){var e=this.getInstance();e&&(e.close(),t===!0&&this.close())},destroy:function(){this.close(!0),r.off("click.fb-start")},isMobile:e.createTouch!==o&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),use3d:function(){var n=e.createElement("div");return t.getComputedStyle&&t.getComputedStyle(n).getPropertyValue("transform")&&!(e.documentMode&&e.documentMode<11)}(),getTranslate:function(t){var e;if(!t||!t.length)return!1;if(e=t.eq(0).css("transform"),e&&e.indexOf("matrix")!==-1?(e=e.split("(")[1],e=e.split(")")[0],e=e.split(",")):e=[],e.length)e=e.length>10?[e[13],e[12],e[0],e[5]]:[e[5],e[4],e[0],e[3]],e=e.map(parseFloat);else{e=[0,0,1,1];var n=/\.*translate\((.*)px,(.*)px\)/i,o=n.exec(t.eq(0).attr("style"));o&&(e[0]=parseFloat(o[2]),e[1]=parseFloat(o[1]))}return{top:e[0],left:e[1],scaleX:e[2],scaleY:e[3],opacity:parseFloat(t.css("opacity")),width:t.width(),height:t.height()}},setTranslate:function(t,e){var n="",i={};if(t&&e)return e.left===o&&e.top===o||(n=(e.left===o?t.position().left:e.left)+"px, "+(e.top===o?t.position().top:e.top)+"px",n=this.use3d?"translate3d("+n+", 0px)":"translate("+n+")"),e.scaleX!==o&&e.scaleY!==o&&(n=(n.length?n+" ":"")+"scale("+e.scaleX+", "+e.scaleY+")"),n.length&&(i.transform=n),e.opacity!==o&&(i.opacity=e.opacity),e.width!==o&&(i.width=e.width),e.height!==o&&(i.height=e.height),t.css(i)},animate:function(t,e,i,a,s){n.isFunction(i)&&(a=i,i=null),n.isPlainObject(e)||t.removeAttr("style"),t.on(d,function(i){(!i||!i.originalEvent||t.is(i.originalEvent.target)&&"z-index"!=i.originalEvent.propertyName)&&(n.fancybox.stop(t),n.isPlainObject(e)?(e.scaleX!==o&&e.scaleY!==o&&(t.css("transition-duration",""),e.width=Math.round(t.width()*e.scaleX),e.height=Math.round(t.height()*e.scaleY),e.scaleX=1,e.scaleY=1,n.fancybox.setTranslate(t,e)),s===!1&&t.removeAttr("style")):s!==!0&&t.removeClass(e),n.isFunction(a)&&a(i))}),n.isNumeric(i)&&t.css("transition-duration",i+"ms"),n.isPlainObject(e)?n.fancybox.setTranslate(t,e):t.addClass(e),e.scaleX&&t.hasClass("fancybox-image-wrap")&&t.parent().addClass("fancybox-is-scaling"),t.data("timer",setTimeout(function(){t.trigger("transitionend")},i+16))},stop:function(t){clearTimeout(t.data("timer")),t.off("transitionend").css("transition-duration",""),t.hasClass("fancybox-image-wrap")&&t.parent().removeClass("fancybox-is-scaling")}},n.fn.fancybox=function(t){var e;return t=t||{},e=t.selector||!1,e?n("body").off("click.fb-start",e).on("click.fb-start",e,{options:t},i):this.off("click.fb-start").on("click.fb-start",{items:this,options:t},i),this},r.on("click.fb-start","[data-fancybox]",i)}}(window,document,window.jQuery||jQuery),function(t){"use strict";var e=function(e,n,o){if(e)return o=o||"","object"===t.type(o)&&(o=t.param(o,!0)),t.each(n,function(t,n){e=e.replace("$"+t,n||"")}),o.length&&(e+=(e.indexOf("?")>0?"&":"?")+o),e},n={youtube:{matcher:/(youtube\.com|youtu\.be|youtube\-nocookie\.com)\/(watch\?(.*&)?v=|v\/|u\/|embed\/?)?(videoseries\?list=(.*)|[\w-]{11}|\?listType=(.*)&list=(.*))(.*)/i,params:{autoplay:1,autohide:1,fs:1,rel:0,hd:1,wmode:"transparent",enablejsapi:1,html5:1},paramPlace:8,type:"iframe",url:"//www.youtube.com/embed/$4",thumb:"//img.youtube.com/vi/$4/hqdefault.jpg" -},vimeo:{matcher:/^.+vimeo.com\/(.*\/)?([\d]+)(.*)?/,params:{autoplay:1,hd:1,show_title:1,show_byline:1,show_portrait:0,fullscreen:1,api:1},paramPlace:3,type:"iframe",url:"//player.vimeo.com/video/$2"},metacafe:{matcher:/metacafe.com\/watch\/(\d+)\/(.*)?/,type:"iframe",url:"//www.metacafe.com/embed/$1/?ap=1"},dailymotion:{matcher:/dailymotion.com\/video\/(.*)\/?(.*)/,params:{additionalInfos:0,autoStart:1},type:"iframe",url:"//www.dailymotion.com/embed/video/$1"},vine:{matcher:/vine.co\/v\/([a-zA-Z0-9\?\=\-]+)/,type:"iframe",url:"//vine.co/v/$1/embed/simple"},instagram:{matcher:/(instagr\.am|instagram\.com)\/p\/([a-zA-Z0-9_\-]+)\/?/i,type:"image",url:"//$1/p/$2/media/?size=l"},gmap_place:{matcher:/(maps\.)?google\.([a-z]{2,3}(\.[a-z]{2})?)\/(((maps\/(place\/(.*)\/)?\@(.*),(\d+.?\d+?)z))|(\?ll=))(.*)?/i,type:"iframe",url:function(t){return"//maps.google."+t[2]+"/?ll="+(t[9]?t[9]+"&z="+Math.floor(t[10])+(t[12]?t[12].replace(/^\//,"&"):""):t[12])+"&output="+(t[12]&&t[12].indexOf("layer=c")>0?"svembed":"embed")}},gmap_search:{matcher:/(maps\.)?google\.([a-z]{2,3}(\.[a-z]{2})?)\/(maps\/search\/)(.*)/i,type:"iframe",url:function(t){return"//maps.google."+t[2]+"/maps?q="+t[5].replace("query=","q=").replace("api=1","")+"&output=embed"}}};t(document).on("objectNeedsType.fb",function(o,i,a){var s,r,c,l,u,d,f,p=a.src||"",h=!1;s=t.extend(!0,{},n,a.opts.media),t.each(s,function(n,o){if(c=p.match(o.matcher)){if(h=o.type,d={},o.paramPlace&&c[o.paramPlace]){u=c[o.paramPlace],"?"==u[0]&&(u=u.substring(1)),u=u.split("&");for(var i=0;ie.clientHeight,a=("scroll"===o||"auto"===o)&&e.scrollWidth>e.clientWidth;return i||a},l=function(t){for(var e=!1;;){if(e=c(t.get(0)))break;if(t=t.parent(),!t.length||t.hasClass("fancybox-stage")||t.is("body"))break}return e},u=function(t){var e=this;e.instance=t,e.$bg=t.$refs.bg,e.$stage=t.$refs.stage,e.$container=t.$refs.container,e.destroy(),e.$container.on("touchstart.fb.touch mousedown.fb.touch",n.proxy(e,"ontouchstart"))};u.prototype.destroy=function(){this.$container.off(".fb.touch")},u.prototype.ontouchstart=function(o){var i=this,c=n(o.target),u=i.instance,d=u.current,f=d.$content,p="touchstart"==o.type;if(p&&i.$container.off("mousedown.fb.touch"),(!o.originalEvent||2!=o.originalEvent.button)&&c.length&&!r(c)&&!r(c.parent())&&(c.is("img")||!(o.originalEvent.clientX>c[0].clientWidth+c.offset().left))){if(!d||i.instance.isAnimating||i.instance.isClosing)return o.stopPropagation(),void o.preventDefault();if(i.realPoints=i.startPoints=a(o),i.startPoints){if(o.stopPropagation(),i.startEvent=o,i.canTap=!0,i.$target=c,i.$content=f,i.opts=d.opts.touch,i.isPanning=!1,i.isSwiping=!1,i.isZooming=!1,i.isScrolling=!1,i.sliderStartPos=i.sliderLastPos||{top:0,left:0},i.contentStartPos=n.fancybox.getTranslate(i.$content),i.contentLastPos=null,i.startTime=(new Date).getTime(),i.distanceX=i.distanceY=i.distance=0,i.canvasWidth=Math.round(d.$slide[0].clientWidth),i.canvasHeight=Math.round(d.$slide[0].clientHeight),n(e).off(".fb.touch").on(p?"touchend.fb.touch touchcancel.fb.touch":"mouseup.fb.touch mouseleave.fb.touch",n.proxy(i,"ontouchend")).on(p?"touchmove.fb.touch":"mousemove.fb.touch",n.proxy(i,"ontouchmove")),n.fancybox.isMobile&&e.addEventListener("scroll",i.onscroll,!0),!i.opts&&!u.canPan()||!c.is(i.$stage)&&!i.$stage.find(c).length)return void(c.is("img")&&o.preventDefault());n.fancybox.isMobile&&(l(c)||l(c.parent()))||o.preventDefault(),1===i.startPoints.length&&("image"===d.type&&(i.contentStartPos.width>i.canvasWidth+1||i.contentStartPos.height>i.canvasHeight+1)?(n.fancybox.stop(i.$content),i.$content.css("transition-duration",""),i.isPanning=!0):i.isSwiping=!0,i.$container.addClass("fancybox-controls--isGrabbing")),2!==i.startPoints.length||u.isAnimating||d.hasError||"image"!==d.type||!d.isLoaded&&!d.$ghost||(i.canTap=!1,i.isSwiping=!1,i.isPanning=!1,i.isZooming=!0,n.fancybox.stop(i.$content),i.$content.css("transition-duration",""),i.centerPointStartX=.5*(i.startPoints[0].x+i.startPoints[1].x)-n(t).scrollLeft(),i.centerPointStartY=.5*(i.startPoints[0].y+i.startPoints[1].y)-n(t).scrollTop(),i.percentageOfImageAtPinchPointX=(i.centerPointStartX-i.contentStartPos.left)/i.contentStartPos.width,i.percentageOfImageAtPinchPointY=(i.centerPointStartY-i.contentStartPos.top)/i.contentStartPos.height,i.startDistanceBetweenFingers=s(i.startPoints[0],i.startPoints[1]))}}},u.prototype.onscroll=function(t){self.isScrolling=!0},u.prototype.ontouchmove=function(t){var e=this,o=n(t.target);return e.isScrolling||!o.is(e.$stage)&&!e.$stage.find(o).length?void(e.canTap=!1):(e.newPoints=a(t),void((e.opts||e.instance.canPan())&&e.newPoints&&e.newPoints.length&&(e.isSwiping&&e.isSwiping===!0||t.preventDefault(),e.distanceX=s(e.newPoints[0],e.startPoints[0],"x"),e.distanceY=s(e.newPoints[0],e.startPoints[0],"y"),e.distance=s(e.newPoints[0],e.startPoints[0]),e.distance>0&&(e.isSwiping?e.onSwipe(t):e.isPanning?e.onPan():e.isZooming&&e.onZoom()))))},u.prototype.onSwipe=function(e){var a,s=this,r=s.isSwiping,c=s.sliderStartPos.left||0;if(r!==!0)"x"==r&&(s.distanceX>0&&(s.instance.group.length<2||0===s.instance.current.index&&!s.instance.current.opts.loop)?c+=Math.pow(s.distanceX,.8):s.distanceX<0&&(s.instance.group.length<2||s.instance.current.index===s.instance.group.length-1&&!s.instance.current.opts.loop)?c-=Math.pow(-s.distanceX,.8):c+=s.distanceX),s.sliderLastPos={top:"x"==r?0:s.sliderStartPos.top+s.distanceY,left:c},s.requestId&&(i(s.requestId),s.requestId=null),s.requestId=o(function(){s.sliderLastPos&&(n.each(s.instance.slides,function(t,e){var o=e.pos-s.instance.currPos;n.fancybox.setTranslate(e.$slide,{top:s.sliderLastPos.top,left:s.sliderLastPos.left+o*s.canvasWidth+o*e.opts.gutter})}),s.$container.addClass("fancybox-is-sliding"))});else if(Math.abs(s.distance)>10){if(s.canTap=!1,s.instance.group.length<2&&s.opts.vertical?s.isSwiping="y":s.instance.isDragging||s.opts.vertical===!1||"auto"===s.opts.vertical&&n(t).width()>800?s.isSwiping="x":(a=Math.abs(180*Math.atan2(s.distanceY,s.distanceX)/Math.PI),s.isSwiping=a>45&&a<135?"y":"x"),s.canTap=!1,"y"===s.isSwiping&&n.fancybox.isMobile&&(l(s.$target)||l(s.$target.parent())))return void(s.isScrolling=!0);s.instance.isDragging=s.isSwiping,s.startPoints=s.newPoints,n.each(s.instance.slides,function(t,e){n.fancybox.stop(e.$slide),e.$slide.css("transition-duration",""),e.inTransition=!1,e.pos===s.instance.current.pos&&(s.sliderStartPos.left=n.fancybox.getTranslate(e.$slide).left)}),s.instance.SlideShow&&s.instance.SlideShow.isActive&&s.instance.SlideShow.stop()}},u.prototype.onPan=function(){var t=this;return s(t.newPoints[0],t.realPoints[0])<(n.fancybox.isMobile?10:5)?void(t.startPoints=t.newPoints):(t.canTap=!1,t.contentLastPos=t.limitMovement(),t.requestId&&(i(t.requestId),t.requestId=null),void(t.requestId=o(function(){n.fancybox.setTranslate(t.$content,t.contentLastPos)})))},u.prototype.limitMovement=function(){var t,e,n,o,i,a,s=this,r=s.canvasWidth,c=s.canvasHeight,l=s.distanceX,u=s.distanceY,d=s.contentStartPos,f=d.left,p=d.top,h=d.width,g=d.height;return i=h>r?f+l:f,a=p+u,t=Math.max(0,.5*r-.5*h),e=Math.max(0,.5*c-.5*g),n=Math.min(r-h,.5*r-.5*h),o=Math.min(c-g,.5*c-.5*g),h>r&&(l>0&&i>t&&(i=t-1+Math.pow(-t+f+l,.8)||0),l<0&&ic&&(u>0&&a>e&&(a=e-1+Math.pow(-e+p+u,.8)||0),u<0&&aa?(t=t>0?0:t,t=ts?(e=e>0?0:e,e=e50?(n.fancybox.animate(o.instance.current.$slide,{top:o.sliderStartPos.top+o.distanceY+150*o.velocityY,opacity:0},150),i=o.instance.close(!0,300)):"x"==t&&o.distanceX>50&&a>1?i=o.instance.previous(o.speedX):"x"==t&&o.distanceX<-50&&a>1&&(i=o.instance.next(o.speedX)),i!==!1||"x"!=t&&"y"!=t||(e||a<2?o.instance.centerSlide(o.instance.current,150):o.instance.jumpTo(o.instance.current.index)),o.$container.removeClass("fancybox-is-sliding")},u.prototype.endPanning=function(){var t,e,o,i=this;i.contentLastPos&&(i.opts.momentum===!1?(t=i.contentLastPos.left,e=i.contentLastPos.top):(t=i.contentLastPos.left+i.velocityX*i.speed,e=i.contentLastPos.top+i.velocityY*i.speed),o=i.limitPosition(t,e,i.contentStartPos.width,i.contentStartPos.height),o.width=i.contentStartPos.width,o.height=i.contentStartPos.height,n.fancybox.animate(i.$content,o,330))},u.prototype.endZooming=function(){var t,e,o,i,a=this,s=a.instance.current,r=a.newWidth,c=a.newHeight;a.contentLastPos&&(t=a.contentLastPos.left,e=a.contentLastPos.top,i={top:e,left:t,width:r,height:c,scaleX:1,scaleY:1},n.fancybox.setTranslate(a.$content,i),rs.width||c>s.height?a.instance.scaleToActual(a.centerPointStartX,a.centerPointStartY,150):(o=a.limitPosition(t,e,r,c),n.fancybox.setTranslate(a.content,n.fancybox.getTranslate(a.$content)),n.fancybox.animate(a.$content,o,150)))},u.prototype.onTap=function(t){var e,o=this,i=n(t.target),s=o.instance,r=s.current,c=t&&a(t)||o.startPoints,l=c[0]?c[0].x-o.$stage.offset().left:0,u=c[0]?c[0].y-o.$stage.offset().top:0,d=function(e){var i=r.opts[e];if(n.isFunction(i)&&(i=i.apply(s,[r,t])),i)switch(i){case"close":s.close(o.startEvent);break;case"toggleControls":s.toggleControls(!0);break;case"next":s.next();break;case"nextOrClose":s.group.length>1?s.next():s.close(o.startEvent);break;case"zoom":"image"==r.type&&(r.isLoaded||r.$ghost)&&(s.canPan()?s.scaleToFit():s.isScaledDown()?s.scaleToActual(l,u):s.group.length<2&&s.close(o.startEvent))}};if((!t.originalEvent||2!=t.originalEvent.button)&&(i.is("img")||!(l>i[0].clientWidth+i.offset().left))){if(i.is(".fancybox-bg,.fancybox-inner,.fancybox-outer,.fancybox-container"))e="Outside";else if(i.is(".fancybox-slide"))e="Slide";else{if(!s.current.$content||!s.current.$content.find(i).addBack().filter(i).length)return;e="Content"}if(o.tapped){if(clearTimeout(o.tapped),o.tapped=null,Math.abs(l-o.tapX)>50||Math.abs(u-o.tapY)>50)return this;d("dblclick"+e)}else o.tapX=l,o.tapY=u,r.opts["dblclick"+e]&&r.opts["dblclick"+e]!==r.opts["click"+e]?o.tapped=setTimeout(function(){o.tapped=null,d("click"+e)},500):d("click"+e);return this}},n(e).on("onActivate.fb",function(t,e){e&&!e.Guestures&&(e.Guestures=new u(e))})}(window,document,window.jQuery||jQuery),function(t,e){"use strict";e.extend(!0,e.fancybox.defaults,{btnTpl:{slideShow:''},slideShow:{autoStart:!1,speed:3e3}});var n=function(t){this.instance=t,this.init()};e.extend(n.prototype,{timer:null,isActive:!1,$button:null,init:function(){var t=this;t.$button=t.instance.$refs.toolbar.find("[data-fancybox-play]").on("click",function(){t.toggle()}),(t.instance.group.length<2||!t.instance.group[t.instance.currIndex].opts.slideShow)&&t.$button.hide()},set:function(t){var e=this;e.instance&&e.instance.current&&(t===!0||e.instance.current.opts.loop||e.instance.currIndex'},fullScreen:{autoStart:!1}}),e(t).on({"onInit.fb":function(t,e){var n;e&&e.group[e.currIndex].opts.fullScreen?(n=e.$refs.container,n.on("click.fb-fullscreen","[data-fancybox-fullscreen]",function(t){t.stopPropagation(),t.preventDefault(),o.toggle(n[0])}),e.opts.fullScreen&&e.opts.fullScreen.autoStart===!0&&o.request(n[0]),e.FullScreen=o):e&&e.$refs.toolbar.find("[data-fancybox-fullscreen]").hide()},"afterKeydown.fb":function(t,e,n,o,i){e&&e.FullScreen&&70===i&&(o.preventDefault(),e.FullScreen.toggle(e.$refs.container[0]))},"beforeClose.fb":function(t){t&&t.FullScreen&&o.exit()}}),e(t).on(n.fullscreenchange,function(){var t=o.isFullscreen(),n=e.fancybox.getInstance();n&&(n.current&&"image"===n.current.type&&n.isAnimating&&(n.current.$content.css("transition","none"),n.isAnimating=!1,n.update(!0,!0,0)),n.trigger("onFullscreenChange",t),n.$refs.container.toggleClass("fancybox-is-fullscreen",t))})}(document,window.jQuery||jQuery),function(t,e){"use strict";e.fancybox.defaults=e.extend(!0,{btnTpl:{thumbs:''},thumbs:{autoStart:!1,hideOnClose:!0,parentEl:".fancybox-container",axis:"y"}},e.fancybox.defaults);var n=function(t){this.init(t)};e.extend(n.prototype,{$button:null,$grid:null,$list:null,isVisible:!1,isActive:!1,init:function(t){var e=this;e.instance=t,t.Thumbs=e;var n=t.group[0],o=t.group[1];e.opts=t.group[t.currIndex].opts.thumbs,e.$button=t.$refs.toolbar.find("[data-fancybox-thumbs]"),e.opts&&n&&o&&("image"==n.type||n.opts.thumb||n.opts.$thumb)&&("image"==o.type||o.opts.thumb||o.opts.$thumb)?(e.$button.show().on("click",function(){e.toggle()}),e.isActive=!0):e.$button.hide()},create:function(){var t,n,o=this,i=o.instance,a=o.opts.parentEl;o.$grid=e('
').appendTo(i.$refs.container.find(a).addBack().filter(a)),t="
    ",e.each(i.group,function(e,o){n=o.opts.thumb||(o.opts.$thumb?o.opts.$thumb.attr("src"):null),n||"image"!==o.type||(n=o.src),n&&n.length&&(t+='
  • ')}),t+="
",o.$list=e(t).appendTo(o.$grid).on("click","li",function(){i.jumpTo(e(this).data("index"))}),o.$list.find("img").hide().one("load",function(){var t,n,o,i,a=e(this).parent().removeClass("fancybox-thumbs-loading"),s=a.outerWidth(),r=a.outerHeight();t=this.naturalWidth||this.width,n=this.naturalHeight||this.height,o=t/s,i=n/r,o>=1&&i>=1&&(o>i?(t/=i,n=r):(t=s,n/=o)),e(this).css({width:Math.floor(t),height:Math.floor(n),"margin-top":n>r?Math.floor(.3*r-.3*n):Math.floor(.5*r-.5*n),"margin-left":Math.floor(.5*s-.5*t)}).show()}).each(function(){this.src=e(this).data("src")}),"x"===o.opts.axis&&o.$list.width(parseInt(o.$grid.css("padding-right"))+i.group.length*o.$list.children().eq(0).outerWidth(!0)+"px")},focus:function(t){var e,n,o=this,i=o.$list;o.instance.current&&(e=i.children().removeClass("fancybox-thumbs-active").filter('[data-index="'+o.instance.current.index+'"]').addClass("fancybox-thumbs-active"),n=e.position(),"y"===o.opts.axis&&(n.top<0||n.top>i.height()-e.outerHeight())?i.stop().animate({scrollTop:i.scrollTop()+n.top},t):"x"===o.opts.axis&&(n.lefti.parent().scrollLeft()+(i.parent().width()-e.outerWidth()))&&i.parent().stop().animate({scrollLeft:n.left},t))},update:function(){this.instance.$refs.container.toggleClass("fancybox-show-thumbs",this.isVisible),this.isVisible?(this.$grid||this.create(),this.instance.trigger("onThumbsShow"),this.focus(0)):this.$grid&&this.instance.trigger("onThumbsHide"),this.instance.update()},hide:function(){this.isVisible=!1,this.update()},show:function(){this.isVisible=!0,this.update()},toggle:function(){this.isVisible=!this.isVisible,this.update()}}),e(t).on({"onInit.fb":function(t,e){var o;e&&!e.Thumbs&&(o=new n(e),o.isActive&&o.opts.autoStart===!0&&o.show())},"beforeShow.fb":function(t,e,n,o){var i=e&&e.Thumbs;i&&i.isVisible&&i.focus(o?0:250)},"afterKeydown.fb":function(t,e,n,o,i){var a=e&&e.Thumbs;a&&a.isActive&&71===i&&(o.preventDefault(),a.toggle())},"beforeClose.fb":function(t,e){var n=e&&e.Thumbs;n&&n.isVisible&&n.opts.hideOnClose!==!1&&n.$grid.hide()}})}(document,window.jQuery),function(t,e){"use strict";function n(t){var e={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};return String(t).replace(/[&<>"'`=\/]/g,function(t){return e[t]})}e.extend(!0,e.fancybox.defaults,{btnTpl:{share:''},share:{tpl:''}}),e(t).on("click","[data-fancybox-share]",function(){var t,o,i=e.fancybox.getInstance();i&&(t=i.current.opts.hash===!1?i.current.src:window.location,o=i.current.opts.share.tpl.replace(/\{\{media\}\}/g,"image"===i.current.type?encodeURIComponent(i.current.src):"").replace(/\{\{url\}\}/g,encodeURIComponent(t)).replace(/\{\{url_raw\}\}/g,n(t)).replace(/\{\{descr\}\}/g,i.$caption?encodeURIComponent(i.$caption.text()):""),e.fancybox.open({src:i.translate(i,o),type:"html",opts:{animationEffect:"fade",animationDuration:250,afterLoad:function(t,e){e.$content.find(".fancybox-share__links a").click(function(){return window.open(this.href,"Share","width=550, height=450"),!1})}}}))})}(document,window.jQuery||jQuery),function(t,e,n){"use strict";function o(){var t=e.location.hash.substr(1),n=t.split("-"),o=n.length>1&&/^\+?\d+$/.test(n[n.length-1])?parseInt(n.pop(-1),10)||1:1,i=n.join("-");return o<1&&(o=1),{hash:t,index:o,gallery:i}}function i(t){var e;""!==t.gallery&&(e=n("[data-fancybox='"+n.escapeSelector(t.gallery)+"']").eq(t.index-1),e.length||(e=n("#"+n.escapeSelector(t.gallery))),e.length&&(s=!1,e.trigger("click")))}function a(t){var e;return!!t&&(e=t.current?t.current.opts:t.opts,e.hash||(e.$orig?e.$orig.data("fancybox"):""))}n.escapeSelector||(n.escapeSelector=function(t){var e=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g,n=function(t,e){return e?"\0"===t?"�":t.slice(0,-1)+"\\"+t.charCodeAt(t.length-1).toString(16)+" ":"\\"+t};return(t+"").replace(e,n)});var s=!0,r=null,c=null;n(function(){n.fancybox.defaults.hash!==!1&&(n(t).on({"onInit.fb":function(t,e){var n,i;e.group[e.currIndex].opts.hash!==!1&&(n=o(),i=a(e),i&&n.gallery&&i==n.gallery&&(e.currIndex=n.index-1))},"beforeShow.fb":function(n,o,i){var l;i&&i.opts.hash!==!1&&(l=a(o),l&&""!==l&&(e.location.hash.indexOf(l)<0&&(o.opts.origHash=e.location.hash),r=l+(o.group.length>1?"-"+(i.index+1):""),"replaceState"in e.history?(c&&clearTimeout(c),c=setTimeout(function(){e.history[s?"pushState":"replaceState"]({},t.title,e.location.pathname+e.location.search+"#"+r),c=null,s=!1},300)):e.location.hash=r))},"beforeClose.fb":function(o,i,s){var l,u;c&&clearTimeout(c),s.opts.hash!==!1&&(l=a(i),u=i&&i.opts.origHash?i.opts.origHash:"",l&&""!==l&&("replaceState"in history?e.history.replaceState({},t.title,e.location.pathname+e.location.search+u):(e.location.hash=u,n(e).scrollTop(i.scrollTop).scrollLeft(i.scrollLeft))),r=null)}}),n(e).on("hashchange.fb",function(){var t=o();n.fancybox.getInstance()?!r||r===t.gallery+"-"+t.index||1===t.index&&r==t.gallery||(r=null,n.fancybox.close()):""!==t.gallery&&i(t)}),setTimeout(function(){i(o())},50))})}(document,window,window.jQuery||jQuery),function(t,e){"use strict";var n=(new Date).getTime();e(t).on({"onInit.fb":function(t,e,o){e.$refs.stage.on("mousewheel DOMMouseScroll wheel MozMousePixelScroll",function(t){var o=e.current,i=(new Date).getTime();e.group.length<1||o.opts.wheel===!1||"auto"===o.opts.wheel&&"image"!==o.type||(t.preventDefault(),t.stopPropagation(),o.$slide.hasClass("fancybox-animated")||(t=t.originalEvent||t,i-n<250||(n=i,e[(-t.deltaY||-t.deltaX||t.wheelDelta||-t.detail)<0?"next":"previous"]())))})}})}(document,window.jQuery||jQuery); \ No newline at end of file diff --git a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/docs/index.html b/mayan/apps/appearance/static/appearance/vendors/fancybox-master/docs/index.html deleted file mode 100644 index 2fed9f45b6..0000000000 --- a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/docs/index.html +++ /dev/null @@ -1,1909 +0,0 @@ - - - - fancyBox - touch enabled, responsive and fully customizable lightbox script - - - - - - - - - - - - -
-
-

fancyBox3 Documentation

- - -
-
- -
- - - -
- - - -

Introduction

- -

- fancyBox is a JavaScript library used to present images, videos and any html content in an elegant way. - It has all features you would expect - touch enabled, responsive and fully customizable. -

- -

- -

- Dependencies -

- -

- jQuery 3+ is preferred, but fancyBox works with jQuery 1.9.1+ and jQuery 2+ -

- -

Important

- -

- If you experience issues with image zooming, then update jQuery to the latest (at least v3.2.1). -

- -

Compatibility

- -

- fancyBox includes support for touch gestures and even supports pinch gestures for zooming. - It is perfectly suited for both mobile and desktop browsers. -

- -

- fancyBox has been tested in following browsers/devices: -

- -
    -
  • Chrome
  • -
  • Firefox
  • -
  • IE10/11
  • -
  • Edge
  • -
  • iOS Safari
  • -
  • Nexus 7 Chrome
  • -
- -

Setup

- -

- You can install fancyBox by linking .css and .js to your html file. - - Make sure you also load the jQuery library. - Below is a basic HTML template to use as an example: -

- -
<!DOCTYPE html>
-<html>
-<head>
-	<meta charset="utf-8">
-	<title>My page</title>
-
-	<!-- CSS -->
-	<link rel="stylesheet" type="text/css" href="jquery.fancybox.min.css">
-</head>
-<body>
-
-	<!-- Your HTML content goes here -->
-
-	<!-- JS -->
-	<script src="//code.jquery.com/jquery-3.2.1.min.js"></script>
-	<script src="jquery.fancybox.min.js"></script>
-</body>
-</html>
-
- -

Important

- -
    -
  • Make sure you add the jQuery library first
  • -
  • If you already have jQuery on your page, you shouldn't include it second time
  • -
  • Do not include both fancybox.js and fancybox.min.js files
  • -
  • - Some functionality (ajax, iframes, etc) will not work - when you're opening local file directly on your browser, - the code must be running on a web server -
  • -
- -

Download fancyBox

- -

- You can download the latest version of fancyBox on GitHub. -
- Or just link directly to fancyBox files on cdnjs - https://cdnjs.com/libraries/fancybox. -

- - -

Package Managers

- -

- fancyBox can also be installed via Bower or npm. -

- -
# NPM
-npm install @fancyapps/fancybox --save
-
-# Bower
-bower install fancybox --save
-
- - - -

How to Use

- -

Initialize with data attributes

- -

- The most basic way to use fancyBox is by adding the data-fancybox attribute to a link. - A caption can be added using the data-caption attribute. Example: -

- -
<a href="image.jpg" data-fancybox data-caption="My caption">
-	<img src="thumbnail.jpg" alt="" />
-</a>
- -

- View demo on CodePen -

- -

- If you choose this method, default settings will be applied. - See Options section for examples how to customize by changing defaults or using data-options attribute. -

- -

Initialize with JavaScript

- -

- Select elements with a jQuery selector and call the fancybox method: -

- -
<script type="text/javascript">
-	$("[data-fancybox]").fancybox({
-		// Options will go here
-	});
-</script>
- -

- View demo on CodePen -

- -

- Using this method, click event handler is attached only to the currently selected elements. -
- To attach click event listener for elements that exist now or in the future, use selector option. Example: -

- -
$().fancybox({
-  selector : '[data-fancybox="images"]',
-  loop     : true
-});
- -

- View demo on CodePen -

- -

Manual calling of fancyBox

- -

- fancyBox can be activated at any point within Javascript and therefore does not necessarily need a trigger element. - - Example of displaying a simple message: -

- -
$.fancybox.open('<div class="message"><h2>Hello!</h2><p>You are awesome!</p></div>');
- -

- View demo on CodePen -

- -

- See API section for more information and examples. -

- -

Grouping

- -

- If you have a group of items, you can use the same attribute data-fancybox value for each of them to create a gallery. - Each group should have a unique value: -

- -
<a href="image_1.jpg" data-fancybox="group" data-caption="Caption #1">
-	<img src="thumbnail_1.jpg" alt="" />
-</a>
-
-<a href="image_2.jpg" data-fancybox="group" data-caption="Caption #2">
-	<img src="thumbnail_2.jpg" alt="" />
-</a>
-
- -

- View demo on CodePen -

- -

Important

- -

- fancyBox attempts to automatically detect the type of content based on the given url. - - If it cannot be detected, the type can also be set manually using data-type attribute: - -

<a href="images.php?id=123" data-type="image" data-caption="Caption">
-	Show image
-</a>
-

- - - - -

Media types

- - -

Images

- -

- The standard way of using fancyBox is with a number of thumbnail images that link to larger images: -

- -
<a href="image.jpg" data-fancybox="images" data-caption="My caption">
-	<img src="thumbnail.jpg" alt="" />
-</a>
- -

- View demo on CodePen -

- -

- By default, fancyBox fully preloads an image before displaying it. - You can choose to display the image right away. - It will render and show the full size image while the data is being received. - To do so, some attributes are necessary: -

- -
    -
  • data-width - the real width of the image
  • -
  • data-height - the real height of the image
  • -
- -
<a href="image.jpg" data-fancybox="images" data-width="2048" data-height="1365">
-    <img src="thumbnail.jpg" />
-</a>
-

- View demo on CodePen -

- -

- fancyBox supports "scrset" so I can display different images based on viewport width. You can use this to improve download times for mobile users and over time save bandwidth. - Example: -

- -
<a href="medium.jpg" data-fancybox="images" data-srcset="large.jpg 1600w, medium.jpg 1200w, small.jpg 640w">
-	<img src="thumbnail.jpg" />
-</a>
-

- View demo on CodePen -

- -

- It is also possible to protect images from downloading by right-click. - While this does not protect from truly determined users, it should discourage the vast majority from ripping off your files. -

- -
$('[data-fancybox]').fancybox({
-	protect: true
-});
- -

- View demo on CodePen -

- -

Inline HTML

- -

- For inline content, create a hidden element with unique id: -

- -
<div style="display: none;" id="hidden-content">
-	<h2>Hello</h2>
-	<p>You are awesome.</p>
-</div>
- -

- And then simply create a link having data-src attribute that matches ID of the element you want to open (preceded by a hash mark (#); in this example - #hidden-content): -

- -
<a data-fancybox data-src="#hidden-content" href="javascript:;">
-	Trigger the fancyBox
-</a>
-

- View demo on CodePen -

- -

- The script will append small close button (if you have not disabled by smallBtn:false) - and will not apply any styles except for centering. Therefore you can easily set custom dimensions using CSS. -

- -

Ajax

- -

- To load content via AJAX, you need to add a data-type="ajax" attribute to your link: -

- -
<a data-fancybox data-type="ajax" data-src="my_page.com/path/to/ajax/" href="javascript:;">
-	AJAX content
-</a>
-

- View demo on CodePen -

- -

- Additionally it is possible to define a selector with the data-filter attribute to show only a part of the response. The selector can be any string, that is a valid jQuery selector: -

- -
<a data-fancybox data-type="ajax" data-src="my_page.com/path/to/ajax/" data-filter="#two" href="javascript:;">
-	AJAX content
-</a>
-
-

- View demo on CodePen -

- -

Iframe

- -

- If the content can be shown on a page, and placement in an iframe is not blocked by script or security configuration of that page, - it can be presented in a fancyBox: -

- -
<a data-fancybox data-type="iframe" data-src="http://codepen.io/fancyapps/full/jyEGGG/" href="javascript:;">
-	Webpage
-</a>
-
-<a data-fancybox data-type="iframe" data-src="https://mozilla.github.io/pdf.js/web/viewer.html" href="javascript:;">
-	Sample PDF
-</a>
-
-

- View demo on CodePen -

- - -

- To access and control fancyBox in parent window from inside an iframe: -

- -
// Adjust iframe height according to the contents
-parent.jQuery.fancybox.getInstance().update();
-
-// Close current fancyBox instance
-parent.jQuery.fancybox.getInstance().close();
- - -

- Iframe dimensions can be controlled by CSS: -

- -
.fancybox-slide--iframe .fancybox-content {
-	width  : 800px;
-	height : 600px;
-	max-width  : 80%;
-	max-height : 80%;
-	margin: 0;
-}
- - -

- These CSS rules can be overridden by JS, if needed: -

- -
$("[data-fancybox]").fancybox({
-	iframe : {
-		css : {
-			width : '600px'
-		}
-	}
-});
- - -

- If you have not disabled iframe preloading (using preload option), then the script will atempt to - calculate content dimensions and will adjust width/height of iframe to fit with content in it. - Keep in mind, that due to same origin policy, - there are some limitations. -

- -

- This example will disable iframe preloading and will display small close button next to iframe instead of the toolbar: -

- -
$('[data-fancybox]').fancybox({
-	toolbar  : false,
-	smallBtn : true,
-	iframe : {
-		preload : false
-	}
-})
-
-

- View demo on CodePen -

- - - -

Embedding

- -

- Supported sites can be used with fancyBox by just providing the page URL: -

- -
<a data-fancybox href="https://www.youtube.com/watch?v=_sI_Ps7JSEk">
-  YouTube video
-</a>
-
-<a data-fancybox href="https://vimeo.com/191947042">
-  Vimeo video
-</a>
-
-<a data-fancybox href="https://www.google.com/maps/search/Empire+State+Building/">
-	Google Map
-</a>
-
-<a data-fancybox href="https://www.instagram.com/p/BNXYW8-goPI/?taken-by=jamesrelfdyer" data-caption="<span title=&quot;Edited&quot;>balloon rides at dawn ✨🎈<br>was such a magical experience floating over napa valley as the golden light hit the hills.<br><a href=&quot;https://www.instagram.com/jamesrelfdyer/&quot;>@jamesrelfdyer</a></span>">
-	Instagram photo
-</a>
-

- View demo on CodePen -

- -

Video dimensions

- -

- Resize video display with the following CSS: -

- -
.fancybox-slide--video .fancybox-content {
-	width  : 800px;
-	height : 600px;
-	max-width  : 80%;
-	max-height : 80%;
-}
-

- View demo on CodePen -

- -

- Obviously, you can choose any size you like, any combination with min/max values. -
- Aspect ratio lock for videos is not implemented yet, but if you wish, you can use this snippet. -

- - - -

Video parameters

- -

- Controlling a video via URL parameters: -

- -
<a data-fancybox href="https://www.youtube.com/watch?v=_sI_Ps7JSEk&amp;autoplay=1&amp;rel=0&amp;controls=0&amp;showinfo=0">
-  YouTube video - hide controls and info
-</a>
-
-<a data-fancybox href="https://vimeo.com/191947042?color=f00">
-  Vimeo video - custom color
-</a>
-

- View demo on CodePen -

- - -

- Via JavaScript: -

- -
$('[data-fancybox]').fancybox({
-	youtube : {
-		controls : 0,
-		showinfo : 0
-	},
-	vimeo : {
-		color : 'f00'
-	}
-});
-

- View demo on CodePen -

- - -

Options

- -

- Quick reference for all default options as defined in the source: -

- -
var defaults = {
-
-    // Enable infinite gallery navigation
-    loop : false,
-
-    // Space around image, ignored if zoomed-in or viewport width is smaller than 800px
-    margin : [44, 0],
-
-    // Horizontal space between slides
-    gutter : 50,
-
-    // Enable keyboard navigation
-    keyboard : true,
-
-    // Should display navigation arrows at the screen edges
-    arrows : true,
-
-    // Should display infobar (counter and arrows at the top)
-    infobar : true,
-
-    // Should display toolbar (buttons at the top)
-    toolbar : true,
-
-    // What buttons should appear in the top right corner.
-    // Buttons will be created using templates from `btnTpl` option
-    // and they will be placed into toolbar (class="fancybox-toolbar"` element)
-    buttons : [
-        'slideShow',
-        'fullScreen',
-        'thumbs',
-        'share',
-        //'download',
-        //'zoom',
-        'close'
-    ],
-
-    // Detect "idle" time in seconds
-    idleTime : 3,
-
-    // Should display buttons at top right corner of the content
-    // If 'auto' - they will be created for content having type 'html', 'inline' or 'ajax'
-    // Use template from `btnTpl.smallBtn` for customization
-    smallBtn : 'auto',
-
-    // Disable right-click and use simple image protection for images
-    protect : false,
-
-    // Shortcut to make content "modal" - disable keyboard navigtion, hide buttons, etc
-    modal : false,
-
-    image : {
-
-        // Wait for images to load before displaying
-        // Requires predefined image dimensions
-        // If 'auto' - will zoom in thumbnail if 'width' and 'height' attributes are found
-        preload : "auto"
-
-    },
-
-    ajax : {
-
-        // Object containing settings for ajax request
-        settings : {
-
-            // This helps to indicate that request comes from the modal
-            // Feel free to change naming
-            data : {
-                fancybox : true
-            }
-        }
-
-    },
-
-    iframe : {
-
-        // Iframe template
-        tpl : '<iframe id="fancybox-frame{rnd}" name="fancybox-frame{rnd}" class="fancybox-iframe" frameborder="0" vspace="0" hspace="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen allowtransparency="true" src=""></iframe>',
-
-        // Preload iframe before displaying it
-        // This allows to calculate iframe content width and height
-        // (note: Due to "Same Origin Policy", you can't get cross domain data).
-        preload : true,
-
-        // Custom CSS styling for iframe wrapping element
-        // You can use this to set custom iframe dimensions
-        css : {},
-
-        // Iframe tag attributes
-        attr : {
-            scrolling : 'auto'
-        }
-
-    },
-
-    // Default content type if cannot be detected automatically
-    defaultType : 'image',
-
-    // Open/close animation type
-    // Possible values:
-    //   false            - disable
-    //   "zoom"           - zoom images from/to thumbnail
-    //   "fade"
-    //   "zoom-in-out"
-    //
-    animationEffect : "zoom",
-
-    // Duration in ms for open/close animation
-    animationDuration : 500,
-
-    // Should image change opacity while zooming
-    // If opacity is "auto", then opacity will be changed if image and thumbnail have different aspect ratios
-    zoomOpacity : "auto",
-
-    // Transition effect between slides
-    //
-    // Possible values:
-    //   false            - disable
-    //   "fade'
-    //   "slide'
-    //   "circular'
-    //   "tube'
-    //   "zoom-in-out'
-    //   "rotate'
-    //
-    transitionEffect : "fade",
-
-    // Duration in ms for transition animation
-    transitionDuration : 366,
-
-    // Custom CSS class for slide element
-    slideClass : '',
-
-    // Custom CSS class for layout
-    baseClass : '',
-
-    // Base template for layout
-    baseTpl	:
-        '<div class="fancybox-container" role="dialog" tabindex="-1">' +
-            '<div class="fancybox-bg"></div>' +
-            '<div class="fancybox-inner">' +
-                '<div class="fancybox-infobar">' +
-                    '<span data-fancybox-index></span>&nbsp;/&nbsp;<span data-fancybox-count></span>' +
-                '</div>' +
-                '<div class="fancybox-toolbar">{{buttons}}</div>' +
-                '<div class="fancybox-navigation">{{arrows}}</div>' +
-                '<div class="fancybox-stage"></div>' +
-                '<div class="fancybox-caption-wrap"><div class="fancybox-caption"></div></div>' +
-            '</div>' +
-        '</div>',
-
-    // Loading indicator template
-    spinnerTpl : '<div class="fancybox-loading"></div>',
-
-    // Error message template
-    errorTpl : '<div class="fancybox-error"><p>{{ERROR}}<p></div>',
-
-    btnTpl : {
-
-        download : '<a download data-fancybox-download class="fancybox-button fancybox-button--download" title="{{DOWNLOAD}}">' +
-                    '<svg viewBox="0 0 40 40">' +
-                        '<path d="M20,23 L20,8 L20,23 L13,16 L20,23 L27,16 L20,23 M26,28 L13,28 L27,28 L14,28" />' +
-                    '</svg>' +
-                '</a>',
-
-        zoom : '<button data-fancybox-zoom class="fancybox-button fancybox-button--zoom" title="{{ZOOM}}">' +
-                    '<svg viewBox="0 0 40 40">' +
-                        '<path d="M 18,17 m-8,0 a 8,8 0 1,0 16,0 a 8,8 0 1,0 -16,0 M25,23 L31,29 L25,23" />' +
-                    '</svg>' +
-                '</button>',
-
-        close : '<button data-fancybox-close class="fancybox-button fancybox-button--close" title="{{CLOSE}}">' +
-                    '<svg viewBox="0 0 40 40">' +
-                        '<path d="M10,10 L30,30 M30,10 L10,30" />' +
-                    '</svg>' +
-                '</button>',
-
-        // This small close button will be appended to your html/inline/ajax content by default,
-        // if "smallBtn" option is not set to false
-        smallBtn   : '<button data-fancybox-close class="fancybox-close-small" title="{{CLOSE}}"></button>',
-
-        // Arrows
-        arrowLeft : '<button data-fancybox-prev class="fancybox-button fancybox-button--arrow_left" title="{{PREV}}">' +
-                        '<svg viewBox="0 0 40 40">' +
-                          '<path d="M10,20 L30,20 L10,20 L18,28 L10,20 L18,12 L10,20"></path>' +
-                        '</svg>' +
-                      '</button>',
-
-        arrowRight : '<button data-fancybox-next class="fancybox-button fancybox-button--arrow_right" title="{{NEXT}}">' +
-                      '<svg viewBox="0 0 40 40">' +
-                        '<path d="M30,20 L10,20 L30,20 L22,28 L30,20 L22,12 L30,20"></path>' +
-                      '</svg>' +
-                    '</button>'
-    },
-
-    // Container is injected into this element
-    parentEl : 'body',
-
-
-    // Focus handling
-    // ==============
-
-    // Try to focus on the first focusable element after opening
-    autoFocus : false,
-
-    // Put focus back to active element after closing
-    backFocus : true,
-
-    // Do not let user to focus on element outside modal content
-    trapFocus : true,
-
-
-    // Module specific options
-    // =======================
-
-    fullScreen : {
-        autoStart : false,
-    },
-
-    // Set `touch: false` to disable dragging/swiping
-    touch : {
-        vertical : true,  // Allow to drag content vertically
-        momentum : true   // Continue movement after releasing mouse/touch when panning
-    },
-
-    // Hash value when initializing manually,
-    // set `false` to disable hash change
-    hash : null,
-
-    // Customize or add new media types
-    // Example:
-    /*
-    media : {
-        youtube : {
-            params : {
-                autoplay : 0
-            }
-        }
-    }
-    */
-    media : {},
-
-    slideShow : {
-        autoStart : false,
-        speed     : 4000
-    },
-
-    thumbs : {
-        autoStart   : false,                  // Display thumbnails on opening
-        hideOnClose : true,                   // Hide thumbnail grid when closing animation starts
-        parentEl    : '.fancybox-container',  // Container is injected into this element
-        axis        : 'y'                     // Vertical (y) or horizontal (x) scrolling
-    },
-
-    // Use mousewheel to navigate gallery
-    // If 'auto' - enabled for images only
-    wheel : 'auto',
-
-    // Callbacks
-    //==========
-
-    // See Documentation/API/Events for more information
-    // Example:
-    /*
-        afterShow: function( instance, current ) {
-             console.info( 'Clicked element:' );
-             console.info( current.opts.$orig );
-        }
-    */
-
-    onInit       : $.noop,  // When instance has been initialized
-
-    beforeLoad   : $.noop,  // Before the content of a slide is being loaded
-    afterLoad    : $.noop,  // When the content of a slide is done loading
-
-    beforeShow   : $.noop,  // Before open animation starts
-    afterShow    : $.noop,  // When content is done loading and animating
-
-    beforeClose  : $.noop,  // Before the instance attempts to close. Return false to cancel the close.
-    afterClose   : $.noop,  // After instance has been closed
-
-    onActivate   : $.noop,  // When instance is brought to front
-    onDeactivate : $.noop,  // When other instance has been activated
-
-
-    // Interaction
-    // ===========
-
-    // Use options below to customize taken action when user clicks or double clicks on the fancyBox area,
-    // each option can be string or method that returns value.
-    //
-    // Possible values:
-    //   "close"           - close instance
-    //   "next"            - move to next gallery item
-    //   "nextOrClose"     - move to next gallery item or close if gallery has only one item
-    //   "toggleControls"  - show/hide controls
-    //   "zoom"            - zoom image (if loaded)
-    //   false             - do nothing
-
-    // Clicked on the content
-    clickContent : function( current, event ) {
-        return current.type === 'image' ? 'zoom' : false;
-    },
-
-    // Clicked on the slide
-    clickSlide : 'close',
-
-    // Clicked on the background (backdrop) element
-    clickOutside : 'close',
-
-    // Same as previous two, but for double click
-    dblclickContent : false,
-    dblclickSlide   : false,
-    dblclickOutside : false,
-
-
-    // Custom options when mobile device is detected
-    // =============================================
-
-    mobile : {
-        idleTime : false,
-        margin   : 0,
-
-        clickContent : function( current, event ) {
-            return current.type === 'image' ? 'toggleControls' : false;
-        },
-        clickSlide : function( current, event ) {
-            return current.type === 'image' ? 'toggleControls' : 'close';
-        },
-        dblclickContent : function( current, event ) {
-            return current.type === 'image' ? 'zoom' : false;
-        },
-        dblclickSlide : function( current, event ) {
-            return current.type === 'image' ? 'zoom' : false;
-        }
-    },
-
-
-    // Internationalization
-    // ============
-
-    lang : 'en',
-    i18n : {
-        'en' : {
-            CLOSE       : 'Close',
-            NEXT        : 'Next',
-            PREV        : 'Previous',
-            ERROR       : 'The requested content cannot be loaded. <br/> Please try again later.',
-            PLAY_START  : 'Start slideshow',
-            PLAY_STOP   : 'Pause slideshow',
-            FULL_SCREEN : 'Full screen',
-            THUMBS      : 'Thumbnails',
-            DOWNLOAD    : 'Download',
-            SHARE       : 'Share',
-            ZOOM        : 'Zoom'
-        },
-        'de' : {
-            CLOSE       : 'Schliessen',
-            NEXT        : 'Weiter',
-            PREV        : 'Zurück',
-            ERROR       : 'Die angeforderten Daten konnten nicht geladen werden. <br/> Bitte versuchen Sie es später nochmal.',
-            PLAY_START  : 'Diaschau starten',
-            PLAY_STOP   : 'Diaschau beenden',
-            FULL_SCREEN : 'Vollbild',
-            THUMBS      : 'Vorschaubilder',
-            DOWNLOAD    : 'Herunterladen',
-            SHARE       : 'Teilen',
-            ZOOM        : 'Maßstab'
-        }
-    }
-
-};
-
- - -

- Set instance options by passing a valid object to fancybox() method: -

- -
$("[data-fancybox]").fancybox({
-	thumbs : {
-		autoStart : true
-	}
-});
- - -

- Plugin options / defaults are exposed in $.fancybox.defaults namespace so you can easily adjust them globally: - -

- -
$.fancybox.defaults.animationEffect = "fade";
- -

- Custom options for each element individually can be set by adding a data-options - attribute to the element. - - This attribute should contain the properly formatted JSON object: -

- -
<a data-fancybox data-options='{"caption" : "My caption", "src" : "https://codepen.io/about/", "type" : "iframe"}' href="javascript:;" class="btn">
-	Open external page
-</a>
-
-

- View demo on CodePen -

- - - - -

API

- -

- The fancyBox API offers a couple of methods to control fancyBox. - - This gives you the ability to extend the plugin and to integrate it with other web application components. -

- -

Core methods

- -

- Core methods are methods which affect/handle instances: -

- - -
// Close only the currently active or all fancyBox instances
-$.fancybox.close( true );
-
-// Open the fancyBox right away
-$.fancybox.open( items, opts, index );
-
- - -

- Gallery items can be collection of jQuery objects or array containing plain objects. This can be used, for example, to create custom click event. -

- -
var $links = $('.fancybox');
-
-$links.on('click', function() {
-
-	$.fancybox.open( $links, {
-		// Custom options
-	}, $links.index( this ) );
-
-	return false;
-});
- - - - -

- When creating group objects manually, each item should follow this pattern: -

- -
{
-	src  : '' // Source of the content
-	type : '' // Content type: image|inline|ajax|iframe|html (optional)
-	opts : {} // Object containing item options (optional)
-}
-
- - -

- Example of opening image gallery programmatically: -

- -
$.fancybox.open([
-	{
-		src  : '1_b.jpg',
-		opts : {
-			caption : 'First caption'
-		}
-	},
-	{
-		src  : '2_b.jpg',
-		opts : {
-			caption : 'Second caption'
-		}
-	}
-], {
-	loop : false
-});
-

- View demo on CodePen -

- -

- It is also possible to pass only one object. Example of opening inline content: -

- -
$.fancybox.open({
-	src  : '#hidden-content',
-	type : 'inline',
-	opts : {
-		afterShow : function( instance, current ) {
-			console.info( 'done!' );
-		}
-	}
-});
-
-

- View demo on CodePen -

- -

- If you wish to display some html content (for example, a message), then you can use a simpler syntax. - It is advised to use a wrapper around your content. -

- -
$.fancybox.open('<div class="message"><h2>Hello!</h2><p>You are awesome!</p></div>');
-

- View demo on CodePen -

- - - -

Instance methods

- -

- In order to use these methods, you need an instance of the plugin's object. -

- -
var instance = $.fancybox.open(
-	// Your content and options
-);
- -

- Get reference to currently active instance: -

- -
var instance = $.fancybox.getInstance();
- -

- The first argument of the callback is reference to instance: -

- -
$("[data-fancybox]").fancybox({
-	afterShow : function( instance, current ) {
-		console.info( instance );
-	}
-});
-

- Once you have a reference to fancyBox instance the following methods are available: -

- - -
// Go to next gallery item
-instance.next( duration );
-
-// Go to previous gallery item
-instance.previous( duration );
-
-// Switch to selected gallery item
-instance.jumpTo( index, duration );
-
-// Check if current image dimensions are smaller than actual
-instance.isScaledDown();
-
-// Scale image to the actual size of the image
-instance.scaleToActual( x, y, duration );
-
-// Check if image dimensions exceed parent element
-instance.canPan();
-
-// Scale image to fit inside parent element
-instance.scaleToFit( duration );
-
-// Update position and content of all slides
-instance.update();
-
-// Update slide position and scale content to fit
-instance.updateSlide( slide );
-
-// Update infobar values, navigation button states and reveal caption
-instance.updateControls( force );
-
-// Load custom content into the slide
-instance.setContent( slide, content );
-
-// Show loading icon inside the slide
-instance.showLoading( slide );
-
-// Remove loading icon from the slide
-instance.hideLoading( slide );
-
-// Try to find and focus on the first focusable element
-instance.focus();
-
-// Activates current instance, brings it to the front
-instance.activate();
-
-// Close instance
-instance.close();
-
- - -

- You can also do something like this: -

- -
$.fancybox.getInstance().jumpTo(1);
- -

- or simply: -

- -
$.fancybox.getInstance('jumpTo', 1);
- - - - -

Events

- -

- fancyBox fires several events: -

- -
beforeLoad   : Before the content of a slide is being loaded
-afterLoad    : When the content of a slide is done loading
-
-beforeShow   : Before open animation starts
-afterShow    : When content is done loading and animating
-
-beforeClose  : Before the instance attempts to close. Return false to cancel the close.
-afterClose   : After instance has been closed
-
-onInit       : When instance has been initialized
-onActivate   : When instance is brought to front
-onDeactivate : When other instance has been activated
- - -

- Event callbacks can be set as function properties of the options object passed to fancyBox initialization function: -

- -
<script type="text/javascript">
-	$("[data-fancybox]").fancybox({
-		afterShow: function( instance, slide ) {
-
-			// Tip: Each event passes useful information within the event object:
-
-			// Object containing references to interface elements
-			// (background, buttons, caption, etc)
-			// console.info( instance.$refs );
-
-			// Current slide options
-			// console.info( slide.opts );
-
-			// Clicked element
-			// console.info( slide.opts.$orig );
-
-			// Reference to DOM element of the slide
-			// console.info( slide.$slide );
-
-		}
-	});
-</script>
- -

- Each callback receives two parameters - current fancyBox instance and current gallery object, if exists. -

- -

- It is also possible to attach event handler for all instances. - To prevent interfering with other scripts, these events have been namespaced to .fb. - These handlers receive 3 parameters - event, current fancyBox instance and current gallery object. -

-

- Here is an example of binding to the afterShow event: -

- -
$(document).on('afterShow.fb', function( e, instance, slide ) {
-	// Your code goes here
-});
- - -

- If you wish to prevent closing of the modal (for example, after form submit), you can use beforeClose - callback. Simply return false: -

- -
beforeClose : function( instance, current, e ) {
-	if ( $('#my-field').val() == '' ) {
-		return false;
-	}
-}
-
- -

Modules

- -

- fancyBox code is split into several files (modules) that extend core functionality. - You can build your own fancyBox version by excluding unnecessary modules, if needed. - Each one has their own js and/or css files. -

- -

- Some modules can be customized and controlled programmatically. - List of all possible options: -

- -
fullScreen : {
-	autoStart : false,
-},
-
-touch : {
-	vertical : true,  // Allow to drag content vertically
-	momentum : true   // Continuous movement when panning
-},
-
-// Hash value when initializing manually,
-// set `false` to disable hash change
-hash : null,
-
-// Customize or add new media types
-// Example:
-/*
-media : {
-	youtube : {
-		params : {
-			autoplay : 0
-		}
-	}
-}
-*/
-media : {},
-
-slideShow : {
-	autoStart : false,
-	speed     : 4000
-},
-
-thumbs : {
-	autoStart   : false,                  // Display thumbnails on opening
-	hideOnClose : true,                   // Hide thumbnail grid when closing animation starts
-	parentEl    : '.fancybox-container',  // Container is injected into this element
-	axis        : 'y'                     // Vertical (y) or horizontal (x) scrolling
-}
-
-
- -

- Example (show thumbnails on start): -

- -
$('[data-fancybox="images"]').fancybox({
-	thumbs : {
-		autoStart : true
-	}
-})
-

- View demo on CodePen -

- -

- If you would inspect fancyBox instance object, you would find that same keys ar captialized - these are references for each module object. - Also, you would notice that fancyBox uses common naming convention to prefix jQuery objects with $. -

- -

- This is how you, for example, can access thumbnail grid element: -

- -
$.fancybox.getInstance().Thumbs.$grid
- -

- This example shows how to call method that toggles thumbnails: -

- -
$.fancybox.getInstance().Thumbs.toggle();
- -

- List of available methods: -

- -
Thumbs.focus()
-Thumbs.update();
-Thumbs.hide();
-Thumbs.show();
-Thumbs.toggle();
-
-FullScreen.request( elem );
-FullScreen.exit();
-FullScreen.toggle( elem );
-FullScreen.isFullscreen();
-FullScreen.enabled();
-
-SlideShow.start();
-SlideShow.stop();
-SlideShow.toggle();
-
- -

- If you wish to disable hash module, use this snippet (after including JS file): -

- -
$.fancybox.defaults.hash = false;
- - -
- -
- -

FAQ

- -

1. Opening/closing causes fixed element to jump

- -

- Simply add compensate-for-scrollbar CSS class to your fixed positioned elements. - Example of using Bootstrap navbar component: -

- -
<nav class="navbar navbar-inverse navbar-fixed-top compensate-for-scrollbar">
-	<div class="container">
-		..
-	</div>
-</nav>
- -

- View demo on CodePen -

- -

- The script measures width of the scrollbar and creates compensate-for-scrollbar CSS class - that uses this value for margin-right property. - Therefore, if your element has width:100%, you should positon it using left and right properties instead. Example: -

- -
.navbar {
-	position: fixed;
-	top: 0;
-	left: 0;
-	right: 0;
-}
- -

2. How to customize caption

- -

- You can use caption option that accepts a function and is called for each group element. Example of appending image download link: -

- -
$( '[data-fancybox="images"]' ).fancybox({
-    caption : function( instance, item ) {
-        var caption = $(this).data('caption') || '';
-
-        if ( item.type === 'image' ) {
-            caption = (caption.length ? caption + '<br />' : '') + '<a href="' + item.src + '">Download image</a>' ;
-        }
-
-        return caption;
-    }
-});
-

- View demo on CodePen -

- - -

- Add current image index and image count (the total number of images in the gallery) right in the caption: -

- -
$( '[data-fancybox="images"]' ).fancybox({
-    infobar : false,
-    caption : function( instance, item ) {
-        var caption = $(this).data('caption') || '';
-
-        return ( caption.length ? caption + '<br />' : '' ) + 'Image <span data-fancybox-index></span> of <span data-fancybox-count></span>';
-    }
-});
-

- View demo on CodePen -

- - - -

- Inside caption method, this refers to the clicked element. Example of using different source for caption: -

- -
$( '[data-fancybox]' ).fancybox({
-	caption : function( instance, item ) {
-		return $(this).find('figcaption').html();
-	}
-});
-

- View demo on CodePen -

- - -

3. How to create custom button in the toolbar

- -

- Example of creating reusable button: -

- -
// Create template for the button
-$.fancybox.defaults.btnTpl.fb = '<button data-fancybox-fb class="fancybox-button fancybox-button--fb" title="Facebook">' +
-    '<svg viewBox="0 0 24 24">' +
-        '<path d="M22.676 0H1.324C.594 0 0 .593 0 1.324v21.352C0 23.408.593 24 1.324 24h11.494v-9.294h-3.13v-3.62h3.13V8.41c0-3.1 1.894-4.785 4.66-4.785 1.324 0 2.463.097 2.795.14v3.24h-1.92c-1.5 0-1.793.722-1.793 1.772v2.31h3.584l-.465 3.63h-3.12V24h6.115c.733 0 1.325-.592 1.325-1.324V1.324C24 .594 23.408 0 22.676 0"/>' +
-    '</svg>' +
-'</button>';
-
-// Make button clickable using event delegation
-$('body').on('click', '[data-fancybox-fb]', function() {
-  window.open("https://www.facebook.com/sharer/sharer.php?u="+encodeURIComponent(window.location.href)+"&t="+encodeURIComponent(document.title), '','left=0,top=0,width=600,height=300,menubar=no,toolbar=no,resizable=yes,scrollbars=yes');
-});
-
-// Customize buttons
-$( '[data-fancybox="images"]' ).fancybox({
-  buttons : [
-    'fb',
-    'close'
-  ]
-});
- -

- View demo on CodePen -

- -

4. How to reposition thumbnail grid

- -

- There is currenty no JS option to change thumbnail grid position. - But fancyBox is designed so that you can use CSS to change position or dimension for each block - (e.g., content area, caption or thumbnail grid). - This gives you freedom to completely change the look and feel of the modal window, if needed. - - View demo on CodePen -

- -

5. How to disable touch gestures/swiping

- -

- When you want to make your content selectable or clickable, you have two options: -

- -
    -
  • - disable touch gestures completely by setting touch:false -
  • -
  • - add data-selectable="true" attribute to your html element -
  • -
- -

- View demo on CodePen -

- - -
- - -
- - - - - - diff --git a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/gulpfile.js b/mayan/apps/appearance/static/appearance/vendors/fancybox-master/gulpfile.js deleted file mode 100644 index fa900f9fb2..0000000000 --- a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/gulpfile.js +++ /dev/null @@ -1,67 +0,0 @@ -var gulp = require('gulp'), - livereload = require('gulp-livereload'), - concat = require('gulp-concat'), - uglify = require('gulp-uglify'), - rename = require('gulp-rename'), - cssnano = require('gulp-cssnano'), - sass = require('gulp-sass'), - autoprefixer = require('gulp-autoprefixer'), - header = require('gulp-header'), - replace = require('gulp-replace'), - gutil = require('gulp-util'); - -var pkg = require('./package.json'); -var banner = ['// ==================================================', - '// fancyBox v${pkg.version}', - '//', - '// Licensed GPLv3 for open source use', - '// or fancyBox Commercial License for commercial use', - '//', - '// http://fancyapps.com/fancybox/', - '// Copyright ${new Date().getFullYear()} fancyApps', - '//', - '// ==================================================', - ''].join('\n'); - -// Concatenate & Minify JS - -gulp.task('scripts', function() { - return gulp.src([ - 'src/js/core.js', - 'src/js/media.js', - 'src/js/guestures.js', - 'src/js/slideshow.js', - 'src/js/fullscreen.js', - 'src/js/thumbs.js', - 'src/js/hash.js', - 'src/js/wheel.js' - ]) - .pipe(concat('jquery.fancybox.js')) - .pipe(replace(/({fancybox-version})/g, pkg.version)) - .pipe(header(banner, { pkg : pkg } )) - .pipe(gulp.dest('dist')) - .pipe(rename({suffix: '.min'})) - .pipe(uglify()) - .pipe(header(banner, { pkg : pkg } )) - .pipe(gulp.dest('dist')); - }); - - -// Compile CSS - -gulp.task('css', function() { - return gulp.src('src/css/*.css') // Gets all files src/css - .pipe(sass()) - .pipe(autoprefixer({ - browsers: ['last 5 versions'], - cascade: false - })) - .pipe(concat('jquery.fancybox.css')) - .pipe(gulp.dest('dist')) - .pipe(rename({suffix: '.min'})) - .pipe(cssnano({zindex: false})) - .pipe(gulp.dest('dist')); -}); - -// Default Task -gulp.task('default', ['scripts', 'css']); diff --git a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/package.json b/mayan/apps/appearance/static/appearance/vendors/fancybox-master/package.json deleted file mode 100644 index ad8943c175..0000000000 --- a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/package.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "name": "@fancyapps/fancybox", - "description": "Touch enabled, responsive and fully customizable jQuery lightbox script", - "version": "3.2.10", - "homepage": "http://fancyapps.com/fancybox/", - "main": "./dist/jquery.fancybox.js", - "author": "fancyApps", - "license": "GPL-3.0", - "repository": { - "type": "git", - "url": "git+https://github.com/fancyapps/fancybox.git" - }, - "peerDependencies": { - "jquery": ">=1.9.0" - }, - "devDependencies": { - "del": "^2.2.2", - "gulp": "^3.9.1", - "gulp-autoprefixer": "^3.1.1", - "gulp-concat": "^2.6.1", - "gulp-cssnano": "^2.1.2", - "gulp-header": "^1.8.8", - "gulp-jshint": "^2.0.4", - "gulp-livereload": "^3.8.1", - "gulp-notify": "^2.2.0", - "gulp-rename": "^1.2.2", - "gulp-replace": "^0.5.4", - "gulp-sass": "^3.0.0", - "gulp-uglify": "^2.0.0", - "gulp-util": "^3.0.8", - "jshint": "^2.9.4" - }, - "keywords": [ - "touch", - "responsive", - "lightbox", - "fancybox", - "gallery", - "jQuery", - "plugin" - ], - "bugs": { - "url": "https://github.com/fancyapps/fancybox/issues" - }, - "directories": { - "doc": "docs" - }, - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - } -} diff --git a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/src/css/core.css b/mayan/apps/appearance/static/appearance/vendors/fancybox-master/src/css/core.css deleted file mode 100644 index a89c022dbe..0000000000 --- a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/src/css/core.css +++ /dev/null @@ -1,619 +0,0 @@ -body.fancybox-active { - overflow: hidden; -} - -body.fancybox-iosfix { - position: fixed; - left: 0; - right: 0; -} - -.fancybox-is-hidden { - position: absolute; - top: -9999px; - left: -9999px; - visibility: hidden; -} - -.fancybox-container { - position: fixed; - top: 0; - left: 0; - width: 100%; - height: 100%; - z-index: 99992; - -webkit-tap-highlight-color: rgba(0,0,0,0); - backface-visibility: hidden; - transform: translateZ(0); - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; -} - -.fancybox-outer, -.fancybox-inner, -.fancybox-bg, -.fancybox-stage { - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; -} - -.fancybox-outer { - overflow-y: auto; - -webkit-overflow-scrolling: touch; -} - -.fancybox-bg { - background: rgb(30,30,30); - opacity: 0; - transition-duration: inherit; - transition-property: opacity; - transition-timing-function: cubic-bezier(.47,0,.74,.71); -} - -.fancybox-is-open .fancybox-bg { - opacity: 0.87; - transition-timing-function: cubic-bezier(.22,.61,.36,1); -} - -.fancybox-infobar, -.fancybox-toolbar, -.fancybox-caption-wrap { - position: absolute; - direction: ltr; - z-index: 99997; - opacity: 0; - visibility: hidden; - transition: opacity .25s, visibility 0s linear .25s; - box-sizing: border-box; -} - -.fancybox-show-infobar .fancybox-infobar, -.fancybox-show-toolbar .fancybox-toolbar, -.fancybox-show-caption .fancybox-caption-wrap { - opacity: 1; - visibility: visible; - transition: opacity .25s, visibility 0s; -} - -.fancybox-infobar { - top: 0; - left: 0; - font-size: 13px; - padding: 0 10px; - height: 44px; - min-width: 44px; - line-height: 44px; - color: #ccc; - text-align: center; - pointer-events: none; - user-select: none; - -webkit-touch-callout: none; - -webkit-tap-highlight-color: rgba(0,0,0,0); - -webkit-font-smoothing: subpixel-antialiased; - mix-blend-mode: exclusion; -} - -.fancybox-toolbar { - top: 0; - right: 0; - margin: 0; - padding: 0; -} - -.fancybox-stage { - overflow: hidden; - direction: ltr; - z-index: 99994; - -webkit-transform: translate3d(0, 0, 0); -} - -.fancybox-is-closing .fancybox-stage { - overflow: visible; -} - -.fancybox-slide { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - margin: 0; - padding: 0; - overflow: auto; - outline: none; - white-space: normal; - box-sizing: border-box; - text-align: center; - z-index: 99994; - -webkit-overflow-scrolling: touch; - display: none; - backface-visibility: hidden; - transition-property: transform, opacity; -} - -.fancybox-slide::before { - content: ''; - display: inline-block; - vertical-align: middle; - height: 100%; - width: 0; -} - -.fancybox-is-sliding .fancybox-slide, -.fancybox-slide--previous, -.fancybox-slide--current, -.fancybox-slide--next { - display: block; -} - -.fancybox-slide--image { - overflow: visible; -} - -.fancybox-slide--image::before { - display: none; -} - -.fancybox-slide--video .fancybox-content, -.fancybox-slide--video iframe { - background: #000; -} - -.fancybox-slide--map .fancybox-content, -.fancybox-slide--map iframe { - background: #E5E3DF; -} - -.fancybox-slide--next { - z-index: 99995; -} - -.fancybox-slide > * { - display: inline-block; - position: relative; - padding: 24px; - margin: 44px 0 44px; - border-width: 0; - vertical-align: middle; - text-align: left; - background-color: #fff; - overflow: auto; - box-sizing: border-box; -} - -.fancybox-slide > title, -.fancybox-slide > style, -.fancybox-slide > meta, -.fancybox-slide > link, -.fancybox-slide > script, -.fancybox-slide > base { - display: none; -} - -.fancybox-slide .fancybox-image-wrap { - position: absolute; - top: 0; - left: 0; - margin: 0; - padding: 0; - border: 0; - z-index: 99995; - background: transparent; - cursor: default; - overflow: visible; - transform-origin: top left; - background-size: 100% 100%; - background-repeat: no-repeat; - backface-visibility: hidden; - user-select: none; - transition-property: transform, opacity; -} - -.fancybox-can-zoomOut .fancybox-image-wrap { - cursor: zoom-out; -} - -.fancybox-can-zoomIn .fancybox-image-wrap { - cursor: zoom-in; -} - -.fancybox-can-drag .fancybox-image-wrap { - cursor: grab; -} - -.fancybox-is-dragging .fancybox-image-wrap { - cursor: grabbing; -} - -.fancybox-image, -.fancybox-spaceball { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - margin: 0; - padding: 0; - border: 0; - max-width: none; - max-height: none; - user-select: none; -} - - .fancybox-spaceball { - z-index: 1; -} - -.fancybox-slide--iframe .fancybox-content { - padding: 0; - width: 80%; - height: 80%; - max-width: calc(100% - 100px); - max-height: calc(100% - 88px); - overflow: visible; - background: #fff; -} - -.fancybox-iframe { - display: block; - margin: 0; - padding: 0; - border: 0; - width: 100%; - height: 100%; - background: #fff; -} - -.fancybox-error { - margin: 0; - padding: 40px; - width: 100%; - max-width: 380px; - background: #fff; - cursor: default; -} - -.fancybox-error p { - margin: 0; - padding: 0; - color: #444; - font-size: 16px; - line-height: 20px; -} - - -/* Buttons */ - -.fancybox-button { - box-sizing: border-box; - display: inline-block; - vertical-align: top; - width: 44px; - height: 44px; - margin: 0; - padding: 10px; - border: 0; - border-radius: 0; - background: rgba(30,30,30,0.6); - transition: color .3s ease; - cursor: pointer; - outline: none; -} - -.fancybox-button, -.fancybox-button:visited, -.fancybox-button:link { - color: #ccc; -} - -.fancybox-button:focus, -.fancybox-button:hover { - color: #fff; -} - -.fancybox-button[disabled] { - color: #ccc; - cursor: default; - opacity: 0.6; -} - -.fancybox-button svg { - display: block; - position: relative; - overflow: visible; - shape-rendering: geometricPrecision; -} - -.fancybox-button svg path { - fill: currentColor; - stroke: currentColor; - stroke-linejoin: round; - stroke-width: 3; -} - -.fancybox-button--share svg path { - stroke-width: 1; -} - -.fancybox-button--play svg path:nth-child(2) { - display: none; -} - -.fancybox-button--pause svg path:nth-child(1) { - display: none; -} - -.fancybox-button--zoom svg path { - fill: transparent; -} - - -/* Navigation arrows */ - -.fancybox-navigation { - display: none; -} - -.fancybox-show-nav .fancybox-navigation { - display: block; -} - -.fancybox-navigation button { - position: absolute; - top: 50%; - margin: -50px 0 0 0; - z-index: 99997; - background: transparent; - width: 60px; - height: 100px; - padding: 17px; -} - -.fancybox-navigation button:before { - content: ""; - position: absolute; - top: 30px; - right: 10px; - width: 40px; - height: 40px; - background: rgba(30,30,30,0.6); -} - -.fancybox-navigation .fancybox-button--arrow_left { - left: 0; -} - -.fancybox-navigation .fancybox-button--arrow_right { - right: 0; -} - -/* Close button on the top right corner of html content */ - -.fancybox-close-small { - position: absolute; - top: 0; - right: 0; - width: 40px; - height: 40px; - padding: 0; - margin: 0; - border: 0; - border-radius: 0; - background: transparent; - z-index: 10; - cursor: pointer; -} - -.fancybox-close-small:after { - content: '×'; - position: absolute; - top : 5px; - right: 5px; - width: 30px; - height: 30px; - font: 22px/30px Arial,"Helvetica Neue",Helvetica,sans-serif; - color: #888; - font-weight: 300; - text-align: center; - border-radius: 50%; - border-width: 0; - background-color: transparent; - transition: background-color .25s; - box-sizing: border-box; - z-index: 2; -} - -.fancybox-close-small:focus { - outline: none; -} - -.fancybox-close-small:focus:after { - outline: 1px dotted #888; -} - -.fancybox-close-small:hover:after { - color: #555; - background: #eee; -} - -.fancybox-slide--image .fancybox-close-small, -.fancybox-slide--iframe .fancybox-close-small { - top: 0; - right: -40px; -} - -.fancybox-slide--image .fancybox-close-small:after, -.fancybox-slide--iframe .fancybox-close-small:after { - font-size: 35px; - color: #aaa; -} - -.fancybox-slide--image .fancybox-close-small:hover:after, -.fancybox-slide--iframe .fancybox-close-small:hover:after { - color: #fff; - background: transparent; -} - -.fancybox-is-scaling .fancybox-close-small, -.fancybox-is-zoomable.fancybox-can-drag .fancybox-close-small { - display: none; -} - -/* Caption */ - -.fancybox-caption-wrap { - bottom: 0; - left: 0; - right: 0; - padding: 60px 2vw 0 2vw; - background: linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,0.1) 20%, rgba(0,0,0,0.2) 40%,rgba(0,0,0,0.6) 80%, rgba(0,0,0,0.8) 100%); - pointer-events: none; -} - -.fancybox-caption { - padding: 30px 0; - border-top: 1px solid rgba(255,255,255,0.4); - font-size: 14px; - color: #fff; - line-height: 20px; - -webkit-text-size-adjust: none; -} - -.fancybox-caption a, -.fancybox-caption button, -.fancybox-caption select { - pointer-events: all; - position: relative; /* Fix IE11 */ -} - -.fancybox-caption a { - color: #fff; - text-decoration: underline; -} - - -/* Loading indicator */ - -.fancybox-slide > .fancybox-loading { - border: 6px solid rgba(100, 100, 100, .4); - border-top: 6px solid rgba(255, 255, 255, .6); - border-radius: 100%; - height: 50px; - width: 50px; - animation: fancybox-rotate .8s infinite linear; - background: transparent; - position: absolute; - top: 50%; - left: 50%; - margin-top: -30px; - margin-left: -30px; - z-index: 99999; -} - -@keyframes fancybox-rotate { - from { transform: rotate( 0deg ); } - to { transform: rotate( 359deg ); } -} - - -/* Transition effects */ - -.fancybox-animated { - transition-timing-function: cubic-bezier(0, 0, 0.25, 1); -} - -/* transitionEffect: slide */ - -.fancybox-fx-slide.fancybox-slide--previous { - transform: translate3d(-100%, 0, 0); - opacity: 0; -} - -.fancybox-fx-slide.fancybox-slide--next { - transform: translate3d(100%, 0, 0); - opacity: 0; -} - -.fancybox-fx-slide.fancybox-slide--current { - transform: translate3d(0, 0, 0); - opacity: 1; -} - -/* transitionEffect: fade */ - -.fancybox-fx-fade.fancybox-slide--previous, -.fancybox-fx-fade.fancybox-slide--next { - opacity: 0; - transition-timing-function: cubic-bezier(.19,1,.22,1); -} - -.fancybox-fx-fade.fancybox-slide--current { - opacity: 1; -} - -/* transitionEffect: zoom-in-out */ - -.fancybox-fx-zoom-in-out.fancybox-slide--previous { - transform: scale3d(1.5, 1.5, 1.5); - opacity: 0; -} - -.fancybox-fx-zoom-in-out.fancybox-slide--next { - transform: scale3d(0.5, 0.5, 0.5); - opacity: 0; -} - -.fancybox-fx-zoom-in-out.fancybox-slide--current { - transform: scale3d(1, 1, 1); - opacity: 1; -} - -/* transitionEffect: rotate */ - -.fancybox-fx-rotate.fancybox-slide--previous { - transform: rotate(-360deg); - opacity: 0; -} - -.fancybox-fx-rotate.fancybox-slide--next { - transform: rotate(360deg); - opacity: 0; -} - -.fancybox-fx-rotate.fancybox-slide--current { - transform: rotate(0deg); - opacity: 1; -} - -/* transitionEffect: circular */ - -.fancybox-fx-circular.fancybox-slide--previous { - transform: scale3d(0, 0, 0) translate3d(-100%, 0, 0); - opacity: 0; -} - -.fancybox-fx-circular.fancybox-slide--next { - transform: scale3d(0, 0, 0) translate3d(100%, 0, 0); - opacity: 0; -} - -.fancybox-fx-circular.fancybox-slide--current { - transform: scale3d(1, 1, 1) translate3d(0, 0, 0); - opacity: 1; -} - -/* transitionEffect: tube */ - -.fancybox-fx-tube.fancybox-slide--previous { - transform: translate3d(-100%, 0, 0) scale(0.1) skew(-10deg); -} - -.fancybox-fx-tube.fancybox-slide--next { - transform: translate3d(100%, 0, 0) scale(0.1) skew(10deg); -} - -.fancybox-fx-tube.fancybox-slide--current { - transform: translate3d(0, 0, 0) scale(1); -} diff --git a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/src/css/fullscreen.css b/mayan/apps/appearance/static/appearance/vendors/fancybox-master/src/css/fullscreen.css deleted file mode 100644 index a4bd316f31..0000000000 --- a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/src/css/fullscreen.css +++ /dev/null @@ -1,11 +0,0 @@ - -/* Fullscreen */ - -.fancybox-button--fullscreen::before { - width: 15px; - height: 11px; - left: calc(50% - 7px); - top: calc(50% - 6px); - border: 2px solid; - background: none; -} diff --git a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/src/css/share.css b/mayan/apps/appearance/static/appearance/vendors/fancybox-master/src/css/share.css deleted file mode 100644 index 6a87afa811..0000000000 --- a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/src/css/share.css +++ /dev/null @@ -1,97 +0,0 @@ -/* Share */ - -.fancybox-share { - padding: 30px; - border-radius: 3px; - background: #f4f4f4; - max-width: 90%; - text-align: center; -} - -.fancybox-share h1 { - color: #222; - margin: 0 0 20px 0; - font-size: 35px; - font-weight: 700; -} - -.fancybox-share p { - margin: 0; - padding: 0; -} - -p.fancybox-share__links { - margin-right: -10px; -} - -.fancybox-share__button { - display: inline-block; - text-decoration: none; - margin: 0 10px 10px 0; - padding: 0 15px; - min-width: 130px; - border: 0; - border-radius: 3px; - background: #fff; - white-space: nowrap; - font-size: 14px; - font-weight: 700; - line-height: 40px; - user-select: none; - color: #fff; - transition: all .2s; -} - -.fancybox-share__button:hover { - text-decoration: none; -} - -.fancybox-share__button--fb { - background: #3b5998; -} - -.fancybox-share__button--fb:hover { - background: #344e86; -} - -.fancybox-share__button--pt { - background: #bd081d; -} - -.fancybox-share__button--pt:hover { - background: #aa0719; -} - -.fancybox-share__button--tw { - background: #1da1f2; -} - -.fancybox-share__button--tw:hover { - background: #0d95e8; -} - -.fancybox-share__button svg { - position: relative; - top: -1px; - width: 25px; - height: 25px; - margin-right: 7px; - vertical-align: middle; -} - -.fancybox-share__button svg path { - fill: #fff; -} - -.fancybox-share__input { - box-sizing: border-box; - width: 100%; - margin: 10px 0 0 0; - padding: 10px 15px; - background: transparent; - color: #5d5b5b; - font-size: 14px; - outline: none; - border: 0; - border-bottom: 2px solid #d7d7d7; -} diff --git a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/src/css/slideshow.css b/mayan/apps/appearance/static/appearance/vendors/fancybox-master/src/css/slideshow.css deleted file mode 100644 index b663619bb3..0000000000 --- a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/src/css/slideshow.css +++ /dev/null @@ -1,26 +0,0 @@ -/* Slideshow button */ - -.fancybox-button--play {} - -.fancybox-button--play::before, -.fancybox-button--pause::before { - top: calc(50% - 6px); - left: calc(50% - 4px); - background: transparent; -} - -.fancybox-button--play::before { - width: 0; - height: 0; - border-top: 6px inset transparent; - border-bottom: 6px inset transparent; - border-left: 10px solid; - border-radius: 1px; -} - -.fancybox-button--pause::before { - width: 7px; - height: 11px; - border-style: solid; - border-width: 0 2px 0 2px; -} diff --git a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/src/css/thumbs.css b/mayan/apps/appearance/static/appearance/vendors/fancybox-master/src/css/thumbs.css deleted file mode 100644 index 23386240ae..0000000000 --- a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/src/css/thumbs.css +++ /dev/null @@ -1,128 +0,0 @@ - -/* Thumbs */ - -.fancybox-thumbs { - display: none; - position: absolute; - top: 0; - bottom: 0; - right: 0; - width: 212px; - margin: 0; - padding: 2px 2px 4px 2px; - background: #fff; - -webkit-tap-highlight-color: rgba(0,0,0,0); - -webkit-overflow-scrolling: touch; - -ms-overflow-style: -ms-autohiding-scrollbar; - box-sizing: border-box; - z-index: 99995; -} - -.fancybox-thumbs-x { - overflow-y: hidden; - overflow-x: auto; -} - -.fancybox-show-thumbs .fancybox-thumbs { - display: block; -} - -.fancybox-show-thumbs .fancybox-inner { - right: 212px; -} - -.fancybox-thumbs > ul { - list-style: none; - position: absolute; - position: relative; - width: 100%; - height: 100%; - margin: 0; - padding: 0; - overflow-x: hidden; - overflow-y: auto; - font-size: 0; - white-space: nowrap; -} - -.fancybox-thumbs-x > ul { - overflow : hidden; -} - -.fancybox-thumbs-y > ul::-webkit-scrollbar { - width: 7px; -} - -.fancybox-thumbs-y > ul::-webkit-scrollbar-track { - background: #fff; - border-radius: 10px; - box-shadow: inset 0 0 6px rgba(0,0,0,0.3); -} - -.fancybox-thumbs-y > ul::-webkit-scrollbar-thumb { - background: #2a2a2a; - border-radius: 10px; -} - -.fancybox-thumbs > ul > li { - float: left; - overflow: hidden; - padding: 0; - margin: 2px; - width: 100px; - height: 75px; - max-width: calc(50% - 4px); - max-height: calc(100% - 8px); - position: relative; - cursor: pointer; - outline: none; - -webkit-tap-highlight-color: transparent; - backface-visibility: hidden; - box-sizing: border-box; -} - -li.fancybox-thumbs-loading { - background: rgba(0,0,0,0.1); -} - -.fancybox-thumbs > ul > li > img { - position: absolute; - top: 0; - left: 0; - max-width: none; - max-height: none; - -webkit-touch-callout: none; - user-select: none; -} - -.fancybox-thumbs > ul > li:before { - content: ''; - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - border: 4px solid #4ea7f9; - z-index: 99991; - opacity: 0; - transition: all 0.2s cubic-bezier(.25,.46,.45,.94); -} - -.fancybox-thumbs > ul > li.fancybox-thumbs-active:before { - opacity: 1; -} - -/* Styling for Small-Screen Devices */ -@media all and (max-width: 800px) { - .fancybox-thumbs { - width: 110px; - } - - .fancybox-show-thumbs .fancybox-inner { - right: 110px; - } - - .fancybox-thumbs > ul > li { - max-width: calc(100% - 10px); - } -} diff --git a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/src/js/core.js b/mayan/apps/appearance/static/appearance/vendors/fancybox-master/src/js/core.js deleted file mode 100644 index 712b814c7f..0000000000 --- a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/src/js/core.js +++ /dev/null @@ -1,3097 +0,0 @@ -;(function (window, document, $, undefined) { - 'use strict'; - - // If there's no jQuery, fancyBox can't work - // ========================================= - - if ( !$ ) { - return; - } - - // Check if fancyBox is already initialized - // ======================================== - - if ( $.fn.fancybox ) { - - if ( 'console' in window ) { - console.log( 'fancyBox already initialized' ); - } - - return; - } - - // Private default settings - // ======================== - - var defaults = { - - // Enable infinite gallery navigation - loop : false, - - // Space around image, ignored if zoomed-in or viewport width is smaller than 800px - margin : [44, 0], - - // Horizontal space between slides - gutter : 50, - - // Enable keyboard navigation - keyboard : true, - - // Should display navigation arrows at the screen edges - arrows : true, - - // Should display infobar (counter and arrows at the top) - infobar : true, - - // Should display toolbar (buttons at the top) - toolbar : true, - - // What buttons should appear in the top right corner. - // Buttons will be created using templates from `btnTpl` option - // and they will be placed into toolbar (class="fancybox-toolbar"` element) - buttons : [ - 'slideShow', - 'fullScreen', - 'thumbs', - 'share', - //'download', - //'zoom', - 'close' - ], - - // Detect "idle" time in seconds - idleTime : 3, - - // Should display buttons at top right corner of the content - // If 'auto' - they will be created for content having type 'html', 'inline' or 'ajax' - // Use template from `btnTpl.smallBtn` for customization - smallBtn : 'auto', - - // Disable right-click and use simple image protection for images - protect : false, - - // Shortcut to make content "modal" - disable keyboard navigtion, hide buttons, etc - modal : false, - - image : { - - // Wait for images to load before displaying - // Requires predefined image dimensions - // If 'auto' - will zoom in thumbnail if 'width' and 'height' attributes are found - preload : "auto" - - }, - - ajax : { - - // Object containing settings for ajax request - settings : { - - // This helps to indicate that request comes from the modal - // Feel free to change naming - data : { - fancybox : true - } - } - - }, - - iframe : { - - // Iframe template - tpl : '', - - // Preload iframe before displaying it - // This allows to calculate iframe content width and height - // (note: Due to "Same Origin Policy", you can't get cross domain data). - preload : true, - - // Custom CSS styling for iframe wrapping element - // You can use this to set custom iframe dimensions - css : {}, - - // Iframe tag attributes - attr : { - scrolling : 'auto' - } - - }, - - // Default content type if cannot be detected automatically - defaultType : 'image', - - // Open/close animation type - // Possible values: - // false - disable - // "zoom" - zoom images from/to thumbnail - // "fade" - // "zoom-in-out" - // - animationEffect : "zoom", - - // Duration in ms for open/close animation - animationDuration : 500, - - // Should image change opacity while zooming - // If opacity is "auto", then opacity will be changed if image and thumbnail have different aspect ratios - zoomOpacity : "auto", - - // Transition effect between slides - // - // Possible values: - // false - disable - // "fade' - // "slide' - // "circular' - // "tube' - // "zoom-in-out' - // "rotate' - // - transitionEffect : "fade", - - // Duration in ms for transition animation - transitionDuration : 366, - - // Custom CSS class for slide element - slideClass : '', - - // Custom CSS class for layout - baseClass : '', - - // Base template for layout - baseTpl : - '', - - // Loading indicator template - spinnerTpl : '
', - - // Error message template - errorTpl : '

{{ERROR}}

', - - btnTpl : { - - download : '' + - '' + - '' + - '' + - '', - - zoom : '', - - close : '', - - // This small close button will be appended to your html/inline/ajax content by default, - // if "smallBtn" option is not set to false - smallBtn : '', - - // Arrows - arrowLeft : '', - - arrowRight : '' - }, - - // Container is injected into this element - parentEl : 'body', - - - // Focus handling - // ============== - - // Try to focus on the first focusable element after opening - autoFocus : false, - - // Put focus back to active element after closing - backFocus : true, - - // Do not let user to focus on element outside modal content - trapFocus : true, - - - // Module specific options - // ======================= - - fullScreen : { - autoStart : false, - }, - - // Set `touch: false` to disable dragging/swiping - touch : { - vertical : true, // Allow to drag content vertically - momentum : true // Continue movement after releasing mouse/touch when panning - }, - - // Hash value when initializing manually, - // set `false` to disable hash change - hash : null, - - // Customize or add new media types - // Example: - /* - media : { - youtube : { - params : { - autoplay : 0 - } - } - } - */ - media : {}, - - slideShow : { - autoStart : false, - speed : 4000 - }, - - thumbs : { - autoStart : false, // Display thumbnails on opening - hideOnClose : true, // Hide thumbnail grid when closing animation starts - parentEl : '.fancybox-container', // Container is injected into this element - axis : 'y' // Vertical (y) or horizontal (x) scrolling - }, - - // Use mousewheel to navigate gallery - // If 'auto' - enabled for images only - wheel : 'auto', - - // Callbacks - //========== - - // See Documentation/API/Events for more information - // Example: - /* - afterShow: function( instance, current ) { - console.info( 'Clicked element:' ); - console.info( current.opts.$orig ); - } - */ - - onInit : $.noop, // When instance has been initialized - - beforeLoad : $.noop, // Before the content of a slide is being loaded - afterLoad : $.noop, // When the content of a slide is done loading - - beforeShow : $.noop, // Before open animation starts - afterShow : $.noop, // When content is done loading and animating - - beforeClose : $.noop, // Before the instance attempts to close. Return false to cancel the close. - afterClose : $.noop, // After instance has been closed - - onActivate : $.noop, // When instance is brought to front - onDeactivate : $.noop, // When other instance has been activated - - - // Interaction - // =========== - - // Use options below to customize taken action when user clicks or double clicks on the fancyBox area, - // each option can be string or method that returns value. - // - // Possible values: - // "close" - close instance - // "next" - move to next gallery item - // "nextOrClose" - move to next gallery item or close if gallery has only one item - // "toggleControls" - show/hide controls - // "zoom" - zoom image (if loaded) - // false - do nothing - - // Clicked on the content - clickContent : function( current, event ) { - return current.type === 'image' ? 'zoom' : false; - }, - - // Clicked on the slide - clickSlide : 'close', - - // Clicked on the background (backdrop) element - clickOutside : 'close', - - // Same as previous two, but for double click - dblclickContent : false, - dblclickSlide : false, - dblclickOutside : false, - - - // Custom options when mobile device is detected - // ============================================= - - mobile : { - idleTime : false, - margin : 0, - - clickContent : function( current, event ) { - return current.type === 'image' ? 'toggleControls' : false; - }, - clickSlide : function( current, event ) { - return current.type === 'image' ? 'toggleControls' : 'close'; - }, - dblclickContent : function( current, event ) { - return current.type === 'image' ? 'zoom' : false; - }, - dblclickSlide : function( current, event ) { - return current.type === 'image' ? 'zoom' : false; - } - }, - - - // Internationalization - // ============ - - lang : 'en', - i18n : { - 'en' : { - CLOSE : 'Close', - NEXT : 'Next', - PREV : 'Previous', - ERROR : 'The requested content cannot be loaded.
Please try again later.', - PLAY_START : 'Start slideshow', - PLAY_STOP : 'Pause slideshow', - FULL_SCREEN : 'Full screen', - THUMBS : 'Thumbnails', - DOWNLOAD : 'Download', - SHARE : 'Share', - ZOOM : 'Zoom' - }, - 'de' : { - CLOSE : 'Schliessen', - NEXT : 'Weiter', - PREV : 'Zurück', - ERROR : 'Die angeforderten Daten konnten nicht geladen werden.
Bitte versuchen Sie es später nochmal.', - PLAY_START : 'Diaschau starten', - PLAY_STOP : 'Diaschau beenden', - FULL_SCREEN : 'Vollbild', - THUMBS : 'Vorschaubilder', - DOWNLOAD : 'Herunterladen', - SHARE : 'Teilen', - ZOOM : 'Maßstab' - } - } - - }; - - // Few useful variables and methods - // ================================ - - var $W = $(window); - var $D = $(document); - - var called = 0; - - - // Check if an object is a jQuery object and not a native JavaScript object - // ======================================================================== - - var isQuery = function ( obj ) { - return obj && obj.hasOwnProperty && obj instanceof $; - }; - - - // Handle multiple browsers for "requestAnimationFrame" and "cancelAnimationFrame" - // =============================================================================== - - var requestAFrame = (function () { - return window.requestAnimationFrame || - window.webkitRequestAnimationFrame || - window.mozRequestAnimationFrame || - window.oRequestAnimationFrame || - // if all else fails, use setTimeout - function (callback) { - return window.setTimeout(callback, 1000 / 60); - }; - })(); - - - // Detect the supported transition-end event property name - // ======================================================= - - var transitionEnd = (function () { - var t, el = document.createElement("fakeelement"); - - var transitions = { - "transition" : "transitionend", - "OTransition" : "oTransitionEnd", - "MozTransition" : "transitionend", - "WebkitTransition": "webkitTransitionEnd" - }; - - for (t in transitions) { - if (el.style[t] !== undefined){ - return transitions[t]; - } - } - - return 'transitionend'; - })(); - - - // Force redraw on an element. - // This helps in cases where the browser doesn't redraw an updated element properly. - // ================================================================================= - - var forceRedraw = function( $el ) { - return ( $el && $el.length && $el[0].offsetHeight ); - }; - - - // Class definition - // ================ - - var FancyBox = function( content, opts, index ) { - var self = this; - - self.opts = $.extend( true, { index : index }, $.fancybox.defaults, opts || {} ); - - if ( $.fancybox.isMobile ) { - self.opts = $.extend( true, {}, self.opts, self.opts.mobile ); - } - - // Exclude buttons option from deep merging - if ( opts && $.isArray( opts.buttons ) ) { - self.opts.buttons = opts.buttons; - } - - self.id = self.opts.id || ++called; - self.group = []; - - self.currIndex = parseInt( self.opts.index, 10 ) || 0; - self.prevIndex = null; - - self.prevPos = null; - self.currPos = 0; - - self.firstRun = null; - - // Create group elements from original item collection - self.createGroup( content ); - - if ( !self.group.length ) { - return; - } - - // Save last active element and current scroll position - self.$lastFocus = $(document.activeElement).blur(); - - // Collection of gallery objects - self.slides = {}; - - self.init(); - }; - - $.extend(FancyBox.prototype, { - - // Create DOM structure - // ==================== - - init : function() { - var self = this, - firstItem = self.group[ self.currIndex ], - firstItemOpts = firstItem.opts, - scrollbarWidth = $.fancybox.scrollbarWidth, - $scrollDiv, - $container, - buttonStr; - - self.scrollTop = $D.scrollTop(); - self.scrollLeft = $D.scrollLeft(); - - - // Hide scrollbars - // =============== - - if ( !$.fancybox.getInstance() ) { - - $( 'body' ).addClass( 'fancybox-active' ); - - // iOS hack - if ( /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream ) { - - // iOS has problems for input elements inside fixed containers, - // the workaround is to apply `position: fixed` to `` element, - // unfortunately, this makes it lose the scrollbars and forces address bar to appear. - - if ( firstItem.type !== 'image' ) { - $( 'body' ).css( 'top', $( 'body' ).scrollTop() * -1 ).addClass( 'fancybox-iosfix' ); - } - - } else if ( !$.fancybox.isMobile && document.body.scrollHeight > window.innerHeight ) { - - if ( scrollbarWidth === undefined ) { - $scrollDiv = $('
').appendTo( 'body' ); - - scrollbarWidth = $.fancybox.scrollbarWidth = $scrollDiv[0].offsetWidth - $scrollDiv[0].clientWidth; - - $scrollDiv.remove(); - } - - $( 'head' ).append( '' ); - $( 'body' ).addClass( 'compensate-for-scrollbar' ); - } - } - - - // Build html markup and set references - // ==================================== - - // Build html code for buttons and insert into main template - buttonStr = ''; - - $.each( firstItemOpts.buttons, function( index, value ) { - buttonStr += ( firstItemOpts.btnTpl[ value ] || '' ); - }); - - // Create markup from base template, it will be initially hidden to - // avoid unnecessary work like painting while initializing is not complete - $container = $( - self.translate( self, - firstItemOpts.baseTpl - .replace( '\{\{buttons\}\}', buttonStr ) - .replace( '\{\{arrows\}\}', firstItemOpts.btnTpl.arrowLeft + firstItemOpts.btnTpl.arrowRight ) - ) - ) - .attr( 'id', 'fancybox-container-' + self.id ) - .addClass( 'fancybox-is-hidden' ) - .addClass( firstItemOpts.baseClass ) - .data( 'FancyBox', self ) - .appendTo( firstItemOpts.parentEl ); - - // Create object holding references to jQuery wrapped nodes - self.$refs = { - container : $container - }; - - [ 'bg', 'inner', 'infobar', 'toolbar', 'stage', 'caption', 'navigation' ].forEach(function(item) { - self.$refs[ item ] = $container.find( '.fancybox-' + item ); - }); - - self.trigger( 'onInit' ); - - // Enable events, deactive previous instances - self.activate(); - - // Build slides, load and reveal content - self.jumpTo( self.currIndex ); - }, - - - // Simple i18n support - replaces object keys found in template - // with corresponding values - // ============================================================ - - translate : function( obj, str ) { - var arr = obj.opts.i18n[ obj.opts.lang ]; - - return str.replace(/\{\{(\w+)\}\}/g, function(match, n) { - var value = arr[n]; - - if ( value === undefined ) { - return match; - } - - return value; - }); - }, - - // Create array of gally item objects - // Check if each object has valid type and content - // =============================================== - - createGroup : function ( content ) { - var self = this; - var items = $.makeArray( content ); - - $.each(items, function( i, item ) { - var obj = {}, - opts = {}, - $item, - type, - found, - src, - srcParts; - - // Step 1 - Make sure we have an object - // ==================================== - - if ( $.isPlainObject( item ) ) { - - // We probably have manual usage here, something like - // $.fancybox.open( [ { src : "image.jpg", type : "image" } ] ) - - obj = item; - opts = item.opts || item; - - } else if ( $.type( item ) === 'object' && $( item ).length ) { - - // Here we probably have jQuery collection returned by some selector - $item = $( item ); - - opts = $item.data(); - opts = $.extend( {}, opts, opts.options || {} ); - - // Here we store clicked element - opts.$orig = $item; - - obj.src = opts.src || $item.attr( 'href' ); - - // Assume that simple syntax is used, for example: - // `$.fancybox.open( $("#test"), {} );` - if ( !obj.type && !obj.src ) { - obj.type = 'inline'; - obj.src = item; - } - - } else { - - // Assume we have a simple html code, for example: - // $.fancybox.open( '

Hi!

' ); - - obj = { - type : 'html', - src : item + '' - }; - - } - - // Each gallery object has full collection of options - obj.opts = $.extend( true, {}, self.opts, opts ); - - // Do not merge buttons array - if ( $.isArray( opts.buttons ) ) { - obj.opts.buttons = opts.buttons; - } - - - // Step 2 - Make sure we have content type, if not - try to guess - // ============================================================== - - type = obj.type || obj.opts.type; - src = obj.src || ''; - - if ( !type && src ) { - if ( src.match(/(^data:image\/[a-z0-9+\/=]*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg|ico)((\?|#).*)?$)/i) ) { - type = 'image'; - - } else if ( src.match(/\.(pdf)((\?|#).*)?$/i) ) { - type = 'pdf'; - - } else if ( found = src.match(/\.(mp4|mov|ogv)((\?|#).*)?$/i) ) { - type = 'video'; - - if ( !obj.opts.videoFormat ) { - obj.opts.videoFormat = 'video/' + ( found[1] === 'ogv' ? 'ogg' : found[1] ); - } - - } else if ( src.charAt(0) === '#' ) { - type = 'inline'; - } - } - - if ( type ) { - obj.type = type; - - } else { - self.trigger( 'objectNeedsType', obj ); - } - - - // Step 3 - Some adjustments - // ========================= - - obj.index = self.group.length; - - // Check if $orig and $thumb objects exist - if ( obj.opts.$orig && !obj.opts.$orig.length ) { - delete obj.opts.$orig; - } - - if ( !obj.opts.$thumb && obj.opts.$orig ) { - obj.opts.$thumb = obj.opts.$orig.find( 'img:first' ); - } - - if ( obj.opts.$thumb && !obj.opts.$thumb.length ) { - delete obj.opts.$thumb; - } - - // "caption" is a "special" option, it can be used to customize caption per gallery item .. - if ( $.type( obj.opts.caption ) === 'function' ) { - obj.opts.caption = obj.opts.caption.apply( item, [ self, obj ] ); - } - - if ( $.type( self.opts.caption ) === 'function' ) { - obj.opts.caption = self.opts.caption.apply( item, [ self, obj ] ); - } - - // Make sure we have caption as a string or jQuery object - if ( !( obj.opts.caption instanceof $ ) ) { - obj.opts.caption = obj.opts.caption === undefined ? '' : obj.opts.caption + ''; - } - - // Check if url contains "filter" used to filter the content - // Example: "ajax.html #something" - if ( type === 'ajax' ) { - srcParts = src.split(/\s+/, 2); - - if ( srcParts.length > 1 ) { - obj.src = srcParts.shift(); - - obj.opts.filter = srcParts.shift(); - } - } - - if ( obj.opts.smallBtn == 'auto' ) { - - if ( $.inArray( type, ['html', 'inline', 'ajax'] ) > -1 ) { - obj.opts.toolbar = false; - obj.opts.smallBtn = true; - - } else { - obj.opts.smallBtn = false; - } - - } - - // If the type is "pdf", then simply load file into iframe - if ( type === 'pdf' ) { - obj.type = 'iframe'; - - obj.opts.iframe.preload = false; - } - - // Hide all buttons and disable interactivity for modal items - if ( obj.opts.modal ) { - - obj.opts = $.extend(true, obj.opts, { - // Remove buttons - infobar : 0, - toolbar : 0, - - smallBtn : 0, - - // Disable keyboard navigation - keyboard : 0, - - // Disable some modules - slideShow : 0, - fullScreen : 0, - thumbs : 0, - touch : 0, - - // Disable click event handlers - clickContent : false, - clickSlide : false, - clickOutside : false, - dblclickContent : false, - dblclickSlide : false, - dblclickOutside : false - }); - - } - - // Step 4 - Add processed object to group - // ====================================== - - self.group.push( obj ); - - }); - - }, - - - // Attach an event handler functions for: - // - navigation buttons - // - browser scrolling, resizing; - // - focusing - // - keyboard - // - detect idle - // ====================================== - - addEvents : function() { - var self = this; - - self.removeEvents(); - - // Make navigation elements clickable - self.$refs.container.on('click.fb-close', '[data-fancybox-close]', function(e) { - e.stopPropagation(); - e.preventDefault(); - - self.close( e ); - - }).on( 'click.fb-prev touchend.fb-prev', '[data-fancybox-prev]', function(e) { - e.stopPropagation(); - e.preventDefault(); - - self.previous(); - - }).on( 'click.fb-next touchend.fb-next', '[data-fancybox-next]', function(e) { - e.stopPropagation(); - e.preventDefault(); - - self.next(); - - }).on( 'click.fb', '[data-fancybox-zoom]', function(e) { - // Click handler for zoom button - self[ self.isScaledDown() ? 'scaleToActual' : 'scaleToFit' ](); - }); - - - // Handle page scrolling and browser resizing - $W.on('orientationchange.fb resize.fb', function(e) { - - if ( e && e.originalEvent && e.originalEvent.type === "resize" ) { - - requestAFrame(function() { - self.update(); - }); - - } else { - - self.$refs.stage.hide(); - - setTimeout(function() { - self.$refs.stage.show(); - - self.update(); - }, 600); - - } - - }); - - // Trap keyboard focus inside of the modal, so the user does not accidentally tab outside of the modal - // (a.k.a. "escaping the modal") - $D.on('focusin.fb', function(e) { - var instance = $.fancybox ? $.fancybox.getInstance() : null; - - if ( instance.isClosing || !instance.current || !instance.current.opts.trapFocus || $( e.target ).hasClass( 'fancybox-container' ) || $( e.target ).is( document ) ) { - return; - } - - if ( instance && $( e.target ).css( 'position' ) !== 'fixed' && !instance.$refs.container.has( e.target ).length ) { - e.stopPropagation(); - - instance.focus(); - - // Sometimes page gets scrolled, set it back - $W.scrollTop( self.scrollTop ).scrollLeft( self.scrollLeft ); - } - }); - - - // Enable keyboard navigation - $D.on('keydown.fb', function (e) { - var current = self.current, - keycode = e.keyCode || e.which; - - if ( !current || !current.opts.keyboard ) { - return; - } - - if ( $(e.target).is('input') || $(e.target).is('textarea') ) { - return; - } - - // Backspace and Esc keys - if ( keycode === 8 || keycode === 27 ) { - e.preventDefault(); - - self.close( e ); - - return; - } - - // Left arrow and Up arrow - if ( keycode === 37 || keycode === 38 ) { - e.preventDefault(); - - self.previous(); - - return; - } - - // Righ arrow and Down arrow - if ( keycode === 39 || keycode === 40 ) { - e.preventDefault(); - - self.next(); - - return; - } - - self.trigger('afterKeydown', e, keycode); - }); - - - // Hide controls after some inactivity period - if ( self.group[ self.currIndex ].opts.idleTime ) { - self.idleSecondsCounter = 0; - - $D.on('mousemove.fb-idle mouseleave.fb-idle mousedown.fb-idle touchstart.fb-idle touchmove.fb-idle scroll.fb-idle keydown.fb-idle', function(e) { - self.idleSecondsCounter = 0; - - if ( self.isIdle ) { - self.showControls(); - } - - self.isIdle = false; - }); - - self.idleInterval = window.setInterval(function() { - self.idleSecondsCounter++; - - if ( self.idleSecondsCounter >= self.group[ self.currIndex ].opts.idleTime && !self.isDragging ) { - self.isIdle = true; - self.idleSecondsCounter = 0; - - self.hideControls(); - } - - }, 1000); - } - - }, - - - // Remove events added by the core - // =============================== - - removeEvents : function() { - var self = this; - - $W.off( 'orientationchange.fb resize.fb' ); - $D.off( 'focusin.fb keydown.fb .fb-idle' ); - - this.$refs.container.off( '.fb-close .fb-prev .fb-next' ); - - if ( self.idleInterval ) { - window.clearInterval( self.idleInterval ); - - self.idleInterval = null; - } - }, - - - // Change to previous gallery item - // =============================== - - previous : function( duration ) { - return this.jumpTo( this.currPos - 1, duration ); - }, - - - // Change to next gallery item - // =========================== - - next : function( duration ) { - return this.jumpTo( this.currPos + 1, duration ); - }, - - - // Switch to selected gallery item - // =============================== - - jumpTo : function ( pos, duration, slide ) { - var self = this, - firstRun, - loop, - current, - previous, - canvasWidth, - currentPos, - transitionProps; - - var groupLen = self.group.length; - - if ( self.isDragging || self.isClosing || ( self.isAnimating && self.firstRun ) ) { - return; - } - - pos = parseInt( pos, 10 ); - loop = self.current ? self.current.opts.loop : self.opts.loop; - - if ( !loop && ( pos < 0 || pos >= groupLen ) ) { - return false; - } - - firstRun = self.firstRun = ( self.firstRun === null ); - - if ( groupLen < 2 && !firstRun && !!self.isDragging ) { - return; - } - - previous = self.current; - - self.prevIndex = self.currIndex; - self.prevPos = self.currPos; - - // Create slides - current = self.createSlide( pos ); - - if ( groupLen > 1 ) { - if ( loop || current.index > 0 ) { - self.createSlide( pos - 1 ); - } - - if ( loop || current.index < groupLen - 1 ) { - self.createSlide( pos + 1 ); - } - } - - self.current = current; - self.currIndex = current.index; - self.currPos = current.pos; - - self.trigger( 'beforeShow', firstRun ); - - self.updateControls(); - - currentPos = $.fancybox.getTranslate( current.$slide ); - - current.isMoved = ( currentPos.left !== 0 || currentPos.top !== 0 ) && !current.$slide.hasClass( 'fancybox-animated' ); - current.forcedDuration = undefined; - - if ( $.isNumeric( duration ) ) { - current.forcedDuration = duration; - } else { - duration = current.opts[ firstRun ? 'animationDuration' : 'transitionDuration' ]; - } - - duration = parseInt( duration, 10 ); - - // Fresh start - reveal container, current slide and start loading content - if ( firstRun ) { - - if ( current.opts.animationEffect && duration ) { - self.$refs.container.css( 'transition-duration', duration + 'ms' ); - } - - self.$refs.container.removeClass( 'fancybox-is-hidden' ); - - forceRedraw( self.$refs.container ); - - self.$refs.container.addClass( 'fancybox-is-open' ); - - // Make first slide visible (to display loading icon, if needed) - current.$slide.addClass( 'fancybox-slide--current' ); - - self.loadSlide( current ); - - self.preload( 'image' ); - - return; - } - - // Clean up - $.each(self.slides, function( index, slide ) { - $.fancybox.stop( slide.$slide ); - }); - - // Make current that slide is visible even if content is still loading - current.$slide.removeClass( 'fancybox-slide--next fancybox-slide--previous' ).addClass( 'fancybox-slide--current' ); - - // If slides have been dragged, animate them to correct position - if ( current.isMoved ) { - canvasWidth = Math.round( current.$slide.width() ); - - $.each(self.slides, function( index, slide ) { - var pos = slide.pos - current.pos; - - $.fancybox.animate( slide.$slide, { - top : 0, - left : ( pos * canvasWidth ) + ( pos * slide.opts.gutter ) - }, duration, function() { - - slide.$slide.removeAttr('style').removeClass( 'fancybox-slide--next fancybox-slide--previous' ); - - if ( slide.pos === self.currPos ) { - current.isMoved = false; - - self.complete(); - } - }); - }); - - } else { - self.$refs.stage.children().removeAttr( 'style' ); - } - - // Start transition that reveals current content - // or wait when it will be loaded - - if ( current.isLoaded ) { - self.revealContent( current ); - - } else { - self.loadSlide( current ); - } - - self.preload( 'image' ); - - if ( previous.pos === current.pos ) { - return; - } - - // Handle previous slide - // ===================== - - transitionProps = 'fancybox-slide--' + ( previous.pos > current.pos ? 'next' : 'previous' ); - - previous.$slide.removeClass( 'fancybox-slide--complete fancybox-slide--current fancybox-slide--next fancybox-slide--previous' ); - - previous.isComplete = false; - - if ( !duration || ( !current.isMoved && !current.opts.transitionEffect ) ) { - return; - } - - if ( current.isMoved ) { - previous.$slide.addClass( transitionProps ); - - } else { - - transitionProps = 'fancybox-animated ' + transitionProps + ' fancybox-fx-' + current.opts.transitionEffect; - - $.fancybox.animate( previous.$slide, transitionProps, duration, function() { - previous.$slide.removeClass( transitionProps ).removeAttr( 'style' ); - }); - - } - - }, - - - // Create new "slide" element - // These are gallery items that are actually added to DOM - // ======================================================= - - createSlide : function( pos ) { - - var self = this; - var $slide; - var index; - - index = pos % self.group.length; - index = index < 0 ? self.group.length + index : index; - - if ( !self.slides[ pos ] && self.group[ index ] ) { - $slide = $('
').appendTo( self.$refs.stage ); - - self.slides[ pos ] = $.extend( true, {}, self.group[ index ], { - pos : pos, - $slide : $slide, - isLoaded : false, - }); - - self.updateSlide( self.slides[ pos ] ); - } - - return self.slides[ pos ]; - }, - - - // Scale image to the actual size of the image - // =========================================== - - scaleToActual : function( x, y, duration ) { - - var self = this; - - var current = self.current; - var $what = current.$content; - - var imgPos, posX, posY, scaleX, scaleY; - - var canvasWidth = parseInt( current.$slide.width(), 10 ); - var canvasHeight = parseInt( current.$slide.height(), 10 ); - - var newImgWidth = current.width; - var newImgHeight = current.height; - - if ( !( current.type == 'image' && !current.hasError) || !$what || self.isAnimating ) { - return; - } - - $.fancybox.stop( $what ); - - self.isAnimating = true; - - x = x === undefined ? canvasWidth * 0.5 : x; - y = y === undefined ? canvasHeight * 0.5 : y; - - imgPos = $.fancybox.getTranslate( $what ); - - scaleX = newImgWidth / imgPos.width; - scaleY = newImgHeight / imgPos.height; - - // Get center position for original image - posX = ( canvasWidth * 0.5 - newImgWidth * 0.5 ); - posY = ( canvasHeight * 0.5 - newImgHeight * 0.5 ); - - // Make sure image does not move away from edges - if ( newImgWidth > canvasWidth ) { - posX = imgPos.left * scaleX - ( ( x * scaleX ) - x ); - - if ( posX > 0 ) { - posX = 0; - } - - if ( posX < canvasWidth - newImgWidth ) { - posX = canvasWidth - newImgWidth; - } - } - - if ( newImgHeight > canvasHeight) { - posY = imgPos.top * scaleY - ( ( y * scaleY ) - y ); - - if ( posY > 0 ) { - posY = 0; - } - - if ( posY < canvasHeight - newImgHeight ) { - posY = canvasHeight - newImgHeight; - } - } - - self.updateCursor( newImgWidth, newImgHeight ); - - $.fancybox.animate( $what, { - top : posY, - left : posX, - scaleX : scaleX, - scaleY : scaleY - }, duration || 330, function() { - self.isAnimating = false; - }); - - // Stop slideshow - if ( self.SlideShow && self.SlideShow.isActive ) { - self.SlideShow.stop(); - } - }, - - - // Scale image to fit inside parent element - // ======================================== - - scaleToFit : function( duration ) { - - var self = this; - - var current = self.current; - var $what = current.$content; - var end; - - if ( !( current.type == 'image' && !current.hasError) || !$what || self.isAnimating ) { - return; - } - - $.fancybox.stop( $what ); - - self.isAnimating = true; - - end = self.getFitPos( current ); - - self.updateCursor( end.width, end.height ); - - $.fancybox.animate( $what, { - top : end.top, - left : end.left, - scaleX : end.width / $what.width(), - scaleY : end.height / $what.height() - }, duration || 330, function() { - self.isAnimating = false; - }); - - }, - - // Calculate image size to fit inside viewport - // =========================================== - - getFitPos : function( slide ) { - var self = this; - var $what = slide.$content; - - var imgWidth = slide.width; - var imgHeight = slide.height; - - var margin = slide.opts.margin; - - var canvasWidth, canvasHeight, minRatio, width, height; - - if ( !$what || !$what.length || ( !imgWidth && !imgHeight) ) { - return false; - } - - // Convert "margin to CSS style: [ top, right, bottom, left ] - if ( $.type( margin ) === "number" ) { - margin = [ margin, margin ]; - } - - if ( margin.length == 2 ) { - margin = [ margin[0], margin[1], margin[0], margin[1] ]; - } - - // We can not use $slide width here, because it can have different diemensions while in transiton - canvasWidth = parseInt( self.$refs.stage.width(), 10 ) - ( margin[ 1 ] + margin[ 3 ] ); - canvasHeight = parseInt( self.$refs.stage.height(), 10 ) - ( margin[ 0 ] + margin[ 2 ] ); - - minRatio = Math.min(1, canvasWidth / imgWidth, canvasHeight / imgHeight ); - - width = Math.floor( minRatio * imgWidth ); - height = Math.floor( minRatio * imgHeight ); - - // Use floor rounding to make sure it really fits - return { - top : Math.floor( ( canvasHeight - height ) * 0.5 ) + margin[ 0 ], - left : Math.floor( ( canvasWidth - width ) * 0.5 ) + margin[ 3 ], - width : width, - height : height - }; - - }, - - - // Update content size and position for all slides - // ============================================== - - update : function() { - var self = this; - - $.each( self.slides, function( key, slide ) { - self.updateSlide( slide ); - }); - }, - - - // Update slide content position and size - // ====================================== - - updateSlide : function( slide, duration ) { - var self = this, - $what = slide && slide.$content; - - if ( $what && ( slide.width || slide.height ) ) { - self.isAnimating = false; - - $.fancybox.stop( $what ); - - $.fancybox.setTranslate( $what, self.getFitPos( slide ) ); - - if ( slide.pos === self.currPos ) { - self.updateCursor(); - } - } - - slide.$slide.trigger( 'refresh' ); - - self.trigger( 'onUpdate', slide ); - - }, - - - // Horizontally center slide - // ========================= - - centerSlide : function( slide, duration ) { - var self = this, canvasWidth, pos; - - if ( self.current ) { - canvasWidth = Math.round( slide.$slide.width() ); - pos = slide.pos - self.current.pos; - - $.fancybox.animate( slide.$slide, { - top : 0, - left : ( pos * canvasWidth ) + ( pos * slide.opts.gutter ), - opacity : 1 - }, duration === undefined ? 0 : duration, null, false); - } - }, - - - // Update cursor style depending if content can be zoomed - // ====================================================== - - updateCursor : function( nextWidth, nextHeight ) { - - var self = this; - var isScaledDown; - - var $container = self.$refs.container.removeClass( 'fancybox-is-zoomable fancybox-can-zoomIn fancybox-can-drag fancybox-can-zoomOut' ); - - if ( !self.current || self.isClosing ) { - return; - } - - if ( self.isZoomable() ) { - - $container.addClass( 'fancybox-is-zoomable' ); - - if ( nextWidth !== undefined && nextHeight !== undefined ) { - isScaledDown = nextWidth < self.current.width && nextHeight < self.current.height; - - } else { - isScaledDown = self.isScaledDown(); - } - - if ( isScaledDown ) { - - // If image is scaled down, then, obviously, it can be zoomed to full size - $container.addClass( 'fancybox-can-zoomIn' ); - - } else { - - if ( self.current.opts.touch ) { - - // If image size ir largen than available available and touch module is not disable, - // then user can do panning - $container.addClass( 'fancybox-can-drag' ); - - } else { - $container.addClass( 'fancybox-can-zoomOut' ); - } - - } - - } else if ( self.current.opts.touch ) { - $container.addClass( 'fancybox-can-drag' ); - } - - }, - - - // Check if current slide is zoomable - // ================================== - - isZoomable : function() { - - var self = this; - - var current = self.current; - var fitPos; - - if ( !current || self.isClosing ) { - return; - } - - // Assume that slide is zoomable if - // - image is loaded successfuly - // - click action is "zoom" - // - actual size of the image is smaller than available area - if ( current.type === 'image' && current.isLoaded && !current.hasError && - ( current.opts.clickContent === 'zoom' || ( $.isFunction( current.opts.clickContent ) && current.opts.clickContent( current ) === "zoom" ) ) - ) { - - fitPos = self.getFitPos( current ); - - if ( current.width > fitPos.width || current.height > fitPos.height ) { - return true; - } - - } - - return false; - - }, - - - // Check if current image dimensions are smaller than actual - // ========================================================= - - isScaledDown : function() { - - var self = this; - - var current = self.current; - var $what = current.$content; - - var rez = false; - - if ( $what ) { - rez = $.fancybox.getTranslate( $what ); - rez = rez.width < current.width || rez.height < current.height; - } - - return rez; - - }, - - - // Check if image dimensions exceed parent element - // =============================================== - - canPan : function() { - - var self = this; - - var current = self.current; - var $what = current.$content; - - var rez = false; - - if ( $what ) { - rez = self.getFitPos( current ); - rez = Math.abs( $what.width() - rez.width ) > 1 || Math.abs( $what.height() - rez.height ) > 1; - } - - return rez; - - }, - - - // Load content into the slide - // =========================== - - loadSlide : function( slide ) { - - var self = this, type, $slide; - var ajaxLoad; - - if ( slide.isLoading ) { - return; - } - - if ( slide.isLoaded ) { - return; - } - - slide.isLoading = true; - - self.trigger( 'beforeLoad', slide ); - - type = slide.type; - $slide = slide.$slide; - - $slide - .off( 'refresh' ) - .trigger( 'onReset' ) - .addClass( 'fancybox-slide--' + ( type || 'unknown' ) ) - .addClass( slide.opts.slideClass ); - - // Create content depending on the type - - switch ( type ) { - - case 'image': - - self.setImage( slide ); - - break; - - case 'iframe': - - self.setIframe( slide ); - - break; - - case 'html': - - self.setContent( slide, slide.src || slide.content ); - - break; - - case 'inline': - - if ( $( slide.src ).length ) { - self.setContent( slide, $( slide.src ) ); - - } else { - self.setError( slide ); - } - - break; - - case 'ajax': - - self.showLoading( slide ); - - ajaxLoad = $.ajax( $.extend( {}, slide.opts.ajax.settings, { - url : slide.src, - success : function ( data, textStatus ) { - - if ( textStatus === 'success' ) { - self.setContent( slide, data ); - } - - }, - error : function ( jqXHR, textStatus ) { - - if ( jqXHR && textStatus !== 'abort' ) { - self.setError( slide ); - } - - } - })); - - $slide.one( 'onReset', function () { - ajaxLoad.abort(); - }); - - break; - - case 'video' : - - self.setContent( slide, - '' - ); - - break; - - default: - - self.setError( slide ); - - break; - - } - - return true; - - }, - - - // Use thumbnail image, if possible - // ================================ - - setImage : function( slide ) { - - var self = this; - var srcset = slide.opts.srcset || slide.opts.image.srcset; - - var found, temp, pxRatio, windowWidth; - - // If we have "srcset", then we need to find matching "src" value. - // This is necessary, because when you set an src attribute, the browser will preload the image - // before any javascript or even CSS is applied. - if ( srcset ) { - pxRatio = window.devicePixelRatio || 1; - windowWidth = window.innerWidth * pxRatio; - - temp = srcset.split(',').map(function ( el ) { - var ret = {}; - - el.trim().split(/\s+/).forEach(function ( el, i ) { - var value = parseInt( el.substring(0, el.length - 1), 10 ); - - if ( i === 0 ) { - return ( ret.url = el ); - } - - if ( value ) { - ret.value = value; - ret.postfix = el[ el.length - 1 ]; - } - - }); - - return ret; - }); - - // Sort by value - temp.sort(function (a, b) { - return a.value - b.value; - }); - - // Ok, now we have an array of all srcset values - for ( var j = 0; j < temp.length; j++ ) { - var el = temp[ j ]; - - if ( ( el.postfix === 'w' && el.value >= windowWidth ) || ( el.postfix === 'x' && el.value >= pxRatio ) ) { - found = el; - break; - } - } - - // If not found, take the last one - if ( !found && temp.length ) { - found = temp[ temp.length - 1 ]; - } - - if ( found ) { - slide.src = found.url; - - // If we have default width/height values, we can calculate height for matching source - if ( slide.width && slide.height && found.postfix == 'w' ) { - slide.height = ( slide.width / slide.height ) * found.value; - slide.width = found.value; - } - } - } - - // This will be wrapper containing both ghost and actual image - slide.$content = $('
') - .addClass( 'fancybox-is-hidden' ) - .appendTo( slide.$slide ); - - - // If we have a thumbnail, we can display it while actual image is loading - // Users will not stare at black screen and actual image will appear gradually - if ( slide.opts.preload !== false && slide.opts.width && slide.opts.height && ( slide.opts.thumb || slide.opts.$thumb ) ) { - - slide.width = slide.opts.width; - slide.height = slide.opts.height; - - slide.$ghost = $('') - .one('error', function() { - - $(this).remove(); - - slide.$ghost = null; - - self.setBigImage( slide ); - - }) - .one('load', function() { - - self.afterLoad( slide ); - - self.setBigImage( slide ); - - }) - .addClass( 'fancybox-image' ) - .appendTo( slide.$content ) - .attr( 'src', slide.opts.thumb || slide.opts.$thumb.attr( 'src' ) ); - - } else { - - self.setBigImage( slide ); - - } - - }, - - - // Create full-size image - // ====================== - - setBigImage : function ( slide ) { - var self = this; - var $img = $(''); - - slide.$image = $img - .one('error', function() { - - self.setError( slide ); - - }) - .one('load', function() { - - // Clear timeout that checks if loading icon needs to be displayed - clearTimeout( slide.timouts ); - - slide.timouts = null; - - if ( self.isClosing ) { - return; - } - - slide.width = slide.opts.width || this.naturalWidth; - slide.height = slide.opts.height || this.naturalHeight; - - if ( slide.opts.image.srcset ) { - $img.attr( 'sizes', '100vw' ).attr( 'srcset', slide.opts.image.srcset ); - } - - self.hideLoading( slide ); - - if ( slide.$ghost ) { - - slide.timouts = setTimeout(function() { - slide.timouts = null; - - slide.$ghost.hide(); - - }, Math.min( 300, Math.max( 1000, slide.height / 1600 ) ) ); - - } else { - self.afterLoad( slide ); - } - - }) - .addClass( 'fancybox-image' ) - .attr('src', slide.src) - .appendTo( slide.$content ); - - if ( ( $img[0].complete || $img[0].readyState == "complete" ) && $img[0].naturalWidth && $img[0].naturalHeight ) { - $img.trigger( 'load' ); - - } else if( $img[0].error ) { - $img.trigger( 'error' ); - - } else { - - slide.timouts = setTimeout(function() { - if ( !$img[0].complete && !slide.hasError ) { - self.showLoading( slide ); - } - - }, 100); - - } - - }, - - - // Create iframe wrapper, iframe and bindings - // ========================================== - - setIframe : function( slide ) { - var self = this, - opts = slide.opts.iframe, - $slide = slide.$slide, - $iframe; - - slide.$content = $('
') - .css( opts.css ) - .appendTo( $slide ); - - $iframe = $( opts.tpl.replace(/\{rnd\}/g, new Date().getTime()) ) - .attr( opts.attr ) - .appendTo( slide.$content ); - - if ( opts.preload ) { - - self.showLoading( slide ); - - // Unfortunately, it is not always possible to determine if iframe is successfully loaded - // (due to browser security policy) - - $iframe.on('load.fb error.fb', function(e) { - this.isReady = 1; - - slide.$slide.trigger( 'refresh' ); - - self.afterLoad( slide ); - }); - - // Recalculate iframe content size - // =============================== - - $slide.on('refresh.fb', function() { - var $wrap = slide.$content, - frameWidth = opts.css.width, - frameHeight = opts.css.height, - scrollWidth, - $contents, - $body; - - if ( $iframe[0].isReady !== 1 ) { - return; - } - - // Check if content is accessible, - // it will fail if frame is not with the same origin - - try { - $contents = $iframe.contents(); - $body = $contents.find('body'); - - } catch (ignore) {} - - // Calculate dimensions for the wrapper - if ( $body && $body.length ) { - - if ( frameWidth === undefined ) { - scrollWidth = $iframe[0].contentWindow.document.documentElement.scrollWidth; - - frameWidth = Math.ceil( $body.outerWidth(true) + ( $wrap.width() - scrollWidth ) ); - frameWidth += $wrap.outerWidth() - $wrap.innerWidth(); - } - - if ( frameHeight === undefined ) { - frameHeight = Math.ceil( $body.outerHeight(true) ); - frameHeight += $wrap.outerHeight() - $wrap.innerHeight(); - } - - // Resize wrapper to fit iframe content - if ( frameWidth ) { - $wrap.width( frameWidth ); - } - - if ( frameHeight ) { - $wrap.height( frameHeight ); - } - } - - $wrap.removeClass( 'fancybox-is-hidden' ); - - }); - - } else { - - this.afterLoad( slide ); - - } - - $iframe.attr( 'src', slide.src ); - - if ( slide.opts.smallBtn === true ) { - slide.$content.prepend( self.translate( slide, slide.opts.btnTpl.smallBtn ) ); - } - - // Remove iframe if closing or changing gallery item - $slide.one( 'onReset', function () { - - // This helps IE not to throw errors when closing - try { - - $( this ).find( 'iframe' ).hide().attr( 'src', '//about:blank' ); - - } catch ( ignore ) {} - - $( this ).empty(); - - slide.isLoaded = false; - - }); - - }, - - - // Wrap and append content to the slide - // ====================================== - - setContent : function ( slide, content ) { - - var self = this; - - if ( self.isClosing ) { - return; - } - - self.hideLoading( slide ); - - slide.$slide.empty(); - - if ( isQuery( content ) && content.parent().length ) { - - // If content is a jQuery object, then it will be moved to the slide. - // The placeholder is created so we will know where to put it back. - // If user is navigating gallery fast, then the content might be already inside fancyBox - // ===================================================================================== - - // Make sure content is not already moved to fancyBox - content.parent( '.fancybox-slide--inline' ).trigger( 'onReset' ); - - // Create temporary element marking original place of the content - slide.$placeholder = $( '
' ).hide().insertAfter( content ); - - // Make sure content is visible - content.css('display', 'inline-block'); - - } else if ( !slide.hasError ) { - - // If content is just a plain text, try to convert it to html - if ( $.type( content ) === 'string' ) { - content = $('
').append( $.trim( content ) ).contents(); - - // If we have text node, then add wrapping element to make vertical alignment work - if ( content[0].nodeType === 3 ) { - content = $('
').html( content ); - } - } - - // If "filter" option is provided, then filter content - if ( slide.opts.filter ) { - content = $('
').html( content ).find( slide.opts.filter ); - } - - } - - slide.$slide.one('onReset', function () { - - // Pause all html5 video/audio - $( this ).find( 'video,audio' ).trigger( 'pause' ); - - // Put content back - if ( slide.$placeholder ) { - slide.$placeholder.after( content.hide() ).remove(); - - slide.$placeholder = null; - } - - // Remove custom close button - if ( slide.$smallBtn ) { - slide.$smallBtn.remove(); - - slide.$smallBtn = null; - } - - // Remove content and mark slide as not loaded - if ( !slide.hasError ) { - $(this).empty(); - - slide.isLoaded = false; - } - - }); - - slide.$content = $( content ).appendTo( slide.$slide ); - - this.afterLoad( slide ); - }, - - // Display error message - // ===================== - - setError : function ( slide ) { - - slide.hasError = true; - - slide.$slide.removeClass( 'fancybox-slide--' + slide.type ); - - this.setContent( slide, this.translate( slide, slide.opts.errorTpl ) ); - - }, - - - // Show loading icon inside the slide - // ================================== - - showLoading : function( slide ) { - - var self = this; - - slide = slide || self.current; - - if ( slide && !slide.$spinner ) { - slide.$spinner = $( self.opts.spinnerTpl ).appendTo( slide.$slide ); - } - - }, - - // Remove loading icon from the slide - // ================================== - - hideLoading : function( slide ) { - - var self = this; - - slide = slide || self.current; - - if ( slide && slide.$spinner ) { - slide.$spinner.remove(); - - delete slide.$spinner; - } - - }, - - - // Adjustments after slide content has been loaded - // =============================================== - - afterLoad : function( slide ) { - - var self = this; - - if ( self.isClosing ) { - return; - } - - slide.isLoading = false; - slide.isLoaded = true; - - self.trigger( 'afterLoad', slide ); - - self.hideLoading( slide ); - - if ( slide.opts.smallBtn && !slide.$smallBtn ) { - slide.$smallBtn = $( self.translate( slide, slide.opts.btnTpl.smallBtn ) ).appendTo( slide.$content.filter('div,form').first() ); - } - - if ( slide.opts.protect && slide.$content && !slide.hasError ) { - - // Disable right click - slide.$content.on( 'contextmenu.fb', function( e ) { - if ( e.button == 2 ) { - e.preventDefault(); - } - - return true; - }); - - // Add fake element on top of the image - // This makes a bit harder for user to select image - if ( slide.type === 'image' ) { - $( '
' ).appendTo( slide.$content ); - } - - } - - self.revealContent( slide ); - - }, - - - // Make content visible - // This method is called right after content has been loaded or - // user navigates gallery and transition should start - // ============================================================ - - revealContent : function( slide ) { - - var self = this; - var $slide = slide.$slide; - - var effect, effectClassName, duration, opacity, end, start = false; - - effect = slide.opts[ self.firstRun ? 'animationEffect' : 'transitionEffect' ]; - duration = slide.opts[ self.firstRun ? 'animationDuration' : 'transitionDuration' ]; - - duration = parseInt( slide.forcedDuration === undefined ? duration : slide.forcedDuration, 10 ); - - if ( slide.isMoved || slide.pos !== self.currPos || !duration ) { - effect = false; - } - - // Check if can zoom - if ( effect === 'zoom' && !( slide.pos === self.currPos && duration && slide.type === 'image' && !slide.hasError && ( start = self.getThumbPos( slide ) ) ) ) { - effect = 'fade'; - } - - // Zoom animation - // ============== - - if ( effect === 'zoom' ) { - end = self.getFitPos( slide ); - - end.scaleX = end.width / start.width; - end.scaleY = end.height / start.height; - - delete end.width; - delete end.height; - - // Check if we need to animate opacity - opacity = slide.opts.zoomOpacity; - - if ( opacity == 'auto' ) { - opacity = Math.abs( slide.width / slide.height - start.width / start.height ) > 0.1; - } - - if ( opacity ) { - start.opacity = 0.1; - end.opacity = 1; - } - - // Draw image at start position - $.fancybox.setTranslate( slide.$content.removeClass( 'fancybox-is-hidden' ), start ); - - forceRedraw( slide.$content ); - - // Start animation - $.fancybox.animate( slide.$content, end, duration, function() { - self.complete(); - }); - - return; - } - - self.updateSlide( slide ); - - - // Simply show content - // =================== - - if ( !effect ) { - forceRedraw( $slide ); - - slide.$content.removeClass( 'fancybox-is-hidden' ); - - if ( slide.pos === self.currPos ) { - self.complete(); - } - - return; - } - - $.fancybox.stop( $slide ); - - effectClassName = 'fancybox-animated fancybox-slide--' + ( slide.pos >= self.prevPos ? 'next' : 'previous' ) + ' fancybox-fx-' + effect; - - $slide.removeAttr( 'style' ).removeClass( 'fancybox-slide--current fancybox-slide--next fancybox-slide--previous' ).addClass( effectClassName ); - - slide.$content.removeClass( 'fancybox-is-hidden' ); - - //Force reflow for CSS3 transitions - forceRedraw( $slide ); - - $.fancybox.animate( $slide, 'fancybox-slide--current', duration, function(e) { - $slide.removeClass( effectClassName ).removeAttr( 'style' ); - - if ( slide.pos === self.currPos ) { - self.complete(); - } - - }, true); - - }, - - - // Check if we can and have to zoom from thumbnail - //================================================ - - getThumbPos : function( slide ) { - - var self = this; - var rez = false; - - // Check if element is inside the viewport by at least 1 pixel - var isElementVisible = function( $el ) { - var element = $el[0]; - - var elementRect = element.getBoundingClientRect(); - var parentRects = []; - - var visibleInAllParents; - - while ( element.parentElement !== null ) { - if ( $(element.parentElement).css('overflow') === 'hidden' || $(element.parentElement).css('overflow') === 'auto' ) { - parentRects.push(element.parentElement.getBoundingClientRect()); - } - - element = element.parentElement; - } - - visibleInAllParents = parentRects.every(function(parentRect){ - var visiblePixelX = Math.min(elementRect.right, parentRect.right) - Math.max(elementRect.left, parentRect.left); - var visiblePixelY = Math.min(elementRect.bottom, parentRect.bottom) - Math.max(elementRect.top, parentRect.top); - - return visiblePixelX > 0 && visiblePixelY > 0; - }); - - return visibleInAllParents && - elementRect.bottom > 0 && elementRect.right > 0 && - elementRect.left < $(window).width() && elementRect.top < $(window).height(); - }; - - var $thumb = slide.opts.$thumb; - var thumbPos = $thumb ? $thumb.offset() : 0; - var slidePos; - - if ( thumbPos && $thumb[0].ownerDocument === document && isElementVisible( $thumb ) ) { - slidePos = self.$refs.stage.offset(); - - rez = { - top : thumbPos.top - slidePos.top + parseFloat( $thumb.css( "border-top-width" ) || 0 ), - left : thumbPos.left - slidePos.left + parseFloat( $thumb.css( "border-left-width" ) || 0 ), - width : $thumb.width(), - height : $thumb.height(), - scaleX : 1, - scaleY : 1 - }; - } - - return rez; - }, - - - // Final adjustments after current gallery item is moved to position - // and it`s content is loaded - // ================================================================== - - complete : function() { - var self = this, - current = self.current, - slides = {}, - promise; - - if ( current.isMoved || !current.isLoaded || current.isComplete ) { - return; - } - - current.isComplete = true; - - current.$slide.siblings().trigger( 'onReset' ); - - self.preload( 'inline' ); - - // Trigger any CSS3 transiton inside the slide - forceRedraw( current.$slide ); - - current.$slide.addClass( 'fancybox-slide--complete' ); - - // Remove unnecessary slides - $.each( self.slides, function( key, slide ) { - if ( slide.pos >= self.currPos - 1 && slide.pos <= self.currPos + 1 ) { - slides[ slide.pos ] = slide; - - } else if ( slide ) { - $.fancybox.stop( slide.$slide ); - - slide.$slide.off().remove(); - } - }); - - self.slides = slides; - - self.updateCursor(); - - self.trigger( 'afterShow' ); - - // Play first html5 video/audio - current.$slide.find( 'video,audio' ).first().trigger( 'play' ); - - // Try to focus on the first focusable element - if ( $( document.activeElement ).is( '[disabled]' ) || ( current.opts.autoFocus && !( current.type == 'image' || current.type === 'iframe' ) ) ) { - self.focus(); - } - - }, - - - // Preload next and previous slides - // ================================ - - preload : function( type ) { - var self = this, - next = self.slides[ self.currPos + 1 ], - prev = self.slides[ self.currPos - 1 ]; - - if ( next && next.type === type ) { - self.loadSlide( next ); - } - - if ( prev && prev.type === type ) { - self.loadSlide( prev ); - } - }, - - - // Try to find and focus on the first focusable element - // ==================================================== - - focus : function() { - var current = this.current; - var $el; - - if ( this.isClosing ) { - return; - } - - if ( current && current.isComplete ) { - - // Look for first input with autofocus attribute - $el = current.$slide.find('input[autofocus]:enabled:visible:first'); - - if ( !$el.length ) { - $el = current.$slide.find('button,:input,[tabindex],a').filter(':enabled:visible:first'); - } - } - - $el = $el && $el.length ? $el : this.$refs.container; - - $el.focus(); - }, - - - // Activates current instance - brings container to the front and enables keyboard, - // notifies other instances about deactivating - // ================================================================================= - - activate : function () { - var self = this; - - // Deactivate all instances - $( '.fancybox-container' ).each(function () { - var instance = $(this).data( 'FancyBox' ); - - // Skip self and closing instances - if (instance && instance.id !== self.id && !instance.isClosing) { - instance.trigger( 'onDeactivate' ); - - instance.removeEvents(); - - instance.isVisible = false; - } - - }); - - self.isVisible = true; - - if ( self.current || self.isIdle ) { - self.update(); - - self.updateControls(); - } - - self.trigger( 'onActivate' ); - - self.addEvents(); - }, - - - // Start closing procedure - // This will start "zoom-out" animation if needed and clean everything up afterwards - // ================================================================================= - - close : function( e, d ) { - - var self = this; - var current = self.current; - - var effect, duration; - var $what, opacity, start, end; - - var done = function() { - self.cleanUp( e ); - }; - - if ( self.isClosing ) { - return false; - } - - self.isClosing = true; - - // If beforeClose callback prevents closing, make sure content is centered - if ( self.trigger( 'beforeClose', e ) === false ) { - self.isClosing = false; - - requestAFrame(function() { - self.update(); - }); - - return false; - } - - // Remove all events - // If there are multiple instances, they will be set again by "activate" method - self.removeEvents(); - - if ( current.timouts ) { - clearTimeout( current.timouts ); - } - - $what = current.$content; - effect = current.opts.animationEffect; - duration = $.isNumeric( d ) ? d : ( effect ? current.opts.animationDuration : 0 ); - - // Remove other slides - current.$slide.off( transitionEnd ).removeClass( 'fancybox-slide--complete fancybox-slide--next fancybox-slide--previous fancybox-animated' ); - - current.$slide.siblings().trigger( 'onReset' ).remove(); - - // Trigger animations - if ( duration ) { - self.$refs.container.removeClass( 'fancybox-is-open' ).addClass( 'fancybox-is-closing' ); - } - - // Clean up - self.hideLoading( current ); - - self.hideControls(); - - self.updateCursor(); - - // Check if possible to zoom-out - if ( effect === 'zoom' && !( e !== true && $what && duration && current.type === 'image' && !current.hasError && ( end = self.getThumbPos( current ) ) ) ) { - effect = 'fade'; - } - - if ( effect === 'zoom' ) { - $.fancybox.stop( $what ); - - start = $.fancybox.getTranslate( $what ); - - start.width = start.width * start.scaleX; - start.height = start.height * start.scaleY; - - // Check if we need to animate opacity - opacity = current.opts.zoomOpacity; - - if ( opacity == 'auto' ) { - opacity = Math.abs( current.width / current.height - end.width / end.height ) > 0.1; - } - - if ( opacity ) { - end.opacity = 0; - } - - start.scaleX = start.width / end.width; - start.scaleY = start.height / end.height; - - start.width = end.width; - start.height = end.height; - - $.fancybox.setTranslate( current.$content, start ); - - forceRedraw( current.$content ); - - $.fancybox.animate( current.$content, end, duration, done ); - - return true; - } - - if ( effect && duration ) { - - // If skip animation - if ( e === true ) { - setTimeout( done, duration ); - - } else { - $.fancybox.animate( current.$slide.removeClass( 'fancybox-slide--current' ), 'fancybox-animated fancybox-slide--previous fancybox-fx-' + effect, duration, done ); - } - - } else { - done(); - } - - return true; - }, - - - // Final adjustments after removing the instance - // ============================================= - - cleanUp : function( e ) { - var self = this, - $body = $( 'body' ), - instance, - offset; - - self.current.$slide.trigger( 'onReset' ); - - self.$refs.container.empty().remove(); - - self.trigger( 'afterClose', e ); - - // Place back focus - if ( self.$lastFocus && !!self.current.opts.backFocus ) { - self.$lastFocus.focus(); - } - - self.current = null; - - // Check if there are other instances - instance = $.fancybox.getInstance(); - - if ( instance ) { - instance.activate(); - - } else { - - $W.scrollTop( self.scrollTop ).scrollLeft( self.scrollLeft ); - - $body.removeClass( 'fancybox-active compensate-for-scrollbar' ); - - if ( $body.hasClass( 'fancybox-iosfix' ) ) { - offset = parseInt(document.body.style.top, 10); - - $body.removeClass( 'fancybox-iosfix' ).css( 'top', '' ).scrollTop( offset * -1 ); - } - - $( '#fancybox-style-noscroll' ).remove(); - - } - - }, - - - // Call callback and trigger an event - // ================================== - - trigger : function( name, slide ) { - var args = Array.prototype.slice.call(arguments, 1), - self = this, - obj = slide && slide.opts ? slide : self.current, - rez; - - if ( obj ) { - args.unshift( obj ); - - } else { - obj = self; - } - - args.unshift( self ); - - if ( $.isFunction( obj.opts[ name ] ) ) { - rez = obj.opts[ name ].apply( obj, args ); - } - - if ( rez === false ) { - return rez; - } - - if ( name === 'afterClose' || !self.$refs ) { - $D.trigger( name + '.fb', args ); - - } else { - self.$refs.container.trigger( name + '.fb', args ); - } - - }, - - - // Update infobar values, navigation button states and reveal caption - // ================================================================== - - updateControls : function ( force ) { - - var self = this; - - var current = self.current, - index = current.index, - caption = current.opts.caption, - $container = self.$refs.container, - $caption = self.$refs.caption; - - // Recalculate content dimensions - current.$slide.trigger( 'refresh' ); - - self.$caption = caption && caption.length ? $caption.html( caption ) : null; - - if ( !self.isHiddenControls && !self.isIdle ) { - self.showControls(); - } - - // Update info and navigation elements - $container.find('[data-fancybox-count]').html( self.group.length ); - $container.find('[data-fancybox-index]').html( index + 1 ); - - $container.find('[data-fancybox-prev]').prop( 'disabled', ( !current.opts.loop && index <= 0 ) ); - $container.find('[data-fancybox-next]').prop( 'disabled', ( !current.opts.loop && index >= self.group.length - 1 ) ); - - if ( current.type === 'image' ) { - - // Update download button source - $container.find('[data-fancybox-download]').attr( 'href', current.opts.image.src || current.src ).show(); - - } else { - $container.find('[data-fancybox-download],[data-fancybox-zoom]').hide(); - } - }, - - // Hide toolbar and caption - // ======================== - - hideControls : function () { - - this.isHiddenControls = true; - - this.$refs.container.removeClass( 'fancybox-show-infobar fancybox-show-toolbar fancybox-show-caption fancybox-show-nav' ); - - }, - - showControls : function() { - var self = this; - var opts = self.current ? self.current.opts : self.opts; - var $container = self.$refs.container; - - self.isHiddenControls = false; - self.idleSecondsCounter = 0; - - $container - .toggleClass( 'fancybox-show-toolbar', !!( opts.toolbar && opts.buttons ) ) - .toggleClass( 'fancybox-show-infobar', !!( opts.infobar && self.group.length > 1 ) ) - .toggleClass( 'fancybox-show-nav', !!( opts.arrows && self.group.length > 1 ) ) - .toggleClass( 'fancybox-is-modal', !!opts.modal ); - - if ( self.$caption ) { - $container.addClass( 'fancybox-show-caption '); - - } else { - $container.removeClass( 'fancybox-show-caption' ); - } - - }, - - - // Toggle toolbar and caption - // ========================== - - toggleControls : function() { - if ( this.isHiddenControls ) { - this.showControls(); - - } else { - this.hideControls(); - } - - }, - - - }); - - - $.fancybox = { - - version : "{fancybox-version}", - defaults : defaults, - - - // Get current instance and execute a command. - // - // Examples of usage: - // - // $instance = $.fancybox.getInstance(); - // $.fancybox.getInstance().jumpTo( 1 ); - // $.fancybox.getInstance( 'jumpTo', 1 ); - // $.fancybox.getInstance( function() { - // console.info( this.currIndex ); - // }); - // ====================================================== - - getInstance : function ( command ) { - var instance = $('.fancybox-container:not(".fancybox-is-closing"):last').data( 'FancyBox' ); - var args = Array.prototype.slice.call(arguments, 1); - - if ( instance instanceof FancyBox ) { - - if ( $.type( command ) === 'string' ) { - instance[ command ].apply( instance, args ); - - } else if ( $.type( command ) === 'function' ) { - command.apply( instance, args ); - } - - return instance; - } - - return false; - - }, - - - // Create new instance - // =================== - - open : function ( items, opts, index ) { - return new FancyBox( items, opts, index ); - }, - - - // Close current or all instances - // ============================== - - close : function ( all ) { - var instance = this.getInstance(); - - if ( instance ) { - instance.close(); - - // Try to find and close next instance - - if ( all === true ) { - this.close(); - } - } - - }, - - // Close instances and unbind all events - // ============================== - - destroy : function() { - - this.close( true ); - - $D.off( 'click.fb-start' ); - - }, - - - // Try to detect mobile devices - // ============================ - - isMobile : document.createTouch !== undefined && /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent), - - - // Detect if 'translate3d' support is available - // ============================================ - - use3d : (function() { - var div = document.createElement('div'); - - return window.getComputedStyle && window.getComputedStyle( div ).getPropertyValue('transform') && !(document.documentMode && document.documentMode < 11); - }()), - - // Helper function to get current visual state of an element - // returns array[ top, left, horizontal-scale, vertical-scale, opacity ] - // ===================================================================== - - getTranslate : function( $el ) { - var matrix; - - if ( !$el || !$el.length ) { - return false; - } - - matrix = $el.eq( 0 ).css('transform'); - - if ( matrix && matrix.indexOf( 'matrix' ) !== -1 ) { - matrix = matrix.split('(')[1]; - matrix = matrix.split(')')[0]; - matrix = matrix.split(','); - } else { - matrix = []; - } - - if ( matrix.length ) { - - // If IE - if ( matrix.length > 10 ) { - matrix = [ matrix[13], matrix[12], matrix[0], matrix[5] ]; - - } else { - matrix = [ matrix[5], matrix[4], matrix[0], matrix[3]]; - } - - matrix = matrix.map(parseFloat); - - } else { - matrix = [ 0, 0, 1, 1 ]; - - var transRegex = /\.*translate\((.*)px,(.*)px\)/i; - var transRez = transRegex.exec( $el.eq( 0 ).attr('style') ); - - if ( transRez ) { - matrix[ 0 ] = parseFloat( transRez[2] ); - matrix[ 1 ] = parseFloat( transRez[1] ); - } - } - - return { - top : matrix[ 0 ], - left : matrix[ 1 ], - scaleX : matrix[ 2 ], - scaleY : matrix[ 3 ], - opacity : parseFloat( $el.css('opacity') ), - width : $el.width(), - height : $el.height() - }; - - }, - - - // Shortcut for setting "translate3d" properties for element - // Can set be used to set opacity, too - // ======================================================== - - setTranslate : function( $el, props ) { - var str = ''; - var css = {}; - - if ( !$el || !props ) { - return; - } - - if ( props.left !== undefined || props.top !== undefined ) { - str = ( props.left === undefined ? $el.position().left : props.left ) + 'px, ' + ( props.top === undefined ? $el.position().top : props.top ) + 'px'; - - if ( this.use3d ) { - str = 'translate3d(' + str + ', 0px)'; - - } else { - str = 'translate(' + str + ')'; - } - } - - if ( props.scaleX !== undefined && props.scaleY !== undefined ) { - str = (str.length ? str + ' ' : '') + 'scale(' + props.scaleX + ', ' + props.scaleY + ')'; - } - - if ( str.length ) { - css.transform = str; - } - - if ( props.opacity !== undefined ) { - css.opacity = props.opacity; - } - - if ( props.width !== undefined ) { - css.width = props.width; - } - - if ( props.height !== undefined ) { - css.height = props.height; - } - - return $el.css( css ); - }, - - - // Simple CSS transition handler - // ============================= - - animate : function ( $el, to, duration, callback, leaveAnimationName ) { - if ( $.isFunction( duration ) ) { - callback = duration; - duration = null; - } - - if ( !$.isPlainObject( to ) ) { - $el.removeAttr( 'style' ); - } - - $el.on( transitionEnd, function(e) { - - // Skip events from child elements and z-index change - if ( e && e.originalEvent && ( !$el.is( e.originalEvent.target ) || e.originalEvent.propertyName == 'z-index' ) ) { - return; - } - - $.fancybox.stop( $el ); - - if ( $.isPlainObject( to ) ) { - - if ( to.scaleX !== undefined && to.scaleY !== undefined ) { - $el.css( 'transition-duration', '' ); - - to.width = Math.round( $el.width() * to.scaleX ); - to.height = Math.round( $el.height() * to.scaleY ); - - to.scaleX = 1; - to.scaleY = 1; - - $.fancybox.setTranslate( $el, to ); - } - - if ( leaveAnimationName === false ) { - $el.removeAttr( 'style' ); - } - - } else if ( leaveAnimationName !== true ) { - $el.removeClass( to ); - } - - if ( $.isFunction( callback ) ) { - callback( e ); - } - - }); - - if ( $.isNumeric( duration ) ) { - $el.css( 'transition-duration', duration + 'ms' ); - } - - if ( $.isPlainObject( to ) ) { - $.fancybox.setTranslate( $el, to ); - - } else { - $el.addClass( to ); - } - - if ( to.scaleX && $el.hasClass( 'fancybox-image-wrap' ) ) { - $el.parent().addClass( 'fancybox-is-scaling' ); - } - - // Make sure that `transitionend` callback gets fired - $el.data("timer", setTimeout(function() { - $el.trigger( 'transitionend' ); - }, duration + 16)); - - }, - - stop : function( $el ) { - clearTimeout( $el.data("timer") ); - - $el.off( 'transitionend' ).css( 'transition-duration', '' ); - - if ( $el.hasClass( 'fancybox-image-wrap' ) ) { - $el.parent().removeClass( 'fancybox-is-scaling' ); - } - } - - }; - - - // Default click handler for "fancyboxed" links - // ============================================ - - function _run( e ) { - var $target = $( e.currentTarget ), - opts = e.data ? e.data.options : {}, - value = $target.attr( 'data-fancybox' ) || '', - index = 0, - items = []; - - // Avoid opening multiple times - if ( e.isDefaultPrevented() ) { - return; - } - - e.preventDefault(); - - // Get all related items and find index for clicked one - if ( value ) { - items = opts.selector ? $( opts.selector ) : ( e.data ? e.data.items : [] ); - items = items.length ? items.filter( '[data-fancybox="' + value + '"]' ) : $( '[data-fancybox="' + value + '"]' ); - - index = items.index( $target ); - - // Sometimes current item can not be found - // (for example, when slider clones items) - if ( index < 0 ) { - index = 0; - } - - } else { - items = [ $target ]; - } - - $.fancybox.open( items, opts, index ); - } - - - // Create a jQuery plugin - // ====================== - - $.fn.fancybox = function (options) { - var selector; - - options = options || {}; - selector = options.selector || false; - - if ( selector ) { - - $( 'body' ).off( 'click.fb-start', selector ).on( 'click.fb-start', selector, { - options : options - }, _run ); - - } else { - - this.off( 'click.fb-start' ).on( 'click.fb-start', { - items : this, - options : options - }, _run); - - } - - return this; - }; - - - // Self initializing plugin - // ======================== - - $D.on( 'click.fb-start', '[data-fancybox]', _run ); - -}( window, document, window.jQuery || jQuery )); diff --git a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/src/js/fullscreen.js b/mayan/apps/appearance/static/appearance/vendors/fancybox-master/src/js/fullscreen.js deleted file mode 100644 index 27143ef609..0000000000 --- a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/src/js/fullscreen.js +++ /dev/null @@ -1,210 +0,0 @@ -// ========================================================================== -// -// FullScreen -// Adds fullscreen functionality -// -// ========================================================================== -;(function (document, $) { - 'use strict'; - - // Collection of methods supported by user browser - var fn = (function () { - - var fnMap = [ - [ - 'requestFullscreen', - 'exitFullscreen', - 'fullscreenElement', - 'fullscreenEnabled', - 'fullscreenchange', - 'fullscreenerror' - ], - // new WebKit - [ - 'webkitRequestFullscreen', - 'webkitExitFullscreen', - 'webkitFullscreenElement', - 'webkitFullscreenEnabled', - 'webkitfullscreenchange', - 'webkitfullscreenerror' - - ], - // old WebKit (Safari 5.1) - [ - 'webkitRequestFullScreen', - 'webkitCancelFullScreen', - 'webkitCurrentFullScreenElement', - 'webkitCancelFullScreen', - 'webkitfullscreenchange', - 'webkitfullscreenerror' - - ], - [ - 'mozRequestFullScreen', - 'mozCancelFullScreen', - 'mozFullScreenElement', - 'mozFullScreenEnabled', - 'mozfullscreenchange', - 'mozfullscreenerror' - ], - [ - 'msRequestFullscreen', - 'msExitFullscreen', - 'msFullscreenElement', - 'msFullscreenEnabled', - 'MSFullscreenChange', - 'MSFullscreenError' - ] - ]; - - var val; - var ret = {}; - var i, j; - - for ( i = 0; i < fnMap.length; i++ ) { - val = fnMap[ i ]; - - if ( val && val[ 1 ] in document ) { - for ( j = 0; j < val.length; j++ ) { - ret[ fnMap[ 0 ][ j ] ] = val[ j ]; - } - - return ret; - } - } - - return false; - })(); - - // If browser does not have Full Screen API, then simply unset default button template and stop - if ( !fn ) { - - if ( $ && $.fancybox ) { - $.fancybox.defaults.btnTpl.fullScreen = false; - } - - return; - } - - var FullScreen = { - - request : function ( elem ) { - - elem = elem || document.documentElement; - - elem[ fn.requestFullscreen ]( elem.ALLOW_KEYBOARD_INPUT ); - - }, - exit : function () { - - document[ fn.exitFullscreen ](); - - }, - toggle : function ( elem ) { - - elem = elem || document.documentElement; - - if ( this.isFullscreen() ) { - this.exit(); - - } else { - this.request( elem ); - } - - }, - isFullscreen : function() { - - return Boolean( document[ fn.fullscreenElement ] ); - - }, - enabled : function() { - - return Boolean( document[ fn.fullscreenEnabled ] ); - - } - }; - - $.extend(true, $.fancybox.defaults, { - btnTpl : { - fullScreen : - '' - }, - fullScreen : { - autoStart : false - } - }); - - $(document).on({ - 'onInit.fb' : function(e, instance) { - var $container; - - if ( instance && instance.group[ instance.currIndex ].opts.fullScreen ) { - $container = instance.$refs.container; - - $container.on('click.fb-fullscreen', '[data-fancybox-fullscreen]', function(e) { - - e.stopPropagation(); - e.preventDefault(); - - FullScreen.toggle( $container[ 0 ] ); - - }); - - if ( instance.opts.fullScreen && instance.opts.fullScreen.autoStart === true ) { - FullScreen.request( $container[ 0 ] ); - } - - // Expose API - instance.FullScreen = FullScreen; - - } else if ( instance ) { - instance.$refs.toolbar.find('[data-fancybox-fullscreen]').hide(); - } - - }, - - 'afterKeydown.fb' : function(e, instance, current, keypress, keycode) { - - // "P" or Spacebar - if ( instance && instance.FullScreen && keycode === 70 ) { - keypress.preventDefault(); - - instance.FullScreen.toggle( instance.$refs.container[ 0 ] ); - } - - }, - - 'beforeClose.fb' : function( instance ) { - if ( instance && instance.FullScreen ) { - FullScreen.exit(); - } - } - }); - - $(document).on(fn.fullscreenchange, function() { - var isFullscreen = FullScreen.isFullscreen(), - instance = $.fancybox.getInstance(); - - if ( instance ) { - - // If image is zooming, then force to stop and reposition properly - if ( instance.current && instance.current.type === 'image' && instance.isAnimating ) { - instance.current.$content.css( 'transition', 'none' ); - - instance.isAnimating = false; - - instance.update( true, true, 0 ); - } - - instance.trigger( 'onFullscreenChange', isFullscreen ); - - instance.$refs.container.toggleClass( 'fancybox-is-fullscreen', isFullscreen ); - } - - }); - -}( document, window.jQuery || jQuery )); diff --git a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/src/js/guestures.js b/mayan/apps/appearance/static/appearance/vendors/fancybox-master/src/js/guestures.js deleted file mode 100644 index cc113fe033..0000000000 --- a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/src/js/guestures.js +++ /dev/null @@ -1,919 +0,0 @@ -// ========================================================================== -// -// Guestures -// Adds touch guestures, handles click and tap events -// -// ========================================================================== -;(function (window, document, $) { - 'use strict'; - - var requestAFrame = (function () { - return window.requestAnimationFrame || - window.webkitRequestAnimationFrame || - window.mozRequestAnimationFrame || - window.oRequestAnimationFrame || - // if all else fails, use setTimeout - function (callback) { - return window.setTimeout(callback, 1000 / 60); - }; - })(); - - var cancelAFrame = (function () { - return window.cancelAnimationFrame || - window.webkitCancelAnimationFrame || - window.mozCancelAnimationFrame || - window.oCancelAnimationFrame || - function (id) { - window.clearTimeout(id); - }; - })(); - - var pointers = function( e ) { - var result = []; - - e = e.originalEvent || e || window.e; - e = e.touches && e.touches.length ? e.touches : ( e.changedTouches && e.changedTouches.length ? e.changedTouches : [ e ] ); - - for ( var key in e ) { - - if ( e[ key ].pageX ) { - result.push( { x : e[ key ].pageX, y : e[ key ].pageY } ); - - } else if ( e[ key ].clientX ) { - result.push( { x : e[ key ].clientX, y : e[ key ].clientY } ); - } - } - - return result; - }; - - var distance = function( point2, point1, what ) { - if ( !point1 || !point2 ) { - return 0; - } - - if ( what === 'x' ) { - return point2.x - point1.x; - - } else if ( what === 'y' ) { - return point2.y - point1.y; - } - - return Math.sqrt( Math.pow( point2.x - point1.x, 2 ) + Math.pow( point2.y - point1.y, 2 ) ); - }; - - var isClickable = function( $el ) { - if ( $el.is('a,area,button,[role="button"],input,label,select,summary,textarea') || $.isFunction( $el.get(0).onclick ) || $el.data('selectable') ) { - return true; - } - - // Check for attributes like data-fancybox-next or data-fancybox-close - for ( var i = 0, atts = $el[0].attributes, n = atts.length; i < n; i++ ) { - if ( atts[i].nodeName.substr(0, 14) === 'data-fancybox-' ) { - return true; - } - } - - return false; - }; - - var hasScrollbars = function( el ) { - var overflowY = window.getComputedStyle( el )['overflow-y']; - var overflowX = window.getComputedStyle( el )['overflow-x']; - - var vertical = (overflowY === 'scroll' || overflowY === 'auto') && el.scrollHeight > el.clientHeight; - var horizontal = (overflowX === 'scroll' || overflowX === 'auto') && el.scrollWidth > el.clientWidth; - - return vertical || horizontal; - }; - - var isScrollable = function ( $el ) { - var rez = false; - - while ( true ) { - rez = hasScrollbars( $el.get(0) ); - - if ( rez ) { - break; - } - - $el = $el.parent(); - - if ( !$el.length || $el.hasClass( 'fancybox-stage' ) || $el.is( 'body' ) ) { - break; - } - } - - return rez; - }; - - - var Guestures = function ( instance ) { - var self = this; - - self.instance = instance; - - self.$bg = instance.$refs.bg; - self.$stage = instance.$refs.stage; - self.$container = instance.$refs.container; - - self.destroy(); - - self.$container.on( 'touchstart.fb.touch mousedown.fb.touch', $.proxy(self, 'ontouchstart') ); - }; - - Guestures.prototype.destroy = function() { - this.$container.off( '.fb.touch' ); - }; - - Guestures.prototype.ontouchstart = function( e ) { - var self = this; - - var $target = $( e.target ); - var instance = self.instance; - var current = instance.current; - var $content = current.$content; - - var isTouchDevice = ( e.type == 'touchstart' ); - - // Do not respond to both (touch and mouse) events - if ( isTouchDevice ) { - self.$container.off( 'mousedown.fb.touch' ); - } - - // Ignore right click - if ( e.originalEvent && e.originalEvent.button == 2 ) { - return; - } - - // Ignore taping on links, buttons, input elements - if ( !$target.length || isClickable( $target ) || isClickable( $target.parent() ) ) { - return; - } - - // Ignore clicks on the scrollbar - if ( !$target.is('img') && e.originalEvent.clientX > $target[0].clientWidth + $target.offset().left ) { - return; - } - - // Ignore clicks while zooming or closing - if ( !current || self.instance.isAnimating || self.instance.isClosing ) { - e.stopPropagation(); - e.preventDefault(); - - return; - } - - self.realPoints = self.startPoints = pointers( e ); - - if ( !self.startPoints ) { - return; - } - - e.stopPropagation(); - - self.startEvent = e; - - self.canTap = true; - self.$target = $target; - self.$content = $content; - self.opts = current.opts.touch; - - self.isPanning = false; - self.isSwiping = false; - self.isZooming = false; - self.isScrolling = false; - - self.sliderStartPos = self.sliderLastPos || { top: 0, left: 0 }; - self.contentStartPos = $.fancybox.getTranslate( self.$content ); - self.contentLastPos = null; - - self.startTime = new Date().getTime(); - self.distanceX = self.distanceY = self.distance = 0; - - self.canvasWidth = Math.round( current.$slide[0].clientWidth ); - self.canvasHeight = Math.round( current.$slide[0].clientHeight ); - - $(document) - .off( '.fb.touch' ) - .on( isTouchDevice ? 'touchend.fb.touch touchcancel.fb.touch' : 'mouseup.fb.touch mouseleave.fb.touch', $.proxy(self, "ontouchend")) - .on( isTouchDevice ? 'touchmove.fb.touch' : 'mousemove.fb.touch', $.proxy(self, "ontouchmove")); - - if ( $.fancybox.isMobile ) { - document.addEventListener('scroll', self.onscroll, true); - } - - if ( !(self.opts || instance.canPan() ) || !( $target.is( self.$stage ) || self.$stage.find( $target ).length ) ) { - - // Prevent image ghosting while dragging - if ( $target.is('img') ) { - e.preventDefault(); - } - - return; - } - - if ( !( $.fancybox.isMobile && ( isScrollable( $target ) || isScrollable( $target.parent() ) ) ) ) { - e.preventDefault(); - } - - if ( self.startPoints.length === 1 ) { - if ( current.type === 'image' && ( self.contentStartPos.width > self.canvasWidth + 1 || self.contentStartPos.height > self.canvasHeight + 1 ) ) { - $.fancybox.stop( self.$content ); - - self.$content.css( 'transition-duration', '' ); - - self.isPanning = true; - - } else { - self.isSwiping = true; - } - - self.$container.addClass( 'fancybox-controls--isGrabbing' ); - } - - if ( self.startPoints.length === 2 && !instance.isAnimating && !current.hasError && current.type === 'image' && ( current.isLoaded || current.$ghost ) ) { - self.canTap = false; - self.isSwiping = false; - self.isPanning = false; - - self.isZooming = true; - - $.fancybox.stop( self.$content ); - - self.$content.css( 'transition-duration', '' ); - - self.centerPointStartX = ( ( self.startPoints[0].x + self.startPoints[1].x ) * 0.5 ) - $(window).scrollLeft(); - self.centerPointStartY = ( ( self.startPoints[0].y + self.startPoints[1].y ) * 0.5 ) - $(window).scrollTop(); - - self.percentageOfImageAtPinchPointX = ( self.centerPointStartX - self.contentStartPos.left ) / self.contentStartPos.width; - self.percentageOfImageAtPinchPointY = ( self.centerPointStartY - self.contentStartPos.top ) / self.contentStartPos.height; - - self.startDistanceBetweenFingers = distance( self.startPoints[0], self.startPoints[1] ); - } - - }; - - Guestures.prototype.onscroll = function(e) { - self.isScrolling = true; - }; - - Guestures.prototype.ontouchmove = function( e ) { - var self = this, - $target = $(e.target); - - if ( self.isScrolling || !( $target.is( self.$stage ) || self.$stage.find( $target ).length ) ) { - self.canTap = false; - - return; - } - - self.newPoints = pointers( e ); - - if ( !( self.opts || self.instance.canPan() ) || !self.newPoints || !self.newPoints.length ) { - return; - } - - if ( !(self.isSwiping && self.isSwiping === true) ) { - e.preventDefault(); - } - - self.distanceX = distance( self.newPoints[0], self.startPoints[0], 'x' ); - self.distanceY = distance( self.newPoints[0], self.startPoints[0], 'y' ); - - self.distance = distance( self.newPoints[0], self.startPoints[0] ) - - // Skip false ontouchmove events (Chrome) - if ( self.distance > 0 ) { - if ( self.isSwiping ) { - self.onSwipe(e); - - } else if ( self.isPanning ) { - self.onPan(); - - } else if ( self.isZooming ) { - self.onZoom(); - } - } - - }; - - Guestures.prototype.onSwipe = function(e) { - var self = this, - swiping = self.isSwiping, - left = self.sliderStartPos.left || 0, - angle; - - // If direction is not yet determined - if ( swiping === true ) { - - // We need at least 10px distance to correctly calculate an angle - if ( Math.abs( self.distance ) > 10 ) { - self.canTap = false; - - if ( self.instance.group.length < 2 && self.opts.vertical ) { - self.isSwiping = 'y'; - - } else if ( self.instance.isDragging || self.opts.vertical === false || ( self.opts.vertical === 'auto' && $( window ).width() > 800 ) ) { - self.isSwiping = 'x'; - - } else { - angle = Math.abs( Math.atan2( self.distanceY, self.distanceX ) * 180 / Math.PI ); - - self.isSwiping = ( angle > 45 && angle < 135 ) ? 'y' : 'x'; - } - - self.canTap = false; - - if ( self.isSwiping === 'y' && $.fancybox.isMobile && ( isScrollable( self.$target ) || isScrollable( self.$target.parent() ) ) ) { - self.isScrolling = true; - - return; - } - - self.instance.isDragging = self.isSwiping; - - // Reset points to avoid jumping, because we dropped first swipes to calculate the angle - self.startPoints = self.newPoints; - - $.each(self.instance.slides, function( index, slide ) { - $.fancybox.stop( slide.$slide ); - - slide.$slide.css( 'transition-duration', '' ); - - slide.inTransition = false; - - if ( slide.pos === self.instance.current.pos ) { - self.sliderStartPos.left = $.fancybox.getTranslate( slide.$slide ).left; - } - }); - - // Stop slideshow - if ( self.instance.SlideShow && self.instance.SlideShow.isActive ) { - self.instance.SlideShow.stop(); - } - } - - return; - } - - // Sticky edges - if ( swiping == 'x' ) { - if ( self.distanceX > 0 && ( self.instance.group.length < 2 || ( self.instance.current.index === 0 && !self.instance.current.opts.loop ) ) ) { - left = left + Math.pow( self.distanceX, 0.8 ); - - } else if ( self.distanceX < 0 && ( self.instance.group.length < 2 || ( self.instance.current.index === self.instance.group.length - 1 && !self.instance.current.opts.loop ) ) ) { - left = left - Math.pow( -self.distanceX, 0.8 ); - - } else { - left = left + self.distanceX; - } - } - - self.sliderLastPos = { - top : swiping == 'x' ? 0 : self.sliderStartPos.top + self.distanceY, - left : left - }; - - if ( self.requestId ) { - cancelAFrame( self.requestId ); - - self.requestId = null; - } - - self.requestId = requestAFrame(function() { - - if ( self.sliderLastPos ) { - $.each(self.instance.slides, function( index, slide ) { - var pos = slide.pos - self.instance.currPos; - - $.fancybox.setTranslate( slide.$slide, { - top : self.sliderLastPos.top, - left : self.sliderLastPos.left + ( pos * self.canvasWidth ) + ( pos * slide.opts.gutter ) - }); - }); - - self.$container.addClass( 'fancybox-is-sliding' ); - } - - }); - - }; - - Guestures.prototype.onPan = function() { - var self = this; - - // Sometimes, when tapping causally, image can move a bit and that breaks double tapping - if ( distance( self.newPoints[0], self.realPoints[0] ) < ($.fancybox.isMobile ? 10 : 5) ) { - self.startPoints = self.newPoints; - return; - } - - self.canTap = false; - - self.contentLastPos = self.limitMovement(); - - if ( self.requestId ) { - cancelAFrame( self.requestId ); - - self.requestId = null; - } - - self.requestId = requestAFrame(function() { - $.fancybox.setTranslate( self.$content, self.contentLastPos ); - }); - }; - - // Make panning sticky to the edges - Guestures.prototype.limitMovement = function() { - var self = this; - - var canvasWidth = self.canvasWidth; - var canvasHeight = self.canvasHeight; - - var distanceX = self.distanceX; - var distanceY = self.distanceY; - - var contentStartPos = self.contentStartPos; - - var currentOffsetX = contentStartPos.left; - var currentOffsetY = contentStartPos.top; - - var currentWidth = contentStartPos.width; - var currentHeight = contentStartPos.height; - - var minTranslateX, minTranslateY, - maxTranslateX, maxTranslateY, - newOffsetX, newOffsetY; - - if ( currentWidth > canvasWidth ) { - newOffsetX = currentOffsetX + distanceX; - - } else { - newOffsetX = currentOffsetX; - } - - newOffsetY = currentOffsetY + distanceY; - - // Slow down proportionally to traveled distance - minTranslateX = Math.max( 0, canvasWidth * 0.5 - currentWidth * 0.5 ); - minTranslateY = Math.max( 0, canvasHeight * 0.5 - currentHeight * 0.5 ); - - maxTranslateX = Math.min( canvasWidth - currentWidth, canvasWidth * 0.5 - currentWidth * 0.5 ); - maxTranslateY = Math.min( canvasHeight - currentHeight, canvasHeight * 0.5 - currentHeight * 0.5 ); - - if ( currentWidth > canvasWidth ) { - - // -> - if ( distanceX > 0 && newOffsetX > minTranslateX ) { - newOffsetX = minTranslateX - 1 + Math.pow( -minTranslateX + currentOffsetX + distanceX, 0.8 ) || 0; - } - - // <- - if ( distanceX < 0 && newOffsetX < maxTranslateX ) { - newOffsetX = maxTranslateX + 1 - Math.pow( maxTranslateX - currentOffsetX - distanceX, 0.8 ) || 0; - } - - } - - if ( currentHeight > canvasHeight ) { - - // \/ - if ( distanceY > 0 && newOffsetY > minTranslateY ) { - newOffsetY = minTranslateY - 1 + Math.pow(-minTranslateY + currentOffsetY + distanceY, 0.8 ) || 0; - } - - // /\ - if ( distanceY < 0 && newOffsetY < maxTranslateY ) { - newOffsetY = maxTranslateY + 1 - Math.pow ( maxTranslateY - currentOffsetY - distanceY, 0.8 ) || 0; - } - - } - - return { - top : newOffsetY, - left : newOffsetX, - scaleX : contentStartPos.scaleX, - scaleY : contentStartPos.scaleY - }; - - }; - - Guestures.prototype.limitPosition = function( newOffsetX, newOffsetY, newWidth, newHeight ) { - var self = this; - - var canvasWidth = self.canvasWidth; - var canvasHeight = self.canvasHeight; - - if ( newWidth > canvasWidth ) { - newOffsetX = newOffsetX > 0 ? 0 : newOffsetX; - newOffsetX = newOffsetX < canvasWidth - newWidth ? canvasWidth - newWidth : newOffsetX; - - } else { - - // Center horizontally - newOffsetX = Math.max( 0, canvasWidth / 2 - newWidth / 2 ); - - } - - if ( newHeight > canvasHeight ) { - newOffsetY = newOffsetY > 0 ? 0 : newOffsetY; - newOffsetY = newOffsetY < canvasHeight - newHeight ? canvasHeight - newHeight : newOffsetY; - - } else { - - // Center vertically - newOffsetY = Math.max( 0, canvasHeight / 2 - newHeight / 2 ); - - } - - return { - top : newOffsetY, - left : newOffsetX - }; - - }; - - Guestures.prototype.onZoom = function() { - var self = this; - - // Calculate current distance between points to get pinch ratio and new width and height - - var currentWidth = self.contentStartPos.width; - var currentHeight = self.contentStartPos.height; - - var currentOffsetX = self.contentStartPos.left; - var currentOffsetY = self.contentStartPos.top; - - var endDistanceBetweenFingers = distance( self.newPoints[0], self.newPoints[1] ); - - var pinchRatio = endDistanceBetweenFingers / self.startDistanceBetweenFingers; - - var newWidth = Math.floor( currentWidth * pinchRatio ); - var newHeight = Math.floor( currentHeight * pinchRatio ); - - // This is the translation due to pinch-zooming - var translateFromZoomingX = (currentWidth - newWidth) * self.percentageOfImageAtPinchPointX; - var translateFromZoomingY = (currentHeight - newHeight) * self.percentageOfImageAtPinchPointY; - - //Point between the two touches - - var centerPointEndX = ((self.newPoints[0].x + self.newPoints[1].x) / 2) - $(window).scrollLeft(); - var centerPointEndY = ((self.newPoints[0].y + self.newPoints[1].y) / 2) - $(window).scrollTop(); - - // And this is the translation due to translation of the centerpoint - // between the two fingers - - var translateFromTranslatingX = centerPointEndX - self.centerPointStartX; - var translateFromTranslatingY = centerPointEndY - self.centerPointStartY; - - // The new offset is the old/current one plus the total translation - - var newOffsetX = currentOffsetX + ( translateFromZoomingX + translateFromTranslatingX ); - var newOffsetY = currentOffsetY + ( translateFromZoomingY + translateFromTranslatingY ); - - var newPos = { - top : newOffsetY, - left : newOffsetX, - scaleX : self.contentStartPos.scaleX * pinchRatio, - scaleY : self.contentStartPos.scaleY * pinchRatio - }; - - self.canTap = false; - - self.newWidth = newWidth; - self.newHeight = newHeight; - - self.contentLastPos = newPos; - - if ( self.requestId ) { - cancelAFrame( self.requestId ); - - self.requestId = null; - } - - self.requestId = requestAFrame(function() { - $.fancybox.setTranslate( self.$content, self.contentLastPos ); - }); - - }; - - Guestures.prototype.ontouchend = function( e ) { - var self = this; - var dMs = Math.max( (new Date().getTime() ) - self.startTime, 1); - - var swiping = self.isSwiping; - var panning = self.isPanning; - var zooming = self.isZooming; - var scrolling = self.isScrolling; - - self.endPoints = pointers( e ); - - self.$container.removeClass( 'fancybox-controls--isGrabbing' ); - - $(document).off( '.fb.touch' ); - - document.removeEventListener('scroll', self.onscroll, true); - - if ( self.requestId ) { - cancelAFrame( self.requestId ); - - self.requestId = null; - } - - self.isSwiping = false; - self.isPanning = false; - self.isZooming = false; - self.isScrolling = false; - - self.instance.isDragging = false; - - if ( self.canTap ) { - return self.onTap( e ); - } - - self.speed = 366; - - // Speed in px/ms - self.velocityX = self.distanceX / dMs * 0.5; - self.velocityY = self.distanceY / dMs * 0.5; - - self.speedX = Math.max( self.speed * 0.5, Math.min( self.speed * 1.5, ( 1 / Math.abs( self.velocityX ) ) * self.speed ) ); - - if ( panning ) { - self.endPanning(); - - } else if ( zooming ) { - self.endZooming(); - - } else { - self.endSwiping( swiping, scrolling ); - } - - return; - }; - - Guestures.prototype.endSwiping = function( swiping, scrolling ) { - var self = this, - ret = false, - len = self.instance.group.length; - - self.sliderLastPos = null; - - // Close if swiped vertically / navigate if horizontally - if ( swiping == 'y' && !scrolling && Math.abs( self.distanceY ) > 50 ) { - - // Continue vertical movement - $.fancybox.animate( self.instance.current.$slide, { - top : self.sliderStartPos.top + self.distanceY + ( self.velocityY * 150 ), - opacity : 0 - }, 150 ); - - ret = self.instance.close( true, 300 ); - - } else if ( swiping == 'x' && self.distanceX > 50 && len > 1 ) { - ret = self.instance.previous( self.speedX ); - - } else if ( swiping == 'x' && self.distanceX < -50 && len > 1 ) { - ret = self.instance.next( self.speedX ); - } - - if ( ret === false && ( swiping == 'x' || swiping == 'y' ) ) { - if ( scrolling || len < 2 ) { - self.instance.centerSlide( self.instance.current, 150 ); - } else { - self.instance.jumpTo( self.instance.current.index ); - } - } - - self.$container.removeClass( 'fancybox-is-sliding' ); - - }; - - // Limit panning from edges - // ======================== - - Guestures.prototype.endPanning = function() { - - var self = this; - var newOffsetX, newOffsetY, newPos; - - if ( !self.contentLastPos ) { - return; - } - - if ( self.opts.momentum === false ) { - newOffsetX = self.contentLastPos.left; - newOffsetY = self.contentLastPos.top; - - } else { - - // Continue movement - newOffsetX = self.contentLastPos.left + ( self.velocityX * self.speed ); - newOffsetY = self.contentLastPos.top + ( self.velocityY * self.speed ); - } - - newPos = self.limitPosition( newOffsetX, newOffsetY, self.contentStartPos.width, self.contentStartPos.height ); - - newPos.width = self.contentStartPos.width; - newPos.height = self.contentStartPos.height; - - $.fancybox.animate( self.$content, newPos, 330 ); - }; - - - Guestures.prototype.endZooming = function() { - var self = this; - - var current = self.instance.current; - - var newOffsetX, newOffsetY, newPos, reset; - - var newWidth = self.newWidth; - var newHeight = self.newHeight; - - if ( !self.contentLastPos ) { - return; - } - - newOffsetX = self.contentLastPos.left; - newOffsetY = self.contentLastPos.top; - - reset = { - top : newOffsetY, - left : newOffsetX, - width : newWidth, - height : newHeight, - scaleX : 1, - scaleY : 1 - }; - - // Reset scalex/scaleY values; this helps for perfomance and does not break animation - $.fancybox.setTranslate( self.$content, reset ); - - if ( newWidth < self.canvasWidth && newHeight < self.canvasHeight ) { - self.instance.scaleToFit( 150 ); - - } else if ( newWidth > current.width || newHeight > current.height ) { - self.instance.scaleToActual( self.centerPointStartX, self.centerPointStartY, 150 ); - - } else { - - newPos = self.limitPosition( newOffsetX, newOffsetY, newWidth, newHeight ); - - // Switch from scale() to width/height or animation will not work correctly - $.fancybox.setTranslate( self.content, $.fancybox.getTranslate( self.$content ) ); - - $.fancybox.animate( self.$content, newPos, 150 ); - } - - }; - - Guestures.prototype.onTap = function(e) { - var self = this; - var $target = $( e.target ); - - var instance = self.instance; - var current = instance.current; - - var endPoints = ( e && pointers( e ) ) || self.startPoints; - - var tapX = endPoints[0] ? endPoints[0].x - self.$stage.offset().left : 0; - var tapY = endPoints[0] ? endPoints[0].y - self.$stage.offset().top : 0; - - var where; - - var process = function ( prefix ) { - - var action = current.opts[ prefix ]; - - if ( $.isFunction( action ) ) { - action = action.apply( instance, [ current, e ] ); - } - - if ( !action) { - return; - } - - switch ( action ) { - - case "close" : - - instance.close( self.startEvent ); - - break; - - case "toggleControls" : - - instance.toggleControls( true ); - - break; - - case "next" : - - instance.next(); - - break; - - case "nextOrClose" : - - if ( instance.group.length > 1 ) { - instance.next(); - - } else { - instance.close( self.startEvent ); - } - - break; - - case "zoom" : - - if ( current.type == 'image' && ( current.isLoaded || current.$ghost ) ) { - - if ( instance.canPan() ) { - instance.scaleToFit(); - - } else if ( instance.isScaledDown() ) { - instance.scaleToActual( tapX, tapY ); - - } else if ( instance.group.length < 2 ) { - instance.close( self.startEvent ); - } - } - - break; - } - - }; - - // Ignore right click - if ( e.originalEvent && e.originalEvent.button == 2 ) { - return; - } - - // Skip if clicked on the scrollbar - if ( !$target.is('img') && tapX > $target[0].clientWidth + $target.offset().left ) { - return; - } - - // Check where is clicked - if ( $target.is( '.fancybox-bg,.fancybox-inner,.fancybox-outer,.fancybox-container' ) ) { - where = 'Outside'; - - } else if ( $target.is( '.fancybox-slide' ) ) { - where = 'Slide'; - - } else if ( instance.current.$content && instance.current.$content.find( $target ).addBack().filter( $target ).length ) { - where = 'Content'; - - } else { - return; - } - - // Check if this is a double tap - if ( self.tapped ) { - - // Stop previously created single tap - clearTimeout( self.tapped ); - self.tapped = null; - - // Skip if distance between taps is too big - if ( Math.abs( tapX - self.tapX ) > 50 || Math.abs( tapY - self.tapY ) > 50 ) { - return this; - } - - // OK, now we assume that this is a double-tap - process( 'dblclick' + where ); - - } else { - - // Single tap will be processed if user has not clicked second time within 300ms - // or there is no need to wait for double-tap - self.tapX = tapX; - self.tapY = tapY; - - if ( current.opts[ 'dblclick' + where ] && current.opts[ 'dblclick' + where ] !== current.opts[ 'click' + where ] ) { - - self.tapped = setTimeout(function() { - self.tapped = null; - - process( 'click' + where ); - - }, 500); - - } else { - process( 'click' + where ); - } - - } - - return this; - }; - - $(document).on('onActivate.fb', function (e, instance) { - if ( instance && !instance.Guestures ) { - instance.Guestures = new Guestures( instance ); - } - }); - -}( window, document, window.jQuery || jQuery )); diff --git a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/src/js/hash.js b/mayan/apps/appearance/static/appearance/vendors/fancybox-master/src/js/hash.js deleted file mode 100644 index 42287006d5..0000000000 --- a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/src/js/hash.js +++ /dev/null @@ -1,218 +0,0 @@ -// ========================================================================== -// -// Hash -// Enables linking to each modal -// -// ========================================================================== -;(function (document, window, $) { - 'use strict'; - - // Simple $.escapeSelector polyfill (for jQuery prior v3) - if ( !$.escapeSelector ) { - $.escapeSelector = function( sel ) { - var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g; - var fcssescape = function( ch, asCodePoint ) { - if ( asCodePoint ) { - // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER - if ( ch === "\0" ) { - return "\uFFFD"; - } - - // Control characters and (dependent upon position) numbers get escaped as code points - return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; - } - - // Other potentially-special ASCII characters get backslash-escaped - return "\\" + ch; - }; - - return ( sel + "" ).replace( rcssescape, fcssescape ); - }; - } - - // Create new history entry only once - var shouldCreateHistory = true; - - // Variable containing last hash value set by fancyBox - // It will be used to determine if fancyBox needs to close after hash change is detected - var currentHash = null; - - // Throttling the history change - var timerID = null; - - // Get info about gallery name and current index from url - function parseUrl() { - var hash = window.location.hash.substr( 1 ); - var rez = hash.split( '-' ); - var index = rez.length > 1 && /^\+?\d+$/.test( rez[ rez.length - 1 ] ) ? parseInt( rez.pop( -1 ), 10 ) || 1 : 1; - var gallery = rez.join( '-' ); - - // Index is starting from 1 - if ( index < 1 ) { - index = 1; - } - - return { - hash : hash, - index : index, - gallery : gallery - }; - } - - // Trigger click evnt on links to open new fancyBox instance - function triggerFromUrl( url ) { - var $el; - - if ( url.gallery !== '' ) { - - // If we can find element matching 'data-fancybox' atribute, then trigger click event for that .. - $el = $( "[data-fancybox='" + $.escapeSelector( url.gallery ) + "']" ).eq( url.index - 1 ); - - if ( !$el.length ) { - // .. if not, try finding element by ID - $el = $( "#" + $.escapeSelector( url.gallery ) + "" ); - } - - if ( $el.length ) { - shouldCreateHistory = false; - - $el.trigger( 'click' ); - } - - } - } - - // Get gallery name from current instance - function getGalleryID( instance ) { - var opts; - - if ( !instance ) { - return false; - } - - opts = instance.current ? instance.current.opts : instance.opts; - - return opts.hash || ( opts.$orig ? opts.$orig.data( 'fancybox' ) : '' ); - } - - // Start when DOM becomes ready - $(function() { - - // Check if user has disabled this module - if ( $.fancybox.defaults.hash === false ) { - return; - } - - // Update hash when opening/closing fancyBox - $(document).on({ - 'onInit.fb' : function( e, instance ) { - var url, gallery; - - if ( instance.group[ instance.currIndex ].opts.hash === false ) { - return; - } - - url = parseUrl(); - gallery = getGalleryID( instance ); - - // Make sure gallery start index matches index from hash - if ( gallery && url.gallery && gallery == url.gallery ) { - instance.currIndex = url.index - 1; - } - }, - - 'beforeShow.fb' : function( e, instance, current ) { - var gallery; - - if ( !current || current.opts.hash === false ) { - return; - } - - gallery = getGalleryID( instance ); - - // Update window hash - if ( gallery && gallery !== '' ) { - - if ( window.location.hash.indexOf( gallery ) < 0 ) { - instance.opts.origHash = window.location.hash; - } - - currentHash = gallery + ( instance.group.length > 1 ? '-' + ( current.index + 1 ) : '' ); - - if ( 'replaceState' in window.history ) { - if ( timerID ) { - clearTimeout( timerID ); - } - - timerID = setTimeout(function() { - window.history[ shouldCreateHistory ? 'pushState' : 'replaceState' ]( {} , document.title, window.location.pathname + window.location.search + '#' + currentHash ); - - timerID = null; - - shouldCreateHistory = false; - - }, 300); - - } else { - window.location.hash = currentHash; - } - - } - - }, - - 'beforeClose.fb' : function( e, instance, current ) { - var gallery, origHash; - - if ( timerID ) { - clearTimeout( timerID ); - } - - if ( current.opts.hash === false ) { - return; - } - - gallery = getGalleryID( instance ); - origHash = instance && instance.opts.origHash ? instance.opts.origHash : ''; - - // Remove hash from location bar - if ( gallery && gallery !== '' ) { - - if ( 'replaceState' in history ) { - window.history.replaceState( {} , document.title, window.location.pathname + window.location.search + origHash ); - - } else { - window.location.hash = origHash; - - // Keep original scroll position - $( window ).scrollTop( instance.scrollTop ).scrollLeft( instance.scrollLeft ); - } - } - - currentHash = null; - } - }); - - // Check if need to close after url has changed - $(window).on('hashchange.fb', function() { - var url = parseUrl(); - - if ( $.fancybox.getInstance() ) { - if ( currentHash && currentHash !== url.gallery + '-' + url.index && !( url.index === 1 && currentHash == url.gallery ) ) { - currentHash = null; - - $.fancybox.close(); - } - - } else if ( url.gallery !== '' ) { - triggerFromUrl( url ); - } - }); - - // Check current hash and trigger click event on matching element to start fancyBox, if needed - setTimeout(function() { - triggerFromUrl( parseUrl() ); - }, 50); - }); - -}( document, window, window.jQuery || jQuery )); diff --git a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/src/js/media.js b/mayan/apps/appearance/static/appearance/vendors/fancybox-master/src/js/media.js deleted file mode 100644 index 5c3820bc38..0000000000 --- a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/src/js/media.js +++ /dev/null @@ -1,211 +0,0 @@ -// ========================================================================== -// -// Media -// Adds additional media type support -// -// ========================================================================== -;(function ($) { - - 'use strict'; - - // Formats matching url to final form - - var format = function (url, rez, params) { - if ( !url ) { - return; - } - - params = params || ''; - - if ( $.type(params) === "object" ) { - params = $.param(params, true); - } - - $.each(rez, function (key, value) { - url = url.replace('$' + key, value || ''); - }); - - if (params.length) { - url += (url.indexOf('?') > 0 ? '&' : '?') + params; - } - - return url; - }; - - // Object containing properties for each media type - - var defaults = { - youtube : { - matcher : /(youtube\.com|youtu\.be|youtube\-nocookie\.com)\/(watch\?(.*&)?v=|v\/|u\/|embed\/?)?(videoseries\?list=(.*)|[\w-]{11}|\?listType=(.*)&list=(.*))(.*)/i, - params : { - autoplay : 1, - autohide : 1, - fs : 1, - rel : 0, - hd : 1, - wmode : 'transparent', - enablejsapi : 1, - html5 : 1 - }, - paramPlace : 8, - type : 'iframe', - url : '//www.youtube.com/embed/$4', - thumb : '//img.youtube.com/vi/$4/hqdefault.jpg' - }, - - vimeo : { - matcher : /^.+vimeo.com\/(.*\/)?([\d]+)(.*)?/, - params : { - autoplay : 1, - hd : 1, - show_title : 1, - show_byline : 1, - show_portrait : 0, - fullscreen : 1, - api : 1 - }, - paramPlace : 3, - type : 'iframe', - url : '//player.vimeo.com/video/$2' - }, - - metacafe : { - matcher : /metacafe.com\/watch\/(\d+)\/(.*)?/, - type : 'iframe', - url : '//www.metacafe.com/embed/$1/?ap=1' - }, - - dailymotion : { - matcher : /dailymotion.com\/video\/(.*)\/?(.*)/, - params : { - additionalInfos : 0, - autoStart : 1 - }, - type : 'iframe', - url : '//www.dailymotion.com/embed/video/$1' - }, - - vine : { - matcher : /vine.co\/v\/([a-zA-Z0-9\?\=\-]+)/, - type : 'iframe', - url : '//vine.co/v/$1/embed/simple' - }, - - instagram : { - matcher : /(instagr\.am|instagram\.com)\/p\/([a-zA-Z0-9_\-]+)\/?/i, - type : 'image', - url : '//$1/p/$2/media/?size=l' - }, - - // Examples: - // http://maps.google.com/?ll=48.857995,2.294297&spn=0.007666,0.021136&t=m&z=16 - // https://www.google.com/maps/@37.7852006,-122.4146355,14.65z - // https://www.google.com/maps/place/Googleplex/@37.4220041,-122.0833494,17z/data=!4m5!3m4!1s0x0:0x6c296c66619367e0!8m2!3d37.4219998!4d-122.0840572 - gmap_place : { - matcher : /(maps\.)?google\.([a-z]{2,3}(\.[a-z]{2})?)\/(((maps\/(place\/(.*)\/)?\@(.*),(\d+.?\d+?)z))|(\?ll=))(.*)?/i, - type : 'iframe', - url : function (rez) { - return '//maps.google.' + rez[2] + '/?ll=' + ( rez[9] ? rez[9] + '&z=' + Math.floor( rez[10] ) + ( rez[12] ? rez[12].replace(/^\//, "&") : '' ) : rez[12] ) + '&output=' + ( rez[12] && rez[12].indexOf('layer=c') > 0 ? 'svembed' : 'embed' ); - } - }, - - // Examples: - // https://www.google.com/maps/search/Empire+State+Building/ - // https://www.google.com/maps/search/?api=1&query=centurylink+field - // https://www.google.com/maps/search/?api=1&query=47.5951518,-122.3316393 - gmap_search : { - matcher : /(maps\.)?google\.([a-z]{2,3}(\.[a-z]{2})?)\/(maps\/search\/)(.*)/i, - type : 'iframe', - url : function (rez) { - return '//maps.google.' + rez[2] + '/maps?q=' + rez[5].replace('query=', 'q=').replace('api=1', '') + '&output=embed'; - } - } - }; - - $(document).on('objectNeedsType.fb', function (e, instance, item) { - - var url = item.src || '', - type = false, - media, - thumb, - rez, - params, - urlParams, - paramObj, - provider; - - media = $.extend( true, {}, defaults, item.opts.media ); - - // Look for any matching media type - $.each(media, function ( providerName, providerOpts ) { - rez = url.match( providerOpts.matcher ); - - if ( !rez ) { - return; - } - - type = providerOpts.type; - paramObj = {}; - - if ( providerOpts.paramPlace && rez[ providerOpts.paramPlace ] ) { - urlParams = rez[ providerOpts.paramPlace ]; - - if ( urlParams[ 0 ] == '?' ) { - urlParams = urlParams.substring(1); - } - - urlParams = urlParams.split('&'); - - for ( var m = 0; m < urlParams.length; ++m ) { - var p = urlParams[ m ].split('=', 2); - - if ( p.length == 2 ) { - paramObj[ p[0] ] = decodeURIComponent( p[1].replace(/\+/g, " ") ); - } - } - } - - params = $.extend( true, {}, providerOpts.params, item.opts[ providerName ], paramObj ); - - url = $.type( providerOpts.url ) === "function" ? providerOpts.url.call( this, rez, params, item ) : format( providerOpts.url, rez, params ); - thumb = $.type( providerOpts.thumb ) === "function" ? providerOpts.thumb.call( this, rez, params, item ) : format( providerOpts.thumb, rez ); - - if ( providerName === 'vimeo' ) { - url = url.replace('&%23', '#'); - } - - return false; - }); - - // If it is found, then change content type and update the url - - if ( type ) { - item.src = url; - item.type = type; - - if ( !item.opts.thumb && !( item.opts.$thumb && item.opts.$thumb.length ) ) { - item.opts.thumb = thumb; - } - - if ( type === 'iframe' ) { - $.extend(true, item.opts, { - iframe : { - preload : false, - attr : { - scrolling : "no" - } - } - }); - - item.contentProvider = provider; - - item.opts.slideClass += ' fancybox-slide--' + ( provider == 'gmap_place' || provider == 'gmap_search' ? 'map' : 'video' ); - } - - } else if ( url ) { - item.type = item.opts.defaultType; - } - - }); - -}( window.jQuery || jQuery )); diff --git a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/src/js/share.js b/mayan/apps/appearance/static/appearance/vendors/fancybox-master/src/js/share.js deleted file mode 100644 index 789284739e..0000000000 --- a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/src/js/share.js +++ /dev/null @@ -1,91 +0,0 @@ -//// ========================================================================== -// -// Share -// Displays simple form for sharing current url -// -// ========================================================================== -;(function (document, $) { - 'use strict'; - - $.extend(true, $.fancybox.defaults, { - btnTpl : { - share : - '' - }, - share : { - tpl : - '
' + - '

{{SHARE}}

' + - '' + - '

' + - '
' - } - }); - - function escapeHtml(string) { - var entityMap = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - "'": ''', - '/': '/', - '`': '`', - '=': '=' - }; - - return String(string).replace(/[&<>"'`=\/]/g, function (s) { - return entityMap[s]; - }); - } - - $(document).on('click', '[data-fancybox-share]', function() { - var f = $.fancybox.getInstance(), - url, - tpl; - - if ( f ) { - url = f.current.opts.hash === false ? f.current.src : window.location; - tpl = f.current.opts.share.tpl - .replace( /\{\{media\}\}/g, f.current.type === 'image' ? encodeURIComponent( f.current.src ) : '' ) - .replace( /\{\{url\}\}/g, encodeURIComponent( url ) ) - .replace( /\{\{url_raw\}\}/g, escapeHtml( url ) ) - .replace( /\{\{descr\}\}/g, f.$caption ? encodeURIComponent( f.$caption.text() ) : '' ); - - $.fancybox.open({ - src : f.translate( f, tpl ), - type : 'html', - opts : { - animationEffect : "fade", - animationDuration : 250, - afterLoad : function(instance, current) { - // Opening links in a popup window - current.$content.find('.fancybox-share__links a').click(function() { - window.open(this.href, "Share", "width=550, height=450"); - return false; - }); - } - } - }); - } - - }); - -}( document, window.jQuery || jQuery )); diff --git a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/src/js/slideshow.js b/mayan/apps/appearance/static/appearance/vendors/fancybox-master/src/js/slideshow.js deleted file mode 100644 index f044912529..0000000000 --- a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/src/js/slideshow.js +++ /dev/null @@ -1,185 +0,0 @@ -// ========================================================================== -// -// SlideShow -// Enables slideshow functionality -// -// Example of usage: -// $.fancybox.getInstance().SlideShow.start() -// -// ========================================================================== -;(function (document, $) { - 'use strict'; - - $.extend(true, $.fancybox.defaults, { - btnTpl : { - slideShow : - '' - }, - slideShow : { - autoStart : false, - speed : 3000 - } - }); - - var SlideShow = function( instance ) { - this.instance = instance; - this.init(); - }; - - $.extend( SlideShow.prototype, { - timer : null, - isActive : false, - $button : null, - - init : function() { - var self = this; - - self.$button = self.instance.$refs.toolbar.find('[data-fancybox-play]').on('click', function() { - self.toggle(); - }); - - if ( self.instance.group.length < 2 || !self.instance.group[ self.instance.currIndex ].opts.slideShow ) { - self.$button.hide(); - } - }, - - set : function( force ) { - var self = this; - - // Check if reached last element - if ( self.instance && self.instance.current && (force === true || self.instance.current.opts.loop || self.instance.currIndex < self.instance.group.length - 1 )) { - self.timer = setTimeout(function() { - if ( self.isActive ) { - self.instance.jumpTo( (self.instance.currIndex + 1) % self.instance.group.length ); - } - - }, self.instance.current.opts.slideShow.speed); - - } else { - self.stop(); - self.instance.idleSecondsCounter = 0; - self.instance.showControls(); - } - }, - - clear : function() { - var self = this; - - clearTimeout( self.timer ); - - self.timer = null; - }, - - start : function() { - var self = this; - var current = self.instance.current; - - if ( current ) { - self.isActive = true; - - self.$button - .attr( 'title', current.opts.i18n[ current.opts.lang ].PLAY_STOP ) - .removeClass( 'fancybox-button--play' ) - .addClass( 'fancybox-button--pause' ); - - self.set( true ); - } - }, - - stop : function() { - var self = this; - var current = self.instance.current; - - self.clear(); - - self.$button - .attr( 'title', current.opts.i18n[ current.opts.lang ].PLAY_START ) - .removeClass( 'fancybox-button--pause' ) - .addClass( 'fancybox-button--play' ); - - self.isActive = false; - }, - - toggle : function() { - var self = this; - - if ( self.isActive ) { - self.stop(); - - } else { - self.start(); - } - } - - }); - - $(document).on({ - 'onInit.fb' : function(e, instance) { - if ( instance && !instance.SlideShow ) { - instance.SlideShow = new SlideShow( instance ); - } - }, - - 'beforeShow.fb' : function(e, instance, current, firstRun) { - var SlideShow = instance && instance.SlideShow; - - if ( firstRun ) { - - if ( SlideShow && current.opts.slideShow.autoStart ) { - SlideShow.start(); - } - - } else if ( SlideShow && SlideShow.isActive ) { - SlideShow.clear(); - } - }, - - 'afterShow.fb' : function(e, instance, current) { - var SlideShow = instance && instance.SlideShow; - - if ( SlideShow && SlideShow.isActive ) { - SlideShow.set(); - } - }, - - 'afterKeydown.fb' : function(e, instance, current, keypress, keycode) { - var SlideShow = instance && instance.SlideShow; - - // "P" or Spacebar - if ( SlideShow && current.opts.slideShow && ( keycode === 80 || keycode === 32 ) && !$(document.activeElement).is( 'button,a,input' ) ) { - keypress.preventDefault(); - - SlideShow.toggle(); - } - }, - - 'beforeClose.fb onDeactivate.fb' : function(e, instance) { - var SlideShow = instance && instance.SlideShow; - - if ( SlideShow ) { - SlideShow.stop(); - } - } - }); - - // Page Visibility API to pause slideshow when window is not active - $(document).on("visibilitychange", function() { - var instance = $.fancybox.getInstance(); - var SlideShow = instance && instance.SlideShow; - - if ( SlideShow && SlideShow.isActive ) { - if ( document.hidden ) { - SlideShow.clear(); - - } else { - SlideShow.set(); - } - } - }); - -}( document, window.jQuery || jQuery )); diff --git a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/src/js/thumbs.js b/mayan/apps/appearance/static/appearance/vendors/fancybox-master/src/js/thumbs.js deleted file mode 100644 index 4d38c1e466..0000000000 --- a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/src/js/thumbs.js +++ /dev/null @@ -1,252 +0,0 @@ -// ========================================================================== -// -// Thumbs -// Displays thumbnails in a grid -// -// ========================================================================== -;(function (document, $) { - 'use strict'; - - // Make sure there are default values - $.fancybox.defaults = $.extend(true, { - btnTpl : { - thumbs : - '' - }, - thumbs : { - autoStart : false, // Display thumbnails on opening - hideOnClose : true, // Hide thumbnail grid when closing animation starts - parentEl : '.fancybox-container', // Container is injected into this element - axis : 'y' // Vertical (y) or horizontal (x) scrolling - } - }, $.fancybox.defaults); - - var FancyThumbs = function( instance ) { - this.init( instance ); - }; - - $.extend( FancyThumbs.prototype, { - - $button : null, - $grid : null, - $list : null, - isVisible : false, - isActive : false, - - init : function( instance ) { - var self = this; - - self.instance = instance; - - instance.Thumbs = self; - - // Enable thumbs if at least two group items have thumbnails - var first = instance.group[0], - second = instance.group[1]; - - self.opts = instance.group[ instance.currIndex ].opts.thumbs; - - self.$button = instance.$refs.toolbar.find( '[data-fancybox-thumbs]' ); - - if ( self.opts && first && second && ( - ( first.type == 'image' || first.opts.thumb || first.opts.$thumb ) && - ( second.type == 'image' || second.opts.thumb || second.opts.$thumb ) - )) { - - self.$button.show().on('click', function() { - self.toggle(); - }); - - self.isActive = true; - - } else { - self.$button.hide(); - } - }, - - create : function() { - var self = this, - instance = self.instance, - parentEl = self.opts.parentEl, - list, - src; - - self.$grid = $('
').appendTo( instance.$refs.container.find( parentEl ).addBack().filter( parentEl ) ); - - // Build list HTML - list = '
    '; - - $.each(instance.group, function( i, item ) { - src = item.opts.thumb || ( item.opts.$thumb ? item.opts.$thumb.attr( 'src' ) : null ); - - if ( !src && item.type === 'image' ) { - src = item.src; - } - - if ( src && src.length ) { - list += '
  • '; - } - }); - - list += '
'; - - self.$list = $( list ).appendTo( self.$grid ).on('click', 'li', function() { - instance.jumpTo( $(this).data('index') ); - }); - - self.$list.find( 'img' ).hide().one('load', function() { - var $parent = $(this).parent().removeClass( 'fancybox-thumbs-loading' ), - thumbWidth = $parent.outerWidth(), - thumbHeight = $parent.outerHeight(), - width, - height, - widthRatio, - heightRatio; - - width = this.naturalWidth || this.width; - height = this.naturalHeight || this.height; - - // Calculate thumbnail dimensions; center vertically and horizontally - widthRatio = width / thumbWidth; - heightRatio = height / thumbHeight; - - if (widthRatio >= 1 && heightRatio >= 1) { - if (widthRatio > heightRatio) { - width = width / heightRatio; - height = thumbHeight; - - } else { - width = thumbWidth; - height = height / widthRatio; - } - } - - $(this).css({ - width : Math.floor(width), - height : Math.floor(height), - 'margin-top' : height > thumbHeight ? ( Math.floor(thumbHeight * 0.3 - height * 0.3 ) ) : Math.floor(thumbHeight * 0.5 - height * 0.5 ), - 'margin-left' : Math.floor(thumbWidth * 0.5 - width * 0.5 ) - }).show(); - - }) - .each(function() { - this.src = $( this ).data( 'src' ); - }); - - if ( self.opts.axis === 'x' ) { - self.$list.width( parseInt( self.$grid.css("padding-right") ) + ( instance.group.length * self.$list.children().eq(0).outerWidth(true) ) + 'px' ); - } - }, - - focus : function( duration ) { - var self = this, - $list = self.$list, - thumb, - thumbPos; - - if ( self.instance.current ) { - thumb = $list.children() - .removeClass( 'fancybox-thumbs-active' ) - .filter('[data-index="' + self.instance.current.index + '"]') - .addClass('fancybox-thumbs-active'); - - thumbPos = thumb.position(); - - // Check if need to scroll to make current thumb visible - if ( self.opts.axis === 'y' && ( thumbPos.top < 0 || thumbPos.top > ( $list.height() - thumb.outerHeight() ) ) ) { - $list.stop().animate({ 'scrollTop' : $list.scrollTop() + thumbPos.top }, duration); - - } else if ( self.opts.axis === 'x' && ( - thumbPos.left < $list.parent().scrollLeft() || - thumbPos.left > ( $list.parent().scrollLeft() + ( $list.parent().width() - thumb.outerWidth() ) ) - ) - ) { - $list.parent().stop().animate({ 'scrollLeft' : thumbPos.left }, duration); - } - } - }, - - update : function() { - this.instance.$refs.container.toggleClass( 'fancybox-show-thumbs', this.isVisible ); - - if ( this.isVisible ) { - if ( !this.$grid ) { - this.create(); - } - - this.instance.trigger( 'onThumbsShow' ); - - this.focus( 0 ); - - } else if ( this.$grid ) { - this.instance.trigger( 'onThumbsHide' ); - } - - // Update content position - this.instance.update(); - }, - - hide : function() { - this.isVisible = false; - this.update(); - }, - - show : function() { - this.isVisible = true; - this.update(); - }, - - toggle : function() { - this.isVisible = !this.isVisible; - this.update(); - } - }); - - $(document).on({ - - 'onInit.fb' : function(e, instance) { - var Thumbs; - - if ( instance && !instance.Thumbs ) { - Thumbs = new FancyThumbs( instance ); - - if ( Thumbs.isActive && Thumbs.opts.autoStart === true ) { - Thumbs.show(); - } - } - }, - - 'beforeShow.fb' : function(e, instance, item, firstRun) { - var Thumbs = instance && instance.Thumbs; - - if ( Thumbs && Thumbs.isVisible ) { - Thumbs.focus( firstRun ? 0 : 250 ); - } - }, - - 'afterKeydown.fb' : function(e, instance, current, keypress, keycode) { - var Thumbs = instance && instance.Thumbs; - - // "G" - if ( Thumbs && Thumbs.isActive && keycode === 71 ) { - keypress.preventDefault(); - - Thumbs.toggle(); - } - }, - - 'beforeClose.fb' : function( e, instance ) { - var Thumbs = instance && instance.Thumbs; - - if ( Thumbs && Thumbs.isVisible && Thumbs.opts.hideOnClose !== false ) { - Thumbs.$grid.hide(); - } - } - - }); - -}(document, window.jQuery)); diff --git a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/src/js/wheel.js b/mayan/apps/appearance/static/appearance/vendors/fancybox-master/src/js/wheel.js deleted file mode 100644 index 199ada58d5..0000000000 --- a/mayan/apps/appearance/static/appearance/vendors/fancybox-master/src/js/wheel.js +++ /dev/null @@ -1,37 +0,0 @@ -;(function (document, $) { - 'use strict'; - - var prevTime = new Date().getTime(); - - $(document).on({ - 'onInit.fb' : function( e, instance, current ) { - instance.$refs.stage.on('mousewheel DOMMouseScroll wheel MozMousePixelScroll', function(e) { - var current = instance.current, - currTime = new Date().getTime(); - - if ( instance.group.length < 1 || current.opts.wheel === false || ( current.opts.wheel === 'auto' && current.type !== 'image' ) ) { - return; - } - - e.preventDefault(); - e.stopPropagation(); - - if ( current.$slide.hasClass( 'fancybox-animated' ) ) { - return; - } - - e = e.originalEvent || e; - - if ( currTime - prevTime < 250 ) { - return; - } - - prevTime = currTime; - - instance[ ( -e.deltaY || -e.deltaX || e.wheelDelta || -e.detail ) < 0 ? 'next' : 'previous' ](); - - }); - } - }); - -}( document, window.jQuery || jQuery )); diff --git a/mayan/apps/appearance/templates/appearance/root.html b/mayan/apps/appearance/templates/appearance/root.html index 0395b698a4..4dd890bd78 100644 --- a/mayan/apps/appearance/templates/appearance/root.html +++ b/mayan/apps/appearance/templates/appearance/root.html @@ -22,7 +22,7 @@ - + @@ -83,7 +83,7 @@ - + diff --git a/mayan/apps/autoadmin/apps.py b/mayan/apps/autoadmin/apps.py index 306cfff264..e1224fef9f 100644 --- a/mayan/apps/autoadmin/apps.py +++ b/mayan/apps/autoadmin/apps.py @@ -6,6 +6,7 @@ from django.utils.translation import ugettext_lazy as _ from mayan.apps.common.apps import MayanAppConfig +from .dependencies import * # NOQA from .handlers import handler_auto_admin_account_password_change @@ -16,6 +17,7 @@ class AutoAdminAppConfig(MayanAppConfig): def ready(self): super(AutoAdminAppConfig, self).ready() + post_save.connect( dispatch_uid='auto_admin_handler_account_password_change', receiver=handler_auto_admin_account_password_change, diff --git a/mayan/apps/autoadmin/dependencies.py b/mayan/apps/autoadmin/dependencies.py new file mode 100644 index 0000000000..40028723bf --- /dev/null +++ b/mayan/apps/autoadmin/dependencies.py @@ -0,0 +1,7 @@ +from __future__ import unicode_literals + +from mayan.apps.dependencies.classes import PythonDependency + +PythonDependency( + module=__name__, name='django-solo', version_string='==1.1.3' +) diff --git a/mayan/apps/cabinets/apps.py b/mayan/apps/cabinets/apps.py index de8b90af51..0102800c8c 100644 --- a/mayan/apps/cabinets/apps.py +++ b/mayan/apps/cabinets/apps.py @@ -13,6 +13,7 @@ from mayan.apps.common.menus import ( from mayan.apps.documents.search import document_page_search, document_search from mayan.apps.navigation.classes import SourceColumn +from .dependencies import * # NOQA from .links import ( link_cabinet_list, link_document_cabinet_list, link_document_cabinet_remove, link_document_cabinet_add, diff --git a/mayan/apps/cabinets/dependencies.py b/mayan/apps/cabinets/dependencies.py new file mode 100644 index 0000000000..6ac1a2b193 --- /dev/null +++ b/mayan/apps/cabinets/dependencies.py @@ -0,0 +1,7 @@ +from __future__ import unicode_literals + +from mayan.apps.dependencies.classes import JavaScriptDependency + +JavaScriptDependency( + module=__name__, name='jstree', version_string='=3.3.3' +) diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/LICENSE-MIT b/mayan/apps/cabinets/static/cabinets/packages/jstree/LICENSE-MIT deleted file mode 100644 index 470dd6181a..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/LICENSE-MIT +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2014 Ivan Bozhanov - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/README.md b/mayan/apps/cabinets/static/cabinets/packages/jstree/README.md deleted file mode 100644 index e1e6db769f..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/README.md +++ /dev/null @@ -1,658 +0,0 @@ -# jstree - -[jsTree](http://www.jstree.com/) is jquery plugin, that provides interactive trees. It is absolutely free, [open source](https://github.com/vakata/jstree) and distributed under the MIT license. - -jsTree is easily extendable, themable and configurable, it supports HTML & JSON data sources, AJAX & async callback loading. - -jsTree functions properly in either box-model (content-box or border-box), can be loaded as an AMD module, and has a built in mobile theme for responsive design, that can easily be customized. It uses jQuery's event system, so binding callbacks on various events in the tree is familiar and easy. - -You also get: - * drag & drop support - * keyboard navigation - * inline edit, create and delete - * tri-state checkboxes - * fuzzy searching - * customizable node types - -_Aside from this readme you can find a lot more info on [jstree.com](http://www.jstree.com) & [the discussion group](https://groups.google.com/forum/#!forum/jstree)_. - ---- - - - -- [Getting Started](#getting-started) - - [Include all neccessary files](#include-all-neccessary-files) - - [Populating a tree using HTML](#populating-a-tree-using-html) - - [Populating a tree using an array \(or JSON\)](#populating-a-tree-using-an-array-or-json) - - [The required JSON format](#the-required-json-format) - - [Populating the tree using AJAX](#populating-the-tree-using-ajax) - - [Populating the tree using AJAX and lazy loading nodes](#populating-the-tree-using-ajax-and-lazy-loading-nodes) - - [Populating the tree using a callback function](#populating-the-tree-using-a-callback-function) -- [Working with events](#working-with-events) -- [Interacting with the tree using the API](#interacting-with-the-tree-using-the-api) -- [More on configuration](#more-on-configuration) -- [Plugins](#plugins) - - [checkbox](#checkbox) - - [contextmenu](#contextmenu) - - [dnd](#dnd) - - [massload](#massload) - - [search](#search) - - [sort](#sort) - - [state](#state) - - [types](#types) - - [unique](#unique) - - [wholerow](#wholerow) - - [More plugins](#more-plugins) -- [License & Contributing](#license--contributing) - - - - ---- - -## Getting Started - -### Include all neccessary files -To get started you need 3 things in your page: - 1. jQuery (anything above 1.9.1 will work) - 2. A jstree theme (there is only one theme supplied by default) - 3. The jstree source file - -```html - - - - -``` - -_If you decide to host jstree yourself - the files are located in the `dist` folder. You can safely ignore the `dist/libs` folder._ - ---- - -### Populating a tree using HTML - -Now we are all set to create a tree, inline HTML is the easiest option (suitable for menus). All you need to do is select a node (using a jQuery selector) and invoke the `.jstree()` function to let jstree know you want to render a tree inside the selected node. `$.jstree.create(element)` can be used too. - -```html -
-
    -
  • Root node -
      -
    • Child node 1
    • -
    • Child node 2
    • -
    -
  • -
-
- -``` - -[view result](http://jsfiddle.net/vakata/2kwkh2uL/) - -_You can add a few options when rendering a node using a data-attribute (note the quotes):_ -```html -
  • Root node ... -``` - ---- - -### Populating a tree using an array (or JSON) - -Building trees from HTML is easy, but it is not very flexible, inline JS data is a better option: - -```html -
    - -``` - -[view result](http://jsfiddle.net/vakata/2kwkh2uL/4478/) - -Unlike the previous simple HTML example, this time the `.jstree()` function accepts a config object. - -For now it is important to note that jstree will try to parse any data you specify in the `core.data` key and use it to create a tree. As seen in the previous example, if this key is missing jstree will try to parse the inline HTML of the container. - -#### The required JSON format - -The data you use must be in a specific format, each branch of the tree is represented by an object, which must at least have a `text` key. The `children` key can be used to add children to the branch, it should be an array of objects. - -_Keep in mind, you can use a simple string instead of an object if all you need is node with the given text, the above data can be written as:_ - -```js -[ { "text" : "Root node", "children" : [ "Child node 1", "Child node 2" ] } ] -``` - -There are other available options for each node, only set them if you need them like: - - * `id` - makes if possible to identify a node later (will also be used as a DOM ID of the `LI` node). _Make sure you do not repeat the same ID in a tree instance (that would defeat its purpose of being a unique identifier and may cause problems for jstree)_. - * `icon` - a string which will be used for the node's icon - this can either be a path to a file, or a className (or list of classNames), which you can style in your CSS (font icons also work). - * `data` - this can be anything you want - it is metadata you want attached to the node - you will be able to access and modify it any time later - it has no effect on the visuals of the node. - * `state` - an object specifyng a few options about the node: - - `selected` - if the node should be initially selected - - `opened` - if the node should be initially opened - - `disabled` - if the node should be disabled - - `checked` - __checkbox plugin specific__ - if the node should be checked (only used when `tie_selection` is `false`, which you should only do if you really know what you are doing) - - `undetermined` - __checkbox plugin specific__ - if the node should be rendered in undetermined state (only used with lazy loading and when the node is not yet loaded, otherwise this state is automatically calculated). - * `type` - __types plugin specific__ - the type of the nodes (should be defined in the types config), if not set `"default"` is assumed. - * `li_attr` - object of values which will be used to add HTML attributes on the resulting `LI` DOM node. - * `a_attr` - object of values which will be used to add HTML attributes on the resulting `A` node. - -Here is a new demo with some of those properties set: - -```html -
    - -``` - -[view result](http://jsfiddle.net/vakata/2kwkh2uL/4479/) - ---- - -### Populating the tree using AJAX - -Building off of the previous example, let's see how to have jstree make AJAX requests for you. - -```html -
    - -``` - -The server response is: -```json -[{ - "id":1,"text":"Root node","children":[ - {"id":2,"text":"Child node 1"}, - {"id":3,"text":"Child node 2"} - ] -}] -``` - -[view result](http://jsfiddle.net/vakata/2kwkh2uL/4480/) - -Instead of a JS array, you can set `core.data` to a [jQuery AJAX config](http://api.jquery.com/jQuery.ajax/). -jsTree will hit that URL, and provided you return properly formatted JSON it will be displayed. - -_If you cannot provide proper JSON headers, set `core.data.dataType` to `"json"`._ - -The ids in the server response make it possible to identify nodes later (which we will see in the next few demos), but they are not required. - -__WHEN USING IDS MAKE SURE THEY ARE UNIQUE INSIDE A PARTICULAR TREE__ - ---- - -### Populating the tree using AJAX and lazy loading nodes - -Lazy loading means nodes will be loaded when they are needed. Imagine you have a huge amount of nodes you want to show, but loading them with a single request is way too much traffic. Lazy loading makes it possible to load nodes on the fly - jstree will perform AJAX requests as the user browses the tree. - -Here we take our previous example, and lazy load the "Child node 1" node. - -```html -
    - -``` - -The initial server response is: -```json -[{ - "id":1,"text":"Root node","children":[ - {"id":2,"text":"Child node 1","children":true}, - {"id":3,"text":"Child node 2"} - ] -}] -``` - -[view result](http://jsfiddle.net/vakata/2kwkh2uL/4481/) - -Now to focus on what is different. First off the `"data"` config option of the data object. If you check with jQuery, it is supposed to be a string or an object. But jstree makes it possible to set a function. - -Each time jstree needs to make an AJAX call this function will be called and will receive a single parameter - the node that is being loaded. The return value of this function will be used as the actual `"data"` of the AJAX call. To understand better open up the demo and see the requests go off in the console. - -You will notice that the first request goes off to: -`http://www.jstree.com/fiddle?lazy&id=#` -`#` is the special ID that the function receives when jstree needs to load the root nodes. - -Now go ahead and open the root node - two children will be shown, but no request will be made - that is because we loaded those children along with the first request. - -Onto the next difference - "Child node 1" appears closed - that is because in the data we supplied `true` as the `"children"` property of this node (you can see it in the server response). This special value indicated to jstree, that it has to lazy load the "Child node 1" node. - -Proceed and open this node - you will see a next request fire off to: -`http://www.jstree.com/fiddle?lazy&id=2` -ID is set to `2` because the node being loaded has an ID of `2`, and we have configured jstree to send the node ID along with the AJAX request (the `data` function). - -The server response is: -```json -["Child node 3","Child node 4"] -``` - -_You can also set `"url"` to a function and it works exactly as with `"data"` - each time a request has to be made, jstree will invoke your function and the request will go off to whatever you return in this function. This is useful when dealing with URLs like: `http://example.com/get_children/1`._ - -### Populating the tree using a callback function - -Sometimes you may not want jsTree to make AJAX calls for you - you might want to make them yourself, or use some other method of puplating the tree. In that case you can use a callback function. - -```html -
    - -``` - -[view result](http://jsfiddle.net/vakata/2kwkh2uL/4482/) - -As you can see your function will receive two arguments - the node whose children need to be loaded and a callback function to call with the data once you have it. The data follows the same familiar JSON format and lazy loading works just as with AJAX (as you can see in the above example). - ---- - -## Working with events - -jstree provides a lot of events to let you know something happened with the tree. The events are the same regardless of how you populate the tree. -Let's use the most basic event `changed` - it fires when selection on the tree changes: - -```html -
    - -``` - -[view result](http://jsfiddle.net/vakata/2kwkh2uL/4483/) - -All jstree events fire in a special `".jstree"` namespace - this is why we listen for `"changed.jstree"`. The handler itself receives one additional parameter - it will be populated with all you need to know about the event that happened. In this case `data.selected` is an array of selected node IDs (please note, that if you have not specified IDs they will be autogenerated). - -Let's extend this a bit and log out the text of the node instead of the ID. - -```js -$('#container').on("changed.jstree", function (e, data) { - console.log(data.instance.get_selected(true)[0].text); - console.log(data.instance.get_node(data.selected[0]).text); -}); -``` - -The two rows above achieve exactly the same thing - get the text of the first selected node. - -In the `data` argument object you will always get an `instance` key - that is a reference to the tree instance, so that you can easily invoke methods. - -__All available functions and events are documented in the API docs__ - ---- - -## Interacting with the tree using the API - -We scratched the surface on interacting with the tree in the previous example. Let's move on to obtaining an instance and calling a method on this instance: - -```html - -
    - -``` - -[view result](http://jsfiddle.net/vakata/2kwkh2uL/4484/) - -The above example shows how to obtain a reference to a jstree instance (again with a selector, but this time instead of a config, we pass a boolean `true`), and call a couple of methods - the latter one is selecting a node by its ID. - -Methods can also be invoked like this: - -```js -$('#container').jstree("select_node", "1"); -``` - -__All available functions and events are documented in the API docs__ - -## More on configuration - -We already covered the config object in general (when we specified inline & AJAX data sources). - -```js -$("#tree").jstree({ /* config object goes here */ }); -``` - -Each key in the config object corresponds to a plugin, and the value of that key is the configuration for that plugin. There are also two special keys `"core"` and `"plugins"`: - * `"core"` stores the core configuration options - * `"plugins"` is an array of plugin names (strings) you want active on the instance - -When configuring you only need to set values that you want to be different from the defaults. - -__All config options and defaults are documented in the API docs__ - -```js -$("#tree").jstree({ - "core" : { // core options go here - "multiple" : false, // no multiselection - "themes" : { - "dots" : false // no connecting dots between dots - } - }, - "plugins" : ["state"] // activate the state plugin on this instance -}); -``` - -[view result](http://jsfiddle.net/vakata/2kwkh2uL/4485/) - -We will cover all plugins further down. - -__Keep in mind by default all modifications to the structure are prevented - that means drag'n'drop, create, rename, delete will not work unless you enable them.__ - -```js -$("#tree").jstree({ - "core" : { - "check_callback" : true, // enable all modifications - }, - "plugins" : ["dnd","contextmenu"] -}); -``` - -[view result](http://jsfiddle.net/vakata/2kwkh2uL/4486/) - -`"core.check_callback"` can also be set to a function, that will be invoked every time a modification is about to happen (or when jstree needs to check if a modification is possible). If you return `true` the operation will be allowed, a value of `false` means it will not be allowed. The possible operation you can expect are `create_node`, `rename_node`, `delete_node`, `move_node` and `copy_node`. The `more` parameter will contain various information provided by the plugin that is invoking the check. For example the DND plugin will provide an object containing information about the move or copy operation that is being checked - is it a multi tree operation, which node is currently hovered, where the insert arrow is pointing - before, after or inside, etc. - -```js -$("#tree").jstree({ - "core" : { - "check_callback" : function (operation, node, parent, position, more) { - if(operation === "copy_node" || operation === "move_node") { - if(parent.id === "#") { - return false; // prevent moving a child above or below the root - } - }, - return true; // allow everything else - } - }, - "plugins" : ["dnd","contextmenu"] -}); -``` - -[view result](http://jsfiddle.net/vakata/2kwkh2uL/4487/) - -The `more` parameter you receive contains other information related to the check being performed. - -__For example__: `move_node` & `copy_node` checks will fire repeatedly while the user drags a node, if the check was triggered by the `dnd` plugin `more` will contain a `dnd` key, which will be set to `true`. -You can check for `more.dnd` and only perform a certain action if `dnd` triggered the check. -If you only want to perform an operation when a node is really about to be dropped check for `more.core`. - -## Plugins - -jsTree comes with a few plugin bundled, but they will only modify your tree if you activate them using the `"plugins"` config option. Here is a brief description of each plugin. You can read more on the available config options for each plugin in the API docs. - -### checkbox -Renders a checkbox icon in front of each node, making multiselection easy. It also has a "tri-state" option, meaning a node with some of its children checked will get a "square" icon. - -_Keep in mind that if any sort of cascade is enabled, disabled nodes may be checked too (not by themselves, but for example when a parent of a disabled node is checked and selection is configured to cascade down)._ - -```js -$("#tree").jstree({ - "plugins" : ["checkbox"] -}); -``` - -[view result](http://jsfiddle.net/vakata/2kwkh2uL/4488/) - -### contextmenu -Makes it possible to right click nodes and shows a list of configurable actions in a menu. - -```js -$("#tree").jstree({ - "core" : { "check_callback" : true }, // so that modifying operations work - "plugins" : ["contextmenu"] -}); -``` - -[view result](http://jsfiddle.net/vakata/2kwkh2uL/4489/) - -### dnd -Makes it possible to drag and drop tree nodes and rearrange the tree. - -```js -$("#tree").jstree({ - "core" : { "check_callback" : true }, // so that operations work - "plugins" : ["dnd"] -}); -``` - -[view result](http://jsfiddle.net/vakata/2kwkh2uL/4490/) - -### massload -Makes it possible to load multiple nodes in a single go (for a lazy loaded tree). - -```js -$("#tree").jstree({ - "core" : { - "data" : { .. AJAX config .. } - }, - "massload" : { - "url" : "/some/path", - "data" : function (nodes) { - return { "ids" : nodes.join(",") }; - } - }, - "plugins" : [ "massload", "state" ] -}); -``` - -### search -Adds the possibility to search for items in the tree and show only matching nodes. It also has AJAX / callback hooks, so that search will work on lazy loaded trees too. - -```html -
    - - -
    - -``` - -[view result](http://jsfiddle.net/vakata/2kwkh2uL/4491/) - -### sort -Automatically arranges all sibling nodes according to a comparison config option function, which defaults to alphabetical order. - -```js -$("#tree").jstree({ - "plugins" : ["sort"] -}); -``` - -[view result](http://jsfiddle.net/vakata/2kwkh2uL/4492/) - -### state -Saves all opened and selected nodes in the user's browser, so when returning to the same tree the previous state will be restored. - -```js -$("#tree").jstree({ - // the key is important if you have multiple trees in the same domain - "state" : { "key" : "state_demo" }, - "plugins" : ["state"] -}); -``` - -[view result](http://jsfiddle.net/vakata/2kwkh2uL/4493/) - -### types -Makes it possible to add a "type" for a node, which means to easily control nesting rules and icon for groups of nodes instead of individually. To set a node type add a type property to the node structure. - -```js -$("#tree").jstree({ - "types" : { - "default" : { - "icon" : "glyphicon glyphicon-flash" - }, - "demo" : { - "icon" : "glyphicon glyphicon-ok" - } - }, - "plugins" : ["types"] -}); -``` - -[view result](http://jsfiddle.net/vakata/2kwkh2uL/4494/) - -### unique -Enforces that no nodes with the same name can coexist as siblings - prevents renaming and moving nodes to a parent, which already contains a node with the same name. - -```js -$("#tree").jstree({ - "plugins" : ["unique"] -}); -``` - -[view result](http://jsfiddle.net/vakata/2kwkh2uL/4495/) - -### wholerow -Makes each node appear block level which makes selection easier. May cause slow down for large trees in old browsers. - -```js -$("#tree").jstree({ - "plugins" : ["wholerow"] -}); -``` - -[view result](http://jsfiddle.net/vakata/2kwkh2uL/4496/) - -### More plugins -If you create your own plugin (or download a 3rd party one) you must include its source on the page and list its name in the `"plugins"` config array. - -```js -// conditional select -(function ($, undefined) { - "use strict"; - $.jstree.defaults.conditionalselect = function () { return true; }; - $.jstree.plugins.conditionalselect = function (options, parent) { - this.activate_node = function (obj, e) { - if(this.settings.conditionalselect.call(this, this.get_node(obj))) { - parent.activate_node.call(this, obj, e); - } - }; - }; -})(jQuery); -$("#tree").jstree({ - "conditionalselect" : function (node) { - return node.text === "Root node" ? false : true; - }, - "plugins" : ["conditionalselect"] -}); -``` - -[view result](http://jsfiddle.net/vakata/2kwkh2uL/4497/) - -As seen here when creating a plugin you can define a default config, add your own functions to jstree, or override existing ones while maintaining the ability to call the overridden function. - -## License & Contributing - -_Please do NOT edit files in the "dist" subdirectory as they are generated via grunt. You'll find source code in the "src" subdirectory!_ - -If you want to you can always [donate a small amount][paypal] to help the development of jstree. -[paypal]: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=paypal@vakata.com¤cy_code=USD&amount=&return=http://jstree.com/donation&item_name=Buy+me+a+coffee+for+jsTree - -Copyright (c) 2014 Ivan Bozhanov (http://vakata.com) - -Licensed under the [MIT license](http://www.opensource.org/licenses/mit-license.php). diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/bower.json b/mayan/apps/cabinets/static/cabinets/packages/jstree/bower.json deleted file mode 100644 index 535b66c151..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/bower.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "jstree", - "version": "3.3.3", - "main" : [ - "./dist/jstree.js", - "./dist/themes/default/style.css" - ], - "ignore": [ - "**/.*", - "docs", - "demo", - "libs", - "node_modules", - "test", - "libs", - "jstree.jquery.json", - "gruntfile.js", - "package.json", - "bower.json", - "component.json", - "LICENCE-MIT", - "README.md" - ], - "dependencies": { - "jquery": ">=1.9.1" - }, - "keywords": [ - "ui", - "tree", - "jstree" - ] -} diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/component.json b/mayan/apps/cabinets/static/cabinets/packages/jstree/component.json deleted file mode 100644 index 2b9183e8d4..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/component.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "jstree", - "repo": "vakata/jstree", - "description": "jsTree is jquery plugin, that provides interactive trees.", - "version": "3.3.3", - "license": "MIT", - "keywords": [ - "ui", - "tree", - "jstree" - ], - "scripts": [ - "dist/jstree.js", - "dist/jstree.min.js" - ], - "images": [ - "dist/themes/default/32px.png", - "dist/themes/default/40px.png", - "dist/themes/default/throbber.gif" - ], - "styles": [ - "dist/themes/default/style.css", - "dist/themes/default/style.min.css" - ], - "dependencies": { - "components/jquery": ">=1.9.1" - } -} diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/composer.json b/mayan/apps/cabinets/static/cabinets/packages/jstree/composer.json deleted file mode 100644 index 282b768a68..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/composer.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "name": "vakata/jstree", - "description": "jsTree is jquery plugin, that provides interactive trees.", - "type": "component", - "homepage": "http://jstree.com", - "license": "MIT", - "support": { - "issues": "https://github.com/vakata/jstree/issues", - "forum": "https://groups.google.com/forum/#!forum/jstree", - "source": "https://github.com/vakata/jstree" - }, - "authors": [ - { - "name": "Ivan Bozhanov", - "email": "jstree@jstree.com" - } - ], - "require": { - "components/jquery": ">=1.9.1" - }, - "suggest": { - "robloach/component-installer": "Allows installation of Components via Composer" - }, - "extra": { - "component": { - "scripts": [ - "dist/jstree.js" - ], - "styles": [ - "dist/themes/default/style.css" - ], - "images": [ - "dist/themes/default/32px.png", - "dist/themes/default/40px.png", - "dist/themes/default/throbber.gif" - ], - "files": [ - "dist/jstree.min.js", - "dist/themes/default/style.min.css", - "dist/themes/default/32px.png", - "dist/themes/default/40px.png", - "dist/themes/default/throbber.gif" - ] - } - } -} \ No newline at end of file diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/demo/basic/index.html b/mayan/apps/cabinets/static/cabinets/packages/jstree/demo/basic/index.html deleted file mode 100644 index 9c1a85597a..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/demo/basic/index.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - jstree basic demos - - - - -

    HTML demo

    -
    -
      -
    • Root node -
        -
      • Child node 1
      • -
      • Child node 2
      • -
      -
    • -
    -
    - -

    Inline data demo

    -
    - -

    Data format demo

    -
    - -

    AJAX demo

    -
    - -

    Lazy loading demo

    -
    - -

    Callback function data demo

    -
    - -

    Interaction and events demo

    - either click the button or a node in the tree -
    - - - - - - - \ No newline at end of file diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/demo/basic/root.json b/mayan/apps/cabinets/static/cabinets/packages/jstree/demo/basic/root.json deleted file mode 100644 index 8560404e85..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/demo/basic/root.json +++ /dev/null @@ -1 +0,0 @@ -[{"id":1,"text":"Root node","children":[{"id":2,"text":"Child node 1"},{"id":3,"text":"Child node 2"}]}] \ No newline at end of file diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/demo/filebrowser/data/.htaccess b/mayan/apps/cabinets/static/cabinets/packages/jstree/demo/filebrowser/data/.htaccess deleted file mode 100644 index 3418e55a68..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/demo/filebrowser/data/.htaccess +++ /dev/null @@ -1 +0,0 @@ -deny from all \ No newline at end of file diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/demo/filebrowser/file_sprite.png b/mayan/apps/cabinets/static/cabinets/packages/jstree/demo/filebrowser/file_sprite.png deleted file mode 100644 index 5d68245cb8..0000000000 Binary files a/mayan/apps/cabinets/static/cabinets/packages/jstree/demo/filebrowser/file_sprite.png and /dev/null differ diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/demo/filebrowser/index.php b/mayan/apps/cabinets/static/cabinets/packages/jstree/demo/filebrowser/index.php deleted file mode 100644 index 1c8ccf0505..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/demo/filebrowser/index.php +++ /dev/null @@ -1,450 +0,0 @@ -base && strlen($this->base)) { - if(strpos($temp, $this->base) !== 0) { throw new Exception('Path is not inside base ('.$this->base.'): ' . $temp); } - } - return $temp; - } - protected function path($id) { - $id = str_replace('/', DIRECTORY_SEPARATOR, $id); - $id = trim($id, DIRECTORY_SEPARATOR); - $id = $this->real($this->base . DIRECTORY_SEPARATOR . $id); - return $id; - } - protected function id($path) { - $path = $this->real($path); - $path = substr($path, strlen($this->base)); - $path = str_replace(DIRECTORY_SEPARATOR, '/', $path); - $path = trim($path, '/'); - return strlen($path) ? $path : '/'; - } - - public function __construct($base) { - $this->base = $this->real($base); - if(!$this->base) { throw new Exception('Base directory does not exist'); } - } - public function lst($id, $with_root = false) { - $dir = $this->path($id); - $lst = @scandir($dir); - if(!$lst) { throw new Exception('Could not list path: ' . $dir); } - $res = array(); - foreach($lst as $item) { - if($item == '.' || $item == '..' || $item === null) { continue; } - $tmp = preg_match('([^ a-zа-я-_0-9.]+)ui', $item); - if($tmp === false || $tmp === 1) { continue; } - if(is_dir($dir . DIRECTORY_SEPARATOR . $item)) { - $res[] = array('text' => $item, 'children' => true, 'id' => $this->id($dir . DIRECTORY_SEPARATOR . $item), 'icon' => 'folder'); - } - else { - $res[] = array('text' => $item, 'children' => false, 'id' => $this->id($dir . DIRECTORY_SEPARATOR . $item), 'type' => 'file', 'icon' => 'file file-'.substr($item, strrpos($item,'.') + 1)); - } - } - if($with_root && $this->id($dir) === '/') { - $res = array(array('text' => basename($this->base), 'children' => $res, 'id' => '/', 'icon'=>'folder', 'state' => array('opened' => true, 'disabled' => true))); - } - return $res; - } - public function data($id) { - if(strpos($id, ":")) { - $id = array_map(array($this, 'id'), explode(':', $id)); - return array('type'=>'multiple', 'content'=> 'Multiple selected: ' . implode(' ', $id)); - } - $dir = $this->path($id); - if(is_dir($dir)) { - return array('type'=>'folder', 'content'=> $id); - } - if(is_file($dir)) { - $ext = strpos($dir, '.') !== FALSE ? substr($dir, strrpos($dir, '.') + 1) : ''; - $dat = array('type' => $ext, 'content' => ''); - switch($ext) { - case 'txt': - case 'text': - case 'md': - case 'js': - case 'json': - case 'css': - case 'html': - case 'htm': - case 'xml': - case 'c': - case 'cpp': - case 'h': - case 'sql': - case 'log': - case 'py': - case 'rb': - case 'htaccess': - case 'php': - $dat['content'] = file_get_contents($dir); - break; - case 'jpg': - case 'jpeg': - case 'gif': - case 'png': - case 'bmp': - $dat['content'] = 'data:'.finfo_file(finfo_open(FILEINFO_MIME_TYPE), $dir).';base64,'.base64_encode(file_get_contents($dir)); - break; - default: - $dat['content'] = 'File not recognized: '.$this->id($dir); - break; - } - return $dat; - } - throw new Exception('Not a valid selection: ' . $dir); - } - public function create($id, $name, $mkdir = false) { - $dir = $this->path($id); - if(preg_match('([^ a-zа-я-_0-9.]+)ui', $name) || !strlen($name)) { - throw new Exception('Invalid name: ' . $name); - } - if($mkdir) { - mkdir($dir . DIRECTORY_SEPARATOR . $name); - } - else { - file_put_contents($dir . DIRECTORY_SEPARATOR . $name, ''); - } - return array('id' => $this->id($dir . DIRECTORY_SEPARATOR . $name)); - } - public function rename($id, $name) { - $dir = $this->path($id); - if($dir === $this->base) { - throw new Exception('Cannot rename root'); - } - if(preg_match('([^ a-zа-я-_0-9.]+)ui', $name) || !strlen($name)) { - throw new Exception('Invalid name: ' . $name); - } - $new = explode(DIRECTORY_SEPARATOR, $dir); - array_pop($new); - array_push($new, $name); - $new = implode(DIRECTORY_SEPARATOR, $new); - if($dir !== $new) { - if(is_file($new) || is_dir($new)) { throw new Exception('Path already exists: ' . $new); } - rename($dir, $new); - } - return array('id' => $this->id($new)); - } - public function remove($id) { - $dir = $this->path($id); - if($dir === $this->base) { - throw new Exception('Cannot remove root'); - } - if(is_dir($dir)) { - foreach(array_diff(scandir($dir), array(".", "..")) as $f) { - $this->remove($this->id($dir . DIRECTORY_SEPARATOR . $f)); - } - rmdir($dir); - } - if(is_file($dir)) { - unlink($dir); - } - return array('status' => 'OK'); - } - public function move($id, $par) { - $dir = $this->path($id); - $par = $this->path($par); - $new = explode(DIRECTORY_SEPARATOR, $dir); - $new = array_pop($new); - $new = $par . DIRECTORY_SEPARATOR . $new; - rename($dir, $new); - return array('id' => $this->id($new)); - } - public function copy($id, $par) { - $dir = $this->path($id); - $par = $this->path($par); - $new = explode(DIRECTORY_SEPARATOR, $dir); - $new = array_pop($new); - $new = $par . DIRECTORY_SEPARATOR . $new; - if(is_file($new) || is_dir($new)) { throw new Exception('Path already exists: ' . $new); } - - if(is_dir($dir)) { - mkdir($new); - foreach(array_diff(scandir($dir), array(".", "..")) as $f) { - $this->copy($this->id($dir . DIRECTORY_SEPARATOR . $f), $this->id($new)); - } - } - if(is_file($dir)) { - copy($dir, $new); - } - return array('id' => $this->id($new)); - } -} - -if(isset($_GET['operation'])) { - $fs = new fs(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'root' . DIRECTORY_SEPARATOR); - try { - $rslt = null; - switch($_GET['operation']) { - case 'get_node': - $node = isset($_GET['id']) && $_GET['id'] !== '#' ? $_GET['id'] : '/'; - $rslt = $fs->lst($node, (isset($_GET['id']) && $_GET['id'] === '#')); - break; - case "get_content": - $node = isset($_GET['id']) && $_GET['id'] !== '#' ? $_GET['id'] : '/'; - $rslt = $fs->data($node); - break; - case 'create_node': - $node = isset($_GET['id']) && $_GET['id'] !== '#' ? $_GET['id'] : '/'; - $rslt = $fs->create($node, isset($_GET['text']) ? $_GET['text'] : '', (!isset($_GET['type']) || $_GET['type'] !== 'file')); - break; - case 'rename_node': - $node = isset($_GET['id']) && $_GET['id'] !== '#' ? $_GET['id'] : '/'; - $rslt = $fs->rename($node, isset($_GET['text']) ? $_GET['text'] : ''); - break; - case 'delete_node': - $node = isset($_GET['id']) && $_GET['id'] !== '#' ? $_GET['id'] : '/'; - $rslt = $fs->remove($node); - break; - case 'move_node': - $node = isset($_GET['id']) && $_GET['id'] !== '#' ? $_GET['id'] : '/'; - $parn = isset($_GET['parent']) && $_GET['parent'] !== '#' ? $_GET['parent'] : '/'; - $rslt = $fs->move($node, $parn); - break; - case 'copy_node': - $node = isset($_GET['id']) && $_GET['id'] !== '#' ? $_GET['id'] : '/'; - $parn = isset($_GET['parent']) && $_GET['parent'] !== '#' ? $_GET['parent'] : '/'; - $rslt = $fs->copy($node, $parn); - break; - default: - throw new Exception('Unsupported operation: ' . $_GET['operation']); - break; - } - header('Content-Type: application/json; charset=utf-8'); - echo json_encode($rslt); - } - catch (Exception $e) { - header($_SERVER["SERVER_PROTOCOL"] . ' 500 Server Error'); - header('Status: 500 Server Error'); - echo $e->getMessage(); - } - die(); -} -?> - - - - - - Title - - - - - -
    -
    -
    - - - -
    Select a file from the tree.
    -
    -
    - - - - - - \ No newline at end of file diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/demo/sitebrowser/class.db.php b/mayan/apps/cabinets/static/cabinets/packages/jstree/demo/sitebrowser/class.db.php deleted file mode 100644 index bf06935f22..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/demo/sitebrowser/class.db.php +++ /dev/null @@ -1,1082 +0,0 @@ -query('UPDATE table SET value = 1 WHERE id = ?', array(1)); -// get all results as array -$db->all('SELECT * FROM table WHERE id = ?', array(1), "array_key", bool_skip_key, "assoc"/"num"); -// get one result -$db->one('SELECT * FROM table WHERE id = ?', array(1), "assoc"/"num"); -// get a traversable object to pass to foreach, or use count(), or use direct access: [INDEX] -$db->get('SELECT * FROM table WHERE id = ?', array(1), "assoc"/"num")[1]; -*/ - -namespace -{ - class db - { - private function __construct() { - } - public function __clone() { - throw new \vakata\database\Exception('Cannot clone static DB'); - } - public static function get($settings = null) { - return new \vakata\database\DBC($settings); - } - public static function getc($settings = null, \vakata\cache\ICache $c = null) { - if($c === null) { $c = \vakata\cache\cache::inst(); } - return new \vakata\database\DBCCached($settings, $c); - } - } -} - -namespace vakata\database -{ - class Exception extends \Exception - { - } - - class Settings - { - public $type = null; - public $username = 'root'; - public $password = null; - public $database = null; - public $servername = 'localhost'; - public $serverport = null; - public $persist = false; - public $timezone = null; - public $charset = 'UTF8'; - - public function __construct($settings) { - $str = parse_url($settings); - if(!$str) { - throw new Exception('Malformed DB settings string: ' . $settings); - } - if(array_key_exists('scheme',$str)) { - $this->type = rawurldecode($str['scheme']); - } - if(array_key_exists('user',$str)) { - $this->username = rawurldecode($str['user']); - } - if(array_key_exists('pass',$str)) { - $this->password = rawurldecode($str['pass']); - } - if(array_key_exists('path',$str)) { - $this->database = trim(rawurldecode($str['path']),'/'); - } - if(array_key_exists('host',$str)) { - $this->servername = rawurldecode($str['host']); - } - if(array_key_exists('port',$str)) { - $this->serverport = rawurldecode($str['port']); - } - if(array_key_exists('query',$str)) { - parse_str($str['query'], $str); - $this->persist = (array_key_exists('persist', $str) && $str['persist'] === 'TRUE'); - if(array_key_exists('charset', $str)) { - $this->charset = $str['charset']; - } - if(array_key_exists('timezone', $str)) { - $this->timezone = $str['timezone']; - } - } - } - } - - interface IDB - { - public function connect(); - public function query($sql, $vars); - public function get($sql, $data, $key, $skip_key, $mode); - public function all($sql, $data, $key, $skip_key, $mode); - public function one($sql, $data, $mode); - public function raw($sql); - public function prepare($sql); - public function execute($data); - public function disconnect(); - } - - interface IDriver - { - public function prepare($sql); - public function execute($data); - public function query($sql, $data); - public function nextr($result); - public function seek($result, $row); - public function nf($result); - public function af(); - public function insert_id(); - public function real_query($sql); - public function get_settings(); - } - - abstract class ADriver implements IDriver - { - protected $lnk = null; - protected $settings = null; - - public function __construct(Settings $settings) { - $this->settings = $settings; - } - public function __destruct() { - if($this->is_connected()) { - $this->disconnect(); - } - } - public function get_settings() { - return $this->settings; - } - - public function connect() { - } - public function is_connected() { - return $this->lnk !== null; - } - public function disconnect() { - } - public function query($sql, $data = array()) { - return $this->execute($this->prepare($sql), $data); - } - public function prepare($sql) { - if(!$this->is_connected()) { $this->connect(); } - return $sql; - } - public function execute($sql, $data = array()) { - if(!$this->is_connected()) { $this->connect(); } - if(!is_array($data)) { $data = array(); } - $binder = '?'; - if(strpos($sql, $binder) !== false && is_array($data) && count($data)) { - $tmp = explode($binder, $sql); - if(!is_array($data)) { $data = array($data); } - $data = array_values($data); - if(count($data) >= count($tmp)) { $data = array_slice($data, 0, count($tmp)-1); } - $sql = $tmp[0]; - foreach($data as $i => $v) { - $sql .= $this->escape($v) . $tmp[($i + 1)]; - } - } - return $this->real_query($sql); - } - - public function real_query($sql) { - if(!$this->is_connected()) { $this->connect(); } - } - protected function escape($input) { - if(is_array($input)) { - foreach($input as $k => $v) { - $input[$k] = $this->escape($v); - } - return implode(',',$input); - } - if(is_string($input)) { - $input = addslashes($input); - return "'".$input."'"; - } - if(is_bool($input)) { - return $input === false ? 0 : 1; - } - if(is_null($input)) { - return 'NULL'; - } - return $input; - } - - public function nextr($result) {} - public function nf($result) {} - public function af() {} - public function insert_id() {} - public function seek($result, $row) {} - } - - class Result implements \Iterator, \ArrayAccess, \Countable - { - protected $all = null; - protected $rdy = false; - protected $rslt = null; - protected $mode = null; - protected $fake = null; - protected $skip = false; - - protected $fake_key = 0; - protected $real_key = 0; - public function __construct(Query $rslt, $key = null, $skip_key = false, $mode = 'assoc') { - $this->rslt = $rslt; - $this->mode = $mode; - $this->fake = $key; - $this->skip = $skip_key; - } - public function count() { - return $this->rdy ? count($this->all) : $this->rslt->nf(); - } - public function current() { - if(!$this->count()) { - return null; - } - if($this->rdy) { - return current($this->all); - } - $tmp = $this->rslt->row(); - $row = array(); - switch($this->mode) { - case 'num': - foreach($tmp as $k => $v) { - if(is_int($k)) { - $row[$k] = $v; - } - } - break; - case 'both': - $row = $tmp; - break; - case 'assoc': - default: - foreach($tmp as $k => $v) { - if(!is_int($k)) { - $row[$k] = $v; - } - } - break; - } - if($this->fake) { - $this->fake_key = $row[$this->fake]; - } - if($this->skip) { - unset($row[$this->fake]); - } - if(is_array($row) && count($row) === 1) { - $row = current($row); - } - return $row; - } - public function key() { - if($this->rdy) { - return key($this->all); - } - return $this->fake ? $this->fake_key : $this->real_key; - } - public function next() { - if($this->rdy) { - return next($this->all); - } - $this->rslt->nextr(); - $this->real_key++; - } - public function rewind() { - if($this->rdy) { - return reset($this->all); - } - if($this->real_key !== null) { - $this->rslt->seek(($this->real_key = 0)); - } - $this->rslt->nextr(); - } - public function valid() { - if($this->rdy) { - return current($this->all) !== false; - } - return $this->rslt->row() !== false && $this->rslt->row() !== null; - } - - public function one() { - $this->rewind(); - return $this->current(); - } - public function get() { - if(!$this->rdy) { - $this->all = array(); - foreach($this as $k => $v) { - $this->all[$k] = $v; - } - $this->rdy = true; - } - return $this->all; - } - public function offsetExists($offset) { - if($this->rdy) { - return isset($this->all[$offset]); - } - if($this->fake === null) { - return $this->rslt->seek(($this->real_key = $offset)); - } - $this->get(); - return isset($this->all[$offset]); - } - public function offsetGet($offset) { - if($this->rdy) { - return $this->all[$offset]; - } - if($this->fake === null) { - $this->rslt->seek(($this->real_key = $offset)); - $this->rslt->nextr(); - return $this->current(); - } - $this->get(); - return $this->all[$offset]; - } - public function offsetSet ($offset, $value ) { - throw new Exception('Cannot set result'); - } - public function offsetUnset ($offset) { - throw new Exception('Cannot unset result'); - } - public function __sleep() { - $this->get(); - return array('all', 'rdy', 'mode', 'fake', 'skip'); - } - public function __toString() { - return print_r($this->get(), true); - } - } - - class Query - { - protected $drv = null; - protected $sql = null; - protected $prp = null; - protected $rsl = null; - protected $row = null; - protected $num = null; - protected $aff = null; - protected $iid = null; - - public function __construct(IDriver $drv, $sql) { - $this->drv = $drv; - $this->sql = $sql; - $this->prp = $this->drv->prepare($sql); - } - public function execute($vars = array()) { - $this->rsl = $this->drv->execute($this->prp, $vars); - $this->num = (is_object($this->rsl) || is_resource($this->rsl)) && is_callable(array($this->drv, 'nf')) ? (int)@$this->drv->nf($this->rsl) : 0; - $this->aff = $this->drv->af(); - $this->iid = $this->drv->insert_id(); - return $this; - } - public function result($key = null, $skip_key = false, $mode = 'assoc') { - return new Result($this, $key, $skip_key, $mode); - } - public function row() { - return $this->row; - } - public function f($field) { - return $this->row[$field]; - } - public function nextr() { - $this->row = $this->drv->nextr($this->rsl); - return $this->row !== false && $this->row !== null; - } - public function seek($offset) { - return @$this->drv->seek($this->rsl, $offset) ? true : false; - } - public function nf() { - return $this->num; - } - public function af() { - return $this->aff; - } - public function insert_id() { - return $this->iid; - } - } - - class DBC implements IDB - { - protected $drv = null; - protected $que = null; - - public function __construct($drv = null) { - if(!$drv && defined('DATABASE')) { - $drv = DATABASE; - } - if(!$drv) { - $this->error('Could not create database (no settings)'); - } - if(is_string($drv)) { - $drv = new \vakata\database\Settings($drv); - } - if($drv instanceof Settings) { - $tmp = '\\vakata\\database\\' . $drv->type . '_driver'; - if(!class_exists($tmp)) { - $this->error('Could not create database (no driver: '.$drv->type.')'); - } - $drv = new $tmp($drv); - } - if(!($drv instanceof IDriver)) { - $this->error('Could not create database - wrong driver'); - } - $this->drv = $drv; - } - - public function connect() { - if(!$this->drv->is_connected()) { - try { - $this->drv->connect(); - } - catch (Exception $e) { - $this->error($e->getMessage(), 1); - } - } - return true; - } - public function disconnect() { - if($this->drv->is_connected()) { - $this->drv->disconnect(); - } - } - - public function prepare($sql) { - try { - $this->que = new Query($this->drv, $sql); - return $this->que; - } catch (Exception $e) { - $this->error($e->getMessage(), 2); - } - } - public function execute($data = array()) { - try { - return $this->que->execute($data); - } catch (Exception $e) { - $this->error($e->getMessage(), 3); - } - } - public function query($sql, $data = array()) { - try { - $this->que = new Query($this->drv, $sql); - return $this->que->execute($data); - } - catch (Exception $e) { - $this->error($e->getMessage(), 4); - } - } - public function get($sql, $data = array(), $key = null, $skip_key = false, $mode = 'assoc') { - return $this->query($sql, $data)->result($key, $skip_key, $mode); - } - public function all($sql, $data = array(), $key = null, $skip_key = false, $mode = 'assoc') { - return $this->get($sql, $data, $key, $skip_key, $mode)->get(); - } - public function one($sql, $data = array(), $mode = 'assoc') { - return $this->query($sql, $data)->result(null, false, $mode)->one(); - } - public function raw($sql) { - return $this->drv->real_query($sql); - } - public function get_driver() { - return $this->drv->get_settings()->type; - } - - public function __call($method, $args) { - if($this->que && is_callable(array($this->que, $method))) { - try { - return call_user_func_array(array($this->que, $method), $args); - } catch (Exception $e) { - $this->error($e->getMessage(), 5); - } - } - } - - protected final function error($error = '') { - $dirnm = defined('LOGROOT') ? LOGROOT : realpath(dirname(__FILE__)); - @file_put_contents( - $dirnm . DIRECTORY_SEPARATOR . '_errors_sql.log', - '[' . date('d-M-Y H:i:s') . '] ' . $this->settings->type . ' > ' . preg_replace("@[\s\r\n\t]+@", ' ', $error) . "\n", - FILE_APPEND - ); - throw new Exception($error); - } - } - - class DBCCached extends DBC - { - protected $cache_inst = null; - protected $cache_nmsp = null; - public function __construct($settings = null, \vakata\cache\ICache $c = null) { - parent::__construct($settings); - $this->cache_inst = $c; - $this->cache_nmsp = 'DBCCached_' . md5(serialize($this->drv->get_settings())); - } - public function cache($expires, $sql, $data = array(), $key = null, $skip_key = false, $mode = 'assoc') { - $arg = func_get_args(); - array_shift($arg); - $key = md5(serialize($arg)); - if(!$this->cache_inst) { - return call_user_func_array(array($this, 'all'), $arg); - } - - $tmp = $this->cache_inst->get($key, $this->cache_nmsp); - if(!$tmp) { - $this->cache_inst->prep($key, $this->cache_nmsp); - $tmp = call_user_func_array(array($this, 'all'), $arg); - $this->cache_inst->set($key, $tmp, $this->cache_nmsp, $expires); - } - return $tmp; - } - public function clear() { - if($this->cache_inst) { - $this->cache_inst->clear($this->cache_nmsp); - } - } - } - - class mysqli_driver extends ADriver - { - protected $iid = 0; - protected $aff = 0; - protected $mnd = false; - - public function __construct($settings) { - parent::__construct($settings); - if(!$this->settings->serverport) { $this->settings->serverport = 3306; } - $this->mnd = function_exists('mysqli_fetch_all'); - } - - public function connect() { - $this->lnk = new \mysqli( - ($this->settings->persist ? 'p:' : '') . $this->settings->servername, - $this->settings->username, - $this->settings->password, - $this->settings->database, - $this->settings->serverport - ); - if($this->lnk->connect_errno) { - throw new Exception('Connect error: ' . $this->lnk->connect_errno); - } - if(!$this->lnk->set_charset($this->settings->charset)) { - throw new Exception('Charset error: ' . $this->lnk->connect_errno); - } - if($this->settings->timezone) { - @$this->lnk->query("SET time_zone = '" . addslashes($this->settings->timezone) . "'"); - } - return true; - } - public function disconnect() { - if($this->is_connected()) { - @$this->lnk->close(); - } - } - public function real_query($sql) { - if(!$this->is_connected()) { $this->connect(); } - $temp = $this->lnk->query($sql); - if(!$temp) { - throw new Exception('Could not execute query : ' . $this->lnk->error . ' <'.$sql.'>'); - } - $this->iid = $this->lnk->insert_id; - $this->aff = $this->lnk->affected_rows; - return $temp; - } - public function nextr($result) { - if($this->mnd) { - return $result->fetch_array(MYSQLI_BOTH); - } - else { - $ref = $result->result_metadata(); - if(!$ref) { return false; } - $tmp = mysqli_fetch_fields($ref); - if(!$tmp) { return false; } - $ref = array(); - foreach($tmp as $col) { $ref[$col->name] = null; } - $tmp = array(); - foreach($ref as $k => $v) { $tmp[] =& $ref[$k]; } - if(!call_user_func_array(array($result, 'bind_result'), $tmp)) { return false; } - if(!$result->fetch()) { return false; } - $tmp = array(); - $i = 0; - foreach($ref as $k => $v) { $tmp[$i++] = $v; $tmp[$k] = $v; } - return $tmp; - } - } - public function seek($result, $row) { - $temp = $result->data_seek($row); - return $temp; - } - public function nf($result) { - return $result->num_rows; - } - public function af() { - return $this->aff; - } - public function insert_id() { - return $this->iid; - } - public function prepare($sql) { - if(!$this->is_connected()) { $this->connect(); } - $temp = $this->lnk->prepare($sql); - if(!$temp) { - throw new Exception('Could not prepare : ' . $this->lnk->error . ' <'.$sql.'>'); - } - return $temp; - } - public function execute($sql, $data = array()) { - if(!$this->is_connected()) { $this->connect(); } - if(!is_array($data)) { $data = array(); } - if(is_string($sql)) { - return parent::execute($sql, $data); - } - - $data = array_values($data); - if($sql->param_count) { - if(count($data) < $sql->param_count) { - throw new Exception('Prepared execute - not enough parameters.'); - } - $ref = array(''); - foreach($data as $i => $v) { - switch(gettype($v)) { - case "boolean": - case "integer": - $data[$i] = (int)$v; - $ref[0] .= 'i'; - $ref[$i+1] =& $data[$i]; - break; - case "double": - $ref[0] .= 'd'; - $ref[$i+1] =& $data[$i]; - break; - case "array": - $data[$i] = implode(',',$v); - $ref[0] .= 's'; - $ref[$i+1] =& $data[$i]; - break; - case "object": - case "resource": - $data[$i] = serialize($data[$i]); - $ref[0] .= 's'; - $ref[$i+1] =& $data[$i]; - break; - default: - $ref[0] .= 's'; - $ref[$i+1] =& $data[$i]; - break; - } - } - call_user_func_array(array($sql, 'bind_param'), $ref); - } - $rtrn = $sql->execute(); - if(!$this->mnd) { - $sql->store_result(); - } - if(!$rtrn) { - throw new Exception('Prepared execute error : ' . $this->lnk->error); - } - $this->iid = $this->lnk->insert_id; - $this->aff = $this->lnk->affected_rows; - if(!$this->mnd) { - return $sql->field_count ? $sql : $rtrn; - } - else { - return $sql->field_count ? $sql->get_result() : $rtrn; - } - } - - protected function escape($input) { - if(is_array($input)) { - foreach($input as $k => $v) { - $input[$k] = $this->escape($v); - } - return implode(',',$input); - } - if(is_string($input)) { - $input = $this->lnk->real_escape_string($input); - return "'".$input."'"; - } - if(is_bool($input)) { - return $input === false ? 0 : 1; - } - if(is_null($input)) { - return 'NULL'; - } - return $input; - } - } - - class mysql_driver extends ADriver - { - protected $iid = 0; - protected $aff = 0; - public function __construct($settings) { - parent::__construct($settings); - if(!$this->settings->serverport) { $this->settings->serverport = 3306; } - } - public function connect() { - $this->lnk = ($this->settings->persist) ? - @mysql_pconnect( - $this->settings->servername.':'.$this->settings->serverport, - $this->settings->username, - $this->settings->password - ) : - @mysql_connect( - $this->settings->servername.':'.$this->settings->serverport, - $this->settings->username, - $this->settings->password - ); - - if($this->lnk === false || !mysql_select_db($this->settings->database, $this->lnk) || !mysql_query("SET NAMES '".$this->settings->charset."'", $this->lnk)) { - throw new Exception('Connect error: ' . mysql_error()); - } - if($this->settings->timezone) { - @mysql_query("SET time_zone = '" . addslashes($this->settings->timezone) . "'", $this->lnk); - } - return true; - } - public function disconnect() { - if(is_resource($this->lnk)) { - mysql_close($this->lnk); - } - } - - public function real_query($sql) { - if(!$this->is_connected()) { $this->connect(); } - $temp = mysql_query($sql, $this->lnk); - if(!$temp) { - throw new Exception('Could not execute query : ' . mysql_error($this->lnk) . ' <'.$sql.'>'); - } - $this->iid = mysql_insert_id($this->lnk); - $this->aff = mysql_affected_rows($this->lnk); - return $temp; - } - public function nextr($result) { - return mysql_fetch_array($result, MYSQL_BOTH); - } - public function seek($result, $row) { - $temp = @mysql_data_seek($result, $row); - if(!$temp) { - //throw new Exception('Could not seek : ' . mysql_error($this->lnk)); - } - return $temp; - } - public function nf($result) { - return mysql_num_rows($result); - } - public function af() { - return $this->aff; - } - public function insert_id() { - return $this->iid; - } - - protected function escape($input) { - if(is_array($input)) { - foreach($input as $k => $v) { - $input[$k] = $this->escape($v); - } - return implode(',',$input); - } - if(is_string($input)) { - $input = mysql_real_escape_string($input, $this->lnk); - return "'".$input."'"; - } - if(is_bool($input)) { - return $input === false ? 0 : 1; - } - if(is_null($input)) { - return 'NULL'; - } - return $input; - } - } - - class postgre_driver extends ADriver - { - protected $iid = 0; - protected $aff = 0; - public function __construct($settings) { - parent::__construct($settings); - if(!$this->settings->serverport) { $this->settings->serverport = 5432; } - } - public function connect() { - $this->lnk = ($this->settings->persist) ? - @pg_pconnect( - "host=" . $this->settings->servername . " " . - "port=" . $this->settings->serverport . " " . - "user=" . $this->settings->username . " " . - "password=" . $this->settings->password . " " . - "dbname=" . $this->settings->database . " " . - "options='--client_encoding=".strtoupper($this->settings->charset)."' " - ) : - @pg_connect( - "host=" . $this->settings->servername . " " . - "port=" . $this->settings->serverport . " " . - "user=" . $this->settings->username . " " . - "password=" . $this->settings->password . " " . - "dbname=" . $this->settings->database . " " . - "options='--client_encoding=".strtoupper($this->settings->charset)."' " - ); - if($this->lnk === false) { - throw new Exception('Connect error'); - } - if($this->settings->timezone) { - @pg_query($this->lnk, "SET TIME ZONE '".addslashes($this->settings->timezone)."'"); - } - return true; - } - public function disconnect() { - if(is_resource($this->lnk)) { - pg_close($this->lnk); - } - } - public function real_query($sql) { - return $this->query($sql); - } - public function prepare($sql) { - if(!$this->is_connected()) { $this->connect(); } - $binder = '?'; - if(strpos($sql, $binder) !== false) { - $tmp = explode($binder, $sql); - $sql = $tmp[0]; - foreach($tmp as $i => $v) { - $sql .= '$' . ($i + 1); - if(isset($tmp[($i + 1)])) { - $sql .= $tmp[($i + 1)]; - } - } - } - return $sql; - } - public function execute($sql, $data = array()) { - if(!$this->is_connected()) { $this->connect(); } - if(!is_array($data)) { $data = array(); } - $temp = (is_array($data) && count($data)) ? pg_query_params($this->lnk, $sql, $data) : pg_query_params($this->lnk, $sql, array()); - if(!$temp) { - throw new Exception('Could not execute query : ' . pg_last_error($this->lnk) . ' <'.$sql.'>'); - } - if(preg_match('@^\s*(INSERT|REPLACE)\s+INTO@i', $sql)) { - $this->iid = pg_query($this->lnk, 'SELECT lastval()'); - $this->aff = pg_affected_rows($temp); - } - return $temp; - } - - public function nextr($result) { - return pg_fetch_array($result, NULL, PGSQL_BOTH); - } - public function seek($result, $row) { - $temp = @pg_result_seek($result, $row); - if(!$temp) { - //throw new Exception('Could not seek : ' . pg_last_error($this->lnk)); - } - return $temp; - } - public function nf($result) { - return pg_num_rows($result); - } - public function af() { - return $this->aff; - } - public function insert_id() { - return $this->iid; - } - - // Функция mysql_query? - // - http://okbob.blogspot.com/2009/08/mysql-functions-for-postgresql.html - // - http://www.xach.com/aolserver/mysql-to-postgresql.html - // - REPLACE unixtimestamp / limit / curdate - } - - class oracle_driver extends ADriver - { - protected $iid = 0; - protected $aff = 0; - - public function connect() { - $this->lnk = ($this->settings->persist) ? - @oci_pconnect($this->settings->username, $this->settings->password, $this->settings->servername, $this->settings->charset) : - @oci_connect ($this->settings->username, $this->settings->password, $this->settings->servername, $this->settings->charset); - if($this->lnk === false) { - throw new Exception('Connect error : ' . oci_error()); - } - if($this->settings->timezone) { - $this->real_query("ALTER session SET time_zone = '" . addslashes($this->settings->timezone) . "'"); - } - return true; - } - public function disconnect() { - if(is_resource($this->lnk)) { - oci_close($this->lnk); - } - } - public function real_query($sql) { - if(!$this->is_connected()) { $this->connect(); } - $temp = oci_parse($this->lnk, $sql); - if(!$temp || !oci_execute($temp)) { - throw new Exception('Could not execute real query : ' . oci_error($temp)); - } - $this->aff = oci_num_rows($temp); - return $temp; - } - - public function prepare($sql) { - if(!$this->is_connected()) { $this->connect(); } - $binder = '?'; - if(strpos($sql, $binder) !== false && $vars !== false) { - $tmp = explode($this->binder, $sql); - $sql = $tmp[0]; - foreach($tmp as $i => $v) { - $sql .= ':f' . $i; - if(isset($tmp[($i + 1)])) { - $sql .= $tmp[($i + 1)]; - } - } - } - return oci_parse($this->lnk, $sql); - } - public function execute($sql, $data = array()) { - if(!$this->is_connected()) { $this->connect(); } - if(!is_array($data)) { $data = array(); } - $data = array_values($data); - foreach($data as $i => $v) { - switch(gettype($v)) { - case "boolean": - case "integer": - $data[$i] = (int)$v; - oci_bind_by_name($sql, 'f'.$i, $data[$i], SQLT_INT); - break; - case "array": - $data[$i] = implode(',',$v); - oci_bind_by_name($sql, 'f'.$i, $data[$i]); - break; - case "object": - case "resource": - $data[$i] = serialize($data[$i]); - oci_bind_by_name($sql, 'f'.$i, $data[$i]); - break; - default: - oci_bind_by_name($sql, 'f'.$i, $data[$i]); - break; - } - } - $temp = oci_execute($sql); - if(!$temp) { - throw new Exception('Could not execute query : ' . oci_error($sql)); - } - $this->aff = oci_num_rows($sql); - - /* TO DO: get iid - if(!$seqname) { return $this->error('INSERT_ID not supported with no sequence.'); } - $stm = oci_parse($this->link, 'SELECT '.strtoupper(str_replace("'",'',$seqname)).'.CURRVAL FROM DUAL'); - oci_execute($stm, $sql); - $tmp = oci_fetch_array($stm); - $tmp = $tmp[0]; - oci_free_statement($stm); - */ - return $sql; - } - public function nextr($result) { - return oci_fetch_array($result, OCI_BOTH); - } - public function seek($result, $row) { - $cnt = 0; - while($cnt < $row) { - if(oci_fetch_array($result, OCI_BOTH) === false) { - return false; - } - $cnt++; - } - return true; - } - public function nf($result) { - return oci_num_rows($result); - } - public function af() { - return $this->aff; - } - public function insert_id() { - return $this->iid; - } - } - - class ibase_driver extends ADriver - { - protected $iid = 0; - protected $aff = 0; - public function __construct($settings) { - parent::__construct($settings); - if(!is_file($this->settings->database) && is_file('/'.$this->settings->database)) { - $this->settings->database = '/'.$this->settings->database; - } - $this->settings->servername = ($this->settings->servername === 'localhost' || $this->settings->servername === '127.0.0.1' || $this->settings->servername === '') ? - '' : - $this->settings->servername . ':'; - } - public function connect() { - $this->lnk = ($this->settings->persist) ? - @ibase_pconnect( - $this->settings->servername . $this->settings->database, - $this->settings->username, - $this->settings->password, - strtoupper($this->settings->charset) - ) : - @ibase_connect( - $this->settings->servername . $this->settings->database, - $this->settings->username, - $this->settings->password, - strtoupper($this->settings->charset) - ); - if($this->lnk === false) { - throw new Exception('Connect error: ' . ibase_errmsg()); - } - return true; - } - public function disconnect() { - if(is_resource($this->lnk)) { - ibase_close($this->lnk); - } - } - - public function real_query($sql) { - if(!$this->is_connected()) { $this->connect(); } - $temp = ibase_query($sql, $this->lnk); - if(!$temp) { - throw new Exception('Could not execute query : ' . ibase_errmsg() . ' <'.$sql.'>'); - } - //$this->iid = mysql_insert_id($this->lnk); - $this->aff = ibase_affected_rows($this->lnk); - return $temp; - } - public function prepare($sql) { - if(!$this->is_connected()) { $this->connect(); } - return ibase_prepare($this->lnk, $sql); - } - public function execute($sql, $data = array()) { - if(!$this->is_connected()) { $this->connect(); } - if(!is_array($data)) { $data = array(); } - $data = array_values($data); - foreach($data as $i => $v) { - switch(gettype($v)) { - case "boolean": - case "integer": - $data[$i] = (int)$v; - break; - case "array": - $data[$i] = implode(',',$v); - break; - case "object": - case "resource": - $data[$i] = serialize($data[$i]); - break; - } - } - array_unshift($data, $sql); - $temp = call_user_func_array("ibase_execute", $data); - if(!$temp) { - throw new Exception('Could not execute query : ' . ibase_errmsg() . ' <'.$sql.'>'); - } - $this->aff = ibase_affected_rows($this->lnk); - return $temp; - } - public function nextr($result) { - return ibase_fetch_assoc($result, IBASE_TEXT); - } - public function seek($result, $row) { - return false; - } - public function nf($result) { - return false; - } - public function af() { - return $this->aff; - } - public function insert_id() { - return $this->iid; - } - } -} diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/demo/sitebrowser/class.tree.php b/mayan/apps/cabinets/static/cabinets/packages/jstree/demo/sitebrowser/class.tree.php deleted file mode 100644 index 94731d4b2a..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/demo/sitebrowser/class.tree.php +++ /dev/null @@ -1,986 +0,0 @@ - 'structure', // the structure table (containing the id, left, right, level, parent_id and position fields) - 'data_table' => 'structure', // table for additional fields (apart from structure ones, can be the same as structure_table) - 'data2structure' => 'id', // which field from the data table maps to the structure table - 'structure' => array( // which field (value) maps to what in the structure (key) - 'id' => 'id', - 'left' => 'lft', - 'right' => 'rgt', - 'level' => 'lvl', - 'parent_id' => 'pid', - 'position' => 'pos' - ), - 'data' => array() // array of additional fields from the data table - ); - - public function __construct(\vakata\database\IDB $db, array $options = array()) { - $this->db = $db; - $this->options = array_merge($this->default, $options); - } - - public function get_node($id, $options = array()) { - $node = $this->db->one(" - SELECT - s.".implode(", s.", $this->options['structure']).", - d.".implode(", d.", $this->options['data'])." - FROM - ".$this->options['structure_table']." s, - ".$this->options['data_table']." d - WHERE - s.".$this->options['structure']['id']." = d.".$this->options['data2structure']." AND - s.".$this->options['structure']['id']." = ".(int)$id - ); - if(!$node) { - throw new Exception('Node does not exist'); - } - if(isset($options['with_children'])) { - $node['children'] = $this->get_children($id, isset($options['deep_children'])); - } - if(isset($options['with_path'])) { - $node['path'] = $this->get_path($id); - } - return $node; - } - - public function get_children($id, $recursive = false) { - $sql = false; - if($recursive) { - $node = $this->get_node($id); - $sql = " - SELECT - s.".implode(", s.", $this->options['structure']).", - d.".implode(", d.", $this->options['data'])." - FROM - ".$this->options['structure_table']." s, - ".$this->options['data_table']." d - WHERE - s.".$this->options['structure']['id']." = d.".$this->options['data2structure']." AND - s.".$this->options['structure']['left']." > ".(int)$node[$this->options['structure']['left']]." AND - s.".$this->options['structure']['right']." < ".(int)$node[$this->options['structure']['right']]." - ORDER BY - s.".$this->options['structure']['left']." - "; - } - else { - $sql = " - SELECT - s.".implode(", s.", $this->options['structure']).", - d.".implode(", d.", $this->options['data'])." - FROM - ".$this->options['structure_table']." s, - ".$this->options['data_table']." d - WHERE - s.".$this->options['structure']['id']." = d.".$this->options['data2structure']." AND - s.".$this->options['structure']['parent_id']." = ".(int)$id." - ORDER BY - s.".$this->options['structure']['position']." - "; - } - return $this->db->all($sql); - } - - public function get_path($id) { - $node = $this->get_node($id); - $sql = false; - if($node) { - $sql = " - SELECT - s.".implode(", s.", $this->options['structure']).", - d.".implode(", d.", $this->options['data'])." - FROM - ".$this->options['structure_table']." s, - ".$this->options['data_table']." d - WHERE - s.".$this->options['structure']['id']." = d.".$this->options['data2structure']." AND - s.".$this->options['structure']['left']." < ".(int)$node[$this->options['structure']['left']]." AND - s.".$this->options['structure']['right']." > ".(int)$node[$this->options['structure']['right']]." - ORDER BY - s.".$this->options['structure']['left']." - "; - } - return $sql ? $this->db->all($sql) : false; - } - - public function mk($parent, $position = 0, $data = array()) { - $parent = (int)$parent; - if($parent == 0) { throw new Exception('Parent is 0'); } - $parent = $this->get_node($parent, array('with_children'=> true)); - if(!$parent['children']) { $position = 0; } - if($parent['children'] && $position >= count($parent['children'])) { $position = count($parent['children']); } - - $sql = array(); - $par = array(); - - // PREPARE NEW PARENT - // update positions of all next elements - $sql[] = " - UPDATE ".$this->options['structure_table']." - SET ".$this->options['structure']["position"]." = ".$this->options['structure']["position"]." + 1 - WHERE - ".$this->options['structure']["parent_id"]." = ".(int)$parent[$this->options['structure']['id']]." AND - ".$this->options['structure']["position"]." >= ".$position." - "; - $par[] = false; - - // update left indexes - $ref_lft = false; - if(!$parent['children']) { - $ref_lft = $parent[$this->options['structure']["right"]]; - } - else if(!isset($parent['children'][$position])) { - $ref_lft = $parent[$this->options['structure']["right"]]; - } - else { - $ref_lft = $parent['children'][(int)$position][$this->options['structure']["left"]]; - } - $sql[] = " - UPDATE ".$this->options['structure_table']." - SET ".$this->options['structure']["left"]." = ".$this->options['structure']["left"]." + 2 - WHERE - ".$this->options['structure']["left"]." >= ".(int)$ref_lft." - "; - $par[] = false; - - // update right indexes - $ref_rgt = false; - if(!$parent['children']) { - $ref_rgt = $parent[$this->options['structure']["right"]]; - } - else if(!isset($parent['children'][$position])) { - $ref_rgt = $parent[$this->options['structure']["right"]]; - } - else { - $ref_rgt = $parent['children'][(int)$position][$this->options['structure']["left"]] + 1; - } - $sql[] = " - UPDATE ".$this->options['structure_table']." - SET ".$this->options['structure']["right"]." = ".$this->options['structure']["right"]." + 2 - WHERE - ".$this->options['structure']["right"]." >= ".(int)$ref_rgt." - "; - $par[] = false; - - // INSERT NEW NODE IN STRUCTURE - $sql[] = "INSERT INTO ".$this->options['structure_table']." (".implode(",", $this->options['structure']).") VALUES (?".str_repeat(',?', count($this->options['structure']) - 1).")"; - $tmp = array(); - foreach($this->options['structure'] as $k => $v) { - switch($k) { - case 'id': - $tmp[] = null; - break; - case 'left': - $tmp[] = (int)$ref_lft; - break; - case 'right': - $tmp[] = (int)$ref_lft + 1; - break; - case 'level': - $tmp[] = (int)$parent[$v] + 1; - break; - case 'parent_id': - $tmp[] = $parent[$this->options['structure']['id']]; - break; - case 'position': - $tmp[] = $position; - break; - default: - $tmp[] = null; - } - } - $par[] = $tmp; - - foreach($sql as $k => $v) { - try { - $this->db->query($v, $par[$k]); - } catch(Exception $e) { - $this->reconstruct(); - throw new Exception('Could not create'); - } - } - if($data && count($data)) { - $node = $this->db->insert_id(); - if(!$this->rn($node,$data)) { - $this->rm($node); - throw new Exception('Could not rename after create'); - } - } - return $node; - } - - public function mv($id, $parent, $position = 0) { - $id = (int)$id; - $parent = (int)$parent; - if($parent == 0 || $id == 0 || $id == 1) { - throw new Exception('Cannot move inside 0, or move root node'); - } - - $parent = $this->get_node($parent, array('with_children'=> true, 'with_path' => true)); - $id = $this->get_node($id, array('with_children'=> true, 'deep_children' => true, 'with_path' => true)); - if(!$parent['children']) { - $position = 0; - } - if($id[$this->options['structure']['parent_id']] == $parent[$this->options['structure']['id']] && $position > $id[$this->options['structure']['position']]) { - $position ++; - } - if($parent['children'] && $position >= count($parent['children'])) { - $position = count($parent['children']); - } - if($id[$this->options['structure']['left']] < $parent[$this->options['structure']['left']] && $id[$this->options['structure']['right']] > $parent[$this->options['structure']['right']]) { - throw new Exception('Could not move parent inside child'); - } - - $tmp = array(); - $tmp[] = (int)$id[$this->options['structure']["id"]]; - if($id['children'] && is_array($id['children'])) { - foreach($id['children'] as $c) { - $tmp[] = (int)$c[$this->options['structure']["id"]]; - } - } - $width = (int)$id[$this->options['structure']["right"]] - (int)$id[$this->options['structure']["left"]] + 1; - - $sql = array(); - - // PREPARE NEW PARENT - // update positions of all next elements - $sql[] = " - UPDATE ".$this->options['structure_table']." - SET ".$this->options['structure']["position"]." = ".$this->options['structure']["position"]." + 1 - WHERE - ".$this->options['structure']["id"]." != ".(int)$id[$this->options['structure']['id']]." AND - ".$this->options['structure']["parent_id"]." = ".(int)$parent[$this->options['structure']['id']]." AND - ".$this->options['structure']["position"]." >= ".$position." - "; - - // update left indexes - $ref_lft = false; - if(!$parent['children']) { - $ref_lft = $parent[$this->options['structure']["right"]]; - } - else if(!isset($parent['children'][$position])) { - $ref_lft = $parent[$this->options['structure']["right"]]; - } - else { - $ref_lft = $parent['children'][(int)$position][$this->options['structure']["left"]]; - } - $sql[] = " - UPDATE ".$this->options['structure_table']." - SET ".$this->options['structure']["left"]." = ".$this->options['structure']["left"]." + ".$width." - WHERE - ".$this->options['structure']["left"]." >= ".(int)$ref_lft." AND - ".$this->options['structure']["id"]." NOT IN(".implode(',',$tmp).") - "; - // update right indexes - $ref_rgt = false; - if(!$parent['children']) { - $ref_rgt = $parent[$this->options['structure']["right"]]; - } - else if(!isset($parent['children'][$position])) { - $ref_rgt = $parent[$this->options['structure']["right"]]; - } - else { - $ref_rgt = $parent['children'][(int)$position][$this->options['structure']["left"]] + 1; - } - $sql[] = " - UPDATE ".$this->options['structure_table']." - SET ".$this->options['structure']["right"]." = ".$this->options['structure']["right"]." + ".$width." - WHERE - ".$this->options['structure']["right"]." >= ".(int)$ref_rgt." AND - ".$this->options['structure']["id"]." NOT IN(".implode(',',$tmp).") - "; - - // MOVE THE ELEMENT AND CHILDREN - // left, right and level - $diff = $ref_lft - (int)$id[$this->options['structure']["left"]]; - - if($diff > 0) { $diff = $diff - $width; } - $ldiff = ((int)$parent[$this->options['structure']['level']] + 1) - (int)$id[$this->options['structure']['level']]; - $sql[] = " - UPDATE ".$this->options['structure_table']." - SET ".$this->options['structure']["right"]." = ".$this->options['structure']["right"]." + ".$diff.", - ".$this->options['structure']["left"]." = ".$this->options['structure']["left"]." + ".$diff.", - ".$this->options['structure']["level"]." = ".$this->options['structure']["level"]." + ".$ldiff." - WHERE ".$this->options['structure']["id"]." IN(".implode(',',$tmp).") - "; - // position and parent_id - $sql[] = " - UPDATE ".$this->options['structure_table']." - SET ".$this->options['structure']["position"]." = ".$position.", - ".$this->options['structure']["parent_id"]." = ".(int)$parent[$this->options['structure']["id"]]." - WHERE ".$this->options['structure']["id"]." = ".(int)$id[$this->options['structure']['id']]." - "; - - // CLEAN OLD PARENT - // position of all next elements - $sql[] = " - UPDATE ".$this->options['structure_table']." - SET ".$this->options['structure']["position"]." = ".$this->options['structure']["position"]." - 1 - WHERE - ".$this->options['structure']["parent_id"]." = ".(int)$id[$this->options['structure']["parent_id"]]." AND - ".$this->options['structure']["position"]." > ".(int)$id[$this->options['structure']["position"]]; - // left indexes - $sql[] = " - UPDATE ".$this->options['structure_table']." - SET ".$this->options['structure']["left"]." = ".$this->options['structure']["left"]." - ".$width." - WHERE - ".$this->options['structure']["left"]." > ".(int)$id[$this->options['structure']["right"]]." AND - ".$this->options['structure']["id"]." NOT IN(".implode(',',$tmp).") - "; - // right indexes - $sql[] = " - UPDATE ".$this->options['structure_table']." - SET ".$this->options['structure']["right"]." = ".$this->options['structure']["right"]." - ".$width." - WHERE - ".$this->options['structure']["right"]." > ".(int)$id[$this->options['structure']["right"]]." AND - ".$this->options['structure']["id"]." NOT IN(".implode(',',$tmp).") - "; - - foreach($sql as $k => $v) { - //echo preg_replace('@[\s\t]+@',' ',$v) ."\n"; - try { - $this->db->query($v); - } catch(Exception $e) { - $this->reconstruct(); - throw new Exception('Error moving'); - } - } - return true; - } - - public function cp($id, $parent, $position = 0) { - $id = (int)$id; - $parent = (int)$parent; - if($parent == 0 || $id == 0 || $id == 1) { - throw new Exception('Could not copy inside parent 0, or copy root nodes'); - } - - $parent = $this->get_node($parent, array('with_children'=> true, 'with_path' => true)); - $id = $this->get_node($id, array('with_children'=> true, 'deep_children' => true, 'with_path' => true)); - $old_nodes = $this->db->get(" - SELECT * FROM ".$this->options['structure_table']." - WHERE ".$this->options['structure']["left"]." > ".$id[$this->options['structure']["left"]]." AND ".$this->options['structure']["right"]." < ".$id[$this->options['structure']["right"]]." - ORDER BY ".$this->options['structure']["left"]." - "); - if(!$parent['children']) { - $position = 0; - } - if($id[$this->options['structure']['parent_id']] == $parent[$this->options['structure']['id']] && $position > $id[$this->options['structure']['position']]) { - //$position ++; - } - if($parent['children'] && $position >= count($parent['children'])) { - $position = count($parent['children']); - } - - $tmp = array(); - $tmp[] = (int)$id[$this->options['structure']["id"]]; - if($id['children'] && is_array($id['children'])) { - foreach($id['children'] as $c) { - $tmp[] = (int)$c[$this->options['structure']["id"]]; - } - } - $width = (int)$id[$this->options['structure']["right"]] - (int)$id[$this->options['structure']["left"]] + 1; - - $sql = array(); - - // PREPARE NEW PARENT - // update positions of all next elements - $sql[] = " - UPDATE ".$this->options['structure_table']." - SET ".$this->options['structure']["position"]." = ".$this->options['structure']["position"]." + 1 - WHERE - ".$this->options['structure']["parent_id"]." = ".(int)$parent[$this->options['structure']['id']]." AND - ".$this->options['structure']["position"]." >= ".$position." - "; - - // update left indexes - $ref_lft = false; - if(!$parent['children']) { - $ref_lft = $parent[$this->options['structure']["right"]]; - } - else if(!isset($parent['children'][$position])) { - $ref_lft = $parent[$this->options['structure']["right"]]; - } - else { - $ref_lft = $parent['children'][(int)$position][$this->options['structure']["left"]]; - } - $sql[] = " - UPDATE ".$this->options['structure_table']." - SET ".$this->options['structure']["left"]." = ".$this->options['structure']["left"]." + ".$width." - WHERE - ".$this->options['structure']["left"]." >= ".(int)$ref_lft." - "; - // update right indexes - $ref_rgt = false; - if(!$parent['children']) { - $ref_rgt = $parent[$this->options['structure']["right"]]; - } - else if(!isset($parent['children'][$position])) { - $ref_rgt = $parent[$this->options['structure']["right"]]; - } - else { - $ref_rgt = $parent['children'][(int)$position][$this->options['structure']["left"]] + 1; - } - $sql[] = " - UPDATE ".$this->options['structure_table']." - SET ".$this->options['structure']["right"]." = ".$this->options['structure']["right"]." + ".$width." - WHERE - ".$this->options['structure']["right"]." >= ".(int)$ref_rgt." - "; - - // MOVE THE ELEMENT AND CHILDREN - // left, right and level - $diff = $ref_lft - (int)$id[$this->options['structure']["left"]]; - - if($diff <= 0) { $diff = $diff - $width; } - $ldiff = ((int)$parent[$this->options['structure']['level']] + 1) - (int)$id[$this->options['structure']['level']]; - - // build all fields + data table - $fields = array_combine($this->options['structure'], $this->options['structure']); - unset($fields['id']); - $fields[$this->options['structure']["left"]] = $this->options['structure']["left"]." + ".$diff; - $fields[$this->options['structure']["right"]] = $this->options['structure']["right"]." + ".$diff; - $fields[$this->options['structure']["level"]] = $this->options['structure']["level"]." + ".$ldiff; - $sql[] = " - INSERT INTO ".$this->options['structure_table']." ( ".implode(',',array_keys($fields))." ) - SELECT ".implode(',',array_values($fields))." FROM ".$this->options['structure_table']." WHERE ".$this->options['structure']["id"]." IN (".implode(",", $tmp).") - ORDER BY ".$this->options['structure']["level"]." ASC"; - - foreach($sql as $k => $v) { - try { - $this->db->query($v); - } catch(Exception $e) { - $this->reconstruct(); - throw new Exception('Error copying'); - } - } - $iid = (int)$this->db->insert_id(); - - try { - $this->db->query(" - UPDATE ".$this->options['structure_table']." - SET ".$this->options['structure']["position"]." = ".$position.", - ".$this->options['structure']["parent_id"]." = ".(int)$parent[$this->options['structure']["id"]]." - WHERE ".$this->options['structure']["id"]." = ".$iid." - "); - } catch(Exception $e) { - $this->rm($iid); - $this->reconstruct(); - throw new Exception('Could not update adjacency after copy'); - } - $fields = $this->options['data']; - unset($fields['id']); - $update_fields = array(); - foreach($fields as $f) { - $update_fields[] = $f.'=VALUES('.$f.')'; - } - $update_fields = implode(',', $update_fields); - if(count($fields)) { - try { - $this->db->query(" - INSERT INTO ".$this->options['data_table']." (".$this->options['data2structure'].",".implode(",",$fields).") - SELECT ".$iid.",".implode(",",$fields)." FROM ".$this->options['data_table']." WHERE ".$this->options['data2structure']." = ".$id[$this->options['data2structure']]." - ON DUPLICATE KEY UPDATE ".$update_fields." - "); - } - catch(Exception $e) { - $this->rm($iid); - $this->reconstruct(); - throw new Exception('Could not update data after copy'); - } - } - - // manually fix all parent_ids and copy all data - $new_nodes = $this->db->get(" - SELECT * FROM ".$this->options['structure_table']." - WHERE ".$this->options['structure']["left"]." > ".$ref_lft." AND ".$this->options['structure']["right"]." < ".($ref_lft + $width - 1)." AND ".$this->options['structure']["id"]." != ".$iid." - ORDER BY ".$this->options['structure']["left"]." - "); - $parents = array(); - foreach($new_nodes as $node) { - if(!isset($parents[$node[$this->options['structure']["left"]]])) { $parents[$node[$this->options['structure']["left"]]] = $iid; } - for($i = $node[$this->options['structure']["left"]] + 1; $i < $node[$this->options['structure']["right"]]; $i++) { - $parents[$i] = $node[$this->options['structure']["id"]]; - } - } - $sql = array(); - foreach($new_nodes as $k => $node) { - $sql[] = " - UPDATE ".$this->options['structure_table']." - SET ".$this->options['structure']["parent_id"]." = ".$parents[$node[$this->options['structure']["left"]]]." - WHERE ".$this->options['structure']["id"]." = ".(int)$node[$this->options['structure']["id"]]." - "; - if(count($fields)) { - $up = ""; - foreach($fields as $f) - $sql[] = " - INSERT INTO ".$this->options['data_table']." (".$this->options['data2structure'].",".implode(",",$fields).") - SELECT ".(int)$node[$this->options['structure']["id"]].",".implode(",",$fields)." FROM ".$this->options['data_table']." - WHERE ".$this->options['data2structure']." = ".$old_nodes[$k][$this->options['structure']['id']]." - ON DUPLICATE KEY UPDATE ".$update_fields." - "; - } - } - //var_dump($sql); - foreach($sql as $k => $v) { - try { - $this->db->query($v); - } catch(Exception $e) { - $this->rm($iid); - $this->reconstruct(); - throw new Exception('Error copying'); - } - } - return $iid; - } - - public function rm($id) { - $id = (int)$id; - if(!$id || $id === 1) { throw new Exception('Could not create inside roots'); } - $data = $this->get_node($id, array('with_children' => true, 'deep_children' => true)); - $lft = (int)$data[$this->options['structure']["left"]]; - $rgt = (int)$data[$this->options['structure']["right"]]; - $pid = (int)$data[$this->options['structure']["parent_id"]]; - $pos = (int)$data[$this->options['structure']["position"]]; - $dif = $rgt - $lft + 1; - - $sql = array(); - // deleting node and its children from structure - $sql[] = " - DELETE FROM ".$this->options['structure_table']." - WHERE ".$this->options['structure']["left"]." >= ".(int)$lft." AND ".$this->options['structure']["right"]." <= ".(int)$rgt." - "; - // shift left indexes of nodes right of the node - $sql[] = " - UPDATE ".$this->options['structure_table']." - SET ".$this->options['structure']["left"]." = ".$this->options['structure']["left"]." - ".(int)$dif." - WHERE ".$this->options['structure']["left"]." > ".(int)$rgt." - "; - // shift right indexes of nodes right of the node and the node's parents - $sql[] = " - UPDATE ".$this->options['structure_table']." - SET ".$this->options['structure']["right"]." = ".$this->options['structure']["right"]." - ".(int)$dif." - WHERE ".$this->options['structure']["right"]." > ".(int)$lft." - "; - // Update position of siblings below the deleted node - $sql[] = " - UPDATE ".$this->options['structure_table']." - SET ".$this->options['structure']["position"]." = ".$this->options['structure']["position"]." - 1 - WHERE ".$this->options['structure']["parent_id"]." = ".$pid." AND ".$this->options['structure']["position"]." > ".(int)$pos." - "; - // delete from data table - if($this->options['data_table']) { - $tmp = array(); - $tmp[] = (int)$data['id']; - if($data['children'] && is_array($data['children'])) { - foreach($data['children'] as $v) { - $tmp[] = (int)$v['id']; - } - } - $sql[] = "DELETE FROM ".$this->options['data_table']." WHERE ".$this->options['data2structure']." IN (".implode(',',$tmp).")"; - } - - foreach($sql as $v) { - try { - $this->db->query($v); - } catch(Exception $e) { - $this->reconstruct(); - throw new Exception('Could not remove'); - } - } - return true; - } - - public function rn($id, $data) { - if(!(int)$this->db->one('SELECT 1 AS res FROM '.$this->options['structure_table'].' WHERE '.$this->options['structure']['id'].' = '.(int)$id)) { - throw new Exception('Could not rename non-existing node'); - } - $tmp = array(); - foreach($this->options['data'] as $v) { - if(isset($data[$v])) { - $tmp[$v] = $data[$v]; - } - } - if(count($tmp)) { - $tmp[$this->options['data2structure']] = $id; - $sql = " - INSERT INTO - ".$this->options['data_table']." (".implode(',', array_keys($tmp)).") - VALUES(?".str_repeat(',?', count($tmp) - 1).") - ON DUPLICATE KEY UPDATE - ".implode(' = ?, ', array_keys($tmp))." = ?"; - $par = array_merge(array_values($tmp), array_values($tmp)); - try { - $this->db->query($sql, $par); - } - catch(Exception $e) { - throw new Exception('Could not rename'); - } - } - return true; - } - - public function analyze($get_errors = false) { - $report = array(); - if((int)$this->db->one("SELECT COUNT(".$this->options['structure']["id"].") AS res FROM ".$this->options['structure_table']." WHERE ".$this->options['structure']["parent_id"]." = 0") !== 1) { - $report[] = "No or more than one root node."; - } - if((int)$this->db->one("SELECT ".$this->options['structure']["left"]." AS res FROM ".$this->options['structure_table']." WHERE ".$this->options['structure']["parent_id"]." = 0") !== 1) { - $report[] = "Root node's left index is not 1."; - } - if((int)$this->db->one(" - SELECT - COUNT(".$this->options['structure']['id'].") AS res - FROM ".$this->options['structure_table']." s - WHERE - ".$this->options['structure']["parent_id"]." != 0 AND - (SELECT COUNT(".$this->options['structure']['id'].") FROM ".$this->options['structure_table']." WHERE ".$this->options['structure']["id"]." = s.".$this->options['structure']["parent_id"].") = 0") > 0 - ) { - $report[] = "Missing parents."; - } - if( - (int)$this->db->one("SELECT MAX(".$this->options['structure']["right"].") AS res FROM ".$this->options['structure_table']) / 2 != - (int)$this->db->one("SELECT COUNT(".$this->options['structure']["id"].") AS res FROM ".$this->options['structure_table']) - ) { - $report[] = "Right index does not match node count."; - } - if( - (int)$this->db->one("SELECT COUNT(DISTINCT ".$this->options['structure']["right"].") AS res FROM ".$this->options['structure_table']) != - (int)$this->db->one("SELECT COUNT(DISTINCT ".$this->options['structure']["left"].") AS res FROM ".$this->options['structure_table']) - ) { - $report[] = "Duplicates in nested set."; - } - if( - (int)$this->db->one("SELECT COUNT(DISTINCT ".$this->options['structure']["id"].") AS res FROM ".$this->options['structure_table']) != - (int)$this->db->one("SELECT COUNT(DISTINCT ".$this->options['structure']["left"].") AS res FROM ".$this->options['structure_table']) - ) { - $report[] = "Left indexes not unique."; - } - if( - (int)$this->db->one("SELECT COUNT(DISTINCT ".$this->options['structure']["id"].") AS res FROM ".$this->options['structure_table']) != - (int)$this->db->one("SELECT COUNT(DISTINCT ".$this->options['structure']["right"].") AS res FROM ".$this->options['structure_table']) - ) { - $report[] = "Right indexes not unique."; - } - if( - (int)$this->db->one(" - SELECT - s1.".$this->options['structure']["id"]." AS res - FROM ".$this->options['structure_table']." s1, ".$this->options['structure_table']." s2 - WHERE - s1.".$this->options['structure']['id']." != s2.".$this->options['structure']['id']." AND - s1.".$this->options['structure']['left']." = s2.".$this->options['structure']['right']." - LIMIT 1") - ) { - $report[] = "Nested set - matching left and right indexes."; - } - if( - (int)$this->db->one(" - SELECT - ".$this->options['structure']["id"]." AS res - FROM ".$this->options['structure_table']." s - WHERE - ".$this->options['structure']['position']." >= ( - SELECT - COUNT(".$this->options['structure']["id"].") - FROM ".$this->options['structure_table']." - WHERE ".$this->options['structure']['parent_id']." = s.".$this->options['structure']['parent_id']." - ) - LIMIT 1") || - (int)$this->db->one(" - SELECT - s1.".$this->options['structure']["id"]." AS res - FROM ".$this->options['structure_table']." s1, ".$this->options['structure_table']." s2 - WHERE - s1.".$this->options['structure']['id']." != s2.".$this->options['structure']['id']." AND - s1.".$this->options['structure']['parent_id']." = s2.".$this->options['structure']['parent_id']." AND - s1.".$this->options['structure']['position']." = s2.".$this->options['structure']['position']." - LIMIT 1") - ) { - $report[] = "Positions not correct."; - } - if((int)$this->db->one(" - SELECT - COUNT(".$this->options['structure']["id"].") FROM ".$this->options['structure_table']." s - WHERE - ( - SELECT - COUNT(".$this->options['structure']["id"].") - FROM ".$this->options['structure_table']." - WHERE - ".$this->options['structure']["right"]." < s.".$this->options['structure']["right"]." AND - ".$this->options['structure']["left"]." > s.".$this->options['structure']["left"]." AND - ".$this->options['structure']["level"]." = s.".$this->options['structure']["level"]." + 1 - ) != - ( - SELECT - COUNT(*) - FROM ".$this->options['structure_table']." - WHERE - ".$this->options['structure']["parent_id"]." = s.".$this->options['structure']["id"]." - )") - ) { - $report[] = "Adjacency and nested set do not match."; - } - if( - $this->options['data_table'] && - (int)$this->db->one(" - SELECT - COUNT(".$this->options['structure']["id"].") AS res - FROM ".$this->options['structure_table']." s - WHERE - (SELECT COUNT(".$this->options['data2structure'].") FROM ".$this->options['data_table']." WHERE ".$this->options['data2structure']." = s.".$this->options['structure']["id"].") = 0 - ") - ) { - $report[] = "Missing records in data table."; - } - if( - $this->options['data_table'] && - (int)$this->db->one(" - SELECT - COUNT(".$this->options['data2structure'].") AS res - FROM ".$this->options['data_table']." s - WHERE - (SELECT COUNT(".$this->options['structure']["id"].") FROM ".$this->options['structure_table']." WHERE ".$this->options['structure']["id"]." = s.".$this->options['data2structure'].") = 0 - ") - ) { - $report[] = "Dangling records in data table."; - } - return $get_errors ? $report : count($report) == 0; - } - - public function reconstruct($analyze = true) { - if($analyze && $this->analyze()) { return true; } - - if(!$this->db->query("" . - "CREATE TEMPORARY TABLE temp_tree (" . - "".$this->options['structure']["id"]." INTEGER NOT NULL, " . - "".$this->options['structure']["parent_id"]." INTEGER NOT NULL, " . - "". $this->options['structure']["position"]." INTEGER NOT NULL" . - ") " - )) { return false; } - if(!$this->db->query("" . - "INSERT INTO temp_tree " . - "SELECT " . - "".$this->options['structure']["id"].", " . - "".$this->options['structure']["parent_id"].", " . - "".$this->options['structure']["position"]." " . - "FROM ".$this->options['structure_table']."" - )) { return false; } - - if(!$this->db->query("" . - "CREATE TEMPORARY TABLE temp_stack (" . - "".$this->options['structure']["id"]." INTEGER NOT NULL, " . - "".$this->options['structure']["left"]." INTEGER, " . - "".$this->options['structure']["right"]." INTEGER, " . - "".$this->options['structure']["level"]." INTEGER, " . - "stack_top INTEGER NOT NULL, " . - "".$this->options['structure']["parent_id"]." INTEGER, " . - "".$this->options['structure']["position"]." INTEGER " . - ") " - )) { return false; } - - $counter = 2; - if(!$this->db->query("SELECT COUNT(*) FROM temp_tree")) { - return false; - } - $this->db->nextr(); - $maxcounter = (int) $this->db->f(0) * 2; - $currenttop = 1; - if(!$this->db->query("" . - "INSERT INTO temp_stack " . - "SELECT " . - "".$this->options['structure']["id"].", " . - "1, " . - "NULL, " . - "0, " . - "1, " . - "".$this->options['structure']["parent_id"].", " . - "".$this->options['structure']["position"]." " . - "FROM temp_tree " . - "WHERE ".$this->options['structure']["parent_id"]." = 0" - )) { return false; } - if(!$this->db->query("DELETE FROM temp_tree WHERE ".$this->options['structure']["parent_id"]." = 0")) { - return false; - } - - while ($counter <= $maxcounter) { - if(!$this->db->query("" . - "SELECT " . - "temp_tree.".$this->options['structure']["id"]." AS tempmin, " . - "temp_tree.".$this->options['structure']["parent_id"]." AS pid, " . - "temp_tree.".$this->options['structure']["position"]." AS lid " . - "FROM temp_stack, temp_tree " . - "WHERE " . - "temp_stack.".$this->options['structure']["id"]." = temp_tree.".$this->options['structure']["parent_id"]." AND " . - "temp_stack.stack_top = ".$currenttop." " . - "ORDER BY temp_tree.".$this->options['structure']["position"]." ASC LIMIT 1" - )) { return false; } - - if($this->db->nextr()) { - $tmp = $this->db->f("tempmin"); - - $q = "INSERT INTO temp_stack (stack_top, ".$this->options['structure']["id"].", ".$this->options['structure']["left"].", ".$this->options['structure']["right"].", ".$this->options['structure']["level"].", ".$this->options['structure']["parent_id"].", ".$this->options['structure']["position"].") VALUES(".($currenttop + 1).", ".$tmp.", ".$counter.", NULL, ".$currenttop.", ".$this->db->f("pid").", ".$this->db->f("lid").")"; - if(!$this->db->query($q)) { - return false; - } - if(!$this->db->query("DELETE FROM temp_tree WHERE ".$this->options['structure']["id"]." = ".$tmp)) { - return false; - } - $counter++; - $currenttop++; - } - else { - if(!$this->db->query("" . - "UPDATE temp_stack SET " . - "".$this->options['structure']["right"]." = ".$counter.", " . - "stack_top = -stack_top " . - "WHERE stack_top = ".$currenttop - )) { return false; } - $counter++; - $currenttop--; - } - } - - $temp_fields = $this->options['structure']; - unset($temp_fields["parent_id"]); - unset($temp_fields["position"]); - unset($temp_fields["left"]); - unset($temp_fields["right"]); - unset($temp_fields["level"]); - if(count($temp_fields) > 1) { - if(!$this->db->query("" . - "CREATE TEMPORARY TABLE temp_tree2 " . - "SELECT ".implode(", ", $temp_fields)." FROM ".$this->options['structure_table']." " - )) { return false; } - } - if(!$this->db->query("TRUNCATE TABLE ".$this->options['structure_table']."")) { - return false; - } - if(!$this->db->query("" . - "INSERT INTO ".$this->options['structure_table']." (" . - "".$this->options['structure']["id"].", " . - "".$this->options['structure']["parent_id"].", " . - "".$this->options['structure']["position"].", " . - "".$this->options['structure']["left"].", " . - "".$this->options['structure']["right"].", " . - "".$this->options['structure']["level"]." " . - ") " . - "SELECT " . - "".$this->options['structure']["id"].", " . - "".$this->options['structure']["parent_id"].", " . - "".$this->options['structure']["position"].", " . - "".$this->options['structure']["left"].", " . - "".$this->options['structure']["right"].", " . - "".$this->options['structure']["level"]." " . - "FROM temp_stack " . - "ORDER BY ".$this->options['structure']["id"]."" - )) { - return false; - } - if(count($temp_fields) > 1) { - $sql = "" . - "UPDATE ".$this->options['structure_table']." v, temp_tree2 SET v.".$this->options['structure']["id"]." = v.".$this->options['structure']["id"]." "; - foreach($temp_fields as $k => $v) { - if($k == "id") continue; - $sql .= ", v.".$v." = temp_tree2.".$v." "; - } - $sql .= " WHERE v.".$this->options['structure']["id"]." = temp_tree2.".$this->options['structure']["id"]." "; - if(!$this->db->query($sql)) { - return false; - } - } - // fix positions - $nodes = $this->db->get("SELECT ".$this->options['structure']['id'].", ".$this->options['structure']['parent_id']." FROM ".$this->options['structure_table']." ORDER BY ".$this->options['structure']['parent_id'].", ".$this->options['structure']['position']); - $last_parent = false; - $last_position = false; - foreach($nodes as $node) { - if((int)$node[$this->options['structure']['parent_id']] !== $last_parent) { - $last_position = 0; - $last_parent = (int)$node[$this->options['structure']['parent_id']]; - } - $this->db->query("UPDATE ".$this->options['structure_table']." SET ".$this->options['structure']['position']." = ".$last_position." WHERE ".$this->options['structure']['id']." = ".(int)$node[$this->options['structure']['id']]); - $last_position++; - } - if($this->options['data_table'] != $this->options['structure_table']) { - // fix missing data records - $this->db->query(" - INSERT INTO - ".$this->options['data_table']." (".implode(',',$this->options['data']).") - SELECT ".$this->options['structure']['id']." ".str_repeat(", ".$this->options['structure']['id'], count($this->options['data']) - 1)." - FROM ".$this->options['structure_table']." s - WHERE (SELECT COUNT(".$this->options['data2structure'].") FROM ".$this->options['data_table']." WHERE ".$this->options['data2structure']." = s.".$this->options['structure']['id'].") = 0 " - ); - // remove dangling data records - $this->db->query(" - DELETE FROM - ".$this->options['data_table']." - WHERE - (SELECT COUNT(".$this->options['structure']['id'].") FROM ".$this->options['structure_table']." WHERE ".$this->options['structure']['id']." = ".$this->options['data_table'].".".$this->options['data2structure'].") = 0 - "); - } - return true; - } - - public function res($data = array()) { - if(!$this->db->query("TRUNCATE TABLE ".$this->options['structure_table'])) { return false; } - if(!$this->db->query("TRUNCATE TABLE ".$this->options['data_table'])) { return false; } - $sql = "INSERT INTO ".$this->options['structure_table']." (".implode(",", $this->options['structure']).") VALUES (?".str_repeat(',?', count($this->options['structure']) - 1).")"; - $par = array(); - foreach($this->options['structure'] as $k => $v) { - switch($k) { - case 'id': - $par[] = null; - break; - case 'left': - $par[] = 1; - break; - case 'right': - $par[] = 2; - break; - case 'level': - $par[] = 0; - break; - case 'parent_id': - $par[] = 0; - break; - case 'position': - $par[] = 0; - break; - default: - $par[] = null; - } - } - if(!$this->db->query($sql, $par)) { return false; } - $id = $this->db->insert_id(); - foreach($this->options['structure'] as $k => $v) { - if(!isset($data[$k])) { $data[$k] = null; } - } - return $this->rn($id, $data); - } - - public function dump() { - $nodes = $this->db->get(" - SELECT - s.".implode(", s.", $this->options['structure']).", - d.".implode(", d.", $this->options['data'])." - FROM - ".$this->options['structure_table']." s, - ".$this->options['data_table']." d - WHERE - s.".$this->options['structure']['id']." = d.".$this->options['data2structure']." - ORDER BY ".$this->options['structure']["left"] - ); - echo "\n\n"; - foreach($nodes as $node) { - echo str_repeat(" ",(int)$node[$this->options['structure']["level"]] * 2); - echo $node[$this->options['structure']["id"]]." ".$node["nm"]." (".$node[$this->options['structure']["left"]].",".$node[$this->options['structure']["right"]].",".$node[$this->options['structure']["level"]].",".$node[$this->options['structure']["parent_id"]].",".$node[$this->options['structure']["position"]].")" . "\n"; - } - echo str_repeat("-",40); - echo "\n\n"; - } -} \ No newline at end of file diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/demo/sitebrowser/data.sql b/mayan/apps/cabinets/static/cabinets/packages/jstree/demo/sitebrowser/data.sql deleted file mode 100644 index d906ffa880..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/demo/sitebrowser/data.sql +++ /dev/null @@ -1,91 +0,0 @@ --- phpMyAdmin SQL Dump --- version 4.0.1 --- http://www.phpmyadmin.net --- --- Host: 127.0.0.1 --- Generation Time: Apr 15, 2014 at 05:14 PM --- Server version: 5.5.27 --- PHP Version: 5.4.7 - -SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; -SET time_zone = "+00:00"; - --- --- Database: `test` --- - --- -------------------------------------------------------- - --- --- Table structure for table `tree_data` --- - -CREATE TABLE IF NOT EXISTS `tree_data` ( - `id` int(10) unsigned NOT NULL, - `nm` varchar(255) CHARACTER SET utf8 NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - --- --- Dumping data for table `tree_data` --- - -INSERT INTO `tree_data` (`id`, `nm`) VALUES -(1, 'root'), -(1063, 'Node 12'), -(1064, 'Node 2'), -(1065, 'Node 3'), -(1066, 'Node 4'), -(1067, 'Node 5'), -(1068, 'Node 6'), -(1069, 'Node 7'), -(1070, 'Node 8'), -(1071, 'Node 9'), -(1072, 'Node 9'), -(1073, 'Node 9'), -(1074, 'Node 9'), -(1075, 'Node 7'), -(1076, 'Node 8'), -(1077, 'Node 9'), -(1078, 'Node 9'), -(1079, 'Node 9'); - --- -------------------------------------------------------- - --- --- Table structure for table `tree_struct` --- - -CREATE TABLE IF NOT EXISTS `tree_struct` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `lft` int(10) unsigned NOT NULL, - `rgt` int(10) unsigned NOT NULL, - `lvl` int(10) unsigned NOT NULL, - `pid` int(10) unsigned NOT NULL, - `pos` int(10) unsigned NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1083 ; - --- --- Dumping data for table `tree_struct` --- - -INSERT INTO `tree_struct` (`id`, `lft`, `rgt`, `lvl`, `pid`, `pos`) VALUES -(1, 1, 36, 0, 0, 0), -(1063, 2, 31, 1, 1, 0), -(1064, 3, 30, 2, 1063, 0), -(1065, 4, 29, 3, 1064, 0), -(1066, 5, 28, 4, 1065, 0), -(1067, 6, 19, 5, 1066, 0), -(1068, 7, 18, 6, 1067, 0), -(1069, 8, 17, 7, 1068, 0), -(1070, 9, 16, 8, 1069, 0), -(1071, 12, 13, 9, 1070, 1), -(1072, 14, 15, 9, 1070, 2), -(1073, 10, 11, 9, 1070, 0), -(1074, 32, 35, 1, 1, 1), -(1075, 20, 27, 5, 1066, 1), -(1076, 21, 26, 6, 1075, 0), -(1077, 24, 25, 7, 1076, 1), -(1078, 33, 34, 2, 1074, 0), -(1079, 22, 23, 7, 1076, 0); diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/demo/sitebrowser/index.php b/mayan/apps/cabinets/static/cabinets/packages/jstree/demo/sitebrowser/index.php deleted file mode 100644 index 89657e2bb0..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/demo/sitebrowser/index.php +++ /dev/null @@ -1,172 +0,0 @@ - 'tree_struct', 'data_table' => 'tree_data', 'data' => array('nm'))); - try { - $rslt = null; - switch($_GET['operation']) { - case 'analyze': - var_dump($fs->analyze(true)); - die(); - break; - case 'get_node': - $node = isset($_GET['id']) && $_GET['id'] !== '#' ? (int)$_GET['id'] : 0; - $temp = $fs->get_children($node); - $rslt = array(); - foreach($temp as $v) { - $rslt[] = array('id' => $v['id'], 'text' => $v['nm'], 'children' => ($v['rgt'] - $v['lft'] > 1)); - } - break; - case "get_content": - $node = isset($_GET['id']) && $_GET['id'] !== '#' ? $_GET['id'] : 0; - $node = explode(':', $node); - if(count($node) > 1) { - $rslt = array('content' => 'Multiple selected'); - } - else { - $temp = $fs->get_node((int)$node[0], array('with_path' => true)); - $rslt = array('content' => 'Selected: /' . implode('/',array_map(function ($v) { return $v['nm']; }, $temp['path'])). '/'.$temp['nm']); - } - break; - case 'create_node': - $node = isset($_GET['id']) && $_GET['id'] !== '#' ? (int)$_GET['id'] : 0; - $temp = $fs->mk($node, isset($_GET['position']) ? (int)$_GET['position'] : 0, array('nm' => isset($_GET['text']) ? $_GET['text'] : 'New node')); - $rslt = array('id' => $temp); - break; - case 'rename_node': - $node = isset($_GET['id']) && $_GET['id'] !== '#' ? (int)$_GET['id'] : 0; - $rslt = $fs->rn($node, array('nm' => isset($_GET['text']) ? $_GET['text'] : 'Renamed node')); - break; - case 'delete_node': - $node = isset($_GET['id']) && $_GET['id'] !== '#' ? (int)$_GET['id'] : 0; - $rslt = $fs->rm($node); - break; - case 'move_node': - $node = isset($_GET['id']) && $_GET['id'] !== '#' ? (int)$_GET['id'] : 0; - $parn = isset($_GET['parent']) && $_GET['parent'] !== '#' ? (int)$_GET['parent'] : 0; - $rslt = $fs->mv($node, $parn, isset($_GET['position']) ? (int)$_GET['position'] : 0); - break; - case 'copy_node': - $node = isset($_GET['id']) && $_GET['id'] !== '#' ? (int)$_GET['id'] : 0; - $parn = isset($_GET['parent']) && $_GET['parent'] !== '#' ? (int)$_GET['parent'] : 0; - $rslt = $fs->cp($node, $parn, isset($_GET['position']) ? (int)$_GET['position'] : 0); - break; - default: - throw new Exception('Unsupported operation: ' . $_GET['operation']); - break; - } - header('Content-Type: application/json; charset=utf-8'); - echo json_encode($rslt); - } - catch (Exception $e) { - header($_SERVER["SERVER_PROTOCOL"] . ' 500 Server Error'); - header('Status: 500 Server Error'); - echo $e->getMessage(); - } - die(); -} -?> - - - - - - Title - - - - - -
    -
    -
    - - - -
    Select a node from the tree.
    -
    -
    - - - - - - diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/dist/jstree.js b/mayan/apps/cabinets/static/cabinets/packages/jstree/dist/jstree.js deleted file mode 100644 index b6509d4671..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/dist/jstree.js +++ /dev/null @@ -1,8305 +0,0 @@ -/*globals jQuery, define, module, exports, require, window, document, postMessage */ -(function (factory) { - "use strict"; - if (typeof define === 'function' && define.amd) { - define(['jquery'], factory); - } - else if(typeof module !== 'undefined' && module.exports) { - module.exports = factory(require('jquery')); - } - else { - factory(jQuery); - } -}(function ($, undefined) { - "use strict"; -/*! - * jsTree 3.3.3 - * http://jstree.com/ - * - * Copyright (c) 2014 Ivan Bozhanov (http://vakata.com) - * - * Licensed same as jquery - under the terms of the MIT License - * http://www.opensource.org/licenses/mit-license.php - */ -/*! - * if using jslint please allow for the jQuery global and use following options: - * jslint: loopfunc: true, browser: true, ass: true, bitwise: true, continue: true, nomen: true, plusplus: true, regexp: true, unparam: true, todo: true, white: true - */ -/*jshint -W083 */ - - // prevent another load? maybe there is a better way? - if($.jstree) { - return; - } - - /** - * ### jsTree core functionality - */ - - // internal variables - var instance_counter = 0, - ccp_node = false, - ccp_mode = false, - ccp_inst = false, - themes_loaded = [], - src = $('script:last').attr('src'), - document = window.document; // local variable is always faster to access then a global - - /** - * holds all jstree related functions and variables, including the actual class and methods to create, access and manipulate instances. - * @name $.jstree - */ - $.jstree = { - /** - * specifies the jstree version in use - * @name $.jstree.version - */ - version : '3.3.3', - /** - * holds all the default options used when creating new instances - * @name $.jstree.defaults - */ - defaults : { - /** - * configure which plugins will be active on an instance. Should be an array of strings, where each element is a plugin name. The default is `[]` - * @name $.jstree.defaults.plugins - */ - plugins : [] - }, - /** - * stores all loaded jstree plugins (used internally) - * @name $.jstree.plugins - */ - plugins : {}, - path : src && src.indexOf('/') !== -1 ? src.replace(/\/[^\/]+$/,'') : '', - idregex : /[\\:&!^|()\[\]<>@*'+~#";.,=\- \/${}%?`]/g, - root : '#' - }; - - /** - * creates a jstree instance - * @name $.jstree.create(el [, options]) - * @param {DOMElement|jQuery|String} el the element to create the instance on, can be jQuery extended or a selector - * @param {Object} options options for this instance (extends `$.jstree.defaults`) - * @return {jsTree} the new instance - */ - $.jstree.create = function (el, options) { - var tmp = new $.jstree.core(++instance_counter), - opt = options; - options = $.extend(true, {}, $.jstree.defaults, options); - if(opt && opt.plugins) { - options.plugins = opt.plugins; - } - $.each(options.plugins, function (i, k) { - if(i !== 'core') { - tmp = tmp.plugin(k, options[k]); - } - }); - $(el).data('jstree', tmp); - tmp.init(el, options); - return tmp; - }; - /** - * remove all traces of jstree from the DOM and destroy all instances - * @name $.jstree.destroy() - */ - $.jstree.destroy = function () { - $('.jstree:jstree').jstree('destroy'); - $(document).off('.jstree'); - }; - /** - * the jstree class constructor, used only internally - * @private - * @name $.jstree.core(id) - * @param {Number} id this instance's index - */ - $.jstree.core = function (id) { - this._id = id; - this._cnt = 0; - this._wrk = null; - this._data = { - core : { - themes : { - name : false, - dots : false, - icons : false, - ellipsis : false - }, - selected : [], - last_error : {}, - working : false, - worker_queue : [], - focused : null - } - }; - }; - /** - * get a reference to an existing instance - * - * __Examples__ - * - * // provided a container with an ID of "tree", and a nested node with an ID of "branch" - * // all of there will return the same instance - * $.jstree.reference('tree'); - * $.jstree.reference('#tree'); - * $.jstree.reference($('#tree')); - * $.jstree.reference(document.getElementByID('tree')); - * $.jstree.reference('branch'); - * $.jstree.reference('#branch'); - * $.jstree.reference($('#branch')); - * $.jstree.reference(document.getElementByID('branch')); - * - * @name $.jstree.reference(needle) - * @param {DOMElement|jQuery|String} needle - * @return {jsTree|null} the instance or `null` if not found - */ - $.jstree.reference = function (needle) { - var tmp = null, - obj = null; - if(needle && needle.id && (!needle.tagName || !needle.nodeType)) { needle = needle.id; } - - if(!obj || !obj.length) { - try { obj = $(needle); } catch (ignore) { } - } - if(!obj || !obj.length) { - try { obj = $('#' + needle.replace($.jstree.idregex,'\\$&')); } catch (ignore) { } - } - if(obj && obj.length && (obj = obj.closest('.jstree')).length && (obj = obj.data('jstree'))) { - tmp = obj; - } - else { - $('.jstree').each(function () { - var inst = $(this).data('jstree'); - if(inst && inst._model.data[needle]) { - tmp = inst; - return false; - } - }); - } - return tmp; - }; - /** - * Create an instance, get an instance or invoke a command on a instance. - * - * If there is no instance associated with the current node a new one is created and `arg` is used to extend `$.jstree.defaults` for this new instance. There would be no return value (chaining is not broken). - * - * If there is an existing instance and `arg` is a string the command specified by `arg` is executed on the instance, with any additional arguments passed to the function. If the function returns a value it will be returned (chaining could break depending on function). - * - * If there is an existing instance and `arg` is not a string the instance itself is returned (similar to `$.jstree.reference`). - * - * In any other case - nothing is returned and chaining is not broken. - * - * __Examples__ - * - * $('#tree1').jstree(); // creates an instance - * $('#tree2').jstree({ plugins : [] }); // create an instance with some options - * $('#tree1').jstree('open_node', '#branch_1'); // call a method on an existing instance, passing additional arguments - * $('#tree2').jstree(); // get an existing instance (or create an instance) - * $('#tree2').jstree(true); // get an existing instance (will not create new instance) - * $('#branch_1').jstree().select_node('#branch_1'); // get an instance (using a nested element and call a method) - * - * @name $().jstree([arg]) - * @param {String|Object} arg - * @return {Mixed} - */ - $.fn.jstree = function (arg) { - // check for string argument - var is_method = (typeof arg === 'string'), - args = Array.prototype.slice.call(arguments, 1), - result = null; - if(arg === true && !this.length) { return false; } - this.each(function () { - // get the instance (if there is one) and method (if it exists) - var instance = $.jstree.reference(this), - method = is_method && instance ? instance[arg] : null; - // if calling a method, and method is available - execute on the instance - result = is_method && method ? - method.apply(instance, args) : - null; - // if there is no instance and no method is being called - create one - if(!instance && !is_method && (arg === undefined || $.isPlainObject(arg))) { - $.jstree.create(this, arg); - } - // if there is an instance and no method is called - return the instance - if( (instance && !is_method) || arg === true ) { - result = instance || false; - } - // if there was a method call which returned a result - break and return the value - if(result !== null && result !== undefined) { - return false; - } - }); - // if there was a method call with a valid return value - return that, otherwise continue the chain - return result !== null && result !== undefined ? - result : this; - }; - /** - * used to find elements containing an instance - * - * __Examples__ - * - * $('div:jstree').each(function () { - * $(this).jstree('destroy'); - * }); - * - * @name $(':jstree') - * @return {jQuery} - */ - $.expr.pseudos.jstree = $.expr.createPseudo(function(search) { - return function(a) { - return $(a).hasClass('jstree') && - $(a).data('jstree') !== undefined; - }; - }); - - /** - * stores all defaults for the core - * @name $.jstree.defaults.core - */ - $.jstree.defaults.core = { - /** - * data configuration - * - * If left as `false` the HTML inside the jstree container element is used to populate the tree (that should be an unordered list with list items). - * - * You can also pass in a HTML string or a JSON array here. - * - * It is possible to pass in a standard jQuery-like AJAX config and jstree will automatically determine if the response is JSON or HTML and use that to populate the tree. - * In addition to the standard jQuery ajax options here you can suppy functions for `data` and `url`, the functions will be run in the current instance's scope and a param will be passed indicating which node is being loaded, the return value of those functions will be used. - * - * The last option is to specify a function, that function will receive the node being loaded as argument and a second param which is a function which should be called with the result. - * - * __Examples__ - * - * // AJAX - * $('#tree').jstree({ - * 'core' : { - * 'data' : { - * 'url' : '/get/children/', - * 'data' : function (node) { - * return { 'id' : node.id }; - * } - * } - * }); - * - * // direct data - * $('#tree').jstree({ - * 'core' : { - * 'data' : [ - * 'Simple root node', - * { - * 'id' : 'node_2', - * 'text' : 'Root node with options', - * 'state' : { 'opened' : true, 'selected' : true }, - * 'children' : [ { 'text' : 'Child 1' }, 'Child 2'] - * } - * ] - * } - * }); - * - * // function - * $('#tree').jstree({ - * 'core' : { - * 'data' : function (obj, callback) { - * callback.call(this, ['Root 1', 'Root 2']); - * } - * }); - * - * @name $.jstree.defaults.core.data - */ - data : false, - /** - * configure the various strings used throughout the tree - * - * You can use an object where the key is the string you need to replace and the value is your replacement. - * Another option is to specify a function which will be called with an argument of the needed string and should return the replacement. - * If left as `false` no replacement is made. - * - * __Examples__ - * - * $('#tree').jstree({ - * 'core' : { - * 'strings' : { - * 'Loading ...' : 'Please wait ...' - * } - * } - * }); - * - * @name $.jstree.defaults.core.strings - */ - strings : false, - /** - * determines what happens when a user tries to modify the structure of the tree - * If left as `false` all operations like create, rename, delete, move or copy are prevented. - * You can set this to `true` to allow all interactions or use a function to have better control. - * - * __Examples__ - * - * $('#tree').jstree({ - * 'core' : { - * 'check_callback' : function (operation, node, node_parent, node_position, more) { - * // operation can be 'create_node', 'rename_node', 'delete_node', 'move_node' or 'copy_node' - * // in case of 'rename_node' node_position is filled with the new node name - * return operation === 'rename_node' ? true : false; - * } - * } - * }); - * - * @name $.jstree.defaults.core.check_callback - */ - check_callback : false, - /** - * a callback called with a single object parameter in the instance's scope when something goes wrong (operation prevented, ajax failed, etc) - * @name $.jstree.defaults.core.error - */ - error : $.noop, - /** - * the open / close animation duration in milliseconds - set this to `false` to disable the animation (default is `200`) - * @name $.jstree.defaults.core.animation - */ - animation : 200, - /** - * a boolean indicating if multiple nodes can be selected - * @name $.jstree.defaults.core.multiple - */ - multiple : true, - /** - * theme configuration object - * @name $.jstree.defaults.core.themes - */ - themes : { - /** - * the name of the theme to use (if left as `false` the default theme is used) - * @name $.jstree.defaults.core.themes.name - */ - name : false, - /** - * the URL of the theme's CSS file, leave this as `false` if you have manually included the theme CSS (recommended). You can set this to `true` too which will try to autoload the theme. - * @name $.jstree.defaults.core.themes.url - */ - url : false, - /** - * the location of all jstree themes - only used if `url` is set to `true` - * @name $.jstree.defaults.core.themes.dir - */ - dir : false, - /** - * a boolean indicating if connecting dots are shown - * @name $.jstree.defaults.core.themes.dots - */ - dots : true, - /** - * a boolean indicating if node icons are shown - * @name $.jstree.defaults.core.themes.icons - */ - icons : true, - /** - * a boolean indicating if node ellipsis should be shown - this only works with a fixed with on the container - * @name $.jstree.defaults.core.themes.ellipsis - */ - ellipsis : false, - /** - * a boolean indicating if the tree background is striped - * @name $.jstree.defaults.core.themes.stripes - */ - stripes : false, - /** - * a string (or boolean `false`) specifying the theme variant to use (if the theme supports variants) - * @name $.jstree.defaults.core.themes.variant - */ - variant : false, - /** - * a boolean specifying if a reponsive version of the theme should kick in on smaller screens (if the theme supports it). Defaults to `false`. - * @name $.jstree.defaults.core.themes.responsive - */ - responsive : false - }, - /** - * if left as `true` all parents of all selected nodes will be opened once the tree loads (so that all selected nodes are visible to the user) - * @name $.jstree.defaults.core.expand_selected_onload - */ - expand_selected_onload : true, - /** - * if left as `true` web workers will be used to parse incoming JSON data where possible, so that the UI will not be blocked by large requests. Workers are however about 30% slower. Defaults to `true` - * @name $.jstree.defaults.core.worker - */ - worker : true, - /** - * Force node text to plain text (and escape HTML). Defaults to `false` - * @name $.jstree.defaults.core.force_text - */ - force_text : false, - /** - * Should the node should be toggled if the text is double clicked . Defaults to `true` - * @name $.jstree.defaults.core.dblclick_toggle - */ - dblclick_toggle : true - }; - $.jstree.core.prototype = { - /** - * used to decorate an instance with a plugin. Used internally. - * @private - * @name plugin(deco [, opts]) - * @param {String} deco the plugin to decorate with - * @param {Object} opts options for the plugin - * @return {jsTree} - */ - plugin : function (deco, opts) { - var Child = $.jstree.plugins[deco]; - if(Child) { - this._data[deco] = {}; - Child.prototype = this; - return new Child(opts, this); - } - return this; - }, - /** - * initialize the instance. Used internally. - * @private - * @name init(el, optons) - * @param {DOMElement|jQuery|String} el the element we are transforming - * @param {Object} options options for this instance - * @trigger init.jstree, loading.jstree, loaded.jstree, ready.jstree, changed.jstree - */ - init : function (el, options) { - this._model = { - data : {}, - changed : [], - force_full_redraw : false, - redraw_timeout : false, - default_state : { - loaded : true, - opened : false, - selected : false, - disabled : false - } - }; - this._model.data[$.jstree.root] = { - id : $.jstree.root, - parent : null, - parents : [], - children : [], - children_d : [], - state : { loaded : false } - }; - - this.element = $(el).addClass('jstree jstree-' + this._id); - this.settings = options; - - this._data.core.ready = false; - this._data.core.loaded = false; - this._data.core.rtl = (this.element.css("direction") === "rtl"); - this.element[this._data.core.rtl ? 'addClass' : 'removeClass']("jstree-rtl"); - this.element.attr('role','tree'); - if(this.settings.core.multiple) { - this.element.attr('aria-multiselectable', true); - } - if(!this.element.attr('tabindex')) { - this.element.attr('tabindex','0'); - } - - this.bind(); - /** - * triggered after all events are bound - * @event - * @name init.jstree - */ - this.trigger("init"); - - this._data.core.original_container_html = this.element.find(" > ul > li").clone(true); - this._data.core.original_container_html - .find("li").addBack() - .contents().filter(function() { - return this.nodeType === 3 && (!this.nodeValue || /^\s+$/.test(this.nodeValue)); - }) - .remove(); - this.element.html("<"+"ul class='jstree-container-ul jstree-children' role='group'><"+"li id='j"+this._id+"_loading' class='jstree-initial-node jstree-loading jstree-leaf jstree-last' role='tree-item'><"+"a class='jstree-anchor' href='#'>" + this.get_string("Loading ...") + "
  • "); - this.element.attr('aria-activedescendant','j' + this._id + '_loading'); - this._data.core.li_height = this.get_container_ul().children("li").first().height() || 24; - this._data.core.node = this._create_prototype_node(); - /** - * triggered after the loading text is shown and before loading starts - * @event - * @name loading.jstree - */ - this.trigger("loading"); - this.load_node($.jstree.root); - }, - /** - * destroy an instance - * @name destroy() - * @param {Boolean} keep_html if not set to `true` the container will be emptied, otherwise the current DOM elements will be kept intact - */ - destroy : function (keep_html) { - if(this._wrk) { - try { - window.URL.revokeObjectURL(this._wrk); - this._wrk = null; - } - catch (ignore) { } - } - if(!keep_html) { this.element.empty(); } - this.teardown(); - }, - /** - * Create prototype node - */ - _create_prototype_node : function () { - var _node = document.createElement('LI'), _temp1, _temp2; - _node.setAttribute('role', 'treeitem'); - _temp1 = document.createElement('I'); - _temp1.className = 'jstree-icon jstree-ocl'; - _temp1.setAttribute('role', 'presentation'); - _node.appendChild(_temp1); - _temp1 = document.createElement('A'); - _temp1.className = 'jstree-anchor'; - _temp1.setAttribute('href','#'); - _temp1.setAttribute('tabindex','-1'); - _temp2 = document.createElement('I'); - _temp2.className = 'jstree-icon jstree-themeicon'; - _temp2.setAttribute('role', 'presentation'); - _temp1.appendChild(_temp2); - _node.appendChild(_temp1); - _temp1 = _temp2 = null; - - return _node; - }, - /** - * part of the destroying of an instance. Used internally. - * @private - * @name teardown() - */ - teardown : function () { - this.unbind(); - this.element - .removeClass('jstree') - .removeData('jstree') - .find("[class^='jstree']") - .addBack() - .attr("class", function () { return this.className.replace(/jstree[^ ]*|$/ig,''); }); - this.element = null; - }, - /** - * bind all events. Used internally. - * @private - * @name bind() - */ - bind : function () { - var word = '', - tout = null, - was_click = 0; - this.element - .on("dblclick.jstree", function (e) { - if(e.target.tagName && e.target.tagName.toLowerCase() === "input") { return true; } - if(document.selection && document.selection.empty) { - document.selection.empty(); - } - else { - if(window.getSelection) { - var sel = window.getSelection(); - try { - sel.removeAllRanges(); - sel.collapse(); - } catch (ignore) { } - } - } - }) - .on("mousedown.jstree", $.proxy(function (e) { - if(e.target === this.element[0]) { - e.preventDefault(); // prevent losing focus when clicking scroll arrows (FF, Chrome) - was_click = +(new Date()); // ie does not allow to prevent losing focus - } - }, this)) - .on("mousedown.jstree", ".jstree-ocl", function (e) { - e.preventDefault(); // prevent any node inside from losing focus when clicking the open/close icon - }) - .on("click.jstree", ".jstree-ocl", $.proxy(function (e) { - this.toggle_node(e.target); - }, this)) - .on("dblclick.jstree", ".jstree-anchor", $.proxy(function (e) { - if(e.target.tagName && e.target.tagName.toLowerCase() === "input") { return true; } - if(this.settings.core.dblclick_toggle) { - this.toggle_node(e.target); - } - }, this)) - .on("click.jstree", ".jstree-anchor", $.proxy(function (e) { - e.preventDefault(); - if(e.currentTarget !== document.activeElement) { $(e.currentTarget).focus(); } - this.activate_node(e.currentTarget, e); - }, this)) - .on('keydown.jstree', '.jstree-anchor', $.proxy(function (e) { - if(e.target.tagName && e.target.tagName.toLowerCase() === "input") { return true; } - if(e.which !== 32 && e.which !== 13 && (e.shiftKey || e.ctrlKey || e.altKey || e.metaKey)) { return true; } - var o = null; - if(this._data.core.rtl) { - if(e.which === 37) { e.which = 39; } - else if(e.which === 39) { e.which = 37; } - } - switch(e.which) { - case 32: // aria defines space only with Ctrl - if(e.ctrlKey) { - e.type = "click"; - $(e.currentTarget).trigger(e); - } - break; - case 13: // enter - e.type = "click"; - $(e.currentTarget).trigger(e); - break; - case 37: // left - e.preventDefault(); - if(this.is_open(e.currentTarget)) { - this.close_node(e.currentTarget); - } - else { - o = this.get_parent(e.currentTarget); - if(o && o.id !== $.jstree.root) { this.get_node(o, true).children('.jstree-anchor').focus(); } - } - break; - case 38: // up - e.preventDefault(); - o = this.get_prev_dom(e.currentTarget); - if(o && o.length) { o.children('.jstree-anchor').focus(); } - break; - case 39: // right - e.preventDefault(); - if(this.is_closed(e.currentTarget)) { - this.open_node(e.currentTarget, function (o) { this.get_node(o, true).children('.jstree-anchor').focus(); }); - } - else if (this.is_open(e.currentTarget)) { - o = this.get_node(e.currentTarget, true).children('.jstree-children')[0]; - if(o) { $(this._firstChild(o)).children('.jstree-anchor').focus(); } - } - break; - case 40: // down - e.preventDefault(); - o = this.get_next_dom(e.currentTarget); - if(o && o.length) { o.children('.jstree-anchor').focus(); } - break; - case 106: // aria defines * on numpad as open_all - not very common - this.open_all(); - break; - case 36: // home - e.preventDefault(); - o = this._firstChild(this.get_container_ul()[0]); - if(o) { $(o).children('.jstree-anchor').filter(':visible').focus(); } - break; - case 35: // end - e.preventDefault(); - this.element.find('.jstree-anchor').filter(':visible').last().focus(); - break; - case 113: // f2 - safe to include - if check_callback is false it will fail - e.preventDefault(); - this.edit(e.currentTarget); - break; - default: - break; - /*! - // delete - case 46: - e.preventDefault(); - o = this.get_node(e.currentTarget); - if(o && o.id && o.id !== $.jstree.root) { - o = this.is_selected(o) ? this.get_selected() : o; - this.delete_node(o); - } - break; - - */ - } - }, this)) - .on("load_node.jstree", $.proxy(function (e, data) { - if(data.status) { - if(data.node.id === $.jstree.root && !this._data.core.loaded) { - this._data.core.loaded = true; - if(this._firstChild(this.get_container_ul()[0])) { - this.element.attr('aria-activedescendant',this._firstChild(this.get_container_ul()[0]).id); - } - /** - * triggered after the root node is loaded for the first time - * @event - * @name loaded.jstree - */ - this.trigger("loaded"); - } - if(!this._data.core.ready) { - setTimeout($.proxy(function() { - if(this.element && !this.get_container_ul().find('.jstree-loading').length) { - this._data.core.ready = true; - if(this._data.core.selected.length) { - if(this.settings.core.expand_selected_onload) { - var tmp = [], i, j; - for(i = 0, j = this._data.core.selected.length; i < j; i++) { - tmp = tmp.concat(this._model.data[this._data.core.selected[i]].parents); - } - tmp = $.vakata.array_unique(tmp); - for(i = 0, j = tmp.length; i < j; i++) { - this.open_node(tmp[i], false, 0); - } - } - this.trigger('changed', { 'action' : 'ready', 'selected' : this._data.core.selected }); - } - /** - * triggered after all nodes are finished loading - * @event - * @name ready.jstree - */ - this.trigger("ready"); - } - }, this), 0); - } - } - }, this)) - // quick searching when the tree is focused - .on('keypress.jstree', $.proxy(function (e) { - if(e.target.tagName && e.target.tagName.toLowerCase() === "input") { return true; } - if(tout) { clearTimeout(tout); } - tout = setTimeout(function () { - word = ''; - }, 500); - - var chr = String.fromCharCode(e.which).toLowerCase(), - col = this.element.find('.jstree-anchor').filter(':visible'), - ind = col.index(document.activeElement) || 0, - end = false; - word += chr; - - // match for whole word from current node down (including the current node) - if(word.length > 1) { - col.slice(ind).each($.proxy(function (i, v) { - if($(v).text().toLowerCase().indexOf(word) === 0) { - $(v).focus(); - end = true; - return false; - } - }, this)); - if(end) { return; } - - // match for whole word from the beginning of the tree - col.slice(0, ind).each($.proxy(function (i, v) { - if($(v).text().toLowerCase().indexOf(word) === 0) { - $(v).focus(); - end = true; - return false; - } - }, this)); - if(end) { return; } - } - // list nodes that start with that letter (only if word consists of a single char) - if(new RegExp('^' + chr.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&') + '+$').test(word)) { - // search for the next node starting with that letter - col.slice(ind + 1).each($.proxy(function (i, v) { - if($(v).text().toLowerCase().charAt(0) === chr) { - $(v).focus(); - end = true; - return false; - } - }, this)); - if(end) { return; } - - // search from the beginning - col.slice(0, ind + 1).each($.proxy(function (i, v) { - if($(v).text().toLowerCase().charAt(0) === chr) { - $(v).focus(); - end = true; - return false; - } - }, this)); - if(end) { return; } - } - }, this)) - // THEME RELATED - .on("init.jstree", $.proxy(function () { - var s = this.settings.core.themes; - this._data.core.themes.dots = s.dots; - this._data.core.themes.stripes = s.stripes; - this._data.core.themes.icons = s.icons; - this._data.core.themes.ellipsis = s.ellipsis; - this.set_theme(s.name || "default", s.url); - this.set_theme_variant(s.variant); - }, this)) - .on("loading.jstree", $.proxy(function () { - this[ this._data.core.themes.dots ? "show_dots" : "hide_dots" ](); - this[ this._data.core.themes.icons ? "show_icons" : "hide_icons" ](); - this[ this._data.core.themes.stripes ? "show_stripes" : "hide_stripes" ](); - this[ this._data.core.themes.ellipsis ? "show_ellipsis" : "hide_ellipsis" ](); - }, this)) - .on('blur.jstree', '.jstree-anchor', $.proxy(function (e) { - this._data.core.focused = null; - $(e.currentTarget).filter('.jstree-hovered').mouseleave(); - this.element.attr('tabindex', '0'); - }, this)) - .on('focus.jstree', '.jstree-anchor', $.proxy(function (e) { - var tmp = this.get_node(e.currentTarget); - if(tmp && tmp.id) { - this._data.core.focused = tmp.id; - } - this.element.find('.jstree-hovered').not(e.currentTarget).mouseleave(); - $(e.currentTarget).mouseenter(); - this.element.attr('tabindex', '-1'); - }, this)) - .on('focus.jstree', $.proxy(function () { - if(+(new Date()) - was_click > 500 && !this._data.core.focused) { - was_click = 0; - var act = this.get_node(this.element.attr('aria-activedescendant'), true); - if(act) { - act.find('> .jstree-anchor').focus(); - } - } - }, this)) - .on('mouseenter.jstree', '.jstree-anchor', $.proxy(function (e) { - this.hover_node(e.currentTarget); - }, this)) - .on('mouseleave.jstree', '.jstree-anchor', $.proxy(function (e) { - this.dehover_node(e.currentTarget); - }, this)); - }, - /** - * part of the destroying of an instance. Used internally. - * @private - * @name unbind() - */ - unbind : function () { - this.element.off('.jstree'); - $(document).off('.jstree-' + this._id); - }, - /** - * trigger an event. Used internally. - * @private - * @name trigger(ev [, data]) - * @param {String} ev the name of the event to trigger - * @param {Object} data additional data to pass with the event - */ - trigger : function (ev, data) { - if(!data) { - data = {}; - } - data.instance = this; - this.element.triggerHandler(ev.replace('.jstree','') + '.jstree', data); - }, - /** - * returns the jQuery extended instance container - * @name get_container() - * @return {jQuery} - */ - get_container : function () { - return this.element; - }, - /** - * returns the jQuery extended main UL node inside the instance container. Used internally. - * @private - * @name get_container_ul() - * @return {jQuery} - */ - get_container_ul : function () { - return this.element.children(".jstree-children").first(); - }, - /** - * gets string replacements (localization). Used internally. - * @private - * @name get_string(key) - * @param {String} key - * @return {String} - */ - get_string : function (key) { - var a = this.settings.core.strings; - if($.isFunction(a)) { return a.call(this, key); } - if(a && a[key]) { return a[key]; } - return key; - }, - /** - * gets the first child of a DOM node. Used internally. - * @private - * @name _firstChild(dom) - * @param {DOMElement} dom - * @return {DOMElement} - */ - _firstChild : function (dom) { - dom = dom ? dom.firstChild : null; - while(dom !== null && dom.nodeType !== 1) { - dom = dom.nextSibling; - } - return dom; - }, - /** - * gets the next sibling of a DOM node. Used internally. - * @private - * @name _nextSibling(dom) - * @param {DOMElement} dom - * @return {DOMElement} - */ - _nextSibling : function (dom) { - dom = dom ? dom.nextSibling : null; - while(dom !== null && dom.nodeType !== 1) { - dom = dom.nextSibling; - } - return dom; - }, - /** - * gets the previous sibling of a DOM node. Used internally. - * @private - * @name _previousSibling(dom) - * @param {DOMElement} dom - * @return {DOMElement} - */ - _previousSibling : function (dom) { - dom = dom ? dom.previousSibling : null; - while(dom !== null && dom.nodeType !== 1) { - dom = dom.previousSibling; - } - return dom; - }, - /** - * get the JSON representation of a node (or the actual jQuery extended DOM node) by using any input (child DOM element, ID string, selector, etc) - * @name get_node(obj [, as_dom]) - * @param {mixed} obj - * @param {Boolean} as_dom - * @return {Object|jQuery} - */ - get_node : function (obj, as_dom) { - if(obj && obj.id) { - obj = obj.id; - } - var dom; - try { - if(this._model.data[obj]) { - obj = this._model.data[obj]; - } - else if(typeof obj === "string" && this._model.data[obj.replace(/^#/, '')]) { - obj = this._model.data[obj.replace(/^#/, '')]; - } - else if(typeof obj === "string" && (dom = $('#' + obj.replace($.jstree.idregex,'\\$&'), this.element)).length && this._model.data[dom.closest('.jstree-node').attr('id')]) { - obj = this._model.data[dom.closest('.jstree-node').attr('id')]; - } - else if((dom = $(obj, this.element)).length && this._model.data[dom.closest('.jstree-node').attr('id')]) { - obj = this._model.data[dom.closest('.jstree-node').attr('id')]; - } - else if((dom = $(obj, this.element)).length && dom.hasClass('jstree')) { - obj = this._model.data[$.jstree.root]; - } - else { - return false; - } - - if(as_dom) { - obj = obj.id === $.jstree.root ? this.element : $('#' + obj.id.replace($.jstree.idregex,'\\$&'), this.element); - } - return obj; - } catch (ex) { return false; } - }, - /** - * get the path to a node, either consisting of node texts, or of node IDs, optionally glued together (otherwise an array) - * @name get_path(obj [, glue, ids]) - * @param {mixed} obj the node - * @param {String} glue if you want the path as a string - pass the glue here (for example '/'), if a falsy value is supplied here, an array is returned - * @param {Boolean} ids if set to true build the path using ID, otherwise node text is used - * @return {mixed} - */ - get_path : function (obj, glue, ids) { - obj = obj.parents ? obj : this.get_node(obj); - if(!obj || obj.id === $.jstree.root || !obj.parents) { - return false; - } - var i, j, p = []; - p.push(ids ? obj.id : obj.text); - for(i = 0, j = obj.parents.length; i < j; i++) { - p.push(ids ? obj.parents[i] : this.get_text(obj.parents[i])); - } - p = p.reverse().slice(1); - return glue ? p.join(glue) : p; - }, - /** - * get the next visible node that is below the `obj` node. If `strict` is set to `true` only sibling nodes are returned. - * @name get_next_dom(obj [, strict]) - * @param {mixed} obj - * @param {Boolean} strict - * @return {jQuery} - */ - get_next_dom : function (obj, strict) { - var tmp; - obj = this.get_node(obj, true); - if(obj[0] === this.element[0]) { - tmp = this._firstChild(this.get_container_ul()[0]); - while (tmp && tmp.offsetHeight === 0) { - tmp = this._nextSibling(tmp); - } - return tmp ? $(tmp) : false; - } - if(!obj || !obj.length) { - return false; - } - if(strict) { - tmp = obj[0]; - do { - tmp = this._nextSibling(tmp); - } while (tmp && tmp.offsetHeight === 0); - return tmp ? $(tmp) : false; - } - if(obj.hasClass("jstree-open")) { - tmp = this._firstChild(obj.children('.jstree-children')[0]); - while (tmp && tmp.offsetHeight === 0) { - tmp = this._nextSibling(tmp); - } - if(tmp !== null) { - return $(tmp); - } - } - tmp = obj[0]; - do { - tmp = this._nextSibling(tmp); - } while (tmp && tmp.offsetHeight === 0); - if(tmp !== null) { - return $(tmp); - } - return obj.parentsUntil(".jstree",".jstree-node").nextAll(".jstree-node:visible").first(); - }, - /** - * get the previous visible node that is above the `obj` node. If `strict` is set to `true` only sibling nodes are returned. - * @name get_prev_dom(obj [, strict]) - * @param {mixed} obj - * @param {Boolean} strict - * @return {jQuery} - */ - get_prev_dom : function (obj, strict) { - var tmp; - obj = this.get_node(obj, true); - if(obj[0] === this.element[0]) { - tmp = this.get_container_ul()[0].lastChild; - while (tmp && tmp.offsetHeight === 0) { - tmp = this._previousSibling(tmp); - } - return tmp ? $(tmp) : false; - } - if(!obj || !obj.length) { - return false; - } - if(strict) { - tmp = obj[0]; - do { - tmp = this._previousSibling(tmp); - } while (tmp && tmp.offsetHeight === 0); - return tmp ? $(tmp) : false; - } - tmp = obj[0]; - do { - tmp = this._previousSibling(tmp); - } while (tmp && tmp.offsetHeight === 0); - if(tmp !== null) { - obj = $(tmp); - while(obj.hasClass("jstree-open")) { - obj = obj.children(".jstree-children").first().children(".jstree-node:visible:last"); - } - return obj; - } - tmp = obj[0].parentNode.parentNode; - return tmp && tmp.className && tmp.className.indexOf('jstree-node') !== -1 ? $(tmp) : false; - }, - /** - * get the parent ID of a node - * @name get_parent(obj) - * @param {mixed} obj - * @return {String} - */ - get_parent : function (obj) { - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { - return false; - } - return obj.parent; - }, - /** - * get a jQuery collection of all the children of a node (node must be rendered) - * @name get_children_dom(obj) - * @param {mixed} obj - * @return {jQuery} - */ - get_children_dom : function (obj) { - obj = this.get_node(obj, true); - if(obj[0] === this.element[0]) { - return this.get_container_ul().children(".jstree-node"); - } - if(!obj || !obj.length) { - return false; - } - return obj.children(".jstree-children").children(".jstree-node"); - }, - /** - * checks if a node has children - * @name is_parent(obj) - * @param {mixed} obj - * @return {Boolean} - */ - is_parent : function (obj) { - obj = this.get_node(obj); - return obj && (obj.state.loaded === false || obj.children.length > 0); - }, - /** - * checks if a node is loaded (its children are available) - * @name is_loaded(obj) - * @param {mixed} obj - * @return {Boolean} - */ - is_loaded : function (obj) { - obj = this.get_node(obj); - return obj && obj.state.loaded; - }, - /** - * check if a node is currently loading (fetching children) - * @name is_loading(obj) - * @param {mixed} obj - * @return {Boolean} - */ - is_loading : function (obj) { - obj = this.get_node(obj); - return obj && obj.state && obj.state.loading; - }, - /** - * check if a node is opened - * @name is_open(obj) - * @param {mixed} obj - * @return {Boolean} - */ - is_open : function (obj) { - obj = this.get_node(obj); - return obj && obj.state.opened; - }, - /** - * check if a node is in a closed state - * @name is_closed(obj) - * @param {mixed} obj - * @return {Boolean} - */ - is_closed : function (obj) { - obj = this.get_node(obj); - return obj && this.is_parent(obj) && !obj.state.opened; - }, - /** - * check if a node has no children - * @name is_leaf(obj) - * @param {mixed} obj - * @return {Boolean} - */ - is_leaf : function (obj) { - return !this.is_parent(obj); - }, - /** - * loads a node (fetches its children using the `core.data` setting). Multiple nodes can be passed to by using an array. - * @name load_node(obj [, callback]) - * @param {mixed} obj - * @param {function} callback a function to be executed once loading is complete, the function is executed in the instance's scope and receives two arguments - the node and a boolean status - * @return {Boolean} - * @trigger load_node.jstree - */ - load_node : function (obj, callback) { - var k, l, i, j, c; - if($.isArray(obj)) { - this._load_nodes(obj.slice(), callback); - return true; - } - obj = this.get_node(obj); - if(!obj) { - if(callback) { callback.call(this, obj, false); } - return false; - } - // if(obj.state.loading) { } // the node is already loading - just wait for it to load and invoke callback? but if called implicitly it should be loaded again? - if(obj.state.loaded) { - obj.state.loaded = false; - for(i = 0, j = obj.parents.length; i < j; i++) { - this._model.data[obj.parents[i]].children_d = $.vakata.array_filter(this._model.data[obj.parents[i]].children_d, function (v) { - return $.inArray(v, obj.children_d) === -1; - }); - } - for(k = 0, l = obj.children_d.length; k < l; k++) { - if(this._model.data[obj.children_d[k]].state.selected) { - c = true; - } - delete this._model.data[obj.children_d[k]]; - } - if (c) { - this._data.core.selected = $.vakata.array_filter(this._data.core.selected, function (v) { - return $.inArray(v, obj.children_d) === -1; - }); - } - obj.children = []; - obj.children_d = []; - if(c) { - this.trigger('changed', { 'action' : 'load_node', 'node' : obj, 'selected' : this._data.core.selected }); - } - } - obj.state.failed = false; - obj.state.loading = true; - this.get_node(obj, true).addClass("jstree-loading").attr('aria-busy',true); - this._load_node(obj, $.proxy(function (status) { - obj = this._model.data[obj.id]; - obj.state.loading = false; - obj.state.loaded = status; - obj.state.failed = !obj.state.loaded; - var dom = this.get_node(obj, true), i = 0, j = 0, m = this._model.data, has_children = false; - for(i = 0, j = obj.children.length; i < j; i++) { - if(m[obj.children[i]] && !m[obj.children[i]].state.hidden) { - has_children = true; - break; - } - } - if(obj.state.loaded && dom && dom.length) { - dom.removeClass('jstree-closed jstree-open jstree-leaf'); - if (!has_children) { - dom.addClass('jstree-leaf'); - } - else { - if (obj.id !== '#') { - dom.addClass(obj.state.opened ? 'jstree-open' : 'jstree-closed'); - } - } - } - dom.removeClass("jstree-loading").attr('aria-busy',false); - /** - * triggered after a node is loaded - * @event - * @name load_node.jstree - * @param {Object} node the node that was loading - * @param {Boolean} status was the node loaded successfully - */ - this.trigger('load_node', { "node" : obj, "status" : status }); - if(callback) { - callback.call(this, obj, status); - } - }, this)); - return true; - }, - /** - * load an array of nodes (will also load unavailable nodes as soon as the appear in the structure). Used internally. - * @private - * @name _load_nodes(nodes [, callback]) - * @param {array} nodes - * @param {function} callback a function to be executed once loading is complete, the function is executed in the instance's scope and receives one argument - the array passed to _load_nodes - */ - _load_nodes : function (nodes, callback, is_callback, force_reload) { - var r = true, - c = function () { this._load_nodes(nodes, callback, true); }, - m = this._model.data, i, j, tmp = []; - for(i = 0, j = nodes.length; i < j; i++) { - if(m[nodes[i]] && ( (!m[nodes[i]].state.loaded && !m[nodes[i]].state.failed) || (!is_callback && force_reload) )) { - if(!this.is_loading(nodes[i])) { - this.load_node(nodes[i], c); - } - r = false; - } - } - if(r) { - for(i = 0, j = nodes.length; i < j; i++) { - if(m[nodes[i]] && m[nodes[i]].state.loaded) { - tmp.push(nodes[i]); - } - } - if(callback && !callback.done) { - callback.call(this, tmp); - callback.done = true; - } - } - }, - /** - * loads all unloaded nodes - * @name load_all([obj, callback]) - * @param {mixed} obj the node to load recursively, omit to load all nodes in the tree - * @param {function} callback a function to be executed once loading all the nodes is complete, - * @trigger load_all.jstree - */ - load_all : function (obj, callback) { - if(!obj) { obj = $.jstree.root; } - obj = this.get_node(obj); - if(!obj) { return false; } - var to_load = [], - m = this._model.data, - c = m[obj.id].children_d, - i, j; - if(obj.state && !obj.state.loaded) { - to_load.push(obj.id); - } - for(i = 0, j = c.length; i < j; i++) { - if(m[c[i]] && m[c[i]].state && !m[c[i]].state.loaded) { - to_load.push(c[i]); - } - } - if(to_load.length) { - this._load_nodes(to_load, function () { - this.load_all(obj, callback); - }); - } - else { - /** - * triggered after a load_all call completes - * @event - * @name load_all.jstree - * @param {Object} node the recursively loaded node - */ - if(callback) { callback.call(this, obj); } - this.trigger('load_all', { "node" : obj }); - } - }, - /** - * handles the actual loading of a node. Used only internally. - * @private - * @name _load_node(obj [, callback]) - * @param {mixed} obj - * @param {function} callback a function to be executed once loading is complete, the function is executed in the instance's scope and receives one argument - a boolean status - * @return {Boolean} - */ - _load_node : function (obj, callback) { - var s = this.settings.core.data, t; - var notTextOrCommentNode = function notTextOrCommentNode () { - return this.nodeType !== 3 && this.nodeType !== 8; - }; - // use original HTML - if(!s) { - if(obj.id === $.jstree.root) { - return this._append_html_data(obj, this._data.core.original_container_html.clone(true), function (status) { - callback.call(this, status); - }); - } - else { - return callback.call(this, false); - } - // return callback.call(this, obj.id === $.jstree.root ? this._append_html_data(obj, this._data.core.original_container_html.clone(true)) : false); - } - if($.isFunction(s)) { - return s.call(this, obj, $.proxy(function (d) { - if(d === false) { - callback.call(this, false); - } - else { - this[typeof d === 'string' ? '_append_html_data' : '_append_json_data'](obj, typeof d === 'string' ? $($.parseHTML(d)).filter(notTextOrCommentNode) : d, function (status) { - callback.call(this, status); - }); - } - // return d === false ? callback.call(this, false) : callback.call(this, this[typeof d === 'string' ? '_append_html_data' : '_append_json_data'](obj, typeof d === 'string' ? $(d) : d)); - }, this)); - } - if(typeof s === 'object') { - if(s.url) { - s = $.extend(true, {}, s); - if($.isFunction(s.url)) { - s.url = s.url.call(this, obj); - } - if($.isFunction(s.data)) { - s.data = s.data.call(this, obj); - } - return $.ajax(s) - .done($.proxy(function (d,t,x) { - var type = x.getResponseHeader('Content-Type'); - if((type && type.indexOf('json') !== -1) || typeof d === "object") { - return this._append_json_data(obj, d, function (status) { callback.call(this, status); }); - //return callback.call(this, this._append_json_data(obj, d)); - } - if((type && type.indexOf('html') !== -1) || typeof d === "string") { - return this._append_html_data(obj, $($.parseHTML(d)).filter(notTextOrCommentNode), function (status) { callback.call(this, status); }); - // return callback.call(this, this._append_html_data(obj, $(d))); - } - this._data.core.last_error = { 'error' : 'ajax', 'plugin' : 'core', 'id' : 'core_04', 'reason' : 'Could not load node', 'data' : JSON.stringify({ 'id' : obj.id, 'xhr' : x }) }; - this.settings.core.error.call(this, this._data.core.last_error); - return callback.call(this, false); - }, this)) - .fail($.proxy(function (f) { - callback.call(this, false); - this._data.core.last_error = { 'error' : 'ajax', 'plugin' : 'core', 'id' : 'core_04', 'reason' : 'Could not load node', 'data' : JSON.stringify({ 'id' : obj.id, 'xhr' : f }) }; - this.settings.core.error.call(this, this._data.core.last_error); - }, this)); - } - t = ($.isArray(s) || $.isPlainObject(s)) ? JSON.parse(JSON.stringify(s)) : s; - if(obj.id === $.jstree.root) { - return this._append_json_data(obj, t, function (status) { - callback.call(this, status); - }); - } - else { - this._data.core.last_error = { 'error' : 'nodata', 'plugin' : 'core', 'id' : 'core_05', 'reason' : 'Could not load node', 'data' : JSON.stringify({ 'id' : obj.id }) }; - this.settings.core.error.call(this, this._data.core.last_error); - return callback.call(this, false); - } - //return callback.call(this, (obj.id === $.jstree.root ? this._append_json_data(obj, t) : false) ); - } - if(typeof s === 'string') { - if(obj.id === $.jstree.root) { - return this._append_html_data(obj, $($.parseHTML(s)).filter(notTextOrCommentNode), function (status) { - callback.call(this, status); - }); - } - else { - this._data.core.last_error = { 'error' : 'nodata', 'plugin' : 'core', 'id' : 'core_06', 'reason' : 'Could not load node', 'data' : JSON.stringify({ 'id' : obj.id }) }; - this.settings.core.error.call(this, this._data.core.last_error); - return callback.call(this, false); - } - //return callback.call(this, (obj.id === $.jstree.root ? this._append_html_data(obj, $(s)) : false) ); - } - return callback.call(this, false); - }, - /** - * adds a node to the list of nodes to redraw. Used only internally. - * @private - * @name _node_changed(obj [, callback]) - * @param {mixed} obj - */ - _node_changed : function (obj) { - obj = this.get_node(obj); - if(obj) { - this._model.changed.push(obj.id); - } - }, - /** - * appends HTML content to the tree. Used internally. - * @private - * @name _append_html_data(obj, data) - * @param {mixed} obj the node to append to - * @param {String} data the HTML string to parse and append - * @trigger model.jstree, changed.jstree - */ - _append_html_data : function (dom, data, cb) { - dom = this.get_node(dom); - dom.children = []; - dom.children_d = []; - var dat = data.is('ul') ? data.children() : data, - par = dom.id, - chd = [], - dpc = [], - m = this._model.data, - p = m[par], - s = this._data.core.selected.length, - tmp, i, j; - dat.each($.proxy(function (i, v) { - tmp = this._parse_model_from_html($(v), par, p.parents.concat()); - if(tmp) { - chd.push(tmp); - dpc.push(tmp); - if(m[tmp].children_d.length) { - dpc = dpc.concat(m[tmp].children_d); - } - } - }, this)); - p.children = chd; - p.children_d = dpc; - for(i = 0, j = p.parents.length; i < j; i++) { - m[p.parents[i]].children_d = m[p.parents[i]].children_d.concat(dpc); - } - /** - * triggered when new data is inserted to the tree model - * @event - * @name model.jstree - * @param {Array} nodes an array of node IDs - * @param {String} parent the parent ID of the nodes - */ - this.trigger('model', { "nodes" : dpc, 'parent' : par }); - if(par !== $.jstree.root) { - this._node_changed(par); - this.redraw(); - } - else { - this.get_container_ul().children('.jstree-initial-node').remove(); - this.redraw(true); - } - if(this._data.core.selected.length !== s) { - this.trigger('changed', { 'action' : 'model', 'selected' : this._data.core.selected }); - } - cb.call(this, true); - }, - /** - * appends JSON content to the tree. Used internally. - * @private - * @name _append_json_data(obj, data) - * @param {mixed} obj the node to append to - * @param {String} data the JSON object to parse and append - * @param {Boolean} force_processing internal param - do not set - * @trigger model.jstree, changed.jstree - */ - _append_json_data : function (dom, data, cb, force_processing) { - if(this.element === null) { return; } - dom = this.get_node(dom); - dom.children = []; - dom.children_d = []; - // *%$@!!! - if(data.d) { - data = data.d; - if(typeof data === "string") { - data = JSON.parse(data); - } - } - if(!$.isArray(data)) { data = [data]; } - var w = null, - args = { - 'df' : this._model.default_state, - 'dat' : data, - 'par' : dom.id, - 'm' : this._model.data, - 't_id' : this._id, - 't_cnt' : this._cnt, - 'sel' : this._data.core.selected - }, - func = function (data, undefined) { - if(data.data) { data = data.data; } - var dat = data.dat, - par = data.par, - chd = [], - dpc = [], - add = [], - df = data.df, - t_id = data.t_id, - t_cnt = data.t_cnt, - m = data.m, - p = m[par], - sel = data.sel, - tmp, i, j, rslt, - parse_flat = function (d, p, ps) { - if(!ps) { ps = []; } - else { ps = ps.concat(); } - if(p) { ps.unshift(p); } - var tid = d.id.toString(), - i, j, c, e, - tmp = { - id : tid, - text : d.text || '', - icon : d.icon !== undefined ? d.icon : true, - parent : p, - parents : ps, - children : d.children || [], - children_d : d.children_d || [], - data : d.data, - state : { }, - li_attr : { id : false }, - a_attr : { href : '#' }, - original : false - }; - for(i in df) { - if(df.hasOwnProperty(i)) { - tmp.state[i] = df[i]; - } - } - if(d && d.data && d.data.jstree && d.data.jstree.icon) { - tmp.icon = d.data.jstree.icon; - } - if(tmp.icon === undefined || tmp.icon === null || tmp.icon === "") { - tmp.icon = true; - } - if(d && d.data) { - tmp.data = d.data; - if(d.data.jstree) { - for(i in d.data.jstree) { - if(d.data.jstree.hasOwnProperty(i)) { - tmp.state[i] = d.data.jstree[i]; - } - } - } - } - if(d && typeof d.state === 'object') { - for (i in d.state) { - if(d.state.hasOwnProperty(i)) { - tmp.state[i] = d.state[i]; - } - } - } - if(d && typeof d.li_attr === 'object') { - for (i in d.li_attr) { - if(d.li_attr.hasOwnProperty(i)) { - tmp.li_attr[i] = d.li_attr[i]; - } - } - } - if(!tmp.li_attr.id) { - tmp.li_attr.id = tid; - } - if(d && typeof d.a_attr === 'object') { - for (i in d.a_attr) { - if(d.a_attr.hasOwnProperty(i)) { - tmp.a_attr[i] = d.a_attr[i]; - } - } - } - if(d && d.children && d.children === true) { - tmp.state.loaded = false; - tmp.children = []; - tmp.children_d = []; - } - m[tmp.id] = tmp; - for(i = 0, j = tmp.children.length; i < j; i++) { - c = parse_flat(m[tmp.children[i]], tmp.id, ps); - e = m[c]; - tmp.children_d.push(c); - if(e.children_d.length) { - tmp.children_d = tmp.children_d.concat(e.children_d); - } - } - delete d.data; - delete d.children; - m[tmp.id].original = d; - if(tmp.state.selected) { - add.push(tmp.id); - } - return tmp.id; - }, - parse_nest = function (d, p, ps) { - if(!ps) { ps = []; } - else { ps = ps.concat(); } - if(p) { ps.unshift(p); } - var tid = false, i, j, c, e, tmp; - do { - tid = 'j' + t_id + '_' + (++t_cnt); - } while(m[tid]); - - tmp = { - id : false, - text : typeof d === 'string' ? d : '', - icon : typeof d === 'object' && d.icon !== undefined ? d.icon : true, - parent : p, - parents : ps, - children : [], - children_d : [], - data : null, - state : { }, - li_attr : { id : false }, - a_attr : { href : '#' }, - original : false - }; - for(i in df) { - if(df.hasOwnProperty(i)) { - tmp.state[i] = df[i]; - } - } - if(d && d.id) { tmp.id = d.id.toString(); } - if(d && d.text) { tmp.text = d.text; } - if(d && d.data && d.data.jstree && d.data.jstree.icon) { - tmp.icon = d.data.jstree.icon; - } - if(tmp.icon === undefined || tmp.icon === null || tmp.icon === "") { - tmp.icon = true; - } - if(d && d.data) { - tmp.data = d.data; - if(d.data.jstree) { - for(i in d.data.jstree) { - if(d.data.jstree.hasOwnProperty(i)) { - tmp.state[i] = d.data.jstree[i]; - } - } - } - } - if(d && typeof d.state === 'object') { - for (i in d.state) { - if(d.state.hasOwnProperty(i)) { - tmp.state[i] = d.state[i]; - } - } - } - if(d && typeof d.li_attr === 'object') { - for (i in d.li_attr) { - if(d.li_attr.hasOwnProperty(i)) { - tmp.li_attr[i] = d.li_attr[i]; - } - } - } - if(tmp.li_attr.id && !tmp.id) { - tmp.id = tmp.li_attr.id.toString(); - } - if(!tmp.id) { - tmp.id = tid; - } - if(!tmp.li_attr.id) { - tmp.li_attr.id = tmp.id; - } - if(d && typeof d.a_attr === 'object') { - for (i in d.a_attr) { - if(d.a_attr.hasOwnProperty(i)) { - tmp.a_attr[i] = d.a_attr[i]; - } - } - } - if(d && d.children && d.children.length) { - for(i = 0, j = d.children.length; i < j; i++) { - c = parse_nest(d.children[i], tmp.id, ps); - e = m[c]; - tmp.children.push(c); - if(e.children_d.length) { - tmp.children_d = tmp.children_d.concat(e.children_d); - } - } - tmp.children_d = tmp.children_d.concat(tmp.children); - } - if(d && d.children && d.children === true) { - tmp.state.loaded = false; - tmp.children = []; - tmp.children_d = []; - } - delete d.data; - delete d.children; - tmp.original = d; - m[tmp.id] = tmp; - if(tmp.state.selected) { - add.push(tmp.id); - } - return tmp.id; - }; - - if(dat.length && dat[0].id !== undefined && dat[0].parent !== undefined) { - // Flat JSON support (for easy import from DB): - // 1) convert to object (foreach) - for(i = 0, j = dat.length; i < j; i++) { - if(!dat[i].children) { - dat[i].children = []; - } - m[dat[i].id.toString()] = dat[i]; - } - // 2) populate children (foreach) - for(i = 0, j = dat.length; i < j; i++) { - m[dat[i].parent.toString()].children.push(dat[i].id.toString()); - // populate parent.children_d - p.children_d.push(dat[i].id.toString()); - } - // 3) normalize && populate parents and children_d with recursion - for(i = 0, j = p.children.length; i < j; i++) { - tmp = parse_flat(m[p.children[i]], par, p.parents.concat()); - dpc.push(tmp); - if(m[tmp].children_d.length) { - dpc = dpc.concat(m[tmp].children_d); - } - } - for(i = 0, j = p.parents.length; i < j; i++) { - m[p.parents[i]].children_d = m[p.parents[i]].children_d.concat(dpc); - } - // ?) three_state selection - p.state.selected && t - (if three_state foreach(dat => ch) -> foreach(parents) if(parent.selected) child.selected = true; - rslt = { - 'cnt' : t_cnt, - 'mod' : m, - 'sel' : sel, - 'par' : par, - 'dpc' : dpc, - 'add' : add - }; - } - else { - for(i = 0, j = dat.length; i < j; i++) { - tmp = parse_nest(dat[i], par, p.parents.concat()); - if(tmp) { - chd.push(tmp); - dpc.push(tmp); - if(m[tmp].children_d.length) { - dpc = dpc.concat(m[tmp].children_d); - } - } - } - p.children = chd; - p.children_d = dpc; - for(i = 0, j = p.parents.length; i < j; i++) { - m[p.parents[i]].children_d = m[p.parents[i]].children_d.concat(dpc); - } - rslt = { - 'cnt' : t_cnt, - 'mod' : m, - 'sel' : sel, - 'par' : par, - 'dpc' : dpc, - 'add' : add - }; - } - if(typeof window === 'undefined' || typeof window.document === 'undefined') { - postMessage(rslt); - } - else { - return rslt; - } - }, - rslt = function (rslt, worker) { - if(this.element === null) { return; } - this._cnt = rslt.cnt; - var i, m = this._model.data; - for (i in m) { - if (m.hasOwnProperty(i) && m[i].state && m[i].state.loading && rslt.mod[i]) { - rslt.mod[i].state.loading = true; - } - } - this._model.data = rslt.mod; // breaks the reference in load_node - careful - - if(worker) { - var j, a = rslt.add, r = rslt.sel, s = this._data.core.selected.slice(); - m = this._model.data; - // if selection was changed while calculating in worker - if(r.length !== s.length || $.vakata.array_unique(r.concat(s)).length !== r.length) { - // deselect nodes that are no longer selected - for(i = 0, j = r.length; i < j; i++) { - if($.inArray(r[i], a) === -1 && $.inArray(r[i], s) === -1) { - m[r[i]].state.selected = false; - } - } - // select nodes that were selected in the mean time - for(i = 0, j = s.length; i < j; i++) { - if($.inArray(s[i], r) === -1) { - m[s[i]].state.selected = true; - } - } - } - } - if(rslt.add.length) { - this._data.core.selected = this._data.core.selected.concat(rslt.add); - } - - this.trigger('model', { "nodes" : rslt.dpc, 'parent' : rslt.par }); - - if(rslt.par !== $.jstree.root) { - this._node_changed(rslt.par); - this.redraw(); - } - else { - // this.get_container_ul().children('.jstree-initial-node').remove(); - this.redraw(true); - } - if(rslt.add.length) { - this.trigger('changed', { 'action' : 'model', 'selected' : this._data.core.selected }); - } - cb.call(this, true); - }; - if(this.settings.core.worker && window.Blob && window.URL && window.Worker) { - try { - if(this._wrk === null) { - this._wrk = window.URL.createObjectURL( - new window.Blob( - ['self.onmessage = ' + func.toString()], - {type:"text/javascript"} - ) - ); - } - if(!this._data.core.working || force_processing) { - this._data.core.working = true; - w = new window.Worker(this._wrk); - w.onmessage = $.proxy(function (e) { - rslt.call(this, e.data, true); - try { w.terminate(); w = null; } catch(ignore) { } - if(this._data.core.worker_queue.length) { - this._append_json_data.apply(this, this._data.core.worker_queue.shift()); - } - else { - this._data.core.working = false; - } - }, this); - if(!args.par) { - if(this._data.core.worker_queue.length) { - this._append_json_data.apply(this, this._data.core.worker_queue.shift()); - } - else { - this._data.core.working = false; - } - } - else { - w.postMessage(args); - } - } - else { - this._data.core.worker_queue.push([dom, data, cb, true]); - } - } - catch(e) { - rslt.call(this, func(args), false); - if(this._data.core.worker_queue.length) { - this._append_json_data.apply(this, this._data.core.worker_queue.shift()); - } - else { - this._data.core.working = false; - } - } - } - else { - rslt.call(this, func(args), false); - } - }, - /** - * parses a node from a jQuery object and appends them to the in memory tree model. Used internally. - * @private - * @name _parse_model_from_html(d [, p, ps]) - * @param {jQuery} d the jQuery object to parse - * @param {String} p the parent ID - * @param {Array} ps list of all parents - * @return {String} the ID of the object added to the model - */ - _parse_model_from_html : function (d, p, ps) { - if(!ps) { ps = []; } - else { ps = [].concat(ps); } - if(p) { ps.unshift(p); } - var c, e, m = this._model.data, - data = { - id : false, - text : false, - icon : true, - parent : p, - parents : ps, - children : [], - children_d : [], - data : null, - state : { }, - li_attr : { id : false }, - a_attr : { href : '#' }, - original : false - }, i, tmp, tid; - for(i in this._model.default_state) { - if(this._model.default_state.hasOwnProperty(i)) { - data.state[i] = this._model.default_state[i]; - } - } - tmp = $.vakata.attributes(d, true); - $.each(tmp, function (i, v) { - v = $.trim(v); - if(!v.length) { return true; } - data.li_attr[i] = v; - if(i === 'id') { - data.id = v.toString(); - } - }); - tmp = d.children('a').first(); - if(tmp.length) { - tmp = $.vakata.attributes(tmp, true); - $.each(tmp, function (i, v) { - v = $.trim(v); - if(v.length) { - data.a_attr[i] = v; - } - }); - } - tmp = d.children("a").first().length ? d.children("a").first().clone() : d.clone(); - tmp.children("ins, i, ul").remove(); - tmp = tmp.html(); - tmp = $('
    ').html(tmp); - data.text = this.settings.core.force_text ? tmp.text() : tmp.html(); - tmp = d.data(); - data.data = tmp ? $.extend(true, {}, tmp) : null; - data.state.opened = d.hasClass('jstree-open'); - data.state.selected = d.children('a').hasClass('jstree-clicked'); - data.state.disabled = d.children('a').hasClass('jstree-disabled'); - if(data.data && data.data.jstree) { - for(i in data.data.jstree) { - if(data.data.jstree.hasOwnProperty(i)) { - data.state[i] = data.data.jstree[i]; - } - } - } - tmp = d.children("a").children(".jstree-themeicon"); - if(tmp.length) { - data.icon = tmp.hasClass('jstree-themeicon-hidden') ? false : tmp.attr('rel'); - } - if(data.state.icon !== undefined) { - data.icon = data.state.icon; - } - if(data.icon === undefined || data.icon === null || data.icon === "") { - data.icon = true; - } - tmp = d.children("ul").children("li"); - do { - tid = 'j' + this._id + '_' + (++this._cnt); - } while(m[tid]); - data.id = data.li_attr.id ? data.li_attr.id.toString() : tid; - if(tmp.length) { - tmp.each($.proxy(function (i, v) { - c = this._parse_model_from_html($(v), data.id, ps); - e = this._model.data[c]; - data.children.push(c); - if(e.children_d.length) { - data.children_d = data.children_d.concat(e.children_d); - } - }, this)); - data.children_d = data.children_d.concat(data.children); - } - else { - if(d.hasClass('jstree-closed')) { - data.state.loaded = false; - } - } - if(data.li_attr['class']) { - data.li_attr['class'] = data.li_attr['class'].replace('jstree-closed','').replace('jstree-open',''); - } - if(data.a_attr['class']) { - data.a_attr['class'] = data.a_attr['class'].replace('jstree-clicked','').replace('jstree-disabled',''); - } - m[data.id] = data; - if(data.state.selected) { - this._data.core.selected.push(data.id); - } - return data.id; - }, - /** - * parses a node from a JSON object (used when dealing with flat data, which has no nesting of children, but has id and parent properties) and appends it to the in memory tree model. Used internally. - * @private - * @name _parse_model_from_flat_json(d [, p, ps]) - * @param {Object} d the JSON object to parse - * @param {String} p the parent ID - * @param {Array} ps list of all parents - * @return {String} the ID of the object added to the model - */ - _parse_model_from_flat_json : function (d, p, ps) { - if(!ps) { ps = []; } - else { ps = ps.concat(); } - if(p) { ps.unshift(p); } - var tid = d.id.toString(), - m = this._model.data, - df = this._model.default_state, - i, j, c, e, - tmp = { - id : tid, - text : d.text || '', - icon : d.icon !== undefined ? d.icon : true, - parent : p, - parents : ps, - children : d.children || [], - children_d : d.children_d || [], - data : d.data, - state : { }, - li_attr : { id : false }, - a_attr : { href : '#' }, - original : false - }; - for(i in df) { - if(df.hasOwnProperty(i)) { - tmp.state[i] = df[i]; - } - } - if(d && d.data && d.data.jstree && d.data.jstree.icon) { - tmp.icon = d.data.jstree.icon; - } - if(tmp.icon === undefined || tmp.icon === null || tmp.icon === "") { - tmp.icon = true; - } - if(d && d.data) { - tmp.data = d.data; - if(d.data.jstree) { - for(i in d.data.jstree) { - if(d.data.jstree.hasOwnProperty(i)) { - tmp.state[i] = d.data.jstree[i]; - } - } - } - } - if(d && typeof d.state === 'object') { - for (i in d.state) { - if(d.state.hasOwnProperty(i)) { - tmp.state[i] = d.state[i]; - } - } - } - if(d && typeof d.li_attr === 'object') { - for (i in d.li_attr) { - if(d.li_attr.hasOwnProperty(i)) { - tmp.li_attr[i] = d.li_attr[i]; - } - } - } - if(!tmp.li_attr.id) { - tmp.li_attr.id = tid; - } - if(d && typeof d.a_attr === 'object') { - for (i in d.a_attr) { - if(d.a_attr.hasOwnProperty(i)) { - tmp.a_attr[i] = d.a_attr[i]; - } - } - } - if(d && d.children && d.children === true) { - tmp.state.loaded = false; - tmp.children = []; - tmp.children_d = []; - } - m[tmp.id] = tmp; - for(i = 0, j = tmp.children.length; i < j; i++) { - c = this._parse_model_from_flat_json(m[tmp.children[i]], tmp.id, ps); - e = m[c]; - tmp.children_d.push(c); - if(e.children_d.length) { - tmp.children_d = tmp.children_d.concat(e.children_d); - } - } - delete d.data; - delete d.children; - m[tmp.id].original = d; - if(tmp.state.selected) { - this._data.core.selected.push(tmp.id); - } - return tmp.id; - }, - /** - * parses a node from a JSON object and appends it to the in memory tree model. Used internally. - * @private - * @name _parse_model_from_json(d [, p, ps]) - * @param {Object} d the JSON object to parse - * @param {String} p the parent ID - * @param {Array} ps list of all parents - * @return {String} the ID of the object added to the model - */ - _parse_model_from_json : function (d, p, ps) { - if(!ps) { ps = []; } - else { ps = ps.concat(); } - if(p) { ps.unshift(p); } - var tid = false, i, j, c, e, m = this._model.data, df = this._model.default_state, tmp; - do { - tid = 'j' + this._id + '_' + (++this._cnt); - } while(m[tid]); - - tmp = { - id : false, - text : typeof d === 'string' ? d : '', - icon : typeof d === 'object' && d.icon !== undefined ? d.icon : true, - parent : p, - parents : ps, - children : [], - children_d : [], - data : null, - state : { }, - li_attr : { id : false }, - a_attr : { href : '#' }, - original : false - }; - for(i in df) { - if(df.hasOwnProperty(i)) { - tmp.state[i] = df[i]; - } - } - if(d && d.id) { tmp.id = d.id.toString(); } - if(d && d.text) { tmp.text = d.text; } - if(d && d.data && d.data.jstree && d.data.jstree.icon) { - tmp.icon = d.data.jstree.icon; - } - if(tmp.icon === undefined || tmp.icon === null || tmp.icon === "") { - tmp.icon = true; - } - if(d && d.data) { - tmp.data = d.data; - if(d.data.jstree) { - for(i in d.data.jstree) { - if(d.data.jstree.hasOwnProperty(i)) { - tmp.state[i] = d.data.jstree[i]; - } - } - } - } - if(d && typeof d.state === 'object') { - for (i in d.state) { - if(d.state.hasOwnProperty(i)) { - tmp.state[i] = d.state[i]; - } - } - } - if(d && typeof d.li_attr === 'object') { - for (i in d.li_attr) { - if(d.li_attr.hasOwnProperty(i)) { - tmp.li_attr[i] = d.li_attr[i]; - } - } - } - if(tmp.li_attr.id && !tmp.id) { - tmp.id = tmp.li_attr.id.toString(); - } - if(!tmp.id) { - tmp.id = tid; - } - if(!tmp.li_attr.id) { - tmp.li_attr.id = tmp.id; - } - if(d && typeof d.a_attr === 'object') { - for (i in d.a_attr) { - if(d.a_attr.hasOwnProperty(i)) { - tmp.a_attr[i] = d.a_attr[i]; - } - } - } - if(d && d.children && d.children.length) { - for(i = 0, j = d.children.length; i < j; i++) { - c = this._parse_model_from_json(d.children[i], tmp.id, ps); - e = m[c]; - tmp.children.push(c); - if(e.children_d.length) { - tmp.children_d = tmp.children_d.concat(e.children_d); - } - } - tmp.children_d = tmp.children_d.concat(tmp.children); - } - if(d && d.children && d.children === true) { - tmp.state.loaded = false; - tmp.children = []; - tmp.children_d = []; - } - delete d.data; - delete d.children; - tmp.original = d; - m[tmp.id] = tmp; - if(tmp.state.selected) { - this._data.core.selected.push(tmp.id); - } - return tmp.id; - }, - /** - * redraws all nodes that need to be redrawn. Used internally. - * @private - * @name _redraw() - * @trigger redraw.jstree - */ - _redraw : function () { - var nodes = this._model.force_full_redraw ? this._model.data[$.jstree.root].children.concat([]) : this._model.changed.concat([]), - f = document.createElement('UL'), tmp, i, j, fe = this._data.core.focused; - for(i = 0, j = nodes.length; i < j; i++) { - tmp = this.redraw_node(nodes[i], true, this._model.force_full_redraw); - if(tmp && this._model.force_full_redraw) { - f.appendChild(tmp); - } - } - if(this._model.force_full_redraw) { - f.className = this.get_container_ul()[0].className; - f.setAttribute('role','group'); - this.element.empty().append(f); - //this.get_container_ul()[0].appendChild(f); - } - if(fe !== null) { - tmp = this.get_node(fe, true); - if(tmp && tmp.length && tmp.children('.jstree-anchor')[0] !== document.activeElement) { - tmp.children('.jstree-anchor').focus(); - } - else { - this._data.core.focused = null; - } - } - this._model.force_full_redraw = false; - this._model.changed = []; - /** - * triggered after nodes are redrawn - * @event - * @name redraw.jstree - * @param {array} nodes the redrawn nodes - */ - this.trigger('redraw', { "nodes" : nodes }); - }, - /** - * redraws all nodes that need to be redrawn or optionally - the whole tree - * @name redraw([full]) - * @param {Boolean} full if set to `true` all nodes are redrawn. - */ - redraw : function (full) { - if(full) { - this._model.force_full_redraw = true; - } - //if(this._model.redraw_timeout) { - // clearTimeout(this._model.redraw_timeout); - //} - //this._model.redraw_timeout = setTimeout($.proxy(this._redraw, this),0); - this._redraw(); - }, - /** - * redraws a single node's children. Used internally. - * @private - * @name draw_children(node) - * @param {mixed} node the node whose children will be redrawn - */ - draw_children : function (node) { - var obj = this.get_node(node), - i = false, - j = false, - k = false, - d = document; - if(!obj) { return false; } - if(obj.id === $.jstree.root) { return this.redraw(true); } - node = this.get_node(node, true); - if(!node || !node.length) { return false; } // TODO: quick toggle - - node.children('.jstree-children').remove(); - node = node[0]; - if(obj.children.length && obj.state.loaded) { - k = d.createElement('UL'); - k.setAttribute('role', 'group'); - k.className = 'jstree-children'; - for(i = 0, j = obj.children.length; i < j; i++) { - k.appendChild(this.redraw_node(obj.children[i], true, true)); - } - node.appendChild(k); - } - }, - /** - * redraws a single node. Used internally. - * @private - * @name redraw_node(node, deep, is_callback, force_render) - * @param {mixed} node the node to redraw - * @param {Boolean} deep should child nodes be redrawn too - * @param {Boolean} is_callback is this a recursion call - * @param {Boolean} force_render should children of closed parents be drawn anyway - */ - redraw_node : function (node, deep, is_callback, force_render) { - var obj = this.get_node(node), - par = false, - ind = false, - old = false, - i = false, - j = false, - k = false, - c = '', - d = document, - m = this._model.data, - f = false, - s = false, - tmp = null, - t = 0, - l = 0, - has_children = false, - last_sibling = false; - if(!obj) { return false; } - if(obj.id === $.jstree.root) { return this.redraw(true); } - deep = deep || obj.children.length === 0; - node = !document.querySelector ? document.getElementById(obj.id) : this.element[0].querySelector('#' + ("0123456789".indexOf(obj.id[0]) !== -1 ? '\\3' + obj.id[0] + ' ' + obj.id.substr(1).replace($.jstree.idregex,'\\$&') : obj.id.replace($.jstree.idregex,'\\$&')) ); //, this.element); - if(!node) { - deep = true; - //node = d.createElement('LI'); - if(!is_callback) { - par = obj.parent !== $.jstree.root ? $('#' + obj.parent.replace($.jstree.idregex,'\\$&'), this.element)[0] : null; - if(par !== null && (!par || !m[obj.parent].state.opened)) { - return false; - } - ind = $.inArray(obj.id, par === null ? m[$.jstree.root].children : m[obj.parent].children); - } - } - else { - node = $(node); - if(!is_callback) { - par = node.parent().parent()[0]; - if(par === this.element[0]) { - par = null; - } - ind = node.index(); - } - // m[obj.id].data = node.data(); // use only node's data, no need to touch jquery storage - if(!deep && obj.children.length && !node.children('.jstree-children').length) { - deep = true; - } - if(!deep) { - old = node.children('.jstree-children')[0]; - } - f = node.children('.jstree-anchor')[0] === document.activeElement; - node.remove(); - //node = d.createElement('LI'); - //node = node[0]; - } - node = this._data.core.node.cloneNode(true); - // node is DOM, deep is boolean - - c = 'jstree-node '; - for(i in obj.li_attr) { - if(obj.li_attr.hasOwnProperty(i)) { - if(i === 'id') { continue; } - if(i !== 'class') { - node.setAttribute(i, obj.li_attr[i]); - } - else { - c += obj.li_attr[i]; - } - } - } - if(!obj.a_attr.id) { - obj.a_attr.id = obj.id + '_anchor'; - } - node.setAttribute('aria-selected', !!obj.state.selected); - node.setAttribute('aria-level', obj.parents.length); - node.setAttribute('aria-labelledby', obj.a_attr.id); - if(obj.state.disabled) { - node.setAttribute('aria-disabled', true); - } - - for(i = 0, j = obj.children.length; i < j; i++) { - if(!m[obj.children[i]].state.hidden) { - has_children = true; - break; - } - } - if(obj.parent !== null && m[obj.parent] && !obj.state.hidden) { - i = $.inArray(obj.id, m[obj.parent].children); - last_sibling = obj.id; - if(i !== -1) { - i++; - for(j = m[obj.parent].children.length; i < j; i++) { - if(!m[m[obj.parent].children[i]].state.hidden) { - last_sibling = m[obj.parent].children[i]; - } - if(last_sibling !== obj.id) { - break; - } - } - } - } - - if(obj.state.hidden) { - c += ' jstree-hidden'; - } - if(obj.state.loaded && !has_children) { - c += ' jstree-leaf'; - } - else { - c += obj.state.opened && obj.state.loaded ? ' jstree-open' : ' jstree-closed'; - node.setAttribute('aria-expanded', (obj.state.opened && obj.state.loaded) ); - } - if(last_sibling === obj.id) { - c += ' jstree-last'; - } - node.id = obj.id; - node.className = c; - c = ( obj.state.selected ? ' jstree-clicked' : '') + ( obj.state.disabled ? ' jstree-disabled' : ''); - for(j in obj.a_attr) { - if(obj.a_attr.hasOwnProperty(j)) { - if(j === 'href' && obj.a_attr[j] === '#') { continue; } - if(j !== 'class') { - node.childNodes[1].setAttribute(j, obj.a_attr[j]); - } - else { - c += ' ' + obj.a_attr[j]; - } - } - } - if(c.length) { - node.childNodes[1].className = 'jstree-anchor ' + c; - } - if((obj.icon && obj.icon !== true) || obj.icon === false) { - if(obj.icon === false) { - node.childNodes[1].childNodes[0].className += ' jstree-themeicon-hidden'; - } - else if(obj.icon.indexOf('/') === -1 && obj.icon.indexOf('.') === -1) { - node.childNodes[1].childNodes[0].className += ' ' + obj.icon + ' jstree-themeicon-custom'; - } - else { - node.childNodes[1].childNodes[0].style.backgroundImage = 'url("'+obj.icon+'")'; - node.childNodes[1].childNodes[0].style.backgroundPosition = 'center center'; - node.childNodes[1].childNodes[0].style.backgroundSize = 'auto'; - node.childNodes[1].childNodes[0].className += ' jstree-themeicon-custom'; - } - } - - if(this.settings.core.force_text) { - node.childNodes[1].appendChild(d.createTextNode(obj.text)); - } - else { - node.childNodes[1].innerHTML += obj.text; - } - - - if(deep && obj.children.length && (obj.state.opened || force_render) && obj.state.loaded) { - k = d.createElement('UL'); - k.setAttribute('role', 'group'); - k.className = 'jstree-children'; - for(i = 0, j = obj.children.length; i < j; i++) { - k.appendChild(this.redraw_node(obj.children[i], deep, true)); - } - node.appendChild(k); - } - if(old) { - node.appendChild(old); - } - if(!is_callback) { - // append back using par / ind - if(!par) { - par = this.element[0]; - } - for(i = 0, j = par.childNodes.length; i < j; i++) { - if(par.childNodes[i] && par.childNodes[i].className && par.childNodes[i].className.indexOf('jstree-children') !== -1) { - tmp = par.childNodes[i]; - break; - } - } - if(!tmp) { - tmp = d.createElement('UL'); - tmp.setAttribute('role', 'group'); - tmp.className = 'jstree-children'; - par.appendChild(tmp); - } - par = tmp; - - if(ind < par.childNodes.length) { - par.insertBefore(node, par.childNodes[ind]); - } - else { - par.appendChild(node); - } - if(f) { - t = this.element[0].scrollTop; - l = this.element[0].scrollLeft; - node.childNodes[1].focus(); - this.element[0].scrollTop = t; - this.element[0].scrollLeft = l; - } - } - if(obj.state.opened && !obj.state.loaded) { - obj.state.opened = false; - setTimeout($.proxy(function () { - this.open_node(obj.id, false, 0); - }, this), 0); - } - return node; - }, - /** - * opens a node, revaling its children. If the node is not loaded it will be loaded and opened once ready. - * @name open_node(obj [, callback, animation]) - * @param {mixed} obj the node to open - * @param {Function} callback a function to execute once the node is opened - * @param {Number} animation the animation duration in milliseconds when opening the node (overrides the `core.animation` setting). Use `false` for no animation. - * @trigger open_node.jstree, after_open.jstree, before_open.jstree - */ - open_node : function (obj, callback, animation) { - var t1, t2, d, t; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.open_node(obj[t1], callback, animation); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { - return false; - } - animation = animation === undefined ? this.settings.core.animation : animation; - if(!this.is_closed(obj)) { - if(callback) { - callback.call(this, obj, false); - } - return false; - } - if(!this.is_loaded(obj)) { - if(this.is_loading(obj)) { - return setTimeout($.proxy(function () { - this.open_node(obj, callback, animation); - }, this), 500); - } - this.load_node(obj, function (o, ok) { - return ok ? this.open_node(o, callback, animation) : (callback ? callback.call(this, o, false) : false); - }); - } - else { - d = this.get_node(obj, true); - t = this; - if(d.length) { - if(animation && d.children(".jstree-children").length) { - d.children(".jstree-children").stop(true, true); - } - if(obj.children.length && !this._firstChild(d.children('.jstree-children')[0])) { - this.draw_children(obj); - //d = this.get_node(obj, true); - } - if(!animation) { - this.trigger('before_open', { "node" : obj }); - d[0].className = d[0].className.replace('jstree-closed', 'jstree-open'); - d[0].setAttribute("aria-expanded", true); - } - else { - this.trigger('before_open', { "node" : obj }); - d - .children(".jstree-children").css("display","none").end() - .removeClass("jstree-closed").addClass("jstree-open").attr("aria-expanded", true) - .children(".jstree-children").stop(true, true) - .slideDown(animation, function () { - this.style.display = ""; - if (t.element) { - t.trigger("after_open", { "node" : obj }); - } - }); - } - } - obj.state.opened = true; - if(callback) { - callback.call(this, obj, true); - } - if(!d.length) { - /** - * triggered when a node is about to be opened (if the node is supposed to be in the DOM, it will be, but it won't be visible yet) - * @event - * @name before_open.jstree - * @param {Object} node the opened node - */ - this.trigger('before_open', { "node" : obj }); - } - /** - * triggered when a node is opened (if there is an animation it will not be completed yet) - * @event - * @name open_node.jstree - * @param {Object} node the opened node - */ - this.trigger('open_node', { "node" : obj }); - if(!animation || !d.length) { - /** - * triggered when a node is opened and the animation is complete - * @event - * @name after_open.jstree - * @param {Object} node the opened node - */ - this.trigger("after_open", { "node" : obj }); - } - return true; - } - }, - /** - * opens every parent of a node (node should be loaded) - * @name _open_to(obj) - * @param {mixed} obj the node to reveal - * @private - */ - _open_to : function (obj) { - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { - return false; - } - var i, j, p = obj.parents; - for(i = 0, j = p.length; i < j; i+=1) { - if(i !== $.jstree.root) { - this.open_node(p[i], false, 0); - } - } - return $('#' + obj.id.replace($.jstree.idregex,'\\$&'), this.element); - }, - /** - * closes a node, hiding its children - * @name close_node(obj [, animation]) - * @param {mixed} obj the node to close - * @param {Number} animation the animation duration in milliseconds when closing the node (overrides the `core.animation` setting). Use `false` for no animation. - * @trigger close_node.jstree, after_close.jstree - */ - close_node : function (obj, animation) { - var t1, t2, t, d; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.close_node(obj[t1], animation); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { - return false; - } - if(this.is_closed(obj)) { - return false; - } - animation = animation === undefined ? this.settings.core.animation : animation; - t = this; - d = this.get_node(obj, true); - - obj.state.opened = false; - /** - * triggered when a node is closed (if there is an animation it will not be complete yet) - * @event - * @name close_node.jstree - * @param {Object} node the closed node - */ - this.trigger('close_node',{ "node" : obj }); - if(!d.length) { - /** - * triggered when a node is closed and the animation is complete - * @event - * @name after_close.jstree - * @param {Object} node the closed node - */ - this.trigger("after_close", { "node" : obj }); - } - else { - if(!animation) { - d[0].className = d[0].className.replace('jstree-open', 'jstree-closed'); - d.attr("aria-expanded", false).children('.jstree-children').remove(); - this.trigger("after_close", { "node" : obj }); - } - else { - d - .children(".jstree-children").attr("style","display:block !important").end() - .removeClass("jstree-open").addClass("jstree-closed").attr("aria-expanded", false) - .children(".jstree-children").stop(true, true).slideUp(animation, function () { - this.style.display = ""; - d.children('.jstree-children').remove(); - if (t.element) { - t.trigger("after_close", { "node" : obj }); - } - }); - } - } - }, - /** - * toggles a node - closing it if it is open, opening it if it is closed - * @name toggle_node(obj) - * @param {mixed} obj the node to toggle - */ - toggle_node : function (obj) { - var t1, t2; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.toggle_node(obj[t1]); - } - return true; - } - if(this.is_closed(obj)) { - return this.open_node(obj); - } - if(this.is_open(obj)) { - return this.close_node(obj); - } - }, - /** - * opens all nodes within a node (or the tree), revaling their children. If the node is not loaded it will be loaded and opened once ready. - * @name open_all([obj, animation, original_obj]) - * @param {mixed} obj the node to open recursively, omit to open all nodes in the tree - * @param {Number} animation the animation duration in milliseconds when opening the nodes, the default is no animation - * @param {jQuery} reference to the node that started the process (internal use) - * @trigger open_all.jstree - */ - open_all : function (obj, animation, original_obj) { - if(!obj) { obj = $.jstree.root; } - obj = this.get_node(obj); - if(!obj) { return false; } - var dom = obj.id === $.jstree.root ? this.get_container_ul() : this.get_node(obj, true), i, j, _this; - if(!dom.length) { - for(i = 0, j = obj.children_d.length; i < j; i++) { - if(this.is_closed(this._model.data[obj.children_d[i]])) { - this._model.data[obj.children_d[i]].state.opened = true; - } - } - return this.trigger('open_all', { "node" : obj }); - } - original_obj = original_obj || dom; - _this = this; - dom = this.is_closed(obj) ? dom.find('.jstree-closed').addBack() : dom.find('.jstree-closed'); - dom.each(function () { - _this.open_node( - this, - function(node, status) { if(status && this.is_parent(node)) { this.open_all(node, animation, original_obj); } }, - animation || 0 - ); - }); - if(original_obj.find('.jstree-closed').length === 0) { - /** - * triggered when an `open_all` call completes - * @event - * @name open_all.jstree - * @param {Object} node the opened node - */ - this.trigger('open_all', { "node" : this.get_node(original_obj) }); - } - }, - /** - * closes all nodes within a node (or the tree), revaling their children - * @name close_all([obj, animation]) - * @param {mixed} obj the node to close recursively, omit to close all nodes in the tree - * @param {Number} animation the animation duration in milliseconds when closing the nodes, the default is no animation - * @trigger close_all.jstree - */ - close_all : function (obj, animation) { - if(!obj) { obj = $.jstree.root; } - obj = this.get_node(obj); - if(!obj) { return false; } - var dom = obj.id === $.jstree.root ? this.get_container_ul() : this.get_node(obj, true), - _this = this, i, j; - if(dom.length) { - dom = this.is_open(obj) ? dom.find('.jstree-open').addBack() : dom.find('.jstree-open'); - $(dom.get().reverse()).each(function () { _this.close_node(this, animation || 0); }); - } - for(i = 0, j = obj.children_d.length; i < j; i++) { - this._model.data[obj.children_d[i]].state.opened = false; - } - /** - * triggered when an `close_all` call completes - * @event - * @name close_all.jstree - * @param {Object} node the closed node - */ - this.trigger('close_all', { "node" : obj }); - }, - /** - * checks if a node is disabled (not selectable) - * @name is_disabled(obj) - * @param {mixed} obj - * @return {Boolean} - */ - is_disabled : function (obj) { - obj = this.get_node(obj); - return obj && obj.state && obj.state.disabled; - }, - /** - * enables a node - so that it can be selected - * @name enable_node(obj) - * @param {mixed} obj the node to enable - * @trigger enable_node.jstree - */ - enable_node : function (obj) { - var t1, t2; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.enable_node(obj[t1]); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { - return false; - } - obj.state.disabled = false; - this.get_node(obj,true).children('.jstree-anchor').removeClass('jstree-disabled').attr('aria-disabled', false); - /** - * triggered when an node is enabled - * @event - * @name enable_node.jstree - * @param {Object} node the enabled node - */ - this.trigger('enable_node', { 'node' : obj }); - }, - /** - * disables a node - so that it can not be selected - * @name disable_node(obj) - * @param {mixed} obj the node to disable - * @trigger disable_node.jstree - */ - disable_node : function (obj) { - var t1, t2; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.disable_node(obj[t1]); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { - return false; - } - obj.state.disabled = true; - this.get_node(obj,true).children('.jstree-anchor').addClass('jstree-disabled').attr('aria-disabled', true); - /** - * triggered when an node is disabled - * @event - * @name disable_node.jstree - * @param {Object} node the disabled node - */ - this.trigger('disable_node', { 'node' : obj }); - }, - /** - * determines if a node is hidden - * @name is_hidden(obj) - * @param {mixed} obj the node - */ - is_hidden : function (obj) { - obj = this.get_node(obj); - return obj.state.hidden === true; - }, - /** - * hides a node - it is still in the structure but will not be visible - * @name hide_node(obj) - * @param {mixed} obj the node to hide - * @param {Boolean} skip_redraw internal parameter controlling if redraw is called - * @trigger hide_node.jstree - */ - hide_node : function (obj, skip_redraw) { - var t1, t2; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.hide_node(obj[t1], true); - } - if (!skip_redraw) { - this.redraw(); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { - return false; - } - if(!obj.state.hidden) { - obj.state.hidden = true; - this._node_changed(obj.parent); - if(!skip_redraw) { - this.redraw(); - } - /** - * triggered when an node is hidden - * @event - * @name hide_node.jstree - * @param {Object} node the hidden node - */ - this.trigger('hide_node', { 'node' : obj }); - } - }, - /** - * shows a node - * @name show_node(obj) - * @param {mixed} obj the node to show - * @param {Boolean} skip_redraw internal parameter controlling if redraw is called - * @trigger show_node.jstree - */ - show_node : function (obj, skip_redraw) { - var t1, t2; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.show_node(obj[t1], true); - } - if (!skip_redraw) { - this.redraw(); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { - return false; - } - if(obj.state.hidden) { - obj.state.hidden = false; - this._node_changed(obj.parent); - if(!skip_redraw) { - this.redraw(); - } - /** - * triggered when an node is shown - * @event - * @name show_node.jstree - * @param {Object} node the shown node - */ - this.trigger('show_node', { 'node' : obj }); - } - }, - /** - * hides all nodes - * @name hide_all() - * @trigger hide_all.jstree - */ - hide_all : function (skip_redraw) { - var i, m = this._model.data, ids = []; - for(i in m) { - if(m.hasOwnProperty(i) && i !== $.jstree.root && !m[i].state.hidden) { - m[i].state.hidden = true; - ids.push(i); - } - } - this._model.force_full_redraw = true; - if(!skip_redraw) { - this.redraw(); - } - /** - * triggered when all nodes are hidden - * @event - * @name hide_all.jstree - * @param {Array} nodes the IDs of all hidden nodes - */ - this.trigger('hide_all', { 'nodes' : ids }); - return ids; - }, - /** - * shows all nodes - * @name show_all() - * @trigger show_all.jstree - */ - show_all : function (skip_redraw) { - var i, m = this._model.data, ids = []; - for(i in m) { - if(m.hasOwnProperty(i) && i !== $.jstree.root && m[i].state.hidden) { - m[i].state.hidden = false; - ids.push(i); - } - } - this._model.force_full_redraw = true; - if(!skip_redraw) { - this.redraw(); - } - /** - * triggered when all nodes are shown - * @event - * @name show_all.jstree - * @param {Array} nodes the IDs of all shown nodes - */ - this.trigger('show_all', { 'nodes' : ids }); - return ids; - }, - /** - * called when a node is selected by the user. Used internally. - * @private - * @name activate_node(obj, e) - * @param {mixed} obj the node - * @param {Object} e the related event - * @trigger activate_node.jstree, changed.jstree - */ - activate_node : function (obj, e) { - if(this.is_disabled(obj)) { - return false; - } - if(!e || typeof e !== 'object') { - e = {}; - } - - // ensure last_clicked is still in the DOM, make it fresh (maybe it was moved?) and make sure it is still selected, if not - make last_clicked the last selected node - this._data.core.last_clicked = this._data.core.last_clicked && this._data.core.last_clicked.id !== undefined ? this.get_node(this._data.core.last_clicked.id) : null; - if(this._data.core.last_clicked && !this._data.core.last_clicked.state.selected) { this._data.core.last_clicked = null; } - if(!this._data.core.last_clicked && this._data.core.selected.length) { this._data.core.last_clicked = this.get_node(this._data.core.selected[this._data.core.selected.length - 1]); } - - if(!this.settings.core.multiple || (!e.metaKey && !e.ctrlKey && !e.shiftKey) || (e.shiftKey && (!this._data.core.last_clicked || !this.get_parent(obj) || this.get_parent(obj) !== this._data.core.last_clicked.parent ) )) { - if(!this.settings.core.multiple && (e.metaKey || e.ctrlKey || e.shiftKey) && this.is_selected(obj)) { - this.deselect_node(obj, false, e); - } - else { - this.deselect_all(true); - this.select_node(obj, false, false, e); - this._data.core.last_clicked = this.get_node(obj); - } - } - else { - if(e.shiftKey) { - var o = this.get_node(obj).id, - l = this._data.core.last_clicked.id, - p = this.get_node(this._data.core.last_clicked.parent).children, - c = false, - i, j; - for(i = 0, j = p.length; i < j; i += 1) { - // separate IFs work whem o and l are the same - if(p[i] === o) { - c = !c; - } - if(p[i] === l) { - c = !c; - } - if(!this.is_disabled(p[i]) && (c || p[i] === o || p[i] === l)) { - if (!this.is_hidden(p[i])) { - this.select_node(p[i], true, false, e); - } - } - else { - this.deselect_node(p[i], true, e); - } - } - this.trigger('changed', { 'action' : 'select_node', 'node' : this.get_node(obj), 'selected' : this._data.core.selected, 'event' : e }); - } - else { - if(!this.is_selected(obj)) { - this.select_node(obj, false, false, e); - } - else { - this.deselect_node(obj, false, e); - } - } - } - /** - * triggered when an node is clicked or intercated with by the user - * @event - * @name activate_node.jstree - * @param {Object} node - * @param {Object} event the ooriginal event (if any) which triggered the call (may be an empty object) - */ - this.trigger('activate_node', { 'node' : this.get_node(obj), 'event' : e }); - }, - /** - * applies the hover state on a node, called when a node is hovered by the user. Used internally. - * @private - * @name hover_node(obj) - * @param {mixed} obj - * @trigger hover_node.jstree - */ - hover_node : function (obj) { - obj = this.get_node(obj, true); - if(!obj || !obj.length || obj.children('.jstree-hovered').length) { - return false; - } - var o = this.element.find('.jstree-hovered'), t = this.element; - if(o && o.length) { this.dehover_node(o); } - - obj.children('.jstree-anchor').addClass('jstree-hovered'); - /** - * triggered when an node is hovered - * @event - * @name hover_node.jstree - * @param {Object} node - */ - this.trigger('hover_node', { 'node' : this.get_node(obj) }); - setTimeout(function () { t.attr('aria-activedescendant', obj[0].id); }, 0); - }, - /** - * removes the hover state from a nodecalled when a node is no longer hovered by the user. Used internally. - * @private - * @name dehover_node(obj) - * @param {mixed} obj - * @trigger dehover_node.jstree - */ - dehover_node : function (obj) { - obj = this.get_node(obj, true); - if(!obj || !obj.length || !obj.children('.jstree-hovered').length) { - return false; - } - obj.children('.jstree-anchor').removeClass('jstree-hovered'); - /** - * triggered when an node is no longer hovered - * @event - * @name dehover_node.jstree - * @param {Object} node - */ - this.trigger('dehover_node', { 'node' : this.get_node(obj) }); - }, - /** - * select a node - * @name select_node(obj [, supress_event, prevent_open]) - * @param {mixed} obj an array can be used to select multiple nodes - * @param {Boolean} supress_event if set to `true` the `changed.jstree` event won't be triggered - * @param {Boolean} prevent_open if set to `true` parents of the selected node won't be opened - * @trigger select_node.jstree, changed.jstree - */ - select_node : function (obj, supress_event, prevent_open, e) { - var dom, t1, t2, th; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.select_node(obj[t1], supress_event, prevent_open, e); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { - return false; - } - dom = this.get_node(obj, true); - if(!obj.state.selected) { - obj.state.selected = true; - this._data.core.selected.push(obj.id); - if(!prevent_open) { - dom = this._open_to(obj); - } - if(dom && dom.length) { - dom.attr('aria-selected', true).children('.jstree-anchor').addClass('jstree-clicked'); - } - /** - * triggered when an node is selected - * @event - * @name select_node.jstree - * @param {Object} node - * @param {Array} selected the current selection - * @param {Object} event the event (if any) that triggered this select_node - */ - this.trigger('select_node', { 'node' : obj, 'selected' : this._data.core.selected, 'event' : e }); - if(!supress_event) { - /** - * triggered when selection changes - * @event - * @name changed.jstree - * @param {Object} node - * @param {Object} action the action that caused the selection to change - * @param {Array} selected the current selection - * @param {Object} event the event (if any) that triggered this changed event - */ - this.trigger('changed', { 'action' : 'select_node', 'node' : obj, 'selected' : this._data.core.selected, 'event' : e }); - } - } - }, - /** - * deselect a node - * @name deselect_node(obj [, supress_event]) - * @param {mixed} obj an array can be used to deselect multiple nodes - * @param {Boolean} supress_event if set to `true` the `changed.jstree` event won't be triggered - * @trigger deselect_node.jstree, changed.jstree - */ - deselect_node : function (obj, supress_event, e) { - var t1, t2, dom; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.deselect_node(obj[t1], supress_event, e); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { - return false; - } - dom = this.get_node(obj, true); - if(obj.state.selected) { - obj.state.selected = false; - this._data.core.selected = $.vakata.array_remove_item(this._data.core.selected, obj.id); - if(dom.length) { - dom.attr('aria-selected', false).children('.jstree-anchor').removeClass('jstree-clicked'); - } - /** - * triggered when an node is deselected - * @event - * @name deselect_node.jstree - * @param {Object} node - * @param {Array} selected the current selection - * @param {Object} event the event (if any) that triggered this deselect_node - */ - this.trigger('deselect_node', { 'node' : obj, 'selected' : this._data.core.selected, 'event' : e }); - if(!supress_event) { - this.trigger('changed', { 'action' : 'deselect_node', 'node' : obj, 'selected' : this._data.core.selected, 'event' : e }); - } - } - }, - /** - * select all nodes in the tree - * @name select_all([supress_event]) - * @param {Boolean} supress_event if set to `true` the `changed.jstree` event won't be triggered - * @trigger select_all.jstree, changed.jstree - */ - select_all : function (supress_event) { - var tmp = this._data.core.selected.concat([]), i, j; - this._data.core.selected = this._model.data[$.jstree.root].children_d.concat(); - for(i = 0, j = this._data.core.selected.length; i < j; i++) { - if(this._model.data[this._data.core.selected[i]]) { - this._model.data[this._data.core.selected[i]].state.selected = true; - } - } - this.redraw(true); - /** - * triggered when all nodes are selected - * @event - * @name select_all.jstree - * @param {Array} selected the current selection - */ - this.trigger('select_all', { 'selected' : this._data.core.selected }); - if(!supress_event) { - this.trigger('changed', { 'action' : 'select_all', 'selected' : this._data.core.selected, 'old_selection' : tmp }); - } - }, - /** - * deselect all selected nodes - * @name deselect_all([supress_event]) - * @param {Boolean} supress_event if set to `true` the `changed.jstree` event won't be triggered - * @trigger deselect_all.jstree, changed.jstree - */ - deselect_all : function (supress_event) { - var tmp = this._data.core.selected.concat([]), i, j; - for(i = 0, j = this._data.core.selected.length; i < j; i++) { - if(this._model.data[this._data.core.selected[i]]) { - this._model.data[this._data.core.selected[i]].state.selected = false; - } - } - this._data.core.selected = []; - this.element.find('.jstree-clicked').removeClass('jstree-clicked').parent().attr('aria-selected', false); - /** - * triggered when all nodes are deselected - * @event - * @name deselect_all.jstree - * @param {Object} node the previous selection - * @param {Array} selected the current selection - */ - this.trigger('deselect_all', { 'selected' : this._data.core.selected, 'node' : tmp }); - if(!supress_event) { - this.trigger('changed', { 'action' : 'deselect_all', 'selected' : this._data.core.selected, 'old_selection' : tmp }); - } - }, - /** - * checks if a node is selected - * @name is_selected(obj) - * @param {mixed} obj - * @return {Boolean} - */ - is_selected : function (obj) { - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { - return false; - } - return obj.state.selected; - }, - /** - * get an array of all selected nodes - * @name get_selected([full]) - * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned - * @return {Array} - */ - get_selected : function (full) { - return full ? $.map(this._data.core.selected, $.proxy(function (i) { return this.get_node(i); }, this)) : this._data.core.selected.slice(); - }, - /** - * get an array of all top level selected nodes (ignoring children of selected nodes) - * @name get_top_selected([full]) - * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned - * @return {Array} - */ - get_top_selected : function (full) { - var tmp = this.get_selected(true), - obj = {}, i, j, k, l; - for(i = 0, j = tmp.length; i < j; i++) { - obj[tmp[i].id] = tmp[i]; - } - for(i = 0, j = tmp.length; i < j; i++) { - for(k = 0, l = tmp[i].children_d.length; k < l; k++) { - if(obj[tmp[i].children_d[k]]) { - delete obj[tmp[i].children_d[k]]; - } - } - } - tmp = []; - for(i in obj) { - if(obj.hasOwnProperty(i)) { - tmp.push(i); - } - } - return full ? $.map(tmp, $.proxy(function (i) { return this.get_node(i); }, this)) : tmp; - }, - /** - * get an array of all bottom level selected nodes (ignoring selected parents) - * @name get_bottom_selected([full]) - * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned - * @return {Array} - */ - get_bottom_selected : function (full) { - var tmp = this.get_selected(true), - obj = [], i, j; - for(i = 0, j = tmp.length; i < j; i++) { - if(!tmp[i].children.length) { - obj.push(tmp[i].id); - } - } - return full ? $.map(obj, $.proxy(function (i) { return this.get_node(i); }, this)) : obj; - }, - /** - * gets the current state of the tree so that it can be restored later with `set_state(state)`. Used internally. - * @name get_state() - * @private - * @return {Object} - */ - get_state : function () { - var state = { - 'core' : { - 'open' : [], - 'scroll' : { - 'left' : this.element.scrollLeft(), - 'top' : this.element.scrollTop() - }, - /*! - 'themes' : { - 'name' : this.get_theme(), - 'icons' : this._data.core.themes.icons, - 'dots' : this._data.core.themes.dots - }, - */ - 'selected' : [] - } - }, i; - for(i in this._model.data) { - if(this._model.data.hasOwnProperty(i)) { - if(i !== $.jstree.root) { - if(this._model.data[i].state.opened) { - state.core.open.push(i); - } - if(this._model.data[i].state.selected) { - state.core.selected.push(i); - } - } - } - } - return state; - }, - /** - * sets the state of the tree. Used internally. - * @name set_state(state [, callback]) - * @private - * @param {Object} state the state to restore. Keep in mind this object is passed by reference and jstree will modify it. - * @param {Function} callback an optional function to execute once the state is restored. - * @trigger set_state.jstree - */ - set_state : function (state, callback) { - if(state) { - if(state.core) { - var res, n, t, _this, i; - if(state.core.open) { - if(!$.isArray(state.core.open) || !state.core.open.length) { - delete state.core.open; - this.set_state(state, callback); - } - else { - this._load_nodes(state.core.open, function (nodes) { - this.open_node(nodes, false, 0); - delete state.core.open; - this.set_state(state, callback); - }); - } - return false; - } - if(state.core.scroll) { - if(state.core.scroll && state.core.scroll.left !== undefined) { - this.element.scrollLeft(state.core.scroll.left); - } - if(state.core.scroll && state.core.scroll.top !== undefined) { - this.element.scrollTop(state.core.scroll.top); - } - delete state.core.scroll; - this.set_state(state, callback); - return false; - } - if(state.core.selected) { - _this = this; - this.deselect_all(); - $.each(state.core.selected, function (i, v) { - _this.select_node(v, false, true); - }); - delete state.core.selected; - this.set_state(state, callback); - return false; - } - for(i in state) { - if(state.hasOwnProperty(i) && i !== "core" && $.inArray(i, this.settings.plugins) === -1) { - delete state[i]; - } - } - if($.isEmptyObject(state.core)) { - delete state.core; - this.set_state(state, callback); - return false; - } - } - if($.isEmptyObject(state)) { - state = null; - if(callback) { callback.call(this); } - /** - * triggered when a `set_state` call completes - * @event - * @name set_state.jstree - */ - this.trigger('set_state'); - return false; - } - return true; - } - return false; - }, - /** - * refreshes the tree - all nodes are reloaded with calls to `load_node`. - * @name refresh() - * @param {Boolean} skip_loading an option to skip showing the loading indicator - * @param {Mixed} forget_state if set to `true` state will not be reapplied, if set to a function (receiving the current state as argument) the result of that function will be used as state - * @trigger refresh.jstree - */ - refresh : function (skip_loading, forget_state) { - this._data.core.state = forget_state === true ? {} : this.get_state(); - if(forget_state && $.isFunction(forget_state)) { this._data.core.state = forget_state.call(this, this._data.core.state); } - this._cnt = 0; - this._model.data = {}; - this._model.data[$.jstree.root] = { - id : $.jstree.root, - parent : null, - parents : [], - children : [], - children_d : [], - state : { loaded : false } - }; - this._data.core.selected = []; - this._data.core.last_clicked = null; - this._data.core.focused = null; - - var c = this.get_container_ul()[0].className; - if(!skip_loading) { - this.element.html("<"+"ul class='"+c+"' role='group'><"+"li class='jstree-initial-node jstree-loading jstree-leaf jstree-last' role='treeitem' id='j"+this._id+"_loading'><"+"a class='jstree-anchor' href='#'>" + this.get_string("Loading ...") + ""); - this.element.attr('aria-activedescendant','j'+this._id+'_loading'); - } - this.load_node($.jstree.root, function (o, s) { - if(s) { - this.get_container_ul()[0].className = c; - if(this._firstChild(this.get_container_ul()[0])) { - this.element.attr('aria-activedescendant',this._firstChild(this.get_container_ul()[0]).id); - } - this.set_state($.extend(true, {}, this._data.core.state), function () { - /** - * triggered when a `refresh` call completes - * @event - * @name refresh.jstree - */ - this.trigger('refresh'); - }); - } - this._data.core.state = null; - }); - }, - /** - * refreshes a node in the tree (reload its children) all opened nodes inside that node are reloaded with calls to `load_node`. - * @name refresh_node(obj) - * @param {mixed} obj the node - * @trigger refresh_node.jstree - */ - refresh_node : function (obj) { - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { return false; } - var opened = [], to_load = [], s = this._data.core.selected.concat([]); - to_load.push(obj.id); - if(obj.state.opened === true) { opened.push(obj.id); } - this.get_node(obj, true).find('.jstree-open').each(function() { to_load.push(this.id); opened.push(this.id); }); - this._load_nodes(to_load, $.proxy(function (nodes) { - this.open_node(opened, false, 0); - this.select_node(s); - /** - * triggered when a node is refreshed - * @event - * @name refresh_node.jstree - * @param {Object} node - the refreshed node - * @param {Array} nodes - an array of the IDs of the nodes that were reloaded - */ - this.trigger('refresh_node', { 'node' : obj, 'nodes' : nodes }); - }, this), false, true); - }, - /** - * set (change) the ID of a node - * @name set_id(obj, id) - * @param {mixed} obj the node - * @param {String} id the new ID - * @return {Boolean} - * @trigger set_id.jstree - */ - set_id : function (obj, id) { - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { return false; } - var i, j, m = this._model.data, old = obj.id; - id = id.toString(); - // update parents (replace current ID with new one in children and children_d) - m[obj.parent].children[$.inArray(obj.id, m[obj.parent].children)] = id; - for(i = 0, j = obj.parents.length; i < j; i++) { - m[obj.parents[i]].children_d[$.inArray(obj.id, m[obj.parents[i]].children_d)] = id; - } - // update children (replace current ID with new one in parent and parents) - for(i = 0, j = obj.children.length; i < j; i++) { - m[obj.children[i]].parent = id; - } - for(i = 0, j = obj.children_d.length; i < j; i++) { - m[obj.children_d[i]].parents[$.inArray(obj.id, m[obj.children_d[i]].parents)] = id; - } - i = $.inArray(obj.id, this._data.core.selected); - if(i !== -1) { this._data.core.selected[i] = id; } - // update model and obj itself (obj.id, this._model.data[KEY]) - i = this.get_node(obj.id, true); - if(i) { - i.attr('id', id); //.children('.jstree-anchor').attr('id', id + '_anchor').end().attr('aria-labelledby', id + '_anchor'); - if(this.element.attr('aria-activedescendant') === obj.id) { - this.element.attr('aria-activedescendant', id); - } - } - delete m[obj.id]; - obj.id = id; - obj.li_attr.id = id; - m[id] = obj; - /** - * triggered when a node id value is changed - * @event - * @name set_id.jstree - * @param {Object} node - * @param {String} old the old id - */ - this.trigger('set_id',{ "node" : obj, "new" : obj.id, "old" : old }); - return true; - }, - /** - * get the text value of a node - * @name get_text(obj) - * @param {mixed} obj the node - * @return {String} - */ - get_text : function (obj) { - obj = this.get_node(obj); - return (!obj || obj.id === $.jstree.root) ? false : obj.text; - }, - /** - * set the text value of a node. Used internally, please use `rename_node(obj, val)`. - * @private - * @name set_text(obj, val) - * @param {mixed} obj the node, you can pass an array to set the text on multiple nodes - * @param {String} val the new text value - * @return {Boolean} - * @trigger set_text.jstree - */ - set_text : function (obj, val) { - var t1, t2; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.set_text(obj[t1], val); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { return false; } - obj.text = val; - if(this.get_node(obj, true).length) { - this.redraw_node(obj.id); - } - /** - * triggered when a node text value is changed - * @event - * @name set_text.jstree - * @param {Object} obj - * @param {String} text the new value - */ - this.trigger('set_text',{ "obj" : obj, "text" : val }); - return true; - }, - /** - * gets a JSON representation of a node (or the whole tree) - * @name get_json([obj, options]) - * @param {mixed} obj - * @param {Object} options - * @param {Boolean} options.no_state do not return state information - * @param {Boolean} options.no_id do not return ID - * @param {Boolean} options.no_children do not include children - * @param {Boolean} options.no_data do not include node data - * @param {Boolean} options.no_li_attr do not include LI attributes - * @param {Boolean} options.no_a_attr do not include A attributes - * @param {Boolean} options.flat return flat JSON instead of nested - * @return {Object} - */ - get_json : function (obj, options, flat) { - obj = this.get_node(obj || $.jstree.root); - if(!obj) { return false; } - if(options && options.flat && !flat) { flat = []; } - var tmp = { - 'id' : obj.id, - 'text' : obj.text, - 'icon' : this.get_icon(obj), - 'li_attr' : $.extend(true, {}, obj.li_attr), - 'a_attr' : $.extend(true, {}, obj.a_attr), - 'state' : {}, - 'data' : options && options.no_data ? false : $.extend(true, {}, obj.data) - //( this.get_node(obj, true).length ? this.get_node(obj, true).data() : obj.data ), - }, i, j; - if(options && options.flat) { - tmp.parent = obj.parent; - } - else { - tmp.children = []; - } - if(!options || !options.no_state) { - for(i in obj.state) { - if(obj.state.hasOwnProperty(i)) { - tmp.state[i] = obj.state[i]; - } - } - } else { - delete tmp.state; - } - if(options && options.no_li_attr) { - delete tmp.li_attr; - } - if(options && options.no_a_attr) { - delete tmp.a_attr; - } - if(options && options.no_id) { - delete tmp.id; - if(tmp.li_attr && tmp.li_attr.id) { - delete tmp.li_attr.id; - } - if(tmp.a_attr && tmp.a_attr.id) { - delete tmp.a_attr.id; - } - } - if(options && options.flat && obj.id !== $.jstree.root) { - flat.push(tmp); - } - if(!options || !options.no_children) { - for(i = 0, j = obj.children.length; i < j; i++) { - if(options && options.flat) { - this.get_json(obj.children[i], options, flat); - } - else { - tmp.children.push(this.get_json(obj.children[i], options)); - } - } - } - return options && options.flat ? flat : (obj.id === $.jstree.root ? tmp.children : tmp); - }, - /** - * create a new node (do not confuse with load_node) - * @name create_node([par, node, pos, callback, is_loaded]) - * @param {mixed} par the parent node (to create a root node use either "#" (string) or `null`) - * @param {mixed} node the data for the new node (a valid JSON object, or a simple string with the name) - * @param {mixed} pos the index at which to insert the node, "first" and "last" are also supported, default is "last" - * @param {Function} callback a function to be called once the node is created - * @param {Boolean} is_loaded internal argument indicating if the parent node was succesfully loaded - * @return {String} the ID of the newly create node - * @trigger model.jstree, create_node.jstree - */ - create_node : function (par, node, pos, callback, is_loaded) { - if(par === null) { par = $.jstree.root; } - par = this.get_node(par); - if(!par) { return false; } - pos = pos === undefined ? "last" : pos; - if(!pos.toString().match(/^(before|after)$/) && !is_loaded && !this.is_loaded(par)) { - return this.load_node(par, function () { this.create_node(par, node, pos, callback, true); }); - } - if(!node) { node = { "text" : this.get_string('New node') }; } - if(typeof node === "string") { node = { "text" : node }; } - if(node.text === undefined) { node.text = this.get_string('New node'); } - var tmp, dpc, i, j; - - if(par.id === $.jstree.root) { - if(pos === "before") { pos = "first"; } - if(pos === "after") { pos = "last"; } - } - switch(pos) { - case "before": - tmp = this.get_node(par.parent); - pos = $.inArray(par.id, tmp.children); - par = tmp; - break; - case "after" : - tmp = this.get_node(par.parent); - pos = $.inArray(par.id, tmp.children) + 1; - par = tmp; - break; - case "inside": - case "first": - pos = 0; - break; - case "last": - pos = par.children.length; - break; - default: - if(!pos) { pos = 0; } - break; - } - if(pos > par.children.length) { pos = par.children.length; } - if(!node.id) { node.id = true; } - if(!this.check("create_node", node, par, pos)) { - this.settings.core.error.call(this, this._data.core.last_error); - return false; - } - if(node.id === true) { delete node.id; } - node = this._parse_model_from_json(node, par.id, par.parents.concat()); - if(!node) { return false; } - tmp = this.get_node(node); - dpc = []; - dpc.push(node); - dpc = dpc.concat(tmp.children_d); - this.trigger('model', { "nodes" : dpc, "parent" : par.id }); - - par.children_d = par.children_d.concat(dpc); - for(i = 0, j = par.parents.length; i < j; i++) { - this._model.data[par.parents[i]].children_d = this._model.data[par.parents[i]].children_d.concat(dpc); - } - node = tmp; - tmp = []; - for(i = 0, j = par.children.length; i < j; i++) { - tmp[i >= pos ? i+1 : i] = par.children[i]; - } - tmp[pos] = node.id; - par.children = tmp; - - this.redraw_node(par, true); - if(callback) { callback.call(this, this.get_node(node)); } - /** - * triggered when a node is created - * @event - * @name create_node.jstree - * @param {Object} node - * @param {String} parent the parent's ID - * @param {Number} position the position of the new node among the parent's children - */ - this.trigger('create_node', { "node" : this.get_node(node), "parent" : par.id, "position" : pos }); - return node.id; - }, - /** - * set the text value of a node - * @name rename_node(obj, val) - * @param {mixed} obj the node, you can pass an array to rename multiple nodes to the same name - * @param {String} val the new text value - * @return {Boolean} - * @trigger rename_node.jstree - */ - rename_node : function (obj, val) { - var t1, t2, old; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.rename_node(obj[t1], val); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { return false; } - old = obj.text; - if(!this.check("rename_node", obj, this.get_parent(obj), val)) { - this.settings.core.error.call(this, this._data.core.last_error); - return false; - } - this.set_text(obj, val); // .apply(this, Array.prototype.slice.call(arguments)) - /** - * triggered when a node is renamed - * @event - * @name rename_node.jstree - * @param {Object} node - * @param {String} text the new value - * @param {String} old the old value - */ - this.trigger('rename_node', { "node" : obj, "text" : val, "old" : old }); - return true; - }, - /** - * remove a node - * @name delete_node(obj) - * @param {mixed} obj the node, you can pass an array to delete multiple nodes - * @return {Boolean} - * @trigger delete_node.jstree, changed.jstree - */ - delete_node : function (obj) { - var t1, t2, par, pos, tmp, i, j, k, l, c, top, lft; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.delete_node(obj[t1]); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { return false; } - par = this.get_node(obj.parent); - pos = $.inArray(obj.id, par.children); - c = false; - if(!this.check("delete_node", obj, par, pos)) { - this.settings.core.error.call(this, this._data.core.last_error); - return false; - } - if(pos !== -1) { - par.children = $.vakata.array_remove(par.children, pos); - } - tmp = obj.children_d.concat([]); - tmp.push(obj.id); - for(i = 0, j = obj.parents.length; i < j; i++) { - this._model.data[obj.parents[i]].children_d = $.vakata.array_filter(this._model.data[obj.parents[i]].children_d, function (v) { - return $.inArray(v, tmp) === -1; - }); - } - for(k = 0, l = tmp.length; k < l; k++) { - if(this._model.data[tmp[k]].state.selected) { - c = true; - break; - } - } - if (c) { - this._data.core.selected = $.vakata.array_filter(this._data.core.selected, function (v) { - return $.inArray(v, tmp) === -1; - }); - } - /** - * triggered when a node is deleted - * @event - * @name delete_node.jstree - * @param {Object} node - * @param {String} parent the parent's ID - */ - this.trigger('delete_node', { "node" : obj, "parent" : par.id }); - if(c) { - this.trigger('changed', { 'action' : 'delete_node', 'node' : obj, 'selected' : this._data.core.selected, 'parent' : par.id }); - } - for(k = 0, l = tmp.length; k < l; k++) { - delete this._model.data[tmp[k]]; - } - if($.inArray(this._data.core.focused, tmp) !== -1) { - this._data.core.focused = null; - top = this.element[0].scrollTop; - lft = this.element[0].scrollLeft; - if(par.id === $.jstree.root) { - if (this._model.data[$.jstree.root].children[0]) { - this.get_node(this._model.data[$.jstree.root].children[0], true).children('.jstree-anchor').focus(); - } - } - else { - this.get_node(par, true).children('.jstree-anchor').focus(); - } - this.element[0].scrollTop = top; - this.element[0].scrollLeft = lft; - } - this.redraw_node(par, true); - return true; - }, - /** - * check if an operation is premitted on the tree. Used internally. - * @private - * @name check(chk, obj, par, pos) - * @param {String} chk the operation to check, can be "create_node", "rename_node", "delete_node", "copy_node" or "move_node" - * @param {mixed} obj the node - * @param {mixed} par the parent - * @param {mixed} pos the position to insert at, or if "rename_node" - the new name - * @param {mixed} more some various additional information, for example if a "move_node" operations is triggered by DND this will be the hovered node - * @return {Boolean} - */ - check : function (chk, obj, par, pos, more) { - obj = obj && obj.id ? obj : this.get_node(obj); - par = par && par.id ? par : this.get_node(par); - var tmp = chk.match(/^move_node|copy_node|create_node$/i) ? par : obj, - chc = this.settings.core.check_callback; - if(chk === "move_node" || chk === "copy_node") { - if((!more || !more.is_multi) && (obj.id === par.id || (chk === "move_node" && $.inArray(obj.id, par.children) === pos) || $.inArray(par.id, obj.children_d) !== -1)) { - this._data.core.last_error = { 'error' : 'check', 'plugin' : 'core', 'id' : 'core_01', 'reason' : 'Moving parent inside child', 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; - return false; - } - } - if(tmp && tmp.data) { tmp = tmp.data; } - if(tmp && tmp.functions && (tmp.functions[chk] === false || tmp.functions[chk] === true)) { - if(tmp.functions[chk] === false) { - this._data.core.last_error = { 'error' : 'check', 'plugin' : 'core', 'id' : 'core_02', 'reason' : 'Node data prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; - } - return tmp.functions[chk]; - } - if(chc === false || ($.isFunction(chc) && chc.call(this, chk, obj, par, pos, more) === false) || (chc && chc[chk] === false)) { - this._data.core.last_error = { 'error' : 'check', 'plugin' : 'core', 'id' : 'core_03', 'reason' : 'User config for core.check_callback prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; - return false; - } - return true; - }, - /** - * get the last error - * @name last_error() - * @return {Object} - */ - last_error : function () { - return this._data.core.last_error; - }, - /** - * move a node to a new parent - * @name move_node(obj, par [, pos, callback, is_loaded]) - * @param {mixed} obj the node to move, pass an array to move multiple nodes - * @param {mixed} par the new parent - * @param {mixed} pos the position to insert at (besides integer values, "first" and "last" are supported, as well as "before" and "after"), defaults to integer `0` - * @param {function} callback a function to call once the move is completed, receives 3 arguments - the node, the new parent and the position - * @param {Boolean} is_loaded internal parameter indicating if the parent node has been loaded - * @param {Boolean} skip_redraw internal parameter indicating if the tree should be redrawn - * @param {Boolean} instance internal parameter indicating if the node comes from another instance - * @trigger move_node.jstree - */ - move_node : function (obj, par, pos, callback, is_loaded, skip_redraw, origin) { - var t1, t2, old_par, old_pos, new_par, old_ins, is_multi, dpc, tmp, i, j, k, l, p; - - par = this.get_node(par); - pos = pos === undefined ? 0 : pos; - if(!par) { return false; } - if(!pos.toString().match(/^(before|after)$/) && !is_loaded && !this.is_loaded(par)) { - return this.load_node(par, function () { this.move_node(obj, par, pos, callback, true, false, origin); }); - } - - if($.isArray(obj)) { - if(obj.length === 1) { - obj = obj[0]; - } - else { - //obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - if((tmp = this.move_node(obj[t1], par, pos, callback, is_loaded, false, origin))) { - par = tmp; - pos = "after"; - } - } - this.redraw(); - return true; - } - } - obj = obj && obj.id ? obj : this.get_node(obj); - - if(!obj || obj.id === $.jstree.root) { return false; } - - old_par = (obj.parent || $.jstree.root).toString(); - new_par = (!pos.toString().match(/^(before|after)$/) || par.id === $.jstree.root) ? par : this.get_node(par.parent); - old_ins = origin ? origin : (this._model.data[obj.id] ? this : $.jstree.reference(obj.id)); - is_multi = !old_ins || !old_ins._id || (this._id !== old_ins._id); - old_pos = old_ins && old_ins._id && old_par && old_ins._model.data[old_par] && old_ins._model.data[old_par].children ? $.inArray(obj.id, old_ins._model.data[old_par].children) : -1; - if(old_ins && old_ins._id) { - obj = old_ins._model.data[obj.id]; - } - - if(is_multi) { - if((tmp = this.copy_node(obj, par, pos, callback, is_loaded, false, origin))) { - if(old_ins) { old_ins.delete_node(obj); } - return tmp; - } - return false; - } - //var m = this._model.data; - if(par.id === $.jstree.root) { - if(pos === "before") { pos = "first"; } - if(pos === "after") { pos = "last"; } - } - switch(pos) { - case "before": - pos = $.inArray(par.id, new_par.children); - break; - case "after" : - pos = $.inArray(par.id, new_par.children) + 1; - break; - case "inside": - case "first": - pos = 0; - break; - case "last": - pos = new_par.children.length; - break; - default: - if(!pos) { pos = 0; } - break; - } - if(pos > new_par.children.length) { pos = new_par.children.length; } - if(!this.check("move_node", obj, new_par, pos, { 'core' : true, 'origin' : origin, 'is_multi' : (old_ins && old_ins._id && old_ins._id !== this._id), 'is_foreign' : (!old_ins || !old_ins._id) })) { - this.settings.core.error.call(this, this._data.core.last_error); - return false; - } - if(obj.parent === new_par.id) { - dpc = new_par.children.concat(); - tmp = $.inArray(obj.id, dpc); - if(tmp !== -1) { - dpc = $.vakata.array_remove(dpc, tmp); - if(pos > tmp) { pos--; } - } - tmp = []; - for(i = 0, j = dpc.length; i < j; i++) { - tmp[i >= pos ? i+1 : i] = dpc[i]; - } - tmp[pos] = obj.id; - new_par.children = tmp; - this._node_changed(new_par.id); - this.redraw(new_par.id === $.jstree.root); - } - else { - // clean old parent and up - tmp = obj.children_d.concat(); - tmp.push(obj.id); - for(i = 0, j = obj.parents.length; i < j; i++) { - dpc = []; - p = old_ins._model.data[obj.parents[i]].children_d; - for(k = 0, l = p.length; k < l; k++) { - if($.inArray(p[k], tmp) === -1) { - dpc.push(p[k]); - } - } - old_ins._model.data[obj.parents[i]].children_d = dpc; - } - old_ins._model.data[old_par].children = $.vakata.array_remove_item(old_ins._model.data[old_par].children, obj.id); - - // insert into new parent and up - for(i = 0, j = new_par.parents.length; i < j; i++) { - this._model.data[new_par.parents[i]].children_d = this._model.data[new_par.parents[i]].children_d.concat(tmp); - } - dpc = []; - for(i = 0, j = new_par.children.length; i < j; i++) { - dpc[i >= pos ? i+1 : i] = new_par.children[i]; - } - dpc[pos] = obj.id; - new_par.children = dpc; - new_par.children_d.push(obj.id); - new_par.children_d = new_par.children_d.concat(obj.children_d); - - // update object - obj.parent = new_par.id; - tmp = new_par.parents.concat(); - tmp.unshift(new_par.id); - p = obj.parents.length; - obj.parents = tmp; - - // update object children - tmp = tmp.concat(); - for(i = 0, j = obj.children_d.length; i < j; i++) { - this._model.data[obj.children_d[i]].parents = this._model.data[obj.children_d[i]].parents.slice(0,p*-1); - Array.prototype.push.apply(this._model.data[obj.children_d[i]].parents, tmp); - } - - if(old_par === $.jstree.root || new_par.id === $.jstree.root) { - this._model.force_full_redraw = true; - } - if(!this._model.force_full_redraw) { - this._node_changed(old_par); - this._node_changed(new_par.id); - } - if(!skip_redraw) { - this.redraw(); - } - } - if(callback) { callback.call(this, obj, new_par, pos); } - /** - * triggered when a node is moved - * @event - * @name move_node.jstree - * @param {Object} node - * @param {String} parent the parent's ID - * @param {Number} position the position of the node among the parent's children - * @param {String} old_parent the old parent of the node - * @param {Number} old_position the old position of the node - * @param {Boolean} is_multi do the node and new parent belong to different instances - * @param {jsTree} old_instance the instance the node came from - * @param {jsTree} new_instance the instance of the new parent - */ - this.trigger('move_node', { "node" : obj, "parent" : new_par.id, "position" : pos, "old_parent" : old_par, "old_position" : old_pos, 'is_multi' : (old_ins && old_ins._id && old_ins._id !== this._id), 'is_foreign' : (!old_ins || !old_ins._id), 'old_instance' : old_ins, 'new_instance' : this }); - return obj.id; - }, - /** - * copy a node to a new parent - * @name copy_node(obj, par [, pos, callback, is_loaded]) - * @param {mixed} obj the node to copy, pass an array to copy multiple nodes - * @param {mixed} par the new parent - * @param {mixed} pos the position to insert at (besides integer values, "first" and "last" are supported, as well as "before" and "after"), defaults to integer `0` - * @param {function} callback a function to call once the move is completed, receives 3 arguments - the node, the new parent and the position - * @param {Boolean} is_loaded internal parameter indicating if the parent node has been loaded - * @param {Boolean} skip_redraw internal parameter indicating if the tree should be redrawn - * @param {Boolean} instance internal parameter indicating if the node comes from another instance - * @trigger model.jstree copy_node.jstree - */ - copy_node : function (obj, par, pos, callback, is_loaded, skip_redraw, origin) { - var t1, t2, dpc, tmp, i, j, node, old_par, new_par, old_ins, is_multi; - - par = this.get_node(par); - pos = pos === undefined ? 0 : pos; - if(!par) { return false; } - if(!pos.toString().match(/^(before|after)$/) && !is_loaded && !this.is_loaded(par)) { - return this.load_node(par, function () { this.copy_node(obj, par, pos, callback, true, false, origin); }); - } - - if($.isArray(obj)) { - if(obj.length === 1) { - obj = obj[0]; - } - else { - //obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - if((tmp = this.copy_node(obj[t1], par, pos, callback, is_loaded, true, origin))) { - par = tmp; - pos = "after"; - } - } - this.redraw(); - return true; - } - } - obj = obj && obj.id ? obj : this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { return false; } - - old_par = (obj.parent || $.jstree.root).toString(); - new_par = (!pos.toString().match(/^(before|after)$/) || par.id === $.jstree.root) ? par : this.get_node(par.parent); - old_ins = origin ? origin : (this._model.data[obj.id] ? this : $.jstree.reference(obj.id)); - is_multi = !old_ins || !old_ins._id || (this._id !== old_ins._id); - - if(old_ins && old_ins._id) { - obj = old_ins._model.data[obj.id]; - } - - if(par.id === $.jstree.root) { - if(pos === "before") { pos = "first"; } - if(pos === "after") { pos = "last"; } - } - switch(pos) { - case "before": - pos = $.inArray(par.id, new_par.children); - break; - case "after" : - pos = $.inArray(par.id, new_par.children) + 1; - break; - case "inside": - case "first": - pos = 0; - break; - case "last": - pos = new_par.children.length; - break; - default: - if(!pos) { pos = 0; } - break; - } - if(pos > new_par.children.length) { pos = new_par.children.length; } - if(!this.check("copy_node", obj, new_par, pos, { 'core' : true, 'origin' : origin, 'is_multi' : (old_ins && old_ins._id && old_ins._id !== this._id), 'is_foreign' : (!old_ins || !old_ins._id) })) { - this.settings.core.error.call(this, this._data.core.last_error); - return false; - } - node = old_ins ? old_ins.get_json(obj, { no_id : true, no_data : true, no_state : true }) : obj; - if(!node) { return false; } - if(node.id === true) { delete node.id; } - node = this._parse_model_from_json(node, new_par.id, new_par.parents.concat()); - if(!node) { return false; } - tmp = this.get_node(node); - if(obj && obj.state && obj.state.loaded === false) { tmp.state.loaded = false; } - dpc = []; - dpc.push(node); - dpc = dpc.concat(tmp.children_d); - this.trigger('model', { "nodes" : dpc, "parent" : new_par.id }); - - // insert into new parent and up - for(i = 0, j = new_par.parents.length; i < j; i++) { - this._model.data[new_par.parents[i]].children_d = this._model.data[new_par.parents[i]].children_d.concat(dpc); - } - dpc = []; - for(i = 0, j = new_par.children.length; i < j; i++) { - dpc[i >= pos ? i+1 : i] = new_par.children[i]; - } - dpc[pos] = tmp.id; - new_par.children = dpc; - new_par.children_d.push(tmp.id); - new_par.children_d = new_par.children_d.concat(tmp.children_d); - - if(new_par.id === $.jstree.root) { - this._model.force_full_redraw = true; - } - if(!this._model.force_full_redraw) { - this._node_changed(new_par.id); - } - if(!skip_redraw) { - this.redraw(new_par.id === $.jstree.root); - } - if(callback) { callback.call(this, tmp, new_par, pos); } - /** - * triggered when a node is copied - * @event - * @name copy_node.jstree - * @param {Object} node the copied node - * @param {Object} original the original node - * @param {String} parent the parent's ID - * @param {Number} position the position of the node among the parent's children - * @param {String} old_parent the old parent of the node - * @param {Number} old_position the position of the original node - * @param {Boolean} is_multi do the node and new parent belong to different instances - * @param {jsTree} old_instance the instance the node came from - * @param {jsTree} new_instance the instance of the new parent - */ - this.trigger('copy_node', { "node" : tmp, "original" : obj, "parent" : new_par.id, "position" : pos, "old_parent" : old_par, "old_position" : old_ins && old_ins._id && old_par && old_ins._model.data[old_par] && old_ins._model.data[old_par].children ? $.inArray(obj.id, old_ins._model.data[old_par].children) : -1,'is_multi' : (old_ins && old_ins._id && old_ins._id !== this._id), 'is_foreign' : (!old_ins || !old_ins._id), 'old_instance' : old_ins, 'new_instance' : this }); - return tmp.id; - }, - /** - * cut a node (a later call to `paste(obj)` would move the node) - * @name cut(obj) - * @param {mixed} obj multiple objects can be passed using an array - * @trigger cut.jstree - */ - cut : function (obj) { - if(!obj) { obj = this._data.core.selected.concat(); } - if(!$.isArray(obj)) { obj = [obj]; } - if(!obj.length) { return false; } - var tmp = [], o, t1, t2; - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - o = this.get_node(obj[t1]); - if(o && o.id && o.id !== $.jstree.root) { tmp.push(o); } - } - if(!tmp.length) { return false; } - ccp_node = tmp; - ccp_inst = this; - ccp_mode = 'move_node'; - /** - * triggered when nodes are added to the buffer for moving - * @event - * @name cut.jstree - * @param {Array} node - */ - this.trigger('cut', { "node" : obj }); - }, - /** - * copy a node (a later call to `paste(obj)` would copy the node) - * @name copy(obj) - * @param {mixed} obj multiple objects can be passed using an array - * @trigger copy.jstree - */ - copy : function (obj) { - if(!obj) { obj = this._data.core.selected.concat(); } - if(!$.isArray(obj)) { obj = [obj]; } - if(!obj.length) { return false; } - var tmp = [], o, t1, t2; - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - o = this.get_node(obj[t1]); - if(o && o.id && o.id !== $.jstree.root) { tmp.push(o); } - } - if(!tmp.length) { return false; } - ccp_node = tmp; - ccp_inst = this; - ccp_mode = 'copy_node'; - /** - * triggered when nodes are added to the buffer for copying - * @event - * @name copy.jstree - * @param {Array} node - */ - this.trigger('copy', { "node" : obj }); - }, - /** - * get the current buffer (any nodes that are waiting for a paste operation) - * @name get_buffer() - * @return {Object} an object consisting of `mode` ("copy_node" or "move_node"), `node` (an array of objects) and `inst` (the instance) - */ - get_buffer : function () { - return { 'mode' : ccp_mode, 'node' : ccp_node, 'inst' : ccp_inst }; - }, - /** - * check if there is something in the buffer to paste - * @name can_paste() - * @return {Boolean} - */ - can_paste : function () { - return ccp_mode !== false && ccp_node !== false; // && ccp_inst._model.data[ccp_node]; - }, - /** - * copy or move the previously cut or copied nodes to a new parent - * @name paste(obj [, pos]) - * @param {mixed} obj the new parent - * @param {mixed} pos the position to insert at (besides integer, "first" and "last" are supported), defaults to integer `0` - * @trigger paste.jstree - */ - paste : function (obj, pos) { - obj = this.get_node(obj); - if(!obj || !ccp_mode || !ccp_mode.match(/^(copy_node|move_node)$/) || !ccp_node) { return false; } - if(this[ccp_mode](ccp_node, obj, pos, false, false, false, ccp_inst)) { - /** - * triggered when paste is invoked - * @event - * @name paste.jstree - * @param {String} parent the ID of the receiving node - * @param {Array} node the nodes in the buffer - * @param {String} mode the performed operation - "copy_node" or "move_node" - */ - this.trigger('paste', { "parent" : obj.id, "node" : ccp_node, "mode" : ccp_mode }); - } - ccp_node = false; - ccp_mode = false; - ccp_inst = false; - }, - /** - * clear the buffer of previously copied or cut nodes - * @name clear_buffer() - * @trigger clear_buffer.jstree - */ - clear_buffer : function () { - ccp_node = false; - ccp_mode = false; - ccp_inst = false; - /** - * triggered when the copy / cut buffer is cleared - * @event - * @name clear_buffer.jstree - */ - this.trigger('clear_buffer'); - }, - /** - * put a node in edit mode (input field to rename the node) - * @name edit(obj [, default_text, callback]) - * @param {mixed} obj - * @param {String} default_text the text to populate the input with (if omitted or set to a non-string value the node's text value is used) - * @param {Function} callback a function to be called once the text box is blurred, it is called in the instance's scope and receives the node, a status parameter (true if the rename is successful, false otherwise) and a boolean indicating if the user cancelled the edit. You can access the node's title using .text - */ - edit : function (obj, default_text, callback) { - var rtl, w, a, s, t, h1, h2, fn, tmp, cancel = false; - obj = this.get_node(obj); - if(!obj) { return false; } - if(this.settings.core.check_callback === false) { - this._data.core.last_error = { 'error' : 'check', 'plugin' : 'core', 'id' : 'core_07', 'reason' : 'Could not edit node because of check_callback' }; - this.settings.core.error.call(this, this._data.core.last_error); - return false; - } - tmp = obj; - default_text = typeof default_text === 'string' ? default_text : obj.text; - this.set_text(obj, ""); - obj = this._open_to(obj); - tmp.text = default_text; - - rtl = this._data.core.rtl; - w = this.element.width(); - this._data.core.focused = tmp.id; - a = obj.children('.jstree-anchor').focus(); - s = $(''); - /*! - oi = obj.children("i:visible"), - ai = a.children("i:visible"), - w1 = oi.width() * oi.length, - w2 = ai.width() * ai.length, - */ - t = default_text; - h1 = $("<"+"div />", { css : { "position" : "absolute", "top" : "-200px", "left" : (rtl ? "0px" : "-1000px"), "visibility" : "hidden" } }).appendTo("body"); - h2 = $("<"+"input />", { - "value" : t, - "class" : "jstree-rename-input", - // "size" : t.length, - "css" : { - "padding" : "0", - "border" : "1px solid silver", - "box-sizing" : "border-box", - "display" : "inline-block", - "height" : (this._data.core.li_height) + "px", - "lineHeight" : (this._data.core.li_height) + "px", - "width" : "150px" // will be set a bit further down - }, - "blur" : $.proxy(function (e) { - e.stopImmediatePropagation(); - e.preventDefault(); - var i = s.children(".jstree-rename-input"), - v = i.val(), - f = this.settings.core.force_text, - nv; - if(v === "") { v = t; } - h1.remove(); - s.replaceWith(a); - s.remove(); - t = f ? t : $('
    ').append($.parseHTML(t)).html(); - this.set_text(obj, t); - nv = !!this.rename_node(obj, f ? $('
    ').text(v).text() : $('
    ').append($.parseHTML(v)).html()); - if(!nv) { - this.set_text(obj, t); // move this up? and fix #483 - } - this._data.core.focused = tmp.id; - setTimeout($.proxy(function () { - var node = this.get_node(tmp.id, true); - if(node.length) { - this._data.core.focused = tmp.id; - node.children('.jstree-anchor').focus(); - } - }, this), 0); - if(callback) { - callback.call(this, tmp, nv, cancel); - } - h2 = null; - }, this), - "keydown" : function (e) { - var key = e.which; - if(key === 27) { - cancel = true; - this.value = t; - } - if(key === 27 || key === 13 || key === 37 || key === 38 || key === 39 || key === 40 || key === 32) { - e.stopImmediatePropagation(); - } - if(key === 27 || key === 13) { - e.preventDefault(); - this.blur(); - } - }, - "click" : function (e) { e.stopImmediatePropagation(); }, - "mousedown" : function (e) { e.stopImmediatePropagation(); }, - "keyup" : function (e) { - h2.width(Math.min(h1.text("pW" + this.value).width(),w)); - }, - "keypress" : function(e) { - if(e.which === 13) { return false; } - } - }); - fn = { - fontFamily : a.css('fontFamily') || '', - fontSize : a.css('fontSize') || '', - fontWeight : a.css('fontWeight') || '', - fontStyle : a.css('fontStyle') || '', - fontStretch : a.css('fontStretch') || '', - fontVariant : a.css('fontVariant') || '', - letterSpacing : a.css('letterSpacing') || '', - wordSpacing : a.css('wordSpacing') || '' - }; - s.attr('class', a.attr('class')).append(a.contents().clone()).append(h2); - a.replaceWith(s); - h1.css(fn); - h2.css(fn).width(Math.min(h1.text("pW" + h2[0].value).width(),w))[0].select(); - $(document).one('mousedown.jstree touchstart.jstree dnd_start.vakata', function (e) { - if (h2 && e.target !== h2) { - $(h2).blur(); - } - }); - }, - - - /** - * changes the theme - * @name set_theme(theme_name [, theme_url]) - * @param {String} theme_name the name of the new theme to apply - * @param {mixed} theme_url the location of the CSS file for this theme. Omit or set to `false` if you manually included the file. Set to `true` to autoload from the `core.themes.dir` directory. - * @trigger set_theme.jstree - */ - set_theme : function (theme_name, theme_url) { - if(!theme_name) { return false; } - if(theme_url === true) { - var dir = this.settings.core.themes.dir; - if(!dir) { dir = $.jstree.path + '/themes'; } - theme_url = dir + '/' + theme_name + '/style.css'; - } - if(theme_url && $.inArray(theme_url, themes_loaded) === -1) { - $('head').append('<'+'link rel="stylesheet" href="' + theme_url + '" type="text/css" />'); - themes_loaded.push(theme_url); - } - if(this._data.core.themes.name) { - this.element.removeClass('jstree-' + this._data.core.themes.name); - } - this._data.core.themes.name = theme_name; - this.element.addClass('jstree-' + theme_name); - this.element[this.settings.core.themes.responsive ? 'addClass' : 'removeClass' ]('jstree-' + theme_name + '-responsive'); - /** - * triggered when a theme is set - * @event - * @name set_theme.jstree - * @param {String} theme the new theme - */ - this.trigger('set_theme', { 'theme' : theme_name }); - }, - /** - * gets the name of the currently applied theme name - * @name get_theme() - * @return {String} - */ - get_theme : function () { return this._data.core.themes.name; }, - /** - * changes the theme variant (if the theme has variants) - * @name set_theme_variant(variant_name) - * @param {String|Boolean} variant_name the variant to apply (if `false` is used the current variant is removed) - */ - set_theme_variant : function (variant_name) { - if(this._data.core.themes.variant) { - this.element.removeClass('jstree-' + this._data.core.themes.name + '-' + this._data.core.themes.variant); - } - this._data.core.themes.variant = variant_name; - if(variant_name) { - this.element.addClass('jstree-' + this._data.core.themes.name + '-' + this._data.core.themes.variant); - } - }, - /** - * gets the name of the currently applied theme variant - * @name get_theme() - * @return {String} - */ - get_theme_variant : function () { return this._data.core.themes.variant; }, - /** - * shows a striped background on the container (if the theme supports it) - * @name show_stripes() - */ - show_stripes : function () { - this._data.core.themes.stripes = true; - this.get_container_ul().addClass("jstree-striped"); - /** - * triggered when stripes are shown - * @event - * @name show_stripes.jstree - */ - this.trigger('show_stripes'); - }, - /** - * hides the striped background on the container - * @name hide_stripes() - */ - hide_stripes : function () { - this._data.core.themes.stripes = false; - this.get_container_ul().removeClass("jstree-striped"); - /** - * triggered when stripes are hidden - * @event - * @name hide_stripes.jstree - */ - this.trigger('hide_stripes'); - }, - /** - * toggles the striped background on the container - * @name toggle_stripes() - */ - toggle_stripes : function () { if(this._data.core.themes.stripes) { this.hide_stripes(); } else { this.show_stripes(); } }, - /** - * shows the connecting dots (if the theme supports it) - * @name show_dots() - */ - show_dots : function () { - this._data.core.themes.dots = true; - this.get_container_ul().removeClass("jstree-no-dots"); - /** - * triggered when dots are shown - * @event - * @name show_dots.jstree - */ - this.trigger('show_dots'); - }, - /** - * hides the connecting dots - * @name hide_dots() - */ - hide_dots : function () { - this._data.core.themes.dots = false; - this.get_container_ul().addClass("jstree-no-dots"); - /** - * triggered when dots are hidden - * @event - * @name hide_dots.jstree - */ - this.trigger('hide_dots'); - }, - /** - * toggles the connecting dots - * @name toggle_dots() - */ - toggle_dots : function () { if(this._data.core.themes.dots) { this.hide_dots(); } else { this.show_dots(); } }, - /** - * show the node icons - * @name show_icons() - */ - show_icons : function () { - this._data.core.themes.icons = true; - this.get_container_ul().removeClass("jstree-no-icons"); - /** - * triggered when icons are shown - * @event - * @name show_icons.jstree - */ - this.trigger('show_icons'); - }, - /** - * hide the node icons - * @name hide_icons() - */ - hide_icons : function () { - this._data.core.themes.icons = false; - this.get_container_ul().addClass("jstree-no-icons"); - /** - * triggered when icons are hidden - * @event - * @name hide_icons.jstree - */ - this.trigger('hide_icons'); - }, - /** - * toggle the node icons - * @name toggle_icons() - */ - toggle_icons : function () { if(this._data.core.themes.icons) { this.hide_icons(); } else { this.show_icons(); } }, - /** - * show the node ellipsis - * @name show_icons() - */ - show_ellipsis : function () { - this._data.core.themes.ellipsis = true; - this.get_container_ul().addClass("jstree-ellipsis"); - /** - * triggered when ellisis is shown - * @event - * @name show_ellipsis.jstree - */ - this.trigger('show_ellipsis'); - }, - /** - * hide the node ellipsis - * @name hide_ellipsis() - */ - hide_ellipsis : function () { - this._data.core.themes.ellipsis = false; - this.get_container_ul().removeClass("jstree-ellipsis"); - /** - * triggered when ellisis is hidden - * @event - * @name hide_ellipsis.jstree - */ - this.trigger('hide_ellipsis'); - }, - /** - * toggle the node ellipsis - * @name toggle_icons() - */ - toggle_ellipsis : function () { if(this._data.core.themes.ellipsis) { this.hide_ellipsis(); } else { this.show_ellipsis(); } }, - /** - * set the node icon for a node - * @name set_icon(obj, icon) - * @param {mixed} obj - * @param {String} icon the new icon - can be a path to an icon or a className, if using an image that is in the current directory use a `./` prefix, otherwise it will be detected as a class - */ - set_icon : function (obj, icon) { - var t1, t2, dom, old; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.set_icon(obj[t1], icon); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { return false; } - old = obj.icon; - obj.icon = icon === true || icon === null || icon === undefined || icon === '' ? true : icon; - dom = this.get_node(obj, true).children(".jstree-anchor").children(".jstree-themeicon"); - if(icon === false) { - this.hide_icon(obj); - } - else if(icon === true || icon === null || icon === undefined || icon === '') { - dom.removeClass('jstree-themeicon-custom ' + old).css("background","").removeAttr("rel"); - if(old === false) { this.show_icon(obj); } - } - else if(icon.indexOf("/") === -1 && icon.indexOf(".") === -1) { - dom.removeClass(old).css("background",""); - dom.addClass(icon + ' jstree-themeicon-custom').attr("rel",icon); - if(old === false) { this.show_icon(obj); } - } - else { - dom.removeClass(old).css("background",""); - dom.addClass('jstree-themeicon-custom').css("background", "url('" + icon + "') center center no-repeat").attr("rel",icon); - if(old === false) { this.show_icon(obj); } - } - return true; - }, - /** - * get the node icon for a node - * @name get_icon(obj) - * @param {mixed} obj - * @return {String} - */ - get_icon : function (obj) { - obj = this.get_node(obj); - return (!obj || obj.id === $.jstree.root) ? false : obj.icon; - }, - /** - * hide the icon on an individual node - * @name hide_icon(obj) - * @param {mixed} obj - */ - hide_icon : function (obj) { - var t1, t2; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.hide_icon(obj[t1]); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj === $.jstree.root) { return false; } - obj.icon = false; - this.get_node(obj, true).children(".jstree-anchor").children(".jstree-themeicon").addClass('jstree-themeicon-hidden'); - return true; - }, - /** - * show the icon on an individual node - * @name show_icon(obj) - * @param {mixed} obj - */ - show_icon : function (obj) { - var t1, t2, dom; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.show_icon(obj[t1]); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj === $.jstree.root) { return false; } - dom = this.get_node(obj, true); - obj.icon = dom.length ? dom.children(".jstree-anchor").children(".jstree-themeicon").attr('rel') : true; - if(!obj.icon) { obj.icon = true; } - dom.children(".jstree-anchor").children(".jstree-themeicon").removeClass('jstree-themeicon-hidden'); - return true; - } - }; - - // helpers - $.vakata = {}; - // collect attributes - $.vakata.attributes = function(node, with_values) { - node = $(node)[0]; - var attr = with_values ? {} : []; - if(node && node.attributes) { - $.each(node.attributes, function (i, v) { - if($.inArray(v.name.toLowerCase(),['style','contenteditable','hasfocus','tabindex']) !== -1) { return; } - if(v.value !== null && $.trim(v.value) !== '') { - if(with_values) { attr[v.name] = v.value; } - else { attr.push(v.name); } - } - }); - } - return attr; - }; - $.vakata.array_unique = function(array) { - var a = [], i, j, l, o = {}; - for(i = 0, l = array.length; i < l; i++) { - if(o[array[i]] === undefined) { - a.push(array[i]); - o[array[i]] = true; - } - } - return a; - }; - // remove item from array - $.vakata.array_remove = function(array, from) { - array.splice(from, 1); - return array; - //var rest = array.slice((to || from) + 1 || array.length); - //array.length = from < 0 ? array.length + from : from; - //array.push.apply(array, rest); - //return array; - }; - // remove item from array - $.vakata.array_remove_item = function(array, item) { - var tmp = $.inArray(item, array); - return tmp !== -1 ? $.vakata.array_remove(array, tmp) : array; - }; - $.vakata.array_filter = function(c,a,b,d,e) { - if (c.filter) { - return c.filter(a, b); - } - d=[]; - for (e in c) { - if (~~e+''===e+'' && e>=0 && a.call(b,c[e],+e,c)) { - d.push(c[e]); - } - } - return d; - }; - - -/** - * ### Changed plugin - * - * This plugin adds more information to the `changed.jstree` event. The new data is contained in the `changed` event data property, and contains a lists of `selected` and `deselected` nodes. - */ - - $.jstree.plugins.changed = function (options, parent) { - var last = []; - this.trigger = function (ev, data) { - var i, j; - if(!data) { - data = {}; - } - if(ev.replace('.jstree','') === 'changed') { - data.changed = { selected : [], deselected : [] }; - var tmp = {}; - for(i = 0, j = last.length; i < j; i++) { - tmp[last[i]] = 1; - } - for(i = 0, j = data.selected.length; i < j; i++) { - if(!tmp[data.selected[i]]) { - data.changed.selected.push(data.selected[i]); - } - else { - tmp[data.selected[i]] = 2; - } - } - for(i = 0, j = last.length; i < j; i++) { - if(tmp[last[i]] === 1) { - data.changed.deselected.push(last[i]); - } - } - last = data.selected.slice(); - } - /** - * triggered when selection changes (the "changed" plugin enhances the original event with more data) - * @event - * @name changed.jstree - * @param {Object} node - * @param {Object} action the action that caused the selection to change - * @param {Array} selected the current selection - * @param {Object} changed an object containing two properties `selected` and `deselected` - both arrays of node IDs, which were selected or deselected since the last changed event - * @param {Object} event the event (if any) that triggered this changed event - * @plugin changed - */ - parent.trigger.call(this, ev, data); - }; - this.refresh = function (skip_loading, forget_state) { - last = []; - return parent.refresh.apply(this, arguments); - }; - }; - -/** - * ### Checkbox plugin - * - * This plugin renders checkbox icons in front of each node, making multiple selection much easier. - * It also supports tri-state behavior, meaning that if a node has a few of its children checked it will be rendered as undetermined, and state will be propagated up. - */ - - var _i = document.createElement('I'); - _i.className = 'jstree-icon jstree-checkbox'; - _i.setAttribute('role', 'presentation'); - /** - * stores all defaults for the checkbox plugin - * @name $.jstree.defaults.checkbox - * @plugin checkbox - */ - $.jstree.defaults.checkbox = { - /** - * a boolean indicating if checkboxes should be visible (can be changed at a later time using `show_checkboxes()` and `hide_checkboxes`). Defaults to `true`. - * @name $.jstree.defaults.checkbox.visible - * @plugin checkbox - */ - visible : true, - /** - * a boolean indicating if checkboxes should cascade down and have an undetermined state. Defaults to `true`. - * @name $.jstree.defaults.checkbox.three_state - * @plugin checkbox - */ - three_state : true, - /** - * a boolean indicating if clicking anywhere on the node should act as clicking on the checkbox. Defaults to `true`. - * @name $.jstree.defaults.checkbox.whole_node - * @plugin checkbox - */ - whole_node : true, - /** - * a boolean indicating if the selected style of a node should be kept, or removed. Defaults to `true`. - * @name $.jstree.defaults.checkbox.keep_selected_style - * @plugin checkbox - */ - keep_selected_style : true, - /** - * This setting controls how cascading and undetermined nodes are applied. - * If 'up' is in the string - cascading up is enabled, if 'down' is in the string - cascading down is enabled, if 'undetermined' is in the string - undetermined nodes will be used. - * If `three_state` is set to `true` this setting is automatically set to 'up+down+undetermined'. Defaults to ''. - * @name $.jstree.defaults.checkbox.cascade - * @plugin checkbox - */ - cascade : '', - /** - * This setting controls if checkbox are bound to the general tree selection or to an internal array maintained by the checkbox plugin. Defaults to `true`, only set to `false` if you know exactly what you are doing. - * @name $.jstree.defaults.checkbox.tie_selection - * @plugin checkbox - */ - tie_selection : true - }; - $.jstree.plugins.checkbox = function (options, parent) { - this.bind = function () { - parent.bind.call(this); - this._data.checkbox.uto = false; - this._data.checkbox.selected = []; - if(this.settings.checkbox.three_state) { - this.settings.checkbox.cascade = 'up+down+undetermined'; - } - this.element - .on("init.jstree", $.proxy(function () { - this._data.checkbox.visible = this.settings.checkbox.visible; - if(!this.settings.checkbox.keep_selected_style) { - this.element.addClass('jstree-checkbox-no-clicked'); - } - if(this.settings.checkbox.tie_selection) { - this.element.addClass('jstree-checkbox-selection'); - } - }, this)) - .on("loading.jstree", $.proxy(function () { - this[ this._data.checkbox.visible ? 'show_checkboxes' : 'hide_checkboxes' ](); - }, this)); - if(this.settings.checkbox.cascade.indexOf('undetermined') !== -1) { - this.element - .on('changed.jstree uncheck_node.jstree check_node.jstree uncheck_all.jstree check_all.jstree move_node.jstree copy_node.jstree redraw.jstree open_node.jstree', $.proxy(function () { - // only if undetermined is in setting - if(this._data.checkbox.uto) { clearTimeout(this._data.checkbox.uto); } - this._data.checkbox.uto = setTimeout($.proxy(this._undetermined, this), 50); - }, this)); - } - if(!this.settings.checkbox.tie_selection) { - this.element - .on('model.jstree', $.proxy(function (e, data) { - var m = this._model.data, - p = m[data.parent], - dpc = data.nodes, - i, j; - for(i = 0, j = dpc.length; i < j; i++) { - m[dpc[i]].state.checked = m[dpc[i]].state.checked || (m[dpc[i]].original && m[dpc[i]].original.state && m[dpc[i]].original.state.checked); - if(m[dpc[i]].state.checked) { - this._data.checkbox.selected.push(dpc[i]); - } - } - }, this)); - } - if(this.settings.checkbox.cascade.indexOf('up') !== -1 || this.settings.checkbox.cascade.indexOf('down') !== -1) { - this.element - .on('model.jstree', $.proxy(function (e, data) { - var m = this._model.data, - p = m[data.parent], - dpc = data.nodes, - chd = [], - c, i, j, k, l, tmp, s = this.settings.checkbox.cascade, t = this.settings.checkbox.tie_selection; - - if(s.indexOf('down') !== -1) { - // apply down - if(p.state[ t ? 'selected' : 'checked' ]) { - for(i = 0, j = dpc.length; i < j; i++) { - m[dpc[i]].state[ t ? 'selected' : 'checked' ] = true; - } - this._data[ t ? 'core' : 'checkbox' ].selected = this._data[ t ? 'core' : 'checkbox' ].selected.concat(dpc); - } - else { - for(i = 0, j = dpc.length; i < j; i++) { - if(m[dpc[i]].state[ t ? 'selected' : 'checked' ]) { - for(k = 0, l = m[dpc[i]].children_d.length; k < l; k++) { - m[m[dpc[i]].children_d[k]].state[ t ? 'selected' : 'checked' ] = true; - } - this._data[ t ? 'core' : 'checkbox' ].selected = this._data[ t ? 'core' : 'checkbox' ].selected.concat(m[dpc[i]].children_d); - } - } - } - } - - if(s.indexOf('up') !== -1) { - // apply up - for(i = 0, j = p.children_d.length; i < j; i++) { - if(!m[p.children_d[i]].children.length) { - chd.push(m[p.children_d[i]].parent); - } - } - chd = $.vakata.array_unique(chd); - for(k = 0, l = chd.length; k < l; k++) { - p = m[chd[k]]; - while(p && p.id !== $.jstree.root) { - c = 0; - for(i = 0, j = p.children.length; i < j; i++) { - c += m[p.children[i]].state[ t ? 'selected' : 'checked' ]; - } - if(c === j) { - p.state[ t ? 'selected' : 'checked' ] = true; - this._data[ t ? 'core' : 'checkbox' ].selected.push(p.id); - tmp = this.get_node(p, true); - if(tmp && tmp.length) { - tmp.attr('aria-selected', true).children('.jstree-anchor').addClass( t ? 'jstree-clicked' : 'jstree-checked'); - } - } - else { - break; - } - p = this.get_node(p.parent); - } - } - } - - this._data[ t ? 'core' : 'checkbox' ].selected = $.vakata.array_unique(this._data[ t ? 'core' : 'checkbox' ].selected); - }, this)) - .on(this.settings.checkbox.tie_selection ? 'select_node.jstree' : 'check_node.jstree', $.proxy(function (e, data) { - var obj = data.node, - m = this._model.data, - par = this.get_node(obj.parent), - dom = this.get_node(obj, true), - i, j, c, tmp, s = this.settings.checkbox.cascade, t = this.settings.checkbox.tie_selection, - sel = {}, cur = this._data[ t ? 'core' : 'checkbox' ].selected; - - for (i = 0, j = cur.length; i < j; i++) { - sel[cur[i]] = true; - } - // apply down - if(s.indexOf('down') !== -1) { - //this._data[ t ? 'core' : 'checkbox' ].selected = $.vakata.array_unique(this._data[ t ? 'core' : 'checkbox' ].selected.concat(obj.children_d)); - for(i = 0, j = obj.children_d.length; i < j; i++) { - sel[obj.children_d[i]] = true; - tmp = m[obj.children_d[i]]; - tmp.state[ t ? 'selected' : 'checked' ] = true; - if(tmp && tmp.original && tmp.original.state && tmp.original.state.undetermined) { - tmp.original.state.undetermined = false; - } - } - } - - // apply up - if(s.indexOf('up') !== -1) { - while(par && par.id !== $.jstree.root) { - c = 0; - for(i = 0, j = par.children.length; i < j; i++) { - c += m[par.children[i]].state[ t ? 'selected' : 'checked' ]; - } - if(c === j) { - par.state[ t ? 'selected' : 'checked' ] = true; - sel[par.id] = true; - //this._data[ t ? 'core' : 'checkbox' ].selected.push(par.id); - tmp = this.get_node(par, true); - if(tmp && tmp.length) { - tmp.attr('aria-selected', true).children('.jstree-anchor').addClass(t ? 'jstree-clicked' : 'jstree-checked'); - } - } - else { - break; - } - par = this.get_node(par.parent); - } - } - - cur = []; - for (i in sel) { - if (sel.hasOwnProperty(i)) { - cur.push(i); - } - } - this._data[ t ? 'core' : 'checkbox' ].selected = cur; - - // apply down (process .children separately?) - if(s.indexOf('down') !== -1 && dom.length) { - dom.find('.jstree-anchor').addClass(t ? 'jstree-clicked' : 'jstree-checked').parent().attr('aria-selected', true); - } - }, this)) - .on(this.settings.checkbox.tie_selection ? 'deselect_all.jstree' : 'uncheck_all.jstree', $.proxy(function (e, data) { - var obj = this.get_node($.jstree.root), - m = this._model.data, - i, j, tmp; - for(i = 0, j = obj.children_d.length; i < j; i++) { - tmp = m[obj.children_d[i]]; - if(tmp && tmp.original && tmp.original.state && tmp.original.state.undetermined) { - tmp.original.state.undetermined = false; - } - } - }, this)) - .on(this.settings.checkbox.tie_selection ? 'deselect_node.jstree' : 'uncheck_node.jstree', $.proxy(function (e, data) { - var obj = data.node, - dom = this.get_node(obj, true), - i, j, tmp, s = this.settings.checkbox.cascade, t = this.settings.checkbox.tie_selection, - cur = this._data[ t ? 'core' : 'checkbox' ].selected, sel = {}; - if(obj && obj.original && obj.original.state && obj.original.state.undetermined) { - obj.original.state.undetermined = false; - } - - // apply down - if(s.indexOf('down') !== -1) { - for(i = 0, j = obj.children_d.length; i < j; i++) { - tmp = this._model.data[obj.children_d[i]]; - tmp.state[ t ? 'selected' : 'checked' ] = false; - if(tmp && tmp.original && tmp.original.state && tmp.original.state.undetermined) { - tmp.original.state.undetermined = false; - } - } - } - - // apply up - if(s.indexOf('up') !== -1) { - for(i = 0, j = obj.parents.length; i < j; i++) { - tmp = this._model.data[obj.parents[i]]; - tmp.state[ t ? 'selected' : 'checked' ] = false; - if(tmp && tmp.original && tmp.original.state && tmp.original.state.undetermined) { - tmp.original.state.undetermined = false; - } - tmp = this.get_node(obj.parents[i], true); - if(tmp && tmp.length) { - tmp.attr('aria-selected', false).children('.jstree-anchor').removeClass(t ? 'jstree-clicked' : 'jstree-checked'); - } - } - } - sel = {}; - for(i = 0, j = cur.length; i < j; i++) { - // apply down + apply up - if( - (s.indexOf('down') === -1 || $.inArray(cur[i], obj.children_d) === -1) && - (s.indexOf('up') === -1 || $.inArray(cur[i], obj.parents) === -1) - ) { - sel[cur[i]] = true; - } - } - cur = []; - for (i in sel) { - if (sel.hasOwnProperty(i)) { - cur.push(i); - } - } - this._data[ t ? 'core' : 'checkbox' ].selected = cur; - - // apply down (process .children separately?) - if(s.indexOf('down') !== -1 && dom.length) { - dom.find('.jstree-anchor').removeClass(t ? 'jstree-clicked' : 'jstree-checked').parent().attr('aria-selected', false); - } - }, this)); - } - if(this.settings.checkbox.cascade.indexOf('up') !== -1) { - this.element - .on('delete_node.jstree', $.proxy(function (e, data) { - // apply up (whole handler) - var p = this.get_node(data.parent), - m = this._model.data, - i, j, c, tmp, t = this.settings.checkbox.tie_selection; - while(p && p.id !== $.jstree.root && !p.state[ t ? 'selected' : 'checked' ]) { - c = 0; - for(i = 0, j = p.children.length; i < j; i++) { - c += m[p.children[i]].state[ t ? 'selected' : 'checked' ]; - } - if(j > 0 && c === j) { - p.state[ t ? 'selected' : 'checked' ] = true; - this._data[ t ? 'core' : 'checkbox' ].selected.push(p.id); - tmp = this.get_node(p, true); - if(tmp && tmp.length) { - tmp.attr('aria-selected', true).children('.jstree-anchor').addClass(t ? 'jstree-clicked' : 'jstree-checked'); - } - } - else { - break; - } - p = this.get_node(p.parent); - } - }, this)) - .on('move_node.jstree', $.proxy(function (e, data) { - // apply up (whole handler) - var is_multi = data.is_multi, - old_par = data.old_parent, - new_par = this.get_node(data.parent), - m = this._model.data, - p, c, i, j, tmp, t = this.settings.checkbox.tie_selection; - if(!is_multi) { - p = this.get_node(old_par); - while(p && p.id !== $.jstree.root && !p.state[ t ? 'selected' : 'checked' ]) { - c = 0; - for(i = 0, j = p.children.length; i < j; i++) { - c += m[p.children[i]].state[ t ? 'selected' : 'checked' ]; - } - if(j > 0 && c === j) { - p.state[ t ? 'selected' : 'checked' ] = true; - this._data[ t ? 'core' : 'checkbox' ].selected.push(p.id); - tmp = this.get_node(p, true); - if(tmp && tmp.length) { - tmp.attr('aria-selected', true).children('.jstree-anchor').addClass(t ? 'jstree-clicked' : 'jstree-checked'); - } - } - else { - break; - } - p = this.get_node(p.parent); - } - } - p = new_par; - while(p && p.id !== $.jstree.root) { - c = 0; - for(i = 0, j = p.children.length; i < j; i++) { - c += m[p.children[i]].state[ t ? 'selected' : 'checked' ]; - } - if(c === j) { - if(!p.state[ t ? 'selected' : 'checked' ]) { - p.state[ t ? 'selected' : 'checked' ] = true; - this._data[ t ? 'core' : 'checkbox' ].selected.push(p.id); - tmp = this.get_node(p, true); - if(tmp && tmp.length) { - tmp.attr('aria-selected', true).children('.jstree-anchor').addClass(t ? 'jstree-clicked' : 'jstree-checked'); - } - } - } - else { - if(p.state[ t ? 'selected' : 'checked' ]) { - p.state[ t ? 'selected' : 'checked' ] = false; - this._data[ t ? 'core' : 'checkbox' ].selected = $.vakata.array_remove_item(this._data[ t ? 'core' : 'checkbox' ].selected, p.id); - tmp = this.get_node(p, true); - if(tmp && tmp.length) { - tmp.attr('aria-selected', false).children('.jstree-anchor').removeClass(t ? 'jstree-clicked' : 'jstree-checked'); - } - } - else { - break; - } - } - p = this.get_node(p.parent); - } - }, this)); - } - }; - /** - * set the undetermined state where and if necessary. Used internally. - * @private - * @name _undetermined() - * @plugin checkbox - */ - this._undetermined = function () { - if(this.element === null) { return; } - var i, j, k, l, o = {}, m = this._model.data, t = this.settings.checkbox.tie_selection, s = this._data[ t ? 'core' : 'checkbox' ].selected, p = [], tt = this; - for(i = 0, j = s.length; i < j; i++) { - if(m[s[i]] && m[s[i]].parents) { - for(k = 0, l = m[s[i]].parents.length; k < l; k++) { - if(o[m[s[i]].parents[k]] !== undefined) { - break; - } - if(m[s[i]].parents[k] !== $.jstree.root) { - o[m[s[i]].parents[k]] = true; - p.push(m[s[i]].parents[k]); - } - } - } - } - // attempt for server side undetermined state - this.element.find('.jstree-closed').not(':has(.jstree-children)') - .each(function () { - var tmp = tt.get_node(this), tmp2; - if(!tmp.state.loaded) { - if(tmp.original && tmp.original.state && tmp.original.state.undetermined && tmp.original.state.undetermined === true) { - if(o[tmp.id] === undefined && tmp.id !== $.jstree.root) { - o[tmp.id] = true; - p.push(tmp.id); - } - for(k = 0, l = tmp.parents.length; k < l; k++) { - if(o[tmp.parents[k]] === undefined && tmp.parents[k] !== $.jstree.root) { - o[tmp.parents[k]] = true; - p.push(tmp.parents[k]); - } - } - } - } - else { - for(i = 0, j = tmp.children_d.length; i < j; i++) { - tmp2 = m[tmp.children_d[i]]; - if(!tmp2.state.loaded && tmp2.original && tmp2.original.state && tmp2.original.state.undetermined && tmp2.original.state.undetermined === true) { - if(o[tmp2.id] === undefined && tmp2.id !== $.jstree.root) { - o[tmp2.id] = true; - p.push(tmp2.id); - } - for(k = 0, l = tmp2.parents.length; k < l; k++) { - if(o[tmp2.parents[k]] === undefined && tmp2.parents[k] !== $.jstree.root) { - o[tmp2.parents[k]] = true; - p.push(tmp2.parents[k]); - } - } - } - } - } - }); - - this.element.find('.jstree-undetermined').removeClass('jstree-undetermined'); - for(i = 0, j = p.length; i < j; i++) { - if(!m[p[i]].state[ t ? 'selected' : 'checked' ]) { - s = this.get_node(p[i], true); - if(s && s.length) { - s.children('.jstree-anchor').children('.jstree-checkbox').addClass('jstree-undetermined'); - } - } - } - }; - this.redraw_node = function(obj, deep, is_callback, force_render) { - obj = parent.redraw_node.apply(this, arguments); - if(obj) { - var i, j, tmp = null, icon = null; - for(i = 0, j = obj.childNodes.length; i < j; i++) { - if(obj.childNodes[i] && obj.childNodes[i].className && obj.childNodes[i].className.indexOf("jstree-anchor") !== -1) { - tmp = obj.childNodes[i]; - break; - } - } - if(tmp) { - if(!this.settings.checkbox.tie_selection && this._model.data[obj.id].state.checked) { tmp.className += ' jstree-checked'; } - icon = _i.cloneNode(false); - if(this._model.data[obj.id].state.checkbox_disabled) { icon.className += ' jstree-checkbox-disabled'; } - tmp.insertBefore(icon, tmp.childNodes[0]); - } - } - if(!is_callback && this.settings.checkbox.cascade.indexOf('undetermined') !== -1) { - if(this._data.checkbox.uto) { clearTimeout(this._data.checkbox.uto); } - this._data.checkbox.uto = setTimeout($.proxy(this._undetermined, this), 50); - } - return obj; - }; - /** - * show the node checkbox icons - * @name show_checkboxes() - * @plugin checkbox - */ - this.show_checkboxes = function () { this._data.core.themes.checkboxes = true; this.get_container_ul().removeClass("jstree-no-checkboxes"); }; - /** - * hide the node checkbox icons - * @name hide_checkboxes() - * @plugin checkbox - */ - this.hide_checkboxes = function () { this._data.core.themes.checkboxes = false; this.get_container_ul().addClass("jstree-no-checkboxes"); }; - /** - * toggle the node icons - * @name toggle_checkboxes() - * @plugin checkbox - */ - this.toggle_checkboxes = function () { if(this._data.core.themes.checkboxes) { this.hide_checkboxes(); } else { this.show_checkboxes(); } }; - /** - * checks if a node is in an undetermined state - * @name is_undetermined(obj) - * @param {mixed} obj - * @return {Boolean} - */ - this.is_undetermined = function (obj) { - obj = this.get_node(obj); - var s = this.settings.checkbox.cascade, i, j, t = this.settings.checkbox.tie_selection, d = this._data[ t ? 'core' : 'checkbox' ].selected, m = this._model.data; - if(!obj || obj.state[ t ? 'selected' : 'checked' ] === true || s.indexOf('undetermined') === -1 || (s.indexOf('down') === -1 && s.indexOf('up') === -1)) { - return false; - } - if(!obj.state.loaded && obj.original.state.undetermined === true) { - return true; - } - for(i = 0, j = obj.children_d.length; i < j; i++) { - if($.inArray(obj.children_d[i], d) !== -1 || (!m[obj.children_d[i]].state.loaded && m[obj.children_d[i]].original.state.undetermined)) { - return true; - } - } - return false; - }; - /** - * disable a node's checkbox - * @name disable_checkbox(obj) - * @param {mixed} obj an array can be used too - * @trigger disable_checkbox.jstree - * @plugin checkbox - */ - this.disable_checkbox = function (obj) { - var t1, t2, dom; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.disable_checkbox(obj[t1]); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { - return false; - } - dom = this.get_node(obj, true); - if(!obj.state.checkbox_disabled) { - obj.state.checkbox_disabled = true; - if(dom && dom.length) { - dom.children('.jstree-anchor').children('.jstree-checkbox').addClass('jstree-checkbox-disabled'); - } - /** - * triggered when an node's checkbox is disabled - * @event - * @name disable_checkbox.jstree - * @param {Object} node - * @plugin checkbox - */ - this.trigger('disable_checkbox', { 'node' : obj }); - } - }; - /** - * enable a node's checkbox - * @name disable_checkbox(obj) - * @param {mixed} obj an array can be used too - * @trigger enable_checkbox.jstree - * @plugin checkbox - */ - this.enable_checkbox = function (obj) { - var t1, t2, dom; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.enable_checkbox(obj[t1]); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { - return false; - } - dom = this.get_node(obj, true); - if(obj.state.checkbox_disabled) { - obj.state.checkbox_disabled = false; - if(dom && dom.length) { - dom.children('.jstree-anchor').children('.jstree-checkbox').removeClass('jstree-checkbox-disabled'); - } - /** - * triggered when an node's checkbox is enabled - * @event - * @name enable_checkbox.jstree - * @param {Object} node - * @plugin checkbox - */ - this.trigger('enable_checkbox', { 'node' : obj }); - } - }; - - this.activate_node = function (obj, e) { - if($(e.target).hasClass('jstree-checkbox-disabled')) { - return false; - } - if(this.settings.checkbox.tie_selection && (this.settings.checkbox.whole_node || $(e.target).hasClass('jstree-checkbox'))) { - e.ctrlKey = true; - } - if(this.settings.checkbox.tie_selection || (!this.settings.checkbox.whole_node && !$(e.target).hasClass('jstree-checkbox'))) { - return parent.activate_node.call(this, obj, e); - } - if(this.is_disabled(obj)) { - return false; - } - if(this.is_checked(obj)) { - this.uncheck_node(obj, e); - } - else { - this.check_node(obj, e); - } - this.trigger('activate_node', { 'node' : this.get_node(obj) }); - }; - - /** - * check a node (only if tie_selection in checkbox settings is false, otherwise select_node will be called internally) - * @name check_node(obj) - * @param {mixed} obj an array can be used to check multiple nodes - * @trigger check_node.jstree - * @plugin checkbox - */ - this.check_node = function (obj, e) { - if(this.settings.checkbox.tie_selection) { return this.select_node(obj, false, true, e); } - var dom, t1, t2, th; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.check_node(obj[t1], e); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { - return false; - } - dom = this.get_node(obj, true); - if(!obj.state.checked) { - obj.state.checked = true; - this._data.checkbox.selected.push(obj.id); - if(dom && dom.length) { - dom.children('.jstree-anchor').addClass('jstree-checked'); - } - /** - * triggered when an node is checked (only if tie_selection in checkbox settings is false) - * @event - * @name check_node.jstree - * @param {Object} node - * @param {Array} selected the current selection - * @param {Object} event the event (if any) that triggered this check_node - * @plugin checkbox - */ - this.trigger('check_node', { 'node' : obj, 'selected' : this._data.checkbox.selected, 'event' : e }); - } - }; - /** - * uncheck a node (only if tie_selection in checkbox settings is false, otherwise deselect_node will be called internally) - * @name uncheck_node(obj) - * @param {mixed} obj an array can be used to uncheck multiple nodes - * @trigger uncheck_node.jstree - * @plugin checkbox - */ - this.uncheck_node = function (obj, e) { - if(this.settings.checkbox.tie_selection) { return this.deselect_node(obj, false, e); } - var t1, t2, dom; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.uncheck_node(obj[t1], e); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { - return false; - } - dom = this.get_node(obj, true); - if(obj.state.checked) { - obj.state.checked = false; - this._data.checkbox.selected = $.vakata.array_remove_item(this._data.checkbox.selected, obj.id); - if(dom.length) { - dom.children('.jstree-anchor').removeClass('jstree-checked'); - } - /** - * triggered when an node is unchecked (only if tie_selection in checkbox settings is false) - * @event - * @name uncheck_node.jstree - * @param {Object} node - * @param {Array} selected the current selection - * @param {Object} event the event (if any) that triggered this uncheck_node - * @plugin checkbox - */ - this.trigger('uncheck_node', { 'node' : obj, 'selected' : this._data.checkbox.selected, 'event' : e }); - } - }; - /** - * checks all nodes in the tree (only if tie_selection in checkbox settings is false, otherwise select_all will be called internally) - * @name check_all() - * @trigger check_all.jstree, changed.jstree - * @plugin checkbox - */ - this.check_all = function () { - if(this.settings.checkbox.tie_selection) { return this.select_all(); } - var tmp = this._data.checkbox.selected.concat([]), i, j; - this._data.checkbox.selected = this._model.data[$.jstree.root].children_d.concat(); - for(i = 0, j = this._data.checkbox.selected.length; i < j; i++) { - if(this._model.data[this._data.checkbox.selected[i]]) { - this._model.data[this._data.checkbox.selected[i]].state.checked = true; - } - } - this.redraw(true); - /** - * triggered when all nodes are checked (only if tie_selection in checkbox settings is false) - * @event - * @name check_all.jstree - * @param {Array} selected the current selection - * @plugin checkbox - */ - this.trigger('check_all', { 'selected' : this._data.checkbox.selected }); - }; - /** - * uncheck all checked nodes (only if tie_selection in checkbox settings is false, otherwise deselect_all will be called internally) - * @name uncheck_all() - * @trigger uncheck_all.jstree - * @plugin checkbox - */ - this.uncheck_all = function () { - if(this.settings.checkbox.tie_selection) { return this.deselect_all(); } - var tmp = this._data.checkbox.selected.concat([]), i, j; - for(i = 0, j = this._data.checkbox.selected.length; i < j; i++) { - if(this._model.data[this._data.checkbox.selected[i]]) { - this._model.data[this._data.checkbox.selected[i]].state.checked = false; - } - } - this._data.checkbox.selected = []; - this.element.find('.jstree-checked').removeClass('jstree-checked'); - /** - * triggered when all nodes are unchecked (only if tie_selection in checkbox settings is false) - * @event - * @name uncheck_all.jstree - * @param {Object} node the previous selection - * @param {Array} selected the current selection - * @plugin checkbox - */ - this.trigger('uncheck_all', { 'selected' : this._data.checkbox.selected, 'node' : tmp }); - }; - /** - * checks if a node is checked (if tie_selection is on in the settings this function will return the same as is_selected) - * @name is_checked(obj) - * @param {mixed} obj - * @return {Boolean} - * @plugin checkbox - */ - this.is_checked = function (obj) { - if(this.settings.checkbox.tie_selection) { return this.is_selected(obj); } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { return false; } - return obj.state.checked; - }; - /** - * get an array of all checked nodes (if tie_selection is on in the settings this function will return the same as get_selected) - * @name get_checked([full]) - * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned - * @return {Array} - * @plugin checkbox - */ - this.get_checked = function (full) { - if(this.settings.checkbox.tie_selection) { return this.get_selected(full); } - return full ? $.map(this._data.checkbox.selected, $.proxy(function (i) { return this.get_node(i); }, this)) : this._data.checkbox.selected; - }; - /** - * get an array of all top level checked nodes (ignoring children of checked nodes) (if tie_selection is on in the settings this function will return the same as get_top_selected) - * @name get_top_checked([full]) - * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned - * @return {Array} - * @plugin checkbox - */ - this.get_top_checked = function (full) { - if(this.settings.checkbox.tie_selection) { return this.get_top_selected(full); } - var tmp = this.get_checked(true), - obj = {}, i, j, k, l; - for(i = 0, j = tmp.length; i < j; i++) { - obj[tmp[i].id] = tmp[i]; - } - for(i = 0, j = tmp.length; i < j; i++) { - for(k = 0, l = tmp[i].children_d.length; k < l; k++) { - if(obj[tmp[i].children_d[k]]) { - delete obj[tmp[i].children_d[k]]; - } - } - } - tmp = []; - for(i in obj) { - if(obj.hasOwnProperty(i)) { - tmp.push(i); - } - } - return full ? $.map(tmp, $.proxy(function (i) { return this.get_node(i); }, this)) : tmp; - }; - /** - * get an array of all bottom level checked nodes (ignoring selected parents) (if tie_selection is on in the settings this function will return the same as get_bottom_selected) - * @name get_bottom_checked([full]) - * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned - * @return {Array} - * @plugin checkbox - */ - this.get_bottom_checked = function (full) { - if(this.settings.checkbox.tie_selection) { return this.get_bottom_selected(full); } - var tmp = this.get_checked(true), - obj = [], i, j; - for(i = 0, j = tmp.length; i < j; i++) { - if(!tmp[i].children.length) { - obj.push(tmp[i].id); - } - } - return full ? $.map(obj, $.proxy(function (i) { return this.get_node(i); }, this)) : obj; - }; - this.load_node = function (obj, callback) { - var k, l, i, j, c, tmp; - if(!$.isArray(obj) && !this.settings.checkbox.tie_selection) { - tmp = this.get_node(obj); - if(tmp && tmp.state.loaded) { - for(k = 0, l = tmp.children_d.length; k < l; k++) { - if(this._model.data[tmp.children_d[k]].state.checked) { - c = true; - this._data.checkbox.selected = $.vakata.array_remove_item(this._data.checkbox.selected, tmp.children_d[k]); - } - } - } - } - return parent.load_node.apply(this, arguments); - }; - this.get_state = function () { - var state = parent.get_state.apply(this, arguments); - if(this.settings.checkbox.tie_selection) { return state; } - state.checkbox = this._data.checkbox.selected.slice(); - return state; - }; - this.set_state = function (state, callback) { - var res = parent.set_state.apply(this, arguments); - if(res && state.checkbox) { - if(!this.settings.checkbox.tie_selection) { - this.uncheck_all(); - var _this = this; - $.each(state.checkbox, function (i, v) { - _this.check_node(v); - }); - } - delete state.checkbox; - this.set_state(state, callback); - return false; - } - return res; - }; - this.refresh = function (skip_loading, forget_state) { - if(!this.settings.checkbox.tie_selection) { - this._data.checkbox.selected = []; - } - return parent.refresh.apply(this, arguments); - }; - }; - - // include the checkbox plugin by default - // $.jstree.defaults.plugins.push("checkbox"); - -/** - * ### Conditionalselect plugin - * - * This plugin allows defining a callback to allow or deny node selection by user input (activate node method). - */ - - /** - * a callback (function) which is invoked in the instance's scope and receives two arguments - the node and the event that triggered the `activate_node` call. Returning false prevents working with the node, returning true allows invoking activate_node. Defaults to returning `true`. - * @name $.jstree.defaults.checkbox.visible - * @plugin checkbox - */ - $.jstree.defaults.conditionalselect = function () { return true; }; - $.jstree.plugins.conditionalselect = function (options, parent) { - // own function - this.activate_node = function (obj, e) { - if(this.settings.conditionalselect.call(this, this.get_node(obj), e)) { - parent.activate_node.call(this, obj, e); - } - }; - }; - - -/** - * ### Contextmenu plugin - * - * Shows a context menu when a node is right-clicked. - */ - - /** - * stores all defaults for the contextmenu plugin - * @name $.jstree.defaults.contextmenu - * @plugin contextmenu - */ - $.jstree.defaults.contextmenu = { - /** - * a boolean indicating if the node should be selected when the context menu is invoked on it. Defaults to `true`. - * @name $.jstree.defaults.contextmenu.select_node - * @plugin contextmenu - */ - select_node : true, - /** - * a boolean indicating if the menu should be shown aligned with the node. Defaults to `true`, otherwise the mouse coordinates are used. - * @name $.jstree.defaults.contextmenu.show_at_node - * @plugin contextmenu - */ - show_at_node : true, - /** - * an object of actions, or a function that accepts a node and a callback function and calls the callback function with an object of actions available for that node (you can also return the items too). - * - * Each action consists of a key (a unique name) and a value which is an object with the following properties (only label and action are required). Once a menu item is activated the `action` function will be invoked with an object containing the following keys: item - the contextmenu item definition as seen below, reference - the DOM node that was used (the tree node), element - the contextmenu DOM element, position - an object with x/y properties indicating the position of the menu. - * - * * `separator_before` - a boolean indicating if there should be a separator before this item - * * `separator_after` - a boolean indicating if there should be a separator after this item - * * `_disabled` - a boolean indicating if this action should be disabled - * * `label` - a string - the name of the action (could be a function returning a string) - * * `title` - a string - an optional tooltip for the item - * * `action` - a function to be executed if this item is chosen, the function will receive - * * `icon` - a string, can be a path to an icon or a className, if using an image that is in the current directory use a `./` prefix, otherwise it will be detected as a class - * * `shortcut` - keyCode which will trigger the action if the menu is open (for example `113` for rename, which equals F2) - * * `shortcut_label` - shortcut label (like for example `F2` for rename) - * * `submenu` - an object with the same structure as $.jstree.defaults.contextmenu.items which can be used to create a submenu - each key will be rendered as a separate option in a submenu that will appear once the current item is hovered - * - * @name $.jstree.defaults.contextmenu.items - * @plugin contextmenu - */ - items : function (o, cb) { // Could be an object directly - return { - "create" : { - "separator_before" : false, - "separator_after" : true, - "_disabled" : false, //(this.check("create_node", data.reference, {}, "last")), - "label" : "Create", - "action" : function (data) { - var inst = $.jstree.reference(data.reference), - obj = inst.get_node(data.reference); - inst.create_node(obj, {}, "last", function (new_node) { - setTimeout(function () { inst.edit(new_node); },0); - }); - } - }, - "rename" : { - "separator_before" : false, - "separator_after" : false, - "_disabled" : false, //(this.check("rename_node", data.reference, this.get_parent(data.reference), "")), - "label" : "Rename", - /*! - "shortcut" : 113, - "shortcut_label" : 'F2', - "icon" : "glyphicon glyphicon-leaf", - */ - "action" : function (data) { - var inst = $.jstree.reference(data.reference), - obj = inst.get_node(data.reference); - inst.edit(obj); - } - }, - "remove" : { - "separator_before" : false, - "icon" : false, - "separator_after" : false, - "_disabled" : false, //(this.check("delete_node", data.reference, this.get_parent(data.reference), "")), - "label" : "Delete", - "action" : function (data) { - var inst = $.jstree.reference(data.reference), - obj = inst.get_node(data.reference); - if(inst.is_selected(obj)) { - inst.delete_node(inst.get_selected()); - } - else { - inst.delete_node(obj); - } - } - }, - "ccp" : { - "separator_before" : true, - "icon" : false, - "separator_after" : false, - "label" : "Edit", - "action" : false, - "submenu" : { - "cut" : { - "separator_before" : false, - "separator_after" : false, - "label" : "Cut", - "action" : function (data) { - var inst = $.jstree.reference(data.reference), - obj = inst.get_node(data.reference); - if(inst.is_selected(obj)) { - inst.cut(inst.get_top_selected()); - } - else { - inst.cut(obj); - } - } - }, - "copy" : { - "separator_before" : false, - "icon" : false, - "separator_after" : false, - "label" : "Copy", - "action" : function (data) { - var inst = $.jstree.reference(data.reference), - obj = inst.get_node(data.reference); - if(inst.is_selected(obj)) { - inst.copy(inst.get_top_selected()); - } - else { - inst.copy(obj); - } - } - }, - "paste" : { - "separator_before" : false, - "icon" : false, - "_disabled" : function (data) { - return !$.jstree.reference(data.reference).can_paste(); - }, - "separator_after" : false, - "label" : "Paste", - "action" : function (data) { - var inst = $.jstree.reference(data.reference), - obj = inst.get_node(data.reference); - inst.paste(obj); - } - } - } - } - }; - } - }; - - $.jstree.plugins.contextmenu = function (options, parent) { - this.bind = function () { - parent.bind.call(this); - - var last_ts = 0, cto = null, ex, ey; - this.element - .on("contextmenu.jstree", ".jstree-anchor", $.proxy(function (e, data) { - if (e.target.tagName.toLowerCase() === 'input') { - return; - } - e.preventDefault(); - last_ts = e.ctrlKey ? +new Date() : 0; - if(data || cto) { - last_ts = (+new Date()) + 10000; - } - if(cto) { - clearTimeout(cto); - } - if(!this.is_loading(e.currentTarget)) { - this.show_contextmenu(e.currentTarget, e.pageX, e.pageY, e); - } - }, this)) - .on("click.jstree", ".jstree-anchor", $.proxy(function (e) { - if(this._data.contextmenu.visible && (!last_ts || (+new Date()) - last_ts > 250)) { // work around safari & macOS ctrl+click - $.vakata.context.hide(); - } - last_ts = 0; - }, this)) - .on("touchstart.jstree", ".jstree-anchor", function (e) { - if(!e.originalEvent || !e.originalEvent.changedTouches || !e.originalEvent.changedTouches[0]) { - return; - } - ex = e.originalEvent.changedTouches[0].clientX; - ey = e.originalEvent.changedTouches[0].clientY; - cto = setTimeout(function () { - $(e.currentTarget).trigger('contextmenu', true); - }, 750); - }) - .on('touchmove.vakata.jstree', function (e) { - if(cto && e.originalEvent && e.originalEvent.changedTouches && e.originalEvent.changedTouches[0] && (Math.abs(ex - e.originalEvent.changedTouches[0].clientX) > 50 || Math.abs(ey - e.originalEvent.changedTouches[0].clientY) > 50)) { - clearTimeout(cto); - } - }) - .on('touchend.vakata.jstree', function (e) { - if(cto) { - clearTimeout(cto); - } - }); - - /*! - if(!('oncontextmenu' in document.body) && ('ontouchstart' in document.body)) { - var el = null, tm = null; - this.element - .on("touchstart", ".jstree-anchor", function (e) { - el = e.currentTarget; - tm = +new Date(); - $(document).one("touchend", function (e) { - e.target = document.elementFromPoint(e.originalEvent.targetTouches[0].pageX - window.pageXOffset, e.originalEvent.targetTouches[0].pageY - window.pageYOffset); - e.currentTarget = e.target; - tm = ((+(new Date())) - tm); - if(e.target === el && tm > 600 && tm < 1000) { - e.preventDefault(); - $(el).trigger('contextmenu', e); - } - el = null; - tm = null; - }); - }); - } - */ - $(document).on("context_hide.vakata.jstree", $.proxy(function (e, data) { - this._data.contextmenu.visible = false; - $(data.reference).removeClass('jstree-context'); - }, this)); - }; - this.teardown = function () { - if(this._data.contextmenu.visible) { - $.vakata.context.hide(); - } - parent.teardown.call(this); - }; - - /** - * prepare and show the context menu for a node - * @name show_contextmenu(obj [, x, y]) - * @param {mixed} obj the node - * @param {Number} x the x-coordinate relative to the document to show the menu at - * @param {Number} y the y-coordinate relative to the document to show the menu at - * @param {Object} e the event if available that triggered the contextmenu - * @plugin contextmenu - * @trigger show_contextmenu.jstree - */ - this.show_contextmenu = function (obj, x, y, e) { - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { return false; } - var s = this.settings.contextmenu, - d = this.get_node(obj, true), - a = d.children(".jstree-anchor"), - o = false, - i = false; - if(s.show_at_node || x === undefined || y === undefined) { - o = a.offset(); - x = o.left; - y = o.top + this._data.core.li_height; - } - if(this.settings.contextmenu.select_node && !this.is_selected(obj)) { - this.activate_node(obj, e); - } - - i = s.items; - if($.isFunction(i)) { - i = i.call(this, obj, $.proxy(function (i) { - this._show_contextmenu(obj, x, y, i); - }, this)); - } - if($.isPlainObject(i)) { - this._show_contextmenu(obj, x, y, i); - } - }; - /** - * show the prepared context menu for a node - * @name _show_contextmenu(obj, x, y, i) - * @param {mixed} obj the node - * @param {Number} x the x-coordinate relative to the document to show the menu at - * @param {Number} y the y-coordinate relative to the document to show the menu at - * @param {Number} i the object of items to show - * @plugin contextmenu - * @trigger show_contextmenu.jstree - * @private - */ - this._show_contextmenu = function (obj, x, y, i) { - var d = this.get_node(obj, true), - a = d.children(".jstree-anchor"); - $(document).one("context_show.vakata.jstree", $.proxy(function (e, data) { - var cls = 'jstree-contextmenu jstree-' + this.get_theme() + '-contextmenu'; - $(data.element).addClass(cls); - a.addClass('jstree-context'); - }, this)); - this._data.contextmenu.visible = true; - $.vakata.context.show(a, { 'x' : x, 'y' : y }, i); - /** - * triggered when the contextmenu is shown for a node - * @event - * @name show_contextmenu.jstree - * @param {Object} node the node - * @param {Number} x the x-coordinate of the menu relative to the document - * @param {Number} y the y-coordinate of the menu relative to the document - * @plugin contextmenu - */ - this.trigger('show_contextmenu', { "node" : obj, "x" : x, "y" : y }); - }; - }; - - // contextmenu helper - (function ($) { - var right_to_left = false, - vakata_context = { - element : false, - reference : false, - position_x : 0, - position_y : 0, - items : [], - html : "", - is_visible : false - }; - - $.vakata.context = { - settings : { - hide_onmouseleave : 0, - icons : true - }, - _trigger : function (event_name) { - $(document).triggerHandler("context_" + event_name + ".vakata", { - "reference" : vakata_context.reference, - "element" : vakata_context.element, - "position" : { - "x" : vakata_context.position_x, - "y" : vakata_context.position_y - } - }); - }, - _execute : function (i) { - i = vakata_context.items[i]; - return i && (!i._disabled || ($.isFunction(i._disabled) && !i._disabled({ "item" : i, "reference" : vakata_context.reference, "element" : vakata_context.element }))) && i.action ? i.action.call(null, { - "item" : i, - "reference" : vakata_context.reference, - "element" : vakata_context.element, - "position" : { - "x" : vakata_context.position_x, - "y" : vakata_context.position_y - } - }) : false; - }, - _parse : function (o, is_callback) { - if(!o) { return false; } - if(!is_callback) { - vakata_context.html = ""; - vakata_context.items = []; - } - var str = "", - sep = false, - tmp; - - if(is_callback) { str += "<"+"ul>"; } - $.each(o, function (i, val) { - if(!val) { return true; } - vakata_context.items.push(val); - if(!sep && val.separator_before) { - str += "<"+"li class='vakata-context-separator'><"+"a href='#' " + ($.vakata.context.settings.icons ? '' : 'style="margin-left:0px;"') + "> <"+"/a><"+"/li>"; - } - sep = false; - str += "<"+"li class='" + (val._class || "") + (val._disabled === true || ($.isFunction(val._disabled) && val._disabled({ "item" : val, "reference" : vakata_context.reference, "element" : vakata_context.element })) ? " vakata-contextmenu-disabled " : "") + "' "+(val.shortcut?" data-shortcut='"+val.shortcut+"' ":'')+">"; - str += "<"+"a href='#' rel='" + (vakata_context.items.length - 1) + "' " + (val.title ? "title='" + val.title + "'" : "") + ">"; - if($.vakata.context.settings.icons) { - str += "<"+"i "; - if(val.icon) { - if(val.icon.indexOf("/") !== -1 || val.icon.indexOf(".") !== -1) { str += " style='background:url(\"" + val.icon + "\") center center no-repeat' "; } - else { str += " class='" + val.icon + "' "; } - } - str += "><"+"/i><"+"span class='vakata-contextmenu-sep'> <"+"/span>"; - } - str += ($.isFunction(val.label) ? val.label({ "item" : i, "reference" : vakata_context.reference, "element" : vakata_context.element }) : val.label) + (val.shortcut?' '+ (val.shortcut_label || '') +'':'') + "<"+"/a>"; - if(val.submenu) { - tmp = $.vakata.context._parse(val.submenu, true); - if(tmp) { str += tmp; } - } - str += "<"+"/li>"; - if(val.separator_after) { - str += "<"+"li class='vakata-context-separator'><"+"a href='#' " + ($.vakata.context.settings.icons ? '' : 'style="margin-left:0px;"') + "> <"+"/a><"+"/li>"; - sep = true; - } - }); - str = str.replace(/
  • <\/li\>$/,""); - if(is_callback) { str += ""; } - /** - * triggered on the document when the contextmenu is parsed (HTML is built) - * @event - * @plugin contextmenu - * @name context_parse.vakata - * @param {jQuery} reference the element that was right clicked - * @param {jQuery} element the DOM element of the menu itself - * @param {Object} position the x & y coordinates of the menu - */ - if(!is_callback) { vakata_context.html = str; $.vakata.context._trigger("parse"); } - return str.length > 10 ? str : false; - }, - _show_submenu : function (o) { - o = $(o); - if(!o.length || !o.children("ul").length) { return; } - var e = o.children("ul"), - xl = o.offset().left, - x = xl + o.outerWidth(), - y = o.offset().top, - w = e.width(), - h = e.height(), - dw = $(window).width() + $(window).scrollLeft(), - dh = $(window).height() + $(window).scrollTop(); - // може да се спести е една проверка - дали няма някой от класовете вече нагоре - if(right_to_left) { - o[x - (w + 10 + o.outerWidth()) < 0 ? "addClass" : "removeClass"]("vakata-context-left"); - } - else { - o[x + w > dw && xl > dw - x ? "addClass" : "removeClass"]("vakata-context-right"); - } - if(y + h + 10 > dh) { - e.css("bottom","-1px"); - } - - //if does not fit - stick it to the side - if (o.hasClass('vakata-context-right')) { - if (xl < w) { - e.css("margin-right", xl - w); - } - } else { - if (dw - x < w) { - e.css("margin-left", dw - x - w); - } - } - - e.show(); - }, - show : function (reference, position, data) { - var o, e, x, y, w, h, dw, dh, cond = true; - if(vakata_context.element && vakata_context.element.length) { - vakata_context.element.width(''); - } - switch(cond) { - case (!position && !reference): - return false; - case (!!position && !!reference): - vakata_context.reference = reference; - vakata_context.position_x = position.x; - vakata_context.position_y = position.y; - break; - case (!position && !!reference): - vakata_context.reference = reference; - o = reference.offset(); - vakata_context.position_x = o.left + reference.outerHeight(); - vakata_context.position_y = o.top; - break; - case (!!position && !reference): - vakata_context.position_x = position.x; - vakata_context.position_y = position.y; - break; - } - if(!!reference && !data && $(reference).data('vakata_contextmenu')) { - data = $(reference).data('vakata_contextmenu'); - } - if($.vakata.context._parse(data)) { - vakata_context.element.html(vakata_context.html); - } - if(vakata_context.items.length) { - vakata_context.element.appendTo("body"); - e = vakata_context.element; - x = vakata_context.position_x; - y = vakata_context.position_y; - w = e.width(); - h = e.height(); - dw = $(window).width() + $(window).scrollLeft(); - dh = $(window).height() + $(window).scrollTop(); - if(right_to_left) { - x -= (e.outerWidth() - $(reference).outerWidth()); - if(x < $(window).scrollLeft() + 20) { - x = $(window).scrollLeft() + 20; - } - } - if(x + w + 20 > dw) { - x = dw - (w + 20); - } - if(y + h + 20 > dh) { - y = dh - (h + 20); - } - - vakata_context.element - .css({ "left" : x, "top" : y }) - .show() - .find('a').first().focus().parent().addClass("vakata-context-hover"); - vakata_context.is_visible = true; - /** - * triggered on the document when the contextmenu is shown - * @event - * @plugin contextmenu - * @name context_show.vakata - * @param {jQuery} reference the element that was right clicked - * @param {jQuery} element the DOM element of the menu itself - * @param {Object} position the x & y coordinates of the menu - */ - $.vakata.context._trigger("show"); - } - }, - hide : function () { - if(vakata_context.is_visible) { - vakata_context.element.hide().find("ul").hide().end().find(':focus').blur().end().detach(); - vakata_context.is_visible = false; - /** - * triggered on the document when the contextmenu is hidden - * @event - * @plugin contextmenu - * @name context_hide.vakata - * @param {jQuery} reference the element that was right clicked - * @param {jQuery} element the DOM element of the menu itself - * @param {Object} position the x & y coordinates of the menu - */ - $.vakata.context._trigger("hide"); - } - } - }; - $(function () { - right_to_left = $("body").css("direction") === "rtl"; - var to = false; - - vakata_context.element = $("
      "); - vakata_context.element - .on("mouseenter", "li", function (e) { - e.stopImmediatePropagation(); - - if($.contains(this, e.relatedTarget)) { - // премахнато заради delegate mouseleave по-долу - // $(this).find(".vakata-context-hover").removeClass("vakata-context-hover"); - return; - } - - if(to) { clearTimeout(to); } - vakata_context.element.find(".vakata-context-hover").removeClass("vakata-context-hover").end(); - - $(this) - .siblings().find("ul").hide().end().end() - .parentsUntil(".vakata-context", "li").addBack().addClass("vakata-context-hover"); - $.vakata.context._show_submenu(this); - }) - // тестово - дали не натоварва? - .on("mouseleave", "li", function (e) { - if($.contains(this, e.relatedTarget)) { return; } - $(this).find(".vakata-context-hover").addBack().removeClass("vakata-context-hover"); - }) - .on("mouseleave", function (e) { - $(this).find(".vakata-context-hover").removeClass("vakata-context-hover"); - if($.vakata.context.settings.hide_onmouseleave) { - to = setTimeout( - (function (t) { - return function () { $.vakata.context.hide(); }; - }(this)), $.vakata.context.settings.hide_onmouseleave); - } - }) - .on("click", "a", function (e) { - e.preventDefault(); - //}) - //.on("mouseup", "a", function (e) { - if(!$(this).blur().parent().hasClass("vakata-context-disabled") && $.vakata.context._execute($(this).attr("rel")) !== false) { - $.vakata.context.hide(); - } - }) - .on('keydown', 'a', function (e) { - var o = null; - switch(e.which) { - case 13: - case 32: - e.type = "click"; - e.preventDefault(); - $(e.currentTarget).trigger(e); - break; - case 37: - if(vakata_context.is_visible) { - vakata_context.element.find(".vakata-context-hover").last().closest("li").first().find("ul").hide().find(".vakata-context-hover").removeClass("vakata-context-hover").end().end().children('a').focus(); - e.stopImmediatePropagation(); - e.preventDefault(); - } - break; - case 38: - if(vakata_context.is_visible) { - o = vakata_context.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").prevAll("li:not(.vakata-context-separator)").first(); - if(!o.length) { o = vakata_context.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").last(); } - o.addClass("vakata-context-hover").children('a').focus(); - e.stopImmediatePropagation(); - e.preventDefault(); - } - break; - case 39: - if(vakata_context.is_visible) { - vakata_context.element.find(".vakata-context-hover").last().children("ul").show().children("li:not(.vakata-context-separator)").removeClass("vakata-context-hover").first().addClass("vakata-context-hover").children('a').focus(); - e.stopImmediatePropagation(); - e.preventDefault(); - } - break; - case 40: - if(vakata_context.is_visible) { - o = vakata_context.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").nextAll("li:not(.vakata-context-separator)").first(); - if(!o.length) { o = vakata_context.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").first(); } - o.addClass("vakata-context-hover").children('a').focus(); - e.stopImmediatePropagation(); - e.preventDefault(); - } - break; - case 27: - $.vakata.context.hide(); - e.preventDefault(); - break; - default: - //console.log(e.which); - break; - } - }) - .on('keydown', function (e) { - e.preventDefault(); - var a = vakata_context.element.find('.vakata-contextmenu-shortcut-' + e.which).parent(); - if(a.parent().not('.vakata-context-disabled')) { - a.click(); - } - }); - - $(document) - .on("mousedown.vakata.jstree", function (e) { - if(vakata_context.is_visible && !$.contains(vakata_context.element[0], e.target)) { - $.vakata.context.hide(); - } - }) - .on("context_show.vakata.jstree", function (e, data) { - vakata_context.element.find("li:has(ul)").children("a").addClass("vakata-context-parent"); - if(right_to_left) { - vakata_context.element.addClass("vakata-context-rtl").css("direction", "rtl"); - } - // also apply a RTL class? - vakata_context.element.find("ul").hide().end(); - }); - }); - }($)); - // $.jstree.defaults.plugins.push("contextmenu"); - - -/** - * ### Drag'n'drop plugin - * - * Enables dragging and dropping of nodes in the tree, resulting in a move or copy operations. - */ - - /** - * stores all defaults for the drag'n'drop plugin - * @name $.jstree.defaults.dnd - * @plugin dnd - */ - $.jstree.defaults.dnd = { - /** - * a boolean indicating if a copy should be possible while dragging (by pressint the meta key or Ctrl). Defaults to `true`. - * @name $.jstree.defaults.dnd.copy - * @plugin dnd - */ - copy : true, - /** - * a number indicating how long a node should remain hovered while dragging to be opened. Defaults to `500`. - * @name $.jstree.defaults.dnd.open_timeout - * @plugin dnd - */ - open_timeout : 500, - /** - * a function invoked each time a node is about to be dragged, invoked in the tree's scope and receives the nodes about to be dragged as an argument (array) and the event that started the drag - return `false` to prevent dragging - * @name $.jstree.defaults.dnd.is_draggable - * @plugin dnd - */ - is_draggable : true, - /** - * a boolean indicating if checks should constantly be made while the user is dragging the node (as opposed to checking only on drop), default is `true` - * @name $.jstree.defaults.dnd.check_while_dragging - * @plugin dnd - */ - check_while_dragging : true, - /** - * a boolean indicating if nodes from this tree should only be copied with dnd (as opposed to moved), default is `false` - * @name $.jstree.defaults.dnd.always_copy - * @plugin dnd - */ - always_copy : false, - /** - * when dropping a node "inside", this setting indicates the position the node should go to - it can be an integer or a string: "first" (same as 0) or "last", default is `0` - * @name $.jstree.defaults.dnd.inside_pos - * @plugin dnd - */ - inside_pos : 0, - /** - * when starting the drag on a node that is selected this setting controls if all selected nodes are dragged or only the single node, default is `true`, which means all selected nodes are dragged when the drag is started on a selected node - * @name $.jstree.defaults.dnd.drag_selection - * @plugin dnd - */ - drag_selection : true, - /** - * controls whether dnd works on touch devices. If left as boolean true dnd will work the same as in desktop browsers, which in some cases may impair scrolling. If set to boolean false dnd will not work on touch devices. There is a special third option - string "selected" which means only selected nodes can be dragged on touch devices. - * @name $.jstree.defaults.dnd.touch - * @plugin dnd - */ - touch : true, - /** - * controls whether items can be dropped anywhere on the node, not just on the anchor, by default only the node anchor is a valid drop target. Works best with the wholerow plugin. If enabled on mobile depending on the interface it might be hard for the user to cancel the drop, since the whole tree container will be a valid drop target. - * @name $.jstree.defaults.dnd.large_drop_target - * @plugin dnd - */ - large_drop_target : false, - /** - * controls whether a drag can be initiated from any part of the node and not just the text/icon part, works best with the wholerow plugin. Keep in mind it can cause problems with tree scrolling on mobile depending on the interface - in that case set the touch option to "selected". - * @name $.jstree.defaults.dnd.large_drag_target - * @plugin dnd - */ - large_drag_target : false, - /** - * controls whether use HTML5 dnd api instead of classical. That will allow better integration of dnd events with other HTML5 controls. - * @reference http://caniuse.com/#feat=dragndrop - * @name $.jstree.defaults.dnd.use_html5 - * @plugin dnd - */ - use_html5: false - }; - var drg, elm; - // TODO: now check works by checking for each node individually, how about max_children, unique, etc? - $.jstree.plugins.dnd = function (options, parent) { - this.init = function (el, options) { - parent.init.call(this, el, options); - this.settings.dnd.use_html5 = this.settings.dnd.use_html5 && ('draggable' in document.createElement('span')); - }; - this.bind = function () { - parent.bind.call(this); - - this.element - .on(this.settings.dnd.use_html5 ? 'dragstart.jstree' : 'mousedown.jstree touchstart.jstree', this.settings.dnd.large_drag_target ? '.jstree-node' : '.jstree-anchor', $.proxy(function (e) { - if(this.settings.dnd.large_drag_target && $(e.target).closest('.jstree-node')[0] !== e.currentTarget) { - return true; - } - if(e.type === "touchstart" && (!this.settings.dnd.touch || (this.settings.dnd.touch === 'selected' && !$(e.currentTarget).closest('.jstree-node').children('.jstree-anchor').hasClass('jstree-clicked')))) { - return true; - } - var obj = this.get_node(e.target), - mlt = this.is_selected(obj) && this.settings.dnd.drag_selection ? this.get_top_selected().length : 1, - txt = (mlt > 1 ? mlt + ' ' + this.get_string('nodes') : this.get_text(e.currentTarget)); - if(this.settings.core.force_text) { - txt = $.vakata.html.escape(txt); - } - if(obj && obj.id && obj.id !== $.jstree.root && (e.which === 1 || e.type === "touchstart" || e.type === "dragstart") && - (this.settings.dnd.is_draggable === true || ($.isFunction(this.settings.dnd.is_draggable) && this.settings.dnd.is_draggable.call(this, (mlt > 1 ? this.get_top_selected(true) : [obj]), e))) - ) { - drg = { 'jstree' : true, 'origin' : this, 'obj' : this.get_node(obj,true), 'nodes' : mlt > 1 ? this.get_top_selected() : [obj.id] }; - elm = e.currentTarget; - if (this.settings.dnd.use_html5) { - $.vakata.dnd._trigger('start', e, { 'helper': $(), 'element': elm, 'data': drg }); - } else { - this.element.trigger('mousedown.jstree'); - return $.vakata.dnd.start(e, drg, '
      ' + txt + '
      '); - } - } - }, this)); - if (this.settings.dnd.use_html5) { - this.element - .on('dragover.jstree', function (e) { - e.preventDefault(); - $.vakata.dnd._trigger('move', e, { 'helper': $(), 'element': elm, 'data': drg }); - return false; - }) - //.on('dragenter.jstree', this.settings.dnd.large_drop_target ? '.jstree-node' : '.jstree-anchor', $.proxy(function (e) { - // e.preventDefault(); - // $.vakata.dnd._trigger('move', e, { 'helper': $(), 'element': elm, 'data': drg }); - // return false; - // }, this)) - .on('drop.jstree', $.proxy(function (e) { - e.preventDefault(); - $.vakata.dnd._trigger('stop', e, { 'helper': $(), 'element': elm, 'data': drg }); - return false; - }, this)); - } - }; - this.redraw_node = function(obj, deep, callback, force_render) { - obj = parent.redraw_node.apply(this, arguments); - if (obj && this.settings.dnd.use_html5) { - if (this.settings.dnd.large_drag_target) { - obj.setAttribute('draggable', true); - } else { - var i, j, tmp = null; - for(i = 0, j = obj.childNodes.length; i < j; i++) { - if(obj.childNodes[i] && obj.childNodes[i].className && obj.childNodes[i].className.indexOf("jstree-anchor") !== -1) { - tmp = obj.childNodes[i]; - break; - } - } - if(tmp) { - tmp.setAttribute('draggable', true); - } - } - } - return obj; - }; - }; - - $(function() { - // bind only once for all instances - var lastmv = false, - laster = false, - lastev = false, - opento = false, - marker = $('
       
      ').hide(); //.appendTo('body'); - - $(document) - .on('dnd_start.vakata.jstree', function (e, data) { - lastmv = false; - lastev = false; - if(!data || !data.data || !data.data.jstree) { return; } - marker.appendTo('body'); //.show(); - }) - .on('dnd_move.vakata.jstree', function (e, data) { - if(opento) { - if (!data.event || data.event.type !== 'dragover' || data.event.target !== lastev.target) { - clearTimeout(opento); - } - } - if(!data || !data.data || !data.data.jstree) { return; } - - // if we are hovering the marker image do nothing (can happen on "inside" drags) - if(data.event.target.id && data.event.target.id === 'jstree-marker') { - return; - } - lastev = data.event; - - var ins = $.jstree.reference(data.event.target), - ref = false, - off = false, - rel = false, - tmp, l, t, h, p, i, o, ok, t1, t2, op, ps, pr, ip, tm, is_copy, pn; - // if we are over an instance - if(ins && ins._data && ins._data.dnd) { - marker.attr('class', 'jstree-' + ins.get_theme() + ( ins.settings.core.themes.responsive ? ' jstree-dnd-responsive' : '' )); - is_copy = data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (data.event.metaKey || data.event.ctrlKey))); - data.helper - .children().attr('class', 'jstree-' + ins.get_theme() + ' jstree-' + ins.get_theme() + '-' + ins.get_theme_variant() + ' ' + ( ins.settings.core.themes.responsive ? ' jstree-dnd-responsive' : '' )) - .find('.jstree-copy').first()[ is_copy ? 'show' : 'hide' ](); - - // if are hovering the container itself add a new root node - //console.log(data.event); - if( (data.event.target === ins.element[0] || data.event.target === ins.get_container_ul()[0]) && ins.get_container_ul().children().length === 0) { - ok = true; - for(t1 = 0, t2 = data.data.nodes.length; t1 < t2; t1++) { - ok = ok && ins.check( (data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (data.event.metaKey || data.event.ctrlKey)) ) ? "copy_node" : "move_node"), (data.data.origin && data.data.origin !== ins ? data.data.origin.get_node(data.data.nodes[t1]) : data.data.nodes[t1]), $.jstree.root, 'last', { 'dnd' : true, 'ref' : ins.get_node($.jstree.root), 'pos' : 'i', 'origin' : data.data.origin, 'is_multi' : (data.data.origin && data.data.origin !== ins), 'is_foreign' : (!data.data.origin) }); - if(!ok) { break; } - } - if(ok) { - lastmv = { 'ins' : ins, 'par' : $.jstree.root, 'pos' : 'last' }; - marker.hide(); - data.helper.find('.jstree-icon').first().removeClass('jstree-er').addClass('jstree-ok'); - if (data.event.originalEvent && data.event.originalEvent.dataTransfer) { - data.event.originalEvent.dataTransfer.dropEffect = is_copy ? 'copy' : 'move'; - } - return; - } - } - else { - // if we are hovering a tree node - ref = ins.settings.dnd.large_drop_target ? $(data.event.target).closest('.jstree-node').children('.jstree-anchor') : $(data.event.target).closest('.jstree-anchor'); - if(ref && ref.length && ref.parent().is('.jstree-closed, .jstree-open, .jstree-leaf')) { - off = ref.offset(); - rel = (data.event.pageY !== undefined ? data.event.pageY : data.event.originalEvent.pageY) - off.top; - h = ref.outerHeight(); - if(rel < h / 3) { - o = ['b', 'i', 'a']; - } - else if(rel > h - h / 3) { - o = ['a', 'i', 'b']; - } - else { - o = rel > h / 2 ? ['i', 'a', 'b'] : ['i', 'b', 'a']; - } - $.each(o, function (j, v) { - switch(v) { - case 'b': - l = off.left - 6; - t = off.top; - p = ins.get_parent(ref); - i = ref.parent().index(); - break; - case 'i': - ip = ins.settings.dnd.inside_pos; - tm = ins.get_node(ref.parent()); - l = off.left - 2; - t = off.top + h / 2 + 1; - p = tm.id; - i = ip === 'first' ? 0 : (ip === 'last' ? tm.children.length : Math.min(ip, tm.children.length)); - break; - case 'a': - l = off.left - 6; - t = off.top + h; - p = ins.get_parent(ref); - i = ref.parent().index() + 1; - break; - } - ok = true; - for(t1 = 0, t2 = data.data.nodes.length; t1 < t2; t1++) { - op = data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (data.event.metaKey || data.event.ctrlKey))) ? "copy_node" : "move_node"; - ps = i; - if(op === "move_node" && v === 'a' && (data.data.origin && data.data.origin === ins) && p === ins.get_parent(data.data.nodes[t1])) { - pr = ins.get_node(p); - if(ps > $.inArray(data.data.nodes[t1], pr.children)) { - ps -= 1; - } - } - ok = ok && ( (ins && ins.settings && ins.settings.dnd && ins.settings.dnd.check_while_dragging === false) || ins.check(op, (data.data.origin && data.data.origin !== ins ? data.data.origin.get_node(data.data.nodes[t1]) : data.data.nodes[t1]), p, ps, { 'dnd' : true, 'ref' : ins.get_node(ref.parent()), 'pos' : v, 'origin' : data.data.origin, 'is_multi' : (data.data.origin && data.data.origin !== ins), 'is_foreign' : (!data.data.origin) }) ); - if(!ok) { - if(ins && ins.last_error) { laster = ins.last_error(); } - break; - } - } - if(v === 'i' && ref.parent().is('.jstree-closed') && ins.settings.dnd.open_timeout) { - opento = setTimeout((function (x, z) { return function () { x.open_node(z); }; }(ins, ref)), ins.settings.dnd.open_timeout); - } - if(ok) { - pn = ins.get_node(p, true); - if (!pn.hasClass('.jstree-dnd-parent')) { - $('.jstree-dnd-parent').removeClass('jstree-dnd-parent'); - pn.addClass('jstree-dnd-parent'); - } - lastmv = { 'ins' : ins, 'par' : p, 'pos' : v === 'i' && ip === 'last' && i === 0 && !ins.is_loaded(tm) ? 'last' : i }; - marker.css({ 'left' : l + 'px', 'top' : t + 'px' }).show(); - data.helper.find('.jstree-icon').first().removeClass('jstree-er').addClass('jstree-ok'); - if (data.event.originalEvent && data.event.originalEvent.dataTransfer) { - data.event.originalEvent.dataTransfer.dropEffect = is_copy ? 'copy' : 'move'; - } - laster = {}; - o = true; - return false; - } - }); - if(o === true) { return; } - } - } - } - $('.jstree-dnd-parent').removeClass('jstree-dnd-parent'); - lastmv = false; - data.helper.find('.jstree-icon').removeClass('jstree-ok').addClass('jstree-er'); - if (data.event.originalEvent && data.event.originalEvent.dataTransfer) { - data.event.originalEvent.dataTransfer.dropEffect = 'none'; - } - marker.hide(); - }) - .on('dnd_scroll.vakata.jstree', function (e, data) { - if(!data || !data.data || !data.data.jstree) { return; } - marker.hide(); - lastmv = false; - lastev = false; - data.helper.find('.jstree-icon').first().removeClass('jstree-ok').addClass('jstree-er'); - }) - .on('dnd_stop.vakata.jstree', function (e, data) { - $('.jstree-dnd-parent').removeClass('jstree-dnd-parent'); - if(opento) { clearTimeout(opento); } - if(!data || !data.data || !data.data.jstree) { return; } - marker.hide().detach(); - var i, j, nodes = []; - if(lastmv) { - for(i = 0, j = data.data.nodes.length; i < j; i++) { - nodes[i] = data.data.origin ? data.data.origin.get_node(data.data.nodes[i]) : data.data.nodes[i]; - } - lastmv.ins[ data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (data.event.metaKey || data.event.ctrlKey))) ? 'copy_node' : 'move_node' ](nodes, lastmv.par, lastmv.pos, false, false, false, data.data.origin); - } - else { - i = $(data.event.target).closest('.jstree'); - if(i.length && laster && laster.error && laster.error === 'check') { - i = i.jstree(true); - if(i) { - i.settings.core.error.call(this, laster); - } - } - } - lastev = false; - lastmv = false; - }) - .on('keyup.jstree keydown.jstree', function (e, data) { - data = $.vakata.dnd._get(); - if(data && data.data && data.data.jstree) { - if (e.type === "keyup" && e.which === 27) { - if (opento) { clearTimeout(opento); } - lastmv = false; - laster = false; - lastev = false; - opento = false; - marker.hide().detach(); - $.vakata.dnd._clean(); - } else { - data.helper.find('.jstree-copy').first()[ data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (e.metaKey || e.ctrlKey))) ? 'show' : 'hide' ](); - if(lastev) { - lastev.metaKey = e.metaKey; - lastev.ctrlKey = e.ctrlKey; - $.vakata.dnd._trigger('move', lastev); - } - } - } - }); - }); - - // helpers - (function ($) { - $.vakata.html = { - div : $('
      '), - escape : function (str) { - return $.vakata.html.div.text(str).html(); - }, - strip : function (str) { - return $.vakata.html.div.empty().append($.parseHTML(str)).text(); - } - }; - // private variable - var vakata_dnd = { - element : false, - target : false, - is_down : false, - is_drag : false, - helper : false, - helper_w: 0, - data : false, - init_x : 0, - init_y : 0, - scroll_l: 0, - scroll_t: 0, - scroll_e: false, - scroll_i: false, - is_touch: false - }; - $.vakata.dnd = { - settings : { - scroll_speed : 10, - scroll_proximity : 20, - helper_left : 5, - helper_top : 10, - threshold : 5, - threshold_touch : 50 - }, - _trigger : function (event_name, e, data) { - if (data === undefined) { - data = $.vakata.dnd._get(); - } - data.event = e; - $(document).triggerHandler("dnd_" + event_name + ".vakata", data); - }, - _get : function () { - return { - "data" : vakata_dnd.data, - "element" : vakata_dnd.element, - "helper" : vakata_dnd.helper - }; - }, - _clean : function () { - if(vakata_dnd.helper) { vakata_dnd.helper.remove(); } - if(vakata_dnd.scroll_i) { clearInterval(vakata_dnd.scroll_i); vakata_dnd.scroll_i = false; } - vakata_dnd = { - element : false, - target : false, - is_down : false, - is_drag : false, - helper : false, - helper_w: 0, - data : false, - init_x : 0, - init_y : 0, - scroll_l: 0, - scroll_t: 0, - scroll_e: false, - scroll_i: false, - is_touch: false - }; - $(document).off("mousemove.vakata.jstree touchmove.vakata.jstree", $.vakata.dnd.drag); - $(document).off("mouseup.vakata.jstree touchend.vakata.jstree", $.vakata.dnd.stop); - }, - _scroll : function (init_only) { - if(!vakata_dnd.scroll_e || (!vakata_dnd.scroll_l && !vakata_dnd.scroll_t)) { - if(vakata_dnd.scroll_i) { clearInterval(vakata_dnd.scroll_i); vakata_dnd.scroll_i = false; } - return false; - } - if(!vakata_dnd.scroll_i) { - vakata_dnd.scroll_i = setInterval($.vakata.dnd._scroll, 100); - return false; - } - if(init_only === true) { return false; } - - var i = vakata_dnd.scroll_e.scrollTop(), - j = vakata_dnd.scroll_e.scrollLeft(); - vakata_dnd.scroll_e.scrollTop(i + vakata_dnd.scroll_t * $.vakata.dnd.settings.scroll_speed); - vakata_dnd.scroll_e.scrollLeft(j + vakata_dnd.scroll_l * $.vakata.dnd.settings.scroll_speed); - if(i !== vakata_dnd.scroll_e.scrollTop() || j !== vakata_dnd.scroll_e.scrollLeft()) { - /** - * triggered on the document when a drag causes an element to scroll - * @event - * @plugin dnd - * @name dnd_scroll.vakata - * @param {Mixed} data any data supplied with the call to $.vakata.dnd.start - * @param {DOM} element the DOM element being dragged - * @param {jQuery} helper the helper shown next to the mouse - * @param {jQuery} event the element that is scrolling - */ - $.vakata.dnd._trigger("scroll", vakata_dnd.scroll_e); - } - }, - start : function (e, data, html) { - if(e.type === "touchstart" && e.originalEvent && e.originalEvent.changedTouches && e.originalEvent.changedTouches[0]) { - e.pageX = e.originalEvent.changedTouches[0].pageX; - e.pageY = e.originalEvent.changedTouches[0].pageY; - e.target = document.elementFromPoint(e.originalEvent.changedTouches[0].pageX - window.pageXOffset, e.originalEvent.changedTouches[0].pageY - window.pageYOffset); - } - if(vakata_dnd.is_drag) { $.vakata.dnd.stop({}); } - try { - e.currentTarget.unselectable = "on"; - e.currentTarget.onselectstart = function() { return false; }; - if(e.currentTarget.style) { - e.currentTarget.style.touchAction = "none"; - e.currentTarget.style.msTouchAction = "none"; - e.currentTarget.style.MozUserSelect = "none"; - } - } catch(ignore) { } - vakata_dnd.init_x = e.pageX; - vakata_dnd.init_y = e.pageY; - vakata_dnd.data = data; - vakata_dnd.is_down = true; - vakata_dnd.element = e.currentTarget; - vakata_dnd.target = e.target; - vakata_dnd.is_touch = e.type === "touchstart"; - if(html !== false) { - vakata_dnd.helper = $("
      ").html(html).css({ - "display" : "block", - "margin" : "0", - "padding" : "0", - "position" : "absolute", - "top" : "-2000px", - "lineHeight" : "16px", - "zIndex" : "10000" - }); - } - $(document).on("mousemove.vakata.jstree touchmove.vakata.jstree", $.vakata.dnd.drag); - $(document).on("mouseup.vakata.jstree touchend.vakata.jstree", $.vakata.dnd.stop); - return false; - }, - drag : function (e) { - if(e.type === "touchmove" && e.originalEvent && e.originalEvent.changedTouches && e.originalEvent.changedTouches[0]) { - e.pageX = e.originalEvent.changedTouches[0].pageX; - e.pageY = e.originalEvent.changedTouches[0].pageY; - e.target = document.elementFromPoint(e.originalEvent.changedTouches[0].pageX - window.pageXOffset, e.originalEvent.changedTouches[0].pageY - window.pageYOffset); - } - if(!vakata_dnd.is_down) { return; } - if(!vakata_dnd.is_drag) { - if( - Math.abs(e.pageX - vakata_dnd.init_x) > (vakata_dnd.is_touch ? $.vakata.dnd.settings.threshold_touch : $.vakata.dnd.settings.threshold) || - Math.abs(e.pageY - vakata_dnd.init_y) > (vakata_dnd.is_touch ? $.vakata.dnd.settings.threshold_touch : $.vakata.dnd.settings.threshold) - ) { - if(vakata_dnd.helper) { - vakata_dnd.helper.appendTo("body"); - vakata_dnd.helper_w = vakata_dnd.helper.outerWidth(); - } - vakata_dnd.is_drag = true; - $(vakata_dnd.target).one('click.vakata', false); - /** - * triggered on the document when a drag starts - * @event - * @plugin dnd - * @name dnd_start.vakata - * @param {Mixed} data any data supplied with the call to $.vakata.dnd.start - * @param {DOM} element the DOM element being dragged - * @param {jQuery} helper the helper shown next to the mouse - * @param {Object} event the event that caused the start (probably mousemove) - */ - $.vakata.dnd._trigger("start", e); - } - else { return; } - } - - var d = false, w = false, - dh = false, wh = false, - dw = false, ww = false, - dt = false, dl = false, - ht = false, hl = false; - - vakata_dnd.scroll_t = 0; - vakata_dnd.scroll_l = 0; - vakata_dnd.scroll_e = false; - $($(e.target).parentsUntil("body").addBack().get().reverse()) - .filter(function () { - return (/^auto|scroll$/).test($(this).css("overflow")) && - (this.scrollHeight > this.offsetHeight || this.scrollWidth > this.offsetWidth); - }) - .each(function () { - var t = $(this), o = t.offset(); - if(this.scrollHeight > this.offsetHeight) { - if(o.top + t.height() - e.pageY < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_t = 1; } - if(e.pageY - o.top < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_t = -1; } - } - if(this.scrollWidth > this.offsetWidth) { - if(o.left + t.width() - e.pageX < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_l = 1; } - if(e.pageX - o.left < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_l = -1; } - } - if(vakata_dnd.scroll_t || vakata_dnd.scroll_l) { - vakata_dnd.scroll_e = $(this); - return false; - } - }); - - if(!vakata_dnd.scroll_e) { - d = $(document); w = $(window); - dh = d.height(); wh = w.height(); - dw = d.width(); ww = w.width(); - dt = d.scrollTop(); dl = d.scrollLeft(); - if(dh > wh && e.pageY - dt < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_t = -1; } - if(dh > wh && wh - (e.pageY - dt) < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_t = 1; } - if(dw > ww && e.pageX - dl < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_l = -1; } - if(dw > ww && ww - (e.pageX - dl) < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_l = 1; } - if(vakata_dnd.scroll_t || vakata_dnd.scroll_l) { - vakata_dnd.scroll_e = d; - } - } - if(vakata_dnd.scroll_e) { $.vakata.dnd._scroll(true); } - - if(vakata_dnd.helper) { - ht = parseInt(e.pageY + $.vakata.dnd.settings.helper_top, 10); - hl = parseInt(e.pageX + $.vakata.dnd.settings.helper_left, 10); - if(dh && ht + 25 > dh) { ht = dh - 50; } - if(dw && hl + vakata_dnd.helper_w > dw) { hl = dw - (vakata_dnd.helper_w + 2); } - vakata_dnd.helper.css({ - left : hl + "px", - top : ht + "px" - }); - } - /** - * triggered on the document when a drag is in progress - * @event - * @plugin dnd - * @name dnd_move.vakata - * @param {Mixed} data any data supplied with the call to $.vakata.dnd.start - * @param {DOM} element the DOM element being dragged - * @param {jQuery} helper the helper shown next to the mouse - * @param {Object} event the event that caused this to trigger (most likely mousemove) - */ - $.vakata.dnd._trigger("move", e); - return false; - }, - stop : function (e) { - if(e.type === "touchend" && e.originalEvent && e.originalEvent.changedTouches && e.originalEvent.changedTouches[0]) { - e.pageX = e.originalEvent.changedTouches[0].pageX; - e.pageY = e.originalEvent.changedTouches[0].pageY; - e.target = document.elementFromPoint(e.originalEvent.changedTouches[0].pageX - window.pageXOffset, e.originalEvent.changedTouches[0].pageY - window.pageYOffset); - } - if(vakata_dnd.is_drag) { - /** - * triggered on the document when a drag stops (the dragged element is dropped) - * @event - * @plugin dnd - * @name dnd_stop.vakata - * @param {Mixed} data any data supplied with the call to $.vakata.dnd.start - * @param {DOM} element the DOM element being dragged - * @param {jQuery} helper the helper shown next to the mouse - * @param {Object} event the event that caused the stop - */ - if (e.target !== vakata_dnd.target) { - $(vakata_dnd.target).off('click.vakata'); - } - $.vakata.dnd._trigger("stop", e); - } - else { - if(e.type === "touchend" && e.target === vakata_dnd.target) { - var to = setTimeout(function () { $(e.target).click(); }, 100); - $(e.target).one('click', function() { if(to) { clearTimeout(to); } }); - } - } - $.vakata.dnd._clean(); - return false; - } - }; - }($)); - - // include the dnd plugin by default - // $.jstree.defaults.plugins.push("dnd"); - - -/** - * ### Massload plugin - * - * Adds massload functionality to jsTree, so that multiple nodes can be loaded in a single request (only useful with lazy loading). - */ - - /** - * massload configuration - * - * It is possible to set this to a standard jQuery-like AJAX config. - * In addition to the standard jQuery ajax options here you can supply functions for `data` and `url`, the functions will be run in the current instance's scope and a param will be passed indicating which node IDs need to be loaded, the return value of those functions will be used. - * - * You can also set this to a function, that function will receive the node IDs being loaded as argument and a second param which is a function (callback) which should be called with the result. - * - * Both the AJAX and the function approach rely on the same return value - an object where the keys are the node IDs, and the value is the children of that node as an array. - * - * { - * "id1" : [{ "text" : "Child of ID1", "id" : "c1" }, { "text" : "Another child of ID1", "id" : "c2" }], - * "id2" : [{ "text" : "Child of ID2", "id" : "c3" }] - * } - * - * @name $.jstree.defaults.massload - * @plugin massload - */ - $.jstree.defaults.massload = null; - $.jstree.plugins.massload = function (options, parent) { - this.init = function (el, options) { - this._data.massload = {}; - parent.init.call(this, el, options); - }; - this._load_nodes = function (nodes, callback, is_callback, force_reload) { - var s = this.settings.massload, - nodesString = JSON.stringify(nodes), - toLoad = [], - m = this._model.data, - i, j, dom; - if (!is_callback) { - for(i = 0, j = nodes.length; i < j; i++) { - if(!m[nodes[i]] || ( (!m[nodes[i]].state.loaded && !m[nodes[i]].state.failed) || force_reload) ) { - toLoad.push(nodes[i]); - dom = this.get_node(nodes[i], true); - if (dom && dom.length) { - dom.addClass("jstree-loading").attr('aria-busy',true); - } - } - } - this._data.massload = {}; - if (toLoad.length) { - if($.isFunction(s)) { - return s.call(this, toLoad, $.proxy(function (data) { - var i, j; - if(data) { - for(i in data) { - if(data.hasOwnProperty(i)) { - this._data.massload[i] = data[i]; - } - } - } - for(i = 0, j = nodes.length; i < j; i++) { - dom = this.get_node(nodes[i], true); - if (dom && dom.length) { - dom.removeClass("jstree-loading").attr('aria-busy',false); - } - } - parent._load_nodes.call(this, nodes, callback, is_callback, force_reload); - }, this)); - } - if(typeof s === 'object' && s && s.url) { - s = $.extend(true, {}, s); - if($.isFunction(s.url)) { - s.url = s.url.call(this, toLoad); - } - if($.isFunction(s.data)) { - s.data = s.data.call(this, toLoad); - } - return $.ajax(s) - .done($.proxy(function (data,t,x) { - var i, j; - if(data) { - for(i in data) { - if(data.hasOwnProperty(i)) { - this._data.massload[i] = data[i]; - } - } - } - for(i = 0, j = nodes.length; i < j; i++) { - dom = this.get_node(nodes[i], true); - if (dom && dom.length) { - dom.removeClass("jstree-loading").attr('aria-busy',false); - } - } - parent._load_nodes.call(this, nodes, callback, is_callback, force_reload); - }, this)) - .fail($.proxy(function (f) { - parent._load_nodes.call(this, nodes, callback, is_callback, force_reload); - }, this)); - } - } - } - return parent._load_nodes.call(this, nodes, callback, is_callback, force_reload); - }; - this._load_node = function (obj, callback) { - var data = this._data.massload[obj.id], - rslt = null, dom; - if(data) { - rslt = this[typeof data === 'string' ? '_append_html_data' : '_append_json_data']( - obj, - typeof data === 'string' ? $($.parseHTML(data)).filter(function () { return this.nodeType !== 3; }) : data, - function (status) { callback.call(this, status); } - ); - dom = this.get_node(obj.id, true); - if (dom && dom.length) { - dom.removeClass("jstree-loading").attr('aria-busy',false); - } - delete this._data.massload[obj.id]; - return rslt; - } - return parent._load_node.call(this, obj, callback); - }; - }; - -/** - * ### Search plugin - * - * Adds search functionality to jsTree. - */ - - /** - * stores all defaults for the search plugin - * @name $.jstree.defaults.search - * @plugin search - */ - $.jstree.defaults.search = { - /** - * a jQuery-like AJAX config, which jstree uses if a server should be queried for results. - * - * A `str` (which is the search string) parameter will be added with the request, an optional `inside` parameter will be added if the search is limited to a node id. The expected result is a JSON array with nodes that need to be opened so that matching nodes will be revealed. - * Leave this setting as `false` to not query the server. You can also set this to a function, which will be invoked in the instance's scope and receive 3 parameters - the search string, the callback to call with the array of nodes to load, and the optional node ID to limit the search to - * @name $.jstree.defaults.search.ajax - * @plugin search - */ - ajax : false, - /** - * Indicates if the search should be fuzzy or not (should `chnd3` match `child node 3`). Default is `false`. - * @name $.jstree.defaults.search.fuzzy - * @plugin search - */ - fuzzy : false, - /** - * Indicates if the search should be case sensitive. Default is `false`. - * @name $.jstree.defaults.search.case_sensitive - * @plugin search - */ - case_sensitive : false, - /** - * Indicates if the tree should be filtered (by default) to show only matching nodes (keep in mind this can be a heavy on large trees in old browsers). - * This setting can be changed at runtime when calling the search method. Default is `false`. - * @name $.jstree.defaults.search.show_only_matches - * @plugin search - */ - show_only_matches : false, - /** - * Indicates if the children of matched element are shown (when show_only_matches is true) - * This setting can be changed at runtime when calling the search method. Default is `false`. - * @name $.jstree.defaults.search.show_only_matches_children - * @plugin search - */ - show_only_matches_children : false, - /** - * Indicates if all nodes opened to reveal the search result, should be closed when the search is cleared or a new search is performed. Default is `true`. - * @name $.jstree.defaults.search.close_opened_onclear - * @plugin search - */ - close_opened_onclear : true, - /** - * Indicates if only leaf nodes should be included in search results. Default is `false`. - * @name $.jstree.defaults.search.search_leaves_only - * @plugin search - */ - search_leaves_only : false, - /** - * If set to a function it wil be called in the instance's scope with two arguments - search string and node (where node will be every node in the structure, so use with caution). - * If the function returns a truthy value the node will be considered a match (it might not be displayed if search_only_leaves is set to true and the node is not a leaf). Default is `false`. - * @name $.jstree.defaults.search.search_callback - * @plugin search - */ - search_callback : false - }; - - $.jstree.plugins.search = function (options, parent) { - this.bind = function () { - parent.bind.call(this); - - this._data.search.str = ""; - this._data.search.dom = $(); - this._data.search.res = []; - this._data.search.opn = []; - this._data.search.som = false; - this._data.search.smc = false; - this._data.search.hdn = []; - - this.element - .on("search.jstree", $.proxy(function (e, data) { - if(this._data.search.som && data.res.length) { - var m = this._model.data, i, j, p = [], k, l; - for(i = 0, j = data.res.length; i < j; i++) { - if(m[data.res[i]] && !m[data.res[i]].state.hidden) { - p.push(data.res[i]); - p = p.concat(m[data.res[i]].parents); - if(this._data.search.smc) { - for (k = 0, l = m[data.res[i]].children_d.length; k < l; k++) { - if (m[m[data.res[i]].children_d[k]] && !m[m[data.res[i]].children_d[k]].state.hidden) { - p.push(m[data.res[i]].children_d[k]); - } - } - } - } - } - p = $.vakata.array_remove_item($.vakata.array_unique(p), $.jstree.root); - this._data.search.hdn = this.hide_all(true); - this.show_node(p, true); - this.redraw(true); - } - }, this)) - .on("clear_search.jstree", $.proxy(function (e, data) { - if(this._data.search.som && data.res.length) { - this.show_node(this._data.search.hdn, true); - this.redraw(true); - } - }, this)); - }; - /** - * used to search the tree nodes for a given string - * @name search(str [, skip_async]) - * @param {String} str the search string - * @param {Boolean} skip_async if set to true server will not be queried even if configured - * @param {Boolean} show_only_matches if set to true only matching nodes will be shown (keep in mind this can be very slow on large trees or old browsers) - * @param {mixed} inside an optional node to whose children to limit the search - * @param {Boolean} append if set to true the results of this search are appended to the previous search - * @plugin search - * @trigger search.jstree - */ - this.search = function (str, skip_async, show_only_matches, inside, append, show_only_matches_children) { - if(str === false || $.trim(str.toString()) === "") { - return this.clear_search(); - } - inside = this.get_node(inside); - inside = inside && inside.id ? inside.id : null; - str = str.toString(); - var s = this.settings.search, - a = s.ajax ? s.ajax : false, - m = this._model.data, - f = null, - r = [], - p = [], i, j; - if(this._data.search.res.length && !append) { - this.clear_search(); - } - if(show_only_matches === undefined) { - show_only_matches = s.show_only_matches; - } - if(show_only_matches_children === undefined) { - show_only_matches_children = s.show_only_matches_children; - } - if(!skip_async && a !== false) { - if($.isFunction(a)) { - return a.call(this, str, $.proxy(function (d) { - if(d && d.d) { d = d.d; } - this._load_nodes(!$.isArray(d) ? [] : $.vakata.array_unique(d), function () { - this.search(str, true, show_only_matches, inside, append, show_only_matches_children); - }); - }, this), inside); - } - else { - a = $.extend({}, a); - if(!a.data) { a.data = {}; } - a.data.str = str; - if(inside) { - a.data.inside = inside; - } - if (this._data.search.lastRequest) { - this._data.search.lastRequest.abort(); - } - this._data.search.lastRequest = $.ajax(a) - .fail($.proxy(function () { - this._data.core.last_error = { 'error' : 'ajax', 'plugin' : 'search', 'id' : 'search_01', 'reason' : 'Could not load search parents', 'data' : JSON.stringify(a) }; - this.settings.core.error.call(this, this._data.core.last_error); - }, this)) - .done($.proxy(function (d) { - if(d && d.d) { d = d.d; } - this._load_nodes(!$.isArray(d) ? [] : $.vakata.array_unique(d), function () { - this.search(str, true, show_only_matches, inside, append, show_only_matches_children); - }); - }, this)); - return this._data.search.lastRequest; - } - } - if(!append) { - this._data.search.str = str; - this._data.search.dom = $(); - this._data.search.res = []; - this._data.search.opn = []; - this._data.search.som = show_only_matches; - this._data.search.smc = show_only_matches_children; - } - - f = new $.vakata.search(str, true, { caseSensitive : s.case_sensitive, fuzzy : s.fuzzy }); - $.each(m[inside ? inside : $.jstree.root].children_d, function (ii, i) { - var v = m[i]; - if(v.text && !v.state.hidden && (!s.search_leaves_only || (v.state.loaded && v.children.length === 0)) && ( (s.search_callback && s.search_callback.call(this, str, v)) || (!s.search_callback && f.search(v.text).isMatch) ) ) { - r.push(i); - p = p.concat(v.parents); - } - }); - if(r.length) { - p = $.vakata.array_unique(p); - for(i = 0, j = p.length; i < j; i++) { - if(p[i] !== $.jstree.root && m[p[i]] && this.open_node(p[i], null, 0) === true) { - this._data.search.opn.push(p[i]); - } - } - if(!append) { - this._data.search.dom = $(this.element[0].querySelectorAll('#' + $.map(r, function (v) { return "0123456789".indexOf(v[0]) !== -1 ? '\\3' + v[0] + ' ' + v.substr(1).replace($.jstree.idregex,'\\$&') : v.replace($.jstree.idregex,'\\$&'); }).join(', #'))); - this._data.search.res = r; - } - else { - this._data.search.dom = this._data.search.dom.add($(this.element[0].querySelectorAll('#' + $.map(r, function (v) { return "0123456789".indexOf(v[0]) !== -1 ? '\\3' + v[0] + ' ' + v.substr(1).replace($.jstree.idregex,'\\$&') : v.replace($.jstree.idregex,'\\$&'); }).join(', #')))); - this._data.search.res = $.vakata.array_unique(this._data.search.res.concat(r)); - } - this._data.search.dom.children(".jstree-anchor").addClass('jstree-search'); - } - /** - * triggered after search is complete - * @event - * @name search.jstree - * @param {jQuery} nodes a jQuery collection of matching nodes - * @param {String} str the search string - * @param {Array} res a collection of objects represeing the matching nodes - * @plugin search - */ - this.trigger('search', { nodes : this._data.search.dom, str : str, res : this._data.search.res, show_only_matches : show_only_matches }); - }; - /** - * used to clear the last search (removes classes and shows all nodes if filtering is on) - * @name clear_search() - * @plugin search - * @trigger clear_search.jstree - */ - this.clear_search = function () { - if(this.settings.search.close_opened_onclear) { - this.close_node(this._data.search.opn, 0); - } - /** - * triggered after search is complete - * @event - * @name clear_search.jstree - * @param {jQuery} nodes a jQuery collection of matching nodes (the result from the last search) - * @param {String} str the search string (the last search string) - * @param {Array} res a collection of objects represeing the matching nodes (the result from the last search) - * @plugin search - */ - this.trigger('clear_search', { 'nodes' : this._data.search.dom, str : this._data.search.str, res : this._data.search.res }); - if(this._data.search.res.length) { - this._data.search.dom = $(this.element[0].querySelectorAll('#' + $.map(this._data.search.res, function (v) { - return "0123456789".indexOf(v[0]) !== -1 ? '\\3' + v[0] + ' ' + v.substr(1).replace($.jstree.idregex,'\\$&') : v.replace($.jstree.idregex,'\\$&'); - }).join(', #'))); - this._data.search.dom.children(".jstree-anchor").removeClass("jstree-search"); - } - this._data.search.str = ""; - this._data.search.res = []; - this._data.search.opn = []; - this._data.search.dom = $(); - }; - - this.redraw_node = function(obj, deep, callback, force_render) { - obj = parent.redraw_node.apply(this, arguments); - if(obj) { - if($.inArray(obj.id, this._data.search.res) !== -1) { - var i, j, tmp = null; - for(i = 0, j = obj.childNodes.length; i < j; i++) { - if(obj.childNodes[i] && obj.childNodes[i].className && obj.childNodes[i].className.indexOf("jstree-anchor") !== -1) { - tmp = obj.childNodes[i]; - break; - } - } - if(tmp) { - tmp.className += ' jstree-search'; - } - } - } - return obj; - }; - }; - - // helpers - (function ($) { - // from http://kiro.me/projects/fuse.html - $.vakata.search = function(pattern, txt, options) { - options = options || {}; - options = $.extend({}, $.vakata.search.defaults, options); - if(options.fuzzy !== false) { - options.fuzzy = true; - } - pattern = options.caseSensitive ? pattern : pattern.toLowerCase(); - var MATCH_LOCATION = options.location, - MATCH_DISTANCE = options.distance, - MATCH_THRESHOLD = options.threshold, - patternLen = pattern.length, - matchmask, pattern_alphabet, match_bitapScore, search; - if(patternLen > 32) { - options.fuzzy = false; - } - if(options.fuzzy) { - matchmask = 1 << (patternLen - 1); - pattern_alphabet = (function () { - var mask = {}, - i = 0; - for (i = 0; i < patternLen; i++) { - mask[pattern.charAt(i)] = 0; - } - for (i = 0; i < patternLen; i++) { - mask[pattern.charAt(i)] |= 1 << (patternLen - i - 1); - } - return mask; - }()); - match_bitapScore = function (e, x) { - var accuracy = e / patternLen, - proximity = Math.abs(MATCH_LOCATION - x); - if(!MATCH_DISTANCE) { - return proximity ? 1.0 : accuracy; - } - return accuracy + (proximity / MATCH_DISTANCE); - }; - } - search = function (text) { - text = options.caseSensitive ? text : text.toLowerCase(); - if(pattern === text || text.indexOf(pattern) !== -1) { - return { - isMatch: true, - score: 0 - }; - } - if(!options.fuzzy) { - return { - isMatch: false, - score: 1 - }; - } - var i, j, - textLen = text.length, - scoreThreshold = MATCH_THRESHOLD, - bestLoc = text.indexOf(pattern, MATCH_LOCATION), - binMin, binMid, - binMax = patternLen + textLen, - lastRd, start, finish, rd, charMatch, - score = 1, - locations = []; - if (bestLoc !== -1) { - scoreThreshold = Math.min(match_bitapScore(0, bestLoc), scoreThreshold); - bestLoc = text.lastIndexOf(pattern, MATCH_LOCATION + patternLen); - if (bestLoc !== -1) { - scoreThreshold = Math.min(match_bitapScore(0, bestLoc), scoreThreshold); - } - } - bestLoc = -1; - for (i = 0; i < patternLen; i++) { - binMin = 0; - binMid = binMax; - while (binMin < binMid) { - if (match_bitapScore(i, MATCH_LOCATION + binMid) <= scoreThreshold) { - binMin = binMid; - } else { - binMax = binMid; - } - binMid = Math.floor((binMax - binMin) / 2 + binMin); - } - binMax = binMid; - start = Math.max(1, MATCH_LOCATION - binMid + 1); - finish = Math.min(MATCH_LOCATION + binMid, textLen) + patternLen; - rd = new Array(finish + 2); - rd[finish + 1] = (1 << i) - 1; - for (j = finish; j >= start; j--) { - charMatch = pattern_alphabet[text.charAt(j - 1)]; - if (i === 0) { - rd[j] = ((rd[j + 1] << 1) | 1) & charMatch; - } else { - rd[j] = ((rd[j + 1] << 1) | 1) & charMatch | (((lastRd[j + 1] | lastRd[j]) << 1) | 1) | lastRd[j + 1]; - } - if (rd[j] & matchmask) { - score = match_bitapScore(i, j - 1); - if (score <= scoreThreshold) { - scoreThreshold = score; - bestLoc = j - 1; - locations.push(bestLoc); - if (bestLoc > MATCH_LOCATION) { - start = Math.max(1, 2 * MATCH_LOCATION - bestLoc); - } else { - break; - } - } - } - } - if (match_bitapScore(i + 1, MATCH_LOCATION) > scoreThreshold) { - break; - } - lastRd = rd; - } - return { - isMatch: bestLoc >= 0, - score: score - }; - }; - return txt === true ? { 'search' : search } : search(txt); - }; - $.vakata.search.defaults = { - location : 0, - distance : 100, - threshold : 0.6, - fuzzy : false, - caseSensitive : false - }; - }($)); - - // include the search plugin by default - // $.jstree.defaults.plugins.push("search"); - - -/** - * ### Sort plugin - * - * Automatically sorts all siblings in the tree according to a sorting function. - */ - - /** - * the settings function used to sort the nodes. - * It is executed in the tree's context, accepts two nodes as arguments and should return `1` or `-1`. - * @name $.jstree.defaults.sort - * @plugin sort - */ - $.jstree.defaults.sort = function (a, b) { - //return this.get_type(a) === this.get_type(b) ? (this.get_text(a) > this.get_text(b) ? 1 : -1) : this.get_type(a) >= this.get_type(b); - return this.get_text(a) > this.get_text(b) ? 1 : -1; - }; - $.jstree.plugins.sort = function (options, parent) { - this.bind = function () { - parent.bind.call(this); - this.element - .on("model.jstree", $.proxy(function (e, data) { - this.sort(data.parent, true); - }, this)) - .on("rename_node.jstree create_node.jstree", $.proxy(function (e, data) { - this.sort(data.parent || data.node.parent, false); - this.redraw_node(data.parent || data.node.parent, true); - }, this)) - .on("move_node.jstree copy_node.jstree", $.proxy(function (e, data) { - this.sort(data.parent, false); - this.redraw_node(data.parent, true); - }, this)); - }; - /** - * used to sort a node's children - * @private - * @name sort(obj [, deep]) - * @param {mixed} obj the node - * @param {Boolean} deep if set to `true` nodes are sorted recursively. - * @plugin sort - * @trigger search.jstree - */ - this.sort = function (obj, deep) { - var i, j; - obj = this.get_node(obj); - if(obj && obj.children && obj.children.length) { - obj.children.sort($.proxy(this.settings.sort, this)); - if(deep) { - for(i = 0, j = obj.children_d.length; i < j; i++) { - this.sort(obj.children_d[i], false); - } - } - } - }; - }; - - // include the sort plugin by default - // $.jstree.defaults.plugins.push("sort"); - -/** - * ### State plugin - * - * Saves the state of the tree (selected nodes, opened nodes) on the user's computer using available options (localStorage, cookies, etc) - */ - - var to = false; - /** - * stores all defaults for the state plugin - * @name $.jstree.defaults.state - * @plugin state - */ - $.jstree.defaults.state = { - /** - * A string for the key to use when saving the current tree (change if using multiple trees in your project). Defaults to `jstree`. - * @name $.jstree.defaults.state.key - * @plugin state - */ - key : 'jstree', - /** - * A space separated list of events that trigger a state save. Defaults to `changed.jstree open_node.jstree close_node.jstree`. - * @name $.jstree.defaults.state.events - * @plugin state - */ - events : 'changed.jstree open_node.jstree close_node.jstree check_node.jstree uncheck_node.jstree', - /** - * Time in milliseconds after which the state will expire. Defaults to 'false' meaning - no expire. - * @name $.jstree.defaults.state.ttl - * @plugin state - */ - ttl : false, - /** - * A function that will be executed prior to restoring state with one argument - the state object. Can be used to clear unwanted parts of the state. - * @name $.jstree.defaults.state.filter - * @plugin state - */ - filter : false - }; - $.jstree.plugins.state = function (options, parent) { - this.bind = function () { - parent.bind.call(this); - var bind = $.proxy(function () { - this.element.on(this.settings.state.events, $.proxy(function () { - if(to) { clearTimeout(to); } - to = setTimeout($.proxy(function () { this.save_state(); }, this), 100); - }, this)); - /** - * triggered when the state plugin is finished restoring the state (and immediately after ready if there is no state to restore). - * @event - * @name state_ready.jstree - * @plugin state - */ - this.trigger('state_ready'); - }, this); - this.element - .on("ready.jstree", $.proxy(function (e, data) { - this.element.one("restore_state.jstree", bind); - if(!this.restore_state()) { bind(); } - }, this)); - }; - /** - * save the state - * @name save_state() - * @plugin state - */ - this.save_state = function () { - var st = { 'state' : this.get_state(), 'ttl' : this.settings.state.ttl, 'sec' : +(new Date()) }; - $.vakata.storage.set(this.settings.state.key, JSON.stringify(st)); - }; - /** - * restore the state from the user's computer - * @name restore_state() - * @plugin state - */ - this.restore_state = function () { - var k = $.vakata.storage.get(this.settings.state.key); - if(!!k) { try { k = JSON.parse(k); } catch(ex) { return false; } } - if(!!k && k.ttl && k.sec && +(new Date()) - k.sec > k.ttl) { return false; } - if(!!k && k.state) { k = k.state; } - if(!!k && $.isFunction(this.settings.state.filter)) { k = this.settings.state.filter.call(this, k); } - if(!!k) { - this.element.one("set_state.jstree", function (e, data) { data.instance.trigger('restore_state', { 'state' : $.extend(true, {}, k) }); }); - this.set_state(k); - return true; - } - return false; - }; - /** - * clear the state on the user's computer - * @name clear_state() - * @plugin state - */ - this.clear_state = function () { - return $.vakata.storage.del(this.settings.state.key); - }; - }; - - (function ($, undefined) { - $.vakata.storage = { - // simply specifying the functions in FF throws an error - set : function (key, val) { return window.localStorage.setItem(key, val); }, - get : function (key) { return window.localStorage.getItem(key); }, - del : function (key) { return window.localStorage.removeItem(key); } - }; - }($)); - - // include the state plugin by default - // $.jstree.defaults.plugins.push("state"); - -/** - * ### Types plugin - * - * Makes it possible to add predefined types for groups of nodes, which make it possible to easily control nesting rules and icon for each group. - */ - - /** - * An object storing all types as key value pairs, where the key is the type name and the value is an object that could contain following keys (all optional). - * - * * `max_children` the maximum number of immediate children this node type can have. Do not specify or set to `-1` for unlimited. - * * `max_depth` the maximum number of nesting this node type can have. A value of `1` would mean that the node can have children, but no grandchildren. Do not specify or set to `-1` for unlimited. - * * `valid_children` an array of node type strings, that nodes of this type can have as children. Do not specify or set to `-1` for no limits. - * * `icon` a string - can be a path to an icon or a className, if using an image that is in the current directory use a `./` prefix, otherwise it will be detected as a class. Omit to use the default icon from your theme. - * * `li_attr` an object of values which will be used to add HTML attributes on the resulting LI DOM node (merged with the node's own data) - * * `a_attr` an object of values which will be used to add HTML attributes on the resulting A DOM node (merged with the node's own data) - * - * There are two predefined types: - * - * * `#` represents the root of the tree, for example `max_children` would control the maximum number of root nodes. - * * `default` represents the default node - any settings here will be applied to all nodes that do not have a type specified. - * - * @name $.jstree.defaults.types - * @plugin types - */ - $.jstree.defaults.types = { - 'default' : {} - }; - $.jstree.defaults.types[$.jstree.root] = {}; - - $.jstree.plugins.types = function (options, parent) { - this.init = function (el, options) { - var i, j; - if(options && options.types && options.types['default']) { - for(i in options.types) { - if(i !== "default" && i !== $.jstree.root && options.types.hasOwnProperty(i)) { - for(j in options.types['default']) { - if(options.types['default'].hasOwnProperty(j) && options.types[i][j] === undefined) { - options.types[i][j] = options.types['default'][j]; - } - } - } - } - } - parent.init.call(this, el, options); - this._model.data[$.jstree.root].type = $.jstree.root; - }; - this.refresh = function (skip_loading, forget_state) { - parent.refresh.call(this, skip_loading, forget_state); - this._model.data[$.jstree.root].type = $.jstree.root; - }; - this.bind = function () { - this.element - .on('model.jstree', $.proxy(function (e, data) { - var m = this._model.data, - dpc = data.nodes, - t = this.settings.types, - i, j, c = 'default', k; - for(i = 0, j = dpc.length; i < j; i++) { - c = 'default'; - if(m[dpc[i]].original && m[dpc[i]].original.type && t[m[dpc[i]].original.type]) { - c = m[dpc[i]].original.type; - } - if(m[dpc[i]].data && m[dpc[i]].data.jstree && m[dpc[i]].data.jstree.type && t[m[dpc[i]].data.jstree.type]) { - c = m[dpc[i]].data.jstree.type; - } - m[dpc[i]].type = c; - if(m[dpc[i]].icon === true && t[c].icon !== undefined) { - m[dpc[i]].icon = t[c].icon; - } - if(t[c].li_attr !== undefined && typeof t[c].li_attr === 'object') { - for (k in t[c].li_attr) { - if (t[c].li_attr.hasOwnProperty(k)) { - if (k === 'id') { - continue; - } - else if (m[dpc[i]].li_attr[k] === undefined) { - m[dpc[i]].li_attr[k] = t[c].li_attr[k]; - } - else if (k === 'class') { - m[dpc[i]].li_attr['class'] = t[c].li_attr['class'] + ' ' + m[dpc[i]].li_attr['class']; - } - } - } - } - if(t[c].a_attr !== undefined && typeof t[c].a_attr === 'object') { - for (k in t[c].a_attr) { - if (t[c].a_attr.hasOwnProperty(k)) { - if (k === 'id') { - continue; - } - else if (m[dpc[i]].a_attr[k] === undefined) { - m[dpc[i]].a_attr[k] = t[c].a_attr[k]; - } - else if (k === 'href' && m[dpc[i]].a_attr[k] === '#') { - m[dpc[i]].a_attr['href'] = t[c].a_attr['href']; - } - else if (k === 'class') { - m[dpc[i]].a_attr['class'] = t[c].a_attr['class'] + ' ' + m[dpc[i]].a_attr['class']; - } - } - } - } - } - m[$.jstree.root].type = $.jstree.root; - }, this)); - parent.bind.call(this); - }; - this.get_json = function (obj, options, flat) { - var i, j, - m = this._model.data, - opt = options ? $.extend(true, {}, options, {no_id:false}) : {}, - tmp = parent.get_json.call(this, obj, opt, flat); - if(tmp === false) { return false; } - if($.isArray(tmp)) { - for(i = 0, j = tmp.length; i < j; i++) { - tmp[i].type = tmp[i].id && m[tmp[i].id] && m[tmp[i].id].type ? m[tmp[i].id].type : "default"; - if(options && options.no_id) { - delete tmp[i].id; - if(tmp[i].li_attr && tmp[i].li_attr.id) { - delete tmp[i].li_attr.id; - } - if(tmp[i].a_attr && tmp[i].a_attr.id) { - delete tmp[i].a_attr.id; - } - } - } - } - else { - tmp.type = tmp.id && m[tmp.id] && m[tmp.id].type ? m[tmp.id].type : "default"; - if(options && options.no_id) { - tmp = this._delete_ids(tmp); - } - } - return tmp; - }; - this._delete_ids = function (tmp) { - if($.isArray(tmp)) { - for(var i = 0, j = tmp.length; i < j; i++) { - tmp[i] = this._delete_ids(tmp[i]); - } - return tmp; - } - delete tmp.id; - if(tmp.li_attr && tmp.li_attr.id) { - delete tmp.li_attr.id; - } - if(tmp.a_attr && tmp.a_attr.id) { - delete tmp.a_attr.id; - } - if(tmp.children && $.isArray(tmp.children)) { - tmp.children = this._delete_ids(tmp.children); - } - return tmp; - }; - this.check = function (chk, obj, par, pos, more) { - if(parent.check.call(this, chk, obj, par, pos, more) === false) { return false; } - obj = obj && obj.id ? obj : this.get_node(obj); - par = par && par.id ? par : this.get_node(par); - var m = obj && obj.id ? (more && more.origin ? more.origin : $.jstree.reference(obj.id)) : null, tmp, d, i, j; - m = m && m._model && m._model.data ? m._model.data : null; - switch(chk) { - case "create_node": - case "move_node": - case "copy_node": - if(chk !== 'move_node' || $.inArray(obj.id, par.children) === -1) { - tmp = this.get_rules(par); - if(tmp.max_children !== undefined && tmp.max_children !== -1 && tmp.max_children === par.children.length) { - this._data.core.last_error = { 'error' : 'check', 'plugin' : 'types', 'id' : 'types_01', 'reason' : 'max_children prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; - return false; - } - if(tmp.valid_children !== undefined && tmp.valid_children !== -1 && $.inArray((obj.type || 'default'), tmp.valid_children) === -1) { - this._data.core.last_error = { 'error' : 'check', 'plugin' : 'types', 'id' : 'types_02', 'reason' : 'valid_children prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; - return false; - } - if(m && obj.children_d && obj.parents) { - d = 0; - for(i = 0, j = obj.children_d.length; i < j; i++) { - d = Math.max(d, m[obj.children_d[i]].parents.length); - } - d = d - obj.parents.length + 1; - } - if(d <= 0 || d === undefined) { d = 1; } - do { - if(tmp.max_depth !== undefined && tmp.max_depth !== -1 && tmp.max_depth < d) { - this._data.core.last_error = { 'error' : 'check', 'plugin' : 'types', 'id' : 'types_03', 'reason' : 'max_depth prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; - return false; - } - par = this.get_node(par.parent); - tmp = this.get_rules(par); - d++; - } while(par); - } - break; - } - return true; - }; - /** - * used to retrieve the type settings object for a node - * @name get_rules(obj) - * @param {mixed} obj the node to find the rules for - * @return {Object} - * @plugin types - */ - this.get_rules = function (obj) { - obj = this.get_node(obj); - if(!obj) { return false; } - var tmp = this.get_type(obj, true); - if(tmp.max_depth === undefined) { tmp.max_depth = -1; } - if(tmp.max_children === undefined) { tmp.max_children = -1; } - if(tmp.valid_children === undefined) { tmp.valid_children = -1; } - return tmp; - }; - /** - * used to retrieve the type string or settings object for a node - * @name get_type(obj [, rules]) - * @param {mixed} obj the node to find the rules for - * @param {Boolean} rules if set to `true` instead of a string the settings object will be returned - * @return {String|Object} - * @plugin types - */ - this.get_type = function (obj, rules) { - obj = this.get_node(obj); - return (!obj) ? false : ( rules ? $.extend({ 'type' : obj.type }, this.settings.types[obj.type]) : obj.type); - }; - /** - * used to change a node's type - * @name set_type(obj, type) - * @param {mixed} obj the node to change - * @param {String} type the new type - * @plugin types - */ - this.set_type = function (obj, type) { - var m = this._model.data, t, t1, t2, old_type, old_icon, k, d, a; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.set_type(obj[t1], type); - } - return true; - } - t = this.settings.types; - obj = this.get_node(obj); - if(!t[type] || !obj) { return false; } - d = this.get_node(obj, true); - if (d && d.length) { - a = d.children('.jstree-anchor'); - } - old_type = obj.type; - old_icon = this.get_icon(obj); - obj.type = type; - if(old_icon === true || !t[old_type] || (t[old_type].icon !== undefined && old_icon === t[old_type].icon)) { - this.set_icon(obj, t[type].icon !== undefined ? t[type].icon : true); - } - - // remove old type props - if(t[old_type] && t[old_type].li_attr !== undefined && typeof t[old_type].li_attr === 'object') { - for (k in t[old_type].li_attr) { - if (t[old_type].li_attr.hasOwnProperty(k)) { - if (k === 'id') { - continue; - } - else if (k === 'class') { - m[obj.id].li_attr['class'] = (m[obj.id].li_attr['class'] || '').replace(t[old_type].li_attr[k], ''); - if (d) { d.removeClass(t[old_type].li_attr[k]); } - } - else if (m[obj.id].li_attr[k] === t[old_type].li_attr[k]) { - m[obj.id].li_attr[k] = null; - if (d) { d.removeAttr(k); } - } - } - } - } - if(t[old_type] && t[old_type].a_attr !== undefined && typeof t[old_type].a_attr === 'object') { - for (k in t[old_type].a_attr) { - if (t[old_type].a_attr.hasOwnProperty(k)) { - if (k === 'id') { - continue; - } - else if (k === 'class') { - m[obj.id].a_attr['class'] = (m[obj.id].a_attr['class'] || '').replace(t[old_type].a_attr[k], ''); - if (a) { a.removeClass(t[old_type].a_attr[k]); } - } - else if (m[obj.id].a_attr[k] === t[old_type].a_attr[k]) { - if (k === 'href') { - m[obj.id].a_attr[k] = '#'; - if (a) { a.attr('href', '#'); } - } - else { - delete m[obj.id].a_attr[k]; - if (a) { a.removeAttr(k); } - } - } - } - } - } - - // add new props - if(t[type].li_attr !== undefined && typeof t[type].li_attr === 'object') { - for (k in t[type].li_attr) { - if (t[type].li_attr.hasOwnProperty(k)) { - if (k === 'id') { - continue; - } - else if (m[obj.id].li_attr[k] === undefined) { - m[obj.id].li_attr[k] = t[type].li_attr[k]; - if (d) { - if (k === 'class') { - d.addClass(t[type].li_attr[k]); - } - else { - d.attr(k, t[type].li_attr[k]); - } - } - } - else if (k === 'class') { - m[obj.id].li_attr['class'] = t[type].li_attr[k] + ' ' + m[obj.id].li_attr['class']; - if (d) { d.addClass(t[type].li_attr[k]); } - } - } - } - } - if(t[type].a_attr !== undefined && typeof t[type].a_attr === 'object') { - for (k in t[type].a_attr) { - if (t[type].a_attr.hasOwnProperty(k)) { - if (k === 'id') { - continue; - } - else if (m[obj.id].a_attr[k] === undefined) { - m[obj.id].a_attr[k] = t[type].a_attr[k]; - if (a) { - if (k === 'class') { - a.addClass(t[type].a_attr[k]); - } - else { - a.attr(k, t[type].a_attr[k]); - } - } - } - else if (k === 'href' && m[obj.id].a_attr[k] === '#') { - m[obj.id].a_attr['href'] = t[type].a_attr['href']; - if (a) { a.attr('href', t[type].a_attr['href']); } - } - else if (k === 'class') { - m[obj.id].a_attr['class'] = t[type].a_attr['class'] + ' ' + m[obj.id].a_attr['class']; - if (a) { a.addClass(t[type].a_attr[k]); } - } - } - } - } - - return true; - }; - }; - // include the types plugin by default - // $.jstree.defaults.plugins.push("types"); - - -/** - * ### Unique plugin - * - * Enforces that no nodes with the same name can coexist as siblings. - */ - - /** - * stores all defaults for the unique plugin - * @name $.jstree.defaults.unique - * @plugin unique - */ - $.jstree.defaults.unique = { - /** - * Indicates if the comparison should be case sensitive. Default is `false`. - * @name $.jstree.defaults.unique.case_sensitive - * @plugin unique - */ - case_sensitive : false, - /** - * A callback executed in the instance's scope when a new node is created and the name is already taken, the two arguments are the conflicting name and the counter. The default will produce results like `New node (2)`. - * @name $.jstree.defaults.unique.duplicate - * @plugin unique - */ - duplicate : function (name, counter) { - return name + ' (' + counter + ')'; - } - }; - - $.jstree.plugins.unique = function (options, parent) { - this.check = function (chk, obj, par, pos, more) { - if(parent.check.call(this, chk, obj, par, pos, more) === false) { return false; } - obj = obj && obj.id ? obj : this.get_node(obj); - par = par && par.id ? par : this.get_node(par); - if(!par || !par.children) { return true; } - var n = chk === "rename_node" ? pos : obj.text, - c = [], - s = this.settings.unique.case_sensitive, - m = this._model.data, i, j; - for(i = 0, j = par.children.length; i < j; i++) { - c.push(s ? m[par.children[i]].text : m[par.children[i]].text.toLowerCase()); - } - if(!s) { n = n.toLowerCase(); } - switch(chk) { - case "delete_node": - return true; - case "rename_node": - i = ($.inArray(n, c) === -1 || (obj.text && obj.text[ s ? 'toString' : 'toLowerCase']() === n)); - if(!i) { - this._data.core.last_error = { 'error' : 'check', 'plugin' : 'unique', 'id' : 'unique_01', 'reason' : 'Child with name ' + n + ' already exists. Preventing: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; - } - return i; - case "create_node": - i = ($.inArray(n, c) === -1); - if(!i) { - this._data.core.last_error = { 'error' : 'check', 'plugin' : 'unique', 'id' : 'unique_04', 'reason' : 'Child with name ' + n + ' already exists. Preventing: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; - } - return i; - case "copy_node": - i = ($.inArray(n, c) === -1); - if(!i) { - this._data.core.last_error = { 'error' : 'check', 'plugin' : 'unique', 'id' : 'unique_02', 'reason' : 'Child with name ' + n + ' already exists. Preventing: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; - } - return i; - case "move_node": - i = ( (obj.parent === par.id && (!more || !more.is_multi)) || $.inArray(n, c) === -1); - if(!i) { - this._data.core.last_error = { 'error' : 'check', 'plugin' : 'unique', 'id' : 'unique_03', 'reason' : 'Child with name ' + n + ' already exists. Preventing: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; - } - return i; - } - return true; - }; - this.create_node = function (par, node, pos, callback, is_loaded) { - if(!node || node.text === undefined) { - if(par === null) { - par = $.jstree.root; - } - par = this.get_node(par); - if(!par) { - return parent.create_node.call(this, par, node, pos, callback, is_loaded); - } - pos = pos === undefined ? "last" : pos; - if(!pos.toString().match(/^(before|after)$/) && !is_loaded && !this.is_loaded(par)) { - return parent.create_node.call(this, par, node, pos, callback, is_loaded); - } - if(!node) { node = {}; } - var tmp, n, dpc, i, j, m = this._model.data, s = this.settings.unique.case_sensitive, cb = this.settings.unique.duplicate; - n = tmp = this.get_string('New node'); - dpc = []; - for(i = 0, j = par.children.length; i < j; i++) { - dpc.push(s ? m[par.children[i]].text : m[par.children[i]].text.toLowerCase()); - } - i = 1; - while($.inArray(s ? n : n.toLowerCase(), dpc) !== -1) { - n = cb.call(this, tmp, (++i)).toString(); - } - node.text = n; - } - return parent.create_node.call(this, par, node, pos, callback, is_loaded); - }; - }; - - // include the unique plugin by default - // $.jstree.defaults.plugins.push("unique"); - - -/** - * ### Wholerow plugin - * - * Makes each node appear block level. Making selection easier. May cause slow down for large trees in old browsers. - */ - - var div = document.createElement('DIV'); - div.setAttribute('unselectable','on'); - div.setAttribute('role','presentation'); - div.className = 'jstree-wholerow'; - div.innerHTML = ' '; - $.jstree.plugins.wholerow = function (options, parent) { - this.bind = function () { - parent.bind.call(this); - - this.element - .on('ready.jstree set_state.jstree', $.proxy(function () { - this.hide_dots(); - }, this)) - .on("init.jstree loading.jstree ready.jstree", $.proxy(function () { - //div.style.height = this._data.core.li_height + 'px'; - this.get_container_ul().addClass('jstree-wholerow-ul'); - }, this)) - .on("deselect_all.jstree", $.proxy(function (e, data) { - this.element.find('.jstree-wholerow-clicked').removeClass('jstree-wholerow-clicked'); - }, this)) - .on("changed.jstree", $.proxy(function (e, data) { - this.element.find('.jstree-wholerow-clicked').removeClass('jstree-wholerow-clicked'); - var tmp = false, i, j; - for(i = 0, j = data.selected.length; i < j; i++) { - tmp = this.get_node(data.selected[i], true); - if(tmp && tmp.length) { - tmp.children('.jstree-wholerow').addClass('jstree-wholerow-clicked'); - } - } - }, this)) - .on("open_node.jstree", $.proxy(function (e, data) { - this.get_node(data.node, true).find('.jstree-clicked').parent().children('.jstree-wholerow').addClass('jstree-wholerow-clicked'); - }, this)) - .on("hover_node.jstree dehover_node.jstree", $.proxy(function (e, data) { - if(e.type === "hover_node" && this.is_disabled(data.node)) { return; } - this.get_node(data.node, true).children('.jstree-wholerow')[e.type === "hover_node"?"addClass":"removeClass"]('jstree-wholerow-hovered'); - }, this)) - .on("contextmenu.jstree", ".jstree-wholerow", $.proxy(function (e) { - if (this._data.contextmenu) { - e.preventDefault(); - var tmp = $.Event('contextmenu', { metaKey : e.metaKey, ctrlKey : e.ctrlKey, altKey : e.altKey, shiftKey : e.shiftKey, pageX : e.pageX, pageY : e.pageY }); - $(e.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(tmp); - } - }, this)) - /*! - .on("mousedown.jstree touchstart.jstree", ".jstree-wholerow", function (e) { - if(e.target === e.currentTarget) { - var a = $(e.currentTarget).closest(".jstree-node").children(".jstree-anchor"); - e.target = a[0]; - a.trigger(e); - } - }) - */ - .on("click.jstree", ".jstree-wholerow", function (e) { - e.stopImmediatePropagation(); - var tmp = $.Event('click', { metaKey : e.metaKey, ctrlKey : e.ctrlKey, altKey : e.altKey, shiftKey : e.shiftKey }); - $(e.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(tmp).focus(); - }) - .on("dblclick.jstree", ".jstree-wholerow", function (e) { - e.stopImmediatePropagation(); - var tmp = $.Event('dblclick', { metaKey : e.metaKey, ctrlKey : e.ctrlKey, altKey : e.altKey, shiftKey : e.shiftKey }); - $(e.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(tmp).focus(); - }) - .on("click.jstree", ".jstree-leaf > .jstree-ocl", $.proxy(function (e) { - e.stopImmediatePropagation(); - var tmp = $.Event('click', { metaKey : e.metaKey, ctrlKey : e.ctrlKey, altKey : e.altKey, shiftKey : e.shiftKey }); - $(e.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(tmp).focus(); - }, this)) - .on("mouseover.jstree", ".jstree-wholerow, .jstree-icon", $.proxy(function (e) { - e.stopImmediatePropagation(); - if(!this.is_disabled(e.currentTarget)) { - this.hover_node(e.currentTarget); - } - return false; - }, this)) - .on("mouseleave.jstree", ".jstree-node", $.proxy(function (e) { - this.dehover_node(e.currentTarget); - }, this)); - }; - this.teardown = function () { - if(this.settings.wholerow) { - this.element.find(".jstree-wholerow").remove(); - } - parent.teardown.call(this); - }; - this.redraw_node = function(obj, deep, callback, force_render) { - obj = parent.redraw_node.apply(this, arguments); - if(obj) { - var tmp = div.cloneNode(true); - //tmp.style.height = this._data.core.li_height + 'px'; - if($.inArray(obj.id, this._data.core.selected) !== -1) { tmp.className += ' jstree-wholerow-clicked'; } - if(this._data.core.focused && this._data.core.focused === obj.id) { tmp.className += ' jstree-wholerow-hovered'; } - obj.insertBefore(tmp, obj.childNodes[0]); - } - return obj; - }; - }; - // include the wholerow plugin by default - // $.jstree.defaults.plugins.push("wholerow"); - if(document.registerElement && Object && Object.create) { - var proto = Object.create(HTMLElement.prototype); - proto.createdCallback = function () { - var c = { core : {}, plugins : [] }, i; - for(i in $.jstree.plugins) { - if($.jstree.plugins.hasOwnProperty(i) && this.attributes[i]) { - c.plugins.push(i); - if(this.getAttribute(i) && JSON.parse(this.getAttribute(i))) { - c[i] = JSON.parse(this.getAttribute(i)); - } - } - } - for(i in $.jstree.defaults.core) { - if($.jstree.defaults.core.hasOwnProperty(i) && this.attributes[i]) { - c.core[i] = JSON.parse(this.getAttribute(i)) || this.getAttribute(i); - } - } - $(this).jstree(c); - }; - // proto.attributeChangedCallback = function (name, previous, value) { }; - try { - document.registerElement("vakata-jstree", { prototype: proto }); - } catch(ignore) { } - } - -})); \ No newline at end of file diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/dist/jstree.min.js b/mayan/apps/cabinets/static/cabinets/packages/jstree/dist/jstree.min.js deleted file mode 100644 index 24c420489e..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/dist/jstree.min.js +++ /dev/null @@ -1,6 +0,0 @@ -/*! jsTree - v3.3.3 - 2016-10-31 - (MIT) */ -!function(a){"use strict";"function"==typeof define&&define.amd?define(["jquery"],a):"undefined"!=typeof module&&module.exports?module.exports=a(require("jquery")):a(jQuery)}(function(a,b){"use strict";if(!a.jstree){var c=0,d=!1,e=!1,f=!1,g=[],h=a("script:last").attr("src"),i=window.document;a.jstree={version:"3.3.3",defaults:{plugins:[]},plugins:{},path:h&&-1!==h.indexOf("/")?h.replace(/\/[^\/]+$/,""):"",idregex:/[\\:&!^|()\[\]<>@*'+~#";.,=\- \/${}%?`]/g,root:"#"},a.jstree.create=function(b,d){var e=new a.jstree.core(++c),f=d;return d=a.extend(!0,{},a.jstree.defaults,d),f&&f.plugins&&(d.plugins=f.plugins),a.each(d.plugins,function(a,b){"core"!==a&&(e=e.plugin(b,d[b]))}),a(b).data("jstree",e),e.init(b,d),e},a.jstree.destroy=function(){a(".jstree:jstree").jstree("destroy"),a(i).off(".jstree")},a.jstree.core=function(a){this._id=a,this._cnt=0,this._wrk=null,this._data={core:{themes:{name:!1,dots:!1,icons:!1,ellipsis:!1},selected:[],last_error:{},working:!1,worker_queue:[],focused:null}}},a.jstree.reference=function(b){var c=null,d=null;if(!b||!b.id||b.tagName&&b.nodeType||(b=b.id),!d||!d.length)try{d=a(b)}catch(e){}if(!d||!d.length)try{d=a("#"+b.replace(a.jstree.idregex,"\\$&"))}catch(e){}return d&&d.length&&(d=d.closest(".jstree")).length&&(d=d.data("jstree"))?c=d:a(".jstree").each(function(){var d=a(this).data("jstree");return d&&d._model.data[b]?(c=d,!1):void 0}),c},a.fn.jstree=function(c){var d="string"==typeof c,e=Array.prototype.slice.call(arguments,1),f=null;return c!==!0||this.length?(this.each(function(){var g=a.jstree.reference(this),h=d&&g?g[c]:null;return f=d&&h?h.apply(g,e):null,g||d||c!==b&&!a.isPlainObject(c)||a.jstree.create(this,c),(g&&!d||c===!0)&&(f=g||!1),null!==f&&f!==b?!1:void 0}),null!==f&&f!==b?f:this):!1},a.expr.pseudos.jstree=a.expr.createPseudo(function(c){return function(c){return a(c).hasClass("jstree")&&a(c).data("jstree")!==b}}),a.jstree.defaults.core={data:!1,strings:!1,check_callback:!1,error:a.noop,animation:200,multiple:!0,themes:{name:!1,url:!1,dir:!1,dots:!0,icons:!0,ellipsis:!1,stripes:!1,variant:!1,responsive:!1},expand_selected_onload:!0,worker:!0,force_text:!1,dblclick_toggle:!0},a.jstree.core.prototype={plugin:function(b,c){var d=a.jstree.plugins[b];return d?(this._data[b]={},d.prototype=this,new d(c,this)):this},init:function(b,c){this._model={data:{},changed:[],force_full_redraw:!1,redraw_timeout:!1,default_state:{loaded:!0,opened:!1,selected:!1,disabled:!1}},this._model.data[a.jstree.root]={id:a.jstree.root,parent:null,parents:[],children:[],children_d:[],state:{loaded:!1}},this.element=a(b).addClass("jstree jstree-"+this._id),this.settings=c,this._data.core.ready=!1,this._data.core.loaded=!1,this._data.core.rtl="rtl"===this.element.css("direction"),this.element[this._data.core.rtl?"addClass":"removeClass"]("jstree-rtl"),this.element.attr("role","tree"),this.settings.core.multiple&&this.element.attr("aria-multiselectable",!0),this.element.attr("tabindex")||this.element.attr("tabindex","0"),this.bind(),this.trigger("init"),this._data.core.original_container_html=this.element.find(" > ul > li").clone(!0),this._data.core.original_container_html.find("li").addBack().contents().filter(function(){return 3===this.nodeType&&(!this.nodeValue||/^\s+$/.test(this.nodeValue))}).remove(),this.element.html(""),this.element.attr("aria-activedescendant","j"+this._id+"_loading"),this._data.core.li_height=this.get_container_ul().children("li").first().height()||24,this._data.core.node=this._create_prototype_node(),this.trigger("loading"),this.load_node(a.jstree.root)},destroy:function(a){if(this._wrk)try{window.URL.revokeObjectURL(this._wrk),this._wrk=null}catch(b){}a||this.element.empty(),this.teardown()},_create_prototype_node:function(){var a=i.createElement("LI"),b,c;return a.setAttribute("role","treeitem"),b=i.createElement("I"),b.className="jstree-icon jstree-ocl",b.setAttribute("role","presentation"),a.appendChild(b),b=i.createElement("A"),b.className="jstree-anchor",b.setAttribute("href","#"),b.setAttribute("tabindex","-1"),c=i.createElement("I"),c.className="jstree-icon jstree-themeicon",c.setAttribute("role","presentation"),b.appendChild(c),a.appendChild(b),b=c=null,a},teardown:function(){this.unbind(),this.element.removeClass("jstree").removeData("jstree").find("[class^='jstree']").addBack().attr("class",function(){return this.className.replace(/jstree[^ ]*|$/gi,"")}),this.element=null},bind:function(){var b="",c=null,d=0;this.element.on("dblclick.jstree",function(a){if(a.target.tagName&&"input"===a.target.tagName.toLowerCase())return!0;if(i.selection&&i.selection.empty)i.selection.empty();else if(window.getSelection){var b=window.getSelection();try{b.removeAllRanges(),b.collapse()}catch(c){}}}).on("mousedown.jstree",a.proxy(function(a){a.target===this.element[0]&&(a.preventDefault(),d=+new Date)},this)).on("mousedown.jstree",".jstree-ocl",function(a){a.preventDefault()}).on("click.jstree",".jstree-ocl",a.proxy(function(a){this.toggle_node(a.target)},this)).on("dblclick.jstree",".jstree-anchor",a.proxy(function(a){return a.target.tagName&&"input"===a.target.tagName.toLowerCase()?!0:void(this.settings.core.dblclick_toggle&&this.toggle_node(a.target))},this)).on("click.jstree",".jstree-anchor",a.proxy(function(b){b.preventDefault(),b.currentTarget!==i.activeElement&&a(b.currentTarget).focus(),this.activate_node(b.currentTarget,b)},this)).on("keydown.jstree",".jstree-anchor",a.proxy(function(b){if(b.target.tagName&&"input"===b.target.tagName.toLowerCase())return!0;if(32!==b.which&&13!==b.which&&(b.shiftKey||b.ctrlKey||b.altKey||b.metaKey))return!0;var c=null;switch(this._data.core.rtl&&(37===b.which?b.which=39:39===b.which&&(b.which=37)),b.which){case 32:b.ctrlKey&&(b.type="click",a(b.currentTarget).trigger(b));break;case 13:b.type="click",a(b.currentTarget).trigger(b);break;case 37:b.preventDefault(),this.is_open(b.currentTarget)?this.close_node(b.currentTarget):(c=this.get_parent(b.currentTarget),c&&c.id!==a.jstree.root&&this.get_node(c,!0).children(".jstree-anchor").focus());break;case 38:b.preventDefault(),c=this.get_prev_dom(b.currentTarget),c&&c.length&&c.children(".jstree-anchor").focus();break;case 39:b.preventDefault(),this.is_closed(b.currentTarget)?this.open_node(b.currentTarget,function(a){this.get_node(a,!0).children(".jstree-anchor").focus()}):this.is_open(b.currentTarget)&&(c=this.get_node(b.currentTarget,!0).children(".jstree-children")[0],c&&a(this._firstChild(c)).children(".jstree-anchor").focus());break;case 40:b.preventDefault(),c=this.get_next_dom(b.currentTarget),c&&c.length&&c.children(".jstree-anchor").focus();break;case 106:this.open_all();break;case 36:b.preventDefault(),c=this._firstChild(this.get_container_ul()[0]),c&&a(c).children(".jstree-anchor").filter(":visible").focus();break;case 35:b.preventDefault(),this.element.find(".jstree-anchor").filter(":visible").last().focus();break;case 113:b.preventDefault(),this.edit(b.currentTarget)}},this)).on("load_node.jstree",a.proxy(function(b,c){c.status&&(c.node.id!==a.jstree.root||this._data.core.loaded||(this._data.core.loaded=!0,this._firstChild(this.get_container_ul()[0])&&this.element.attr("aria-activedescendant",this._firstChild(this.get_container_ul()[0]).id),this.trigger("loaded")),this._data.core.ready||setTimeout(a.proxy(function(){if(this.element&&!this.get_container_ul().find(".jstree-loading").length){if(this._data.core.ready=!0,this._data.core.selected.length){if(this.settings.core.expand_selected_onload){var b=[],c,d;for(c=0,d=this._data.core.selected.length;d>c;c++)b=b.concat(this._model.data[this._data.core.selected[c]].parents);for(b=a.vakata.array_unique(b),c=0,d=b.length;d>c;c++)this.open_node(b[c],!1,0)}this.trigger("changed",{action:"ready",selected:this._data.core.selected})}this.trigger("ready")}},this),0))},this)).on("keypress.jstree",a.proxy(function(d){if(d.target.tagName&&"input"===d.target.tagName.toLowerCase())return!0;c&&clearTimeout(c),c=setTimeout(function(){b=""},500);var e=String.fromCharCode(d.which).toLowerCase(),f=this.element.find(".jstree-anchor").filter(":visible"),g=f.index(i.activeElement)||0,h=!1;if(b+=e,b.length>1){if(f.slice(g).each(a.proxy(function(c,d){return 0===a(d).text().toLowerCase().indexOf(b)?(a(d).focus(),h=!0,!1):void 0},this)),h)return;if(f.slice(0,g).each(a.proxy(function(c,d){return 0===a(d).text().toLowerCase().indexOf(b)?(a(d).focus(),h=!0,!1):void 0},this)),h)return}if(new RegExp("^"+e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")+"+$").test(b)){if(f.slice(g+1).each(a.proxy(function(b,c){return a(c).text().toLowerCase().charAt(0)===e?(a(c).focus(),h=!0,!1):void 0},this)),h)return;if(f.slice(0,g+1).each(a.proxy(function(b,c){return a(c).text().toLowerCase().charAt(0)===e?(a(c).focus(),h=!0,!1):void 0},this)),h)return}},this)).on("init.jstree",a.proxy(function(){var a=this.settings.core.themes;this._data.core.themes.dots=a.dots,this._data.core.themes.stripes=a.stripes,this._data.core.themes.icons=a.icons,this._data.core.themes.ellipsis=a.ellipsis,this.set_theme(a.name||"default",a.url),this.set_theme_variant(a.variant)},this)).on("loading.jstree",a.proxy(function(){this[this._data.core.themes.dots?"show_dots":"hide_dots"](),this[this._data.core.themes.icons?"show_icons":"hide_icons"](),this[this._data.core.themes.stripes?"show_stripes":"hide_stripes"](),this[this._data.core.themes.ellipsis?"show_ellipsis":"hide_ellipsis"]()},this)).on("blur.jstree",".jstree-anchor",a.proxy(function(b){this._data.core.focused=null,a(b.currentTarget).filter(".jstree-hovered").mouseleave(),this.element.attr("tabindex","0")},this)).on("focus.jstree",".jstree-anchor",a.proxy(function(b){var c=this.get_node(b.currentTarget);c&&c.id&&(this._data.core.focused=c.id),this.element.find(".jstree-hovered").not(b.currentTarget).mouseleave(),a(b.currentTarget).mouseenter(),this.element.attr("tabindex","-1")},this)).on("focus.jstree",a.proxy(function(){if(+new Date-d>500&&!this._data.core.focused){d=0;var a=this.get_node(this.element.attr("aria-activedescendant"),!0);a&&a.find("> .jstree-anchor").focus()}},this)).on("mouseenter.jstree",".jstree-anchor",a.proxy(function(a){this.hover_node(a.currentTarget)},this)).on("mouseleave.jstree",".jstree-anchor",a.proxy(function(a){this.dehover_node(a.currentTarget)},this))},unbind:function(){this.element.off(".jstree"),a(i).off(".jstree-"+this._id)},trigger:function(a,b){b||(b={}),b.instance=this,this.element.triggerHandler(a.replace(".jstree","")+".jstree",b)},get_container:function(){return this.element},get_container_ul:function(){return this.element.children(".jstree-children").first()},get_string:function(b){var c=this.settings.core.strings;return a.isFunction(c)?c.call(this,b):c&&c[b]?c[b]:b},_firstChild:function(a){a=a?a.firstChild:null;while(null!==a&&1!==a.nodeType)a=a.nextSibling;return a},_nextSibling:function(a){a=a?a.nextSibling:null;while(null!==a&&1!==a.nodeType)a=a.nextSibling;return a},_previousSibling:function(a){a=a?a.previousSibling:null;while(null!==a&&1!==a.nodeType)a=a.previousSibling;return a},get_node:function(b,c){b&&b.id&&(b=b.id);var d;try{if(this._model.data[b])b=this._model.data[b];else if("string"==typeof b&&this._model.data[b.replace(/^#/,"")])b=this._model.data[b.replace(/^#/,"")];else if("string"==typeof b&&(d=a("#"+b.replace(a.jstree.idregex,"\\$&"),this.element)).length&&this._model.data[d.closest(".jstree-node").attr("id")])b=this._model.data[d.closest(".jstree-node").attr("id")];else if((d=a(b,this.element)).length&&this._model.data[d.closest(".jstree-node").attr("id")])b=this._model.data[d.closest(".jstree-node").attr("id")];else{if(!(d=a(b,this.element)).length||!d.hasClass("jstree"))return!1;b=this._model.data[a.jstree.root]}return c&&(b=b.id===a.jstree.root?this.element:a("#"+b.id.replace(a.jstree.idregex,"\\$&"),this.element)),b}catch(e){return!1}},get_path:function(b,c,d){if(b=b.parents?b:this.get_node(b),!b||b.id===a.jstree.root||!b.parents)return!1;var e,f,g=[];for(g.push(d?b.id:b.text),e=0,f=b.parents.length;f>e;e++)g.push(d?b.parents[e]:this.get_text(b.parents[e]));return g=g.reverse().slice(1),c?g.join(c):g},get_next_dom:function(b,c){var d;if(b=this.get_node(b,!0),b[0]===this.element[0]){d=this._firstChild(this.get_container_ul()[0]);while(d&&0===d.offsetHeight)d=this._nextSibling(d);return d?a(d):!1}if(!b||!b.length)return!1;if(c){d=b[0];do d=this._nextSibling(d);while(d&&0===d.offsetHeight);return d?a(d):!1}if(b.hasClass("jstree-open")){d=this._firstChild(b.children(".jstree-children")[0]);while(d&&0===d.offsetHeight)d=this._nextSibling(d);if(null!==d)return a(d)}d=b[0];do d=this._nextSibling(d);while(d&&0===d.offsetHeight);return null!==d?a(d):b.parentsUntil(".jstree",".jstree-node").nextAll(".jstree-node:visible").first()},get_prev_dom:function(b,c){var d;if(b=this.get_node(b,!0),b[0]===this.element[0]){d=this.get_container_ul()[0].lastChild;while(d&&0===d.offsetHeight)d=this._previousSibling(d);return d?a(d):!1}if(!b||!b.length)return!1;if(c){d=b[0];do d=this._previousSibling(d);while(d&&0===d.offsetHeight);return d?a(d):!1}d=b[0];do d=this._previousSibling(d);while(d&&0===d.offsetHeight);if(null!==d){b=a(d);while(b.hasClass("jstree-open"))b=b.children(".jstree-children").first().children(".jstree-node:visible:last");return b}return d=b[0].parentNode.parentNode,d&&d.className&&-1!==d.className.indexOf("jstree-node")?a(d):!1},get_parent:function(b){return b=this.get_node(b),b&&b.id!==a.jstree.root?b.parent:!1},get_children_dom:function(a){return a=this.get_node(a,!0),a[0]===this.element[0]?this.get_container_ul().children(".jstree-node"):a&&a.length?a.children(".jstree-children").children(".jstree-node"):!1},is_parent:function(a){return a=this.get_node(a),a&&(a.state.loaded===!1||a.children.length>0)},is_loaded:function(a){return a=this.get_node(a),a&&a.state.loaded},is_loading:function(a){return a=this.get_node(a),a&&a.state&&a.state.loading},is_open:function(a){return a=this.get_node(a),a&&a.state.opened},is_closed:function(a){return a=this.get_node(a),a&&this.is_parent(a)&&!a.state.opened},is_leaf:function(a){return!this.is_parent(a)},load_node:function(b,c){var d,e,f,g,h;if(a.isArray(b))return this._load_nodes(b.slice(),c),!0;if(b=this.get_node(b),!b)return c&&c.call(this,b,!1),!1;if(b.state.loaded){for(b.state.loaded=!1,f=0,g=b.parents.length;g>f;f++)this._model.data[b.parents[f]].children_d=a.vakata.array_filter(this._model.data[b.parents[f]].children_d,function(c){return-1===a.inArray(c,b.children_d)});for(d=0,e=b.children_d.length;e>d;d++)this._model.data[b.children_d[d]].state.selected&&(h=!0),delete this._model.data[b.children_d[d]];h&&(this._data.core.selected=a.vakata.array_filter(this._data.core.selected,function(c){return-1===a.inArray(c,b.children_d)})),b.children=[],b.children_d=[],h&&this.trigger("changed",{action:"load_node",node:b,selected:this._data.core.selected})}return b.state.failed=!1,b.state.loading=!0,this.get_node(b,!0).addClass("jstree-loading").attr("aria-busy",!0),this._load_node(b,a.proxy(function(a){b=this._model.data[b.id],b.state.loading=!1,b.state.loaded=a,b.state.failed=!b.state.loaded;var d=this.get_node(b,!0),e=0,f=0,g=this._model.data,h=!1;for(e=0,f=b.children.length;f>e;e++)if(g[b.children[e]]&&!g[b.children[e]].state.hidden){h=!0;break}b.state.loaded&&d&&d.length&&(d.removeClass("jstree-closed jstree-open jstree-leaf"),h?"#"!==b.id&&d.addClass(b.state.opened?"jstree-open":"jstree-closed"):d.addClass("jstree-leaf")),d.removeClass("jstree-loading").attr("aria-busy",!1),this.trigger("load_node",{node:b,status:a}),c&&c.call(this,b,a)},this)),!0},_load_nodes:function(a,b,c,d){var e=!0,f=function(){this._load_nodes(a,b,!0)},g=this._model.data,h,i,j=[];for(h=0,i=a.length;i>h;h++)g[a[h]]&&(!g[a[h]].state.loaded&&!g[a[h]].state.failed||!c&&d)&&(this.is_loading(a[h])||this.load_node(a[h],f),e=!1);if(e){for(h=0,i=a.length;i>h;h++)g[a[h]]&&g[a[h]].state.loaded&&j.push(a[h]);b&&!b.done&&(b.call(this,j),b.done=!0)}},load_all:function(b,c){if(b||(b=a.jstree.root),b=this.get_node(b),!b)return!1;var d=[],e=this._model.data,f=e[b.id].children_d,g,h;for(b.state&&!b.state.loaded&&d.push(b.id),g=0,h=f.length;h>g;g++)e[f[g]]&&e[f[g]].state&&!e[f[g]].state.loaded&&d.push(f[g]);d.length?this._load_nodes(d,function(){this.load_all(b,c)}):(c&&c.call(this,b),this.trigger("load_all",{node:b}))},_load_node:function(b,c){var d=this.settings.core.data,e,f=function g(){return 3!==this.nodeType&&8!==this.nodeType};return d?a.isFunction(d)?d.call(this,b,a.proxy(function(d){d===!1?c.call(this,!1):this["string"==typeof d?"_append_html_data":"_append_json_data"](b,"string"==typeof d?a(a.parseHTML(d)).filter(f):d,function(a){c.call(this,a)})},this)):"object"==typeof d?d.url?(d=a.extend(!0,{},d),a.isFunction(d.url)&&(d.url=d.url.call(this,b)),a.isFunction(d.data)&&(d.data=d.data.call(this,b)),a.ajax(d).done(a.proxy(function(d,e,g){var h=g.getResponseHeader("Content-Type");return h&&-1!==h.indexOf("json")||"object"==typeof d?this._append_json_data(b,d,function(a){c.call(this,a)}):h&&-1!==h.indexOf("html")||"string"==typeof d?this._append_html_data(b,a(a.parseHTML(d)).filter(f),function(a){c.call(this,a)}):(this._data.core.last_error={error:"ajax",plugin:"core",id:"core_04",reason:"Could not load node",data:JSON.stringify({id:b.id,xhr:g})},this.settings.core.error.call(this,this._data.core.last_error),c.call(this,!1))},this)).fail(a.proxy(function(a){c.call(this,!1),this._data.core.last_error={error:"ajax",plugin:"core",id:"core_04",reason:"Could not load node",data:JSON.stringify({id:b.id,xhr:a})},this.settings.core.error.call(this,this._data.core.last_error)},this))):(e=a.isArray(d)||a.isPlainObject(d)?JSON.parse(JSON.stringify(d)):d,b.id===a.jstree.root?this._append_json_data(b,e,function(a){c.call(this,a)}):(this._data.core.last_error={error:"nodata",plugin:"core",id:"core_05",reason:"Could not load node",data:JSON.stringify({id:b.id})},this.settings.core.error.call(this,this._data.core.last_error),c.call(this,!1))):"string"==typeof d?b.id===a.jstree.root?this._append_html_data(b,a(a.parseHTML(d)).filter(f),function(a){c.call(this,a)}):(this._data.core.last_error={error:"nodata",plugin:"core",id:"core_06",reason:"Could not load node",data:JSON.stringify({id:b.id})},this.settings.core.error.call(this,this._data.core.last_error),c.call(this,!1)):c.call(this,!1):b.id===a.jstree.root?this._append_html_data(b,this._data.core.original_container_html.clone(!0),function(a){c.call(this,a)}):c.call(this,!1)},_node_changed:function(a){a=this.get_node(a),a&&this._model.changed.push(a.id)},_append_html_data:function(b,c,d){b=this.get_node(b),b.children=[],b.children_d=[];var e=c.is("ul")?c.children():c,f=b.id,g=[],h=[],i=this._model.data,j=i[f],k=this._data.core.selected.length,l,m,n;for(e.each(a.proxy(function(b,c){l=this._parse_model_from_html(a(c),f,j.parents.concat()),l&&(g.push(l),h.push(l),i[l].children_d.length&&(h=h.concat(i[l].children_d)))},this)),j.children=g,j.children_d=h,m=0,n=j.parents.length;n>m;m++)i[j.parents[m]].children_d=i[j.parents[m]].children_d.concat(h);this.trigger("model",{nodes:h,parent:f}),f!==a.jstree.root?(this._node_changed(f),this.redraw()):(this.get_container_ul().children(".jstree-initial-node").remove(),this.redraw(!0)),this._data.core.selected.length!==k&&this.trigger("changed",{action:"model",selected:this._data.core.selected}),d.call(this,!0)},_append_json_data:function(b,c,d,e){if(null!==this.element){b=this.get_node(b),b.children=[],b.children_d=[],c.d&&(c=c.d,"string"==typeof c&&(c=JSON.parse(c))),a.isArray(c)||(c=[c]);var f=null,g={df:this._model.default_state,dat:c,par:b.id,m:this._model.data,t_id:this._id,t_cnt:this._cnt,sel:this._data.core.selected},h=function(a,b){a.data&&(a=a.data);var c=a.dat,d=a.par,e=[],f=[],g=[],h=a.df,i=a.t_id,j=a.t_cnt,k=a.m,l=k[d],m=a.sel,n,o,p,q,r=function(a,c,d){d=d?d.concat():[],c&&d.unshift(c);var e=a.id.toString(),f,i,j,l,m={id:e,text:a.text||"",icon:a.icon!==b?a.icon:!0,parent:c,parents:d,children:a.children||[],children_d:a.children_d||[],data:a.data,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(f in h)h.hasOwnProperty(f)&&(m.state[f]=h[f]);if(a&&a.data&&a.data.jstree&&a.data.jstree.icon&&(m.icon=a.data.jstree.icon),(m.icon===b||null===m.icon||""===m.icon)&&(m.icon=!0),a&&a.data&&(m.data=a.data,a.data.jstree))for(f in a.data.jstree)a.data.jstree.hasOwnProperty(f)&&(m.state[f]=a.data.jstree[f]);if(a&&"object"==typeof a.state)for(f in a.state)a.state.hasOwnProperty(f)&&(m.state[f]=a.state[f]);if(a&&"object"==typeof a.li_attr)for(f in a.li_attr)a.li_attr.hasOwnProperty(f)&&(m.li_attr[f]=a.li_attr[f]);if(m.li_attr.id||(m.li_attr.id=e),a&&"object"==typeof a.a_attr)for(f in a.a_attr)a.a_attr.hasOwnProperty(f)&&(m.a_attr[f]=a.a_attr[f]);for(a&&a.children&&a.children===!0&&(m.state.loaded=!1,m.children=[],m.children_d=[]),k[m.id]=m,f=0,i=m.children.length;i>f;f++)j=r(k[m.children[f]],m.id,d),l=k[j],m.children_d.push(j),l.children_d.length&&(m.children_d=m.children_d.concat(l.children_d));return delete a.data,delete a.children,k[m.id].original=a,m.state.selected&&g.push(m.id),m.id},s=function(a,c,d){d=d?d.concat():[],c&&d.unshift(c);var e=!1,f,l,m,n,o;do e="j"+i+"_"+ ++j;while(k[e]);o={id:!1,text:"string"==typeof a?a:"",icon:"object"==typeof a&&a.icon!==b?a.icon:!0,parent:c,parents:d,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(f in h)h.hasOwnProperty(f)&&(o.state[f]=h[f]);if(a&&a.id&&(o.id=a.id.toString()),a&&a.text&&(o.text=a.text),a&&a.data&&a.data.jstree&&a.data.jstree.icon&&(o.icon=a.data.jstree.icon),(o.icon===b||null===o.icon||""===o.icon)&&(o.icon=!0),a&&a.data&&(o.data=a.data,a.data.jstree))for(f in a.data.jstree)a.data.jstree.hasOwnProperty(f)&&(o.state[f]=a.data.jstree[f]);if(a&&"object"==typeof a.state)for(f in a.state)a.state.hasOwnProperty(f)&&(o.state[f]=a.state[f]);if(a&&"object"==typeof a.li_attr)for(f in a.li_attr)a.li_attr.hasOwnProperty(f)&&(o.li_attr[f]=a.li_attr[f]);if(o.li_attr.id&&!o.id&&(o.id=o.li_attr.id.toString()),o.id||(o.id=e),o.li_attr.id||(o.li_attr.id=o.id),a&&"object"==typeof a.a_attr)for(f in a.a_attr)a.a_attr.hasOwnProperty(f)&&(o.a_attr[f]=a.a_attr[f]);if(a&&a.children&&a.children.length){for(f=0,l=a.children.length;l>f;f++)m=s(a.children[f],o.id,d),n=k[m],o.children.push(m),n.children_d.length&&(o.children_d=o.children_d.concat(n.children_d));o.children_d=o.children_d.concat(o.children)}return a&&a.children&&a.children===!0&&(o.state.loaded=!1,o.children=[],o.children_d=[]),delete a.data,delete a.children,o.original=a,k[o.id]=o,o.state.selected&&g.push(o.id),o.id};if(c.length&&c[0].id!==b&&c[0].parent!==b){for(o=0,p=c.length;p>o;o++)c[o].children||(c[o].children=[]),k[c[o].id.toString()]=c[o];for(o=0,p=c.length;p>o;o++)k[c[o].parent.toString()].children.push(c[o].id.toString()),l.children_d.push(c[o].id.toString());for(o=0,p=l.children.length;p>o;o++)n=r(k[l.children[o]],d,l.parents.concat()),f.push(n),k[n].children_d.length&&(f=f.concat(k[n].children_d));for(o=0,p=l.parents.length;p>o;o++)k[l.parents[o]].children_d=k[l.parents[o]].children_d.concat(f);q={cnt:j,mod:k,sel:m,par:d,dpc:f,add:g}}else{for(o=0,p=c.length;p>o;o++)n=s(c[o],d,l.parents.concat()),n&&(e.push(n),f.push(n),k[n].children_d.length&&(f=f.concat(k[n].children_d)));for(l.children=e,l.children_d=f,o=0,p=l.parents.length;p>o;o++)k[l.parents[o]].children_d=k[l.parents[o]].children_d.concat(f);q={cnt:j,mod:k,sel:m,par:d,dpc:f,add:g}}return"undefined"!=typeof window&&"undefined"!=typeof window.document?q:void postMessage(q)},i=function(b,c){if(null!==this.element){this._cnt=b.cnt;var e,f=this._model.data;for(e in f)f.hasOwnProperty(e)&&f[e].state&&f[e].state.loading&&b.mod[e]&&(b.mod[e].state.loading=!0);if(this._model.data=b.mod,c){var g,h=b.add,i=b.sel,j=this._data.core.selected.slice();if(f=this._model.data,i.length!==j.length||a.vakata.array_unique(i.concat(j)).length!==i.length){for(e=0,g=i.length;g>e;e++)-1===a.inArray(i[e],h)&&-1===a.inArray(i[e],j)&&(f[i[e]].state.selected=!1);for(e=0,g=j.length;g>e;e++)-1===a.inArray(j[e],i)&&(f[j[e]].state.selected=!0)}}b.add.length&&(this._data.core.selected=this._data.core.selected.concat(b.add)),this.trigger("model",{nodes:b.dpc,parent:b.par}),b.par!==a.jstree.root?(this._node_changed(b.par),this.redraw()):this.redraw(!0),b.add.length&&this.trigger("changed",{action:"model",selected:this._data.core.selected}),d.call(this,!0)}};if(this.settings.core.worker&&window.Blob&&window.URL&&window.Worker)try{null===this._wrk&&(this._wrk=window.URL.createObjectURL(new window.Blob(["self.onmessage = "+h.toString()],{type:"text/javascript"}))),!this._data.core.working||e?(this._data.core.working=!0,f=new window.Worker(this._wrk),f.onmessage=a.proxy(function(a){i.call(this,a.data,!0);try{f.terminate(),f=null}catch(b){}this._data.core.worker_queue.length?this._append_json_data.apply(this,this._data.core.worker_queue.shift()):this._data.core.working=!1},this),g.par?f.postMessage(g):this._data.core.worker_queue.length?this._append_json_data.apply(this,this._data.core.worker_queue.shift()):this._data.core.working=!1):this._data.core.worker_queue.push([b,c,d,!0])}catch(j){i.call(this,h(g),!1),this._data.core.worker_queue.length?this._append_json_data.apply(this,this._data.core.worker_queue.shift()):this._data.core.working=!1}else i.call(this,h(g),!1)}},_parse_model_from_html:function(c,d,e){e=e?[].concat(e):[],d&&e.unshift(d);var f,g,h=this._model.data,i={id:!1,text:!1,icon:!0,parent:d,parents:e,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1},j,k,l;for(j in this._model.default_state)this._model.default_state.hasOwnProperty(j)&&(i.state[j]=this._model.default_state[j]);if(k=a.vakata.attributes(c,!0),a.each(k,function(b,c){return c=a.trim(c),c.length?(i.li_attr[b]=c,void("id"===b&&(i.id=c.toString()))):!0}),k=c.children("a").first(),k.length&&(k=a.vakata.attributes(k,!0),a.each(k,function(b,c){c=a.trim(c),c.length&&(i.a_attr[b]=c)})),k=c.children("a").first().length?c.children("a").first().clone():c.clone(),k.children("ins, i, ul").remove(),k=k.html(),k=a("
      ").html(k),i.text=this.settings.core.force_text?k.text():k.html(),k=c.data(),i.data=k?a.extend(!0,{},k):null,i.state.opened=c.hasClass("jstree-open"),i.state.selected=c.children("a").hasClass("jstree-clicked"),i.state.disabled=c.children("a").hasClass("jstree-disabled"),i.data&&i.data.jstree)for(j in i.data.jstree)i.data.jstree.hasOwnProperty(j)&&(i.state[j]=i.data.jstree[j]);k=c.children("a").children(".jstree-themeicon"),k.length&&(i.icon=k.hasClass("jstree-themeicon-hidden")?!1:k.attr("rel")),i.state.icon!==b&&(i.icon=i.state.icon),(i.icon===b||null===i.icon||""===i.icon)&&(i.icon=!0),k=c.children("ul").children("li");do l="j"+this._id+"_"+ ++this._cnt;while(h[l]);return i.id=i.li_attr.id?i.li_attr.id.toString():l,k.length?(k.each(a.proxy(function(b,c){f=this._parse_model_from_html(a(c),i.id,e),g=this._model.data[f],i.children.push(f),g.children_d.length&&(i.children_d=i.children_d.concat(g.children_d))},this)),i.children_d=i.children_d.concat(i.children)):c.hasClass("jstree-closed")&&(i.state.loaded=!1),i.li_attr["class"]&&(i.li_attr["class"]=i.li_attr["class"].replace("jstree-closed","").replace("jstree-open","")),i.a_attr["class"]&&(i.a_attr["class"]=i.a_attr["class"].replace("jstree-clicked","").replace("jstree-disabled","")),h[i.id]=i,i.state.selected&&this._data.core.selected.push(i.id),i.id},_parse_model_from_flat_json:function(a,c,d){d=d?d.concat():[],c&&d.unshift(c);var e=a.id.toString(),f=this._model.data,g=this._model.default_state,h,i,j,k,l={id:e,text:a.text||"",icon:a.icon!==b?a.icon:!0,parent:c,parents:d,children:a.children||[],children_d:a.children_d||[],data:a.data,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(h in g)g.hasOwnProperty(h)&&(l.state[h]=g[h]);if(a&&a.data&&a.data.jstree&&a.data.jstree.icon&&(l.icon=a.data.jstree.icon),(l.icon===b||null===l.icon||""===l.icon)&&(l.icon=!0),a&&a.data&&(l.data=a.data,a.data.jstree))for(h in a.data.jstree)a.data.jstree.hasOwnProperty(h)&&(l.state[h]=a.data.jstree[h]);if(a&&"object"==typeof a.state)for(h in a.state)a.state.hasOwnProperty(h)&&(l.state[h]=a.state[h]);if(a&&"object"==typeof a.li_attr)for(h in a.li_attr)a.li_attr.hasOwnProperty(h)&&(l.li_attr[h]=a.li_attr[h]);if(l.li_attr.id||(l.li_attr.id=e),a&&"object"==typeof a.a_attr)for(h in a.a_attr)a.a_attr.hasOwnProperty(h)&&(l.a_attr[h]=a.a_attr[h]);for(a&&a.children&&a.children===!0&&(l.state.loaded=!1,l.children=[],l.children_d=[]),f[l.id]=l,h=0,i=l.children.length;i>h;h++)j=this._parse_model_from_flat_json(f[l.children[h]],l.id,d),k=f[j],l.children_d.push(j),k.children_d.length&&(l.children_d=l.children_d.concat(k.children_d));return delete a.data,delete a.children,f[l.id].original=a,l.state.selected&&this._data.core.selected.push(l.id),l.id},_parse_model_from_json:function(a,c,d){d=d?d.concat():[],c&&d.unshift(c);var e=!1,f,g,h,i,j=this._model.data,k=this._model.default_state,l;do e="j"+this._id+"_"+ ++this._cnt;while(j[e]);l={id:!1,text:"string"==typeof a?a:"",icon:"object"==typeof a&&a.icon!==b?a.icon:!0,parent:c,parents:d,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(f in k)k.hasOwnProperty(f)&&(l.state[f]=k[f]);if(a&&a.id&&(l.id=a.id.toString()),a&&a.text&&(l.text=a.text),a&&a.data&&a.data.jstree&&a.data.jstree.icon&&(l.icon=a.data.jstree.icon),(l.icon===b||null===l.icon||""===l.icon)&&(l.icon=!0),a&&a.data&&(l.data=a.data,a.data.jstree))for(f in a.data.jstree)a.data.jstree.hasOwnProperty(f)&&(l.state[f]=a.data.jstree[f]);if(a&&"object"==typeof a.state)for(f in a.state)a.state.hasOwnProperty(f)&&(l.state[f]=a.state[f]);if(a&&"object"==typeof a.li_attr)for(f in a.li_attr)a.li_attr.hasOwnProperty(f)&&(l.li_attr[f]=a.li_attr[f]);if(l.li_attr.id&&!l.id&&(l.id=l.li_attr.id.toString()),l.id||(l.id=e),l.li_attr.id||(l.li_attr.id=l.id),a&&"object"==typeof a.a_attr)for(f in a.a_attr)a.a_attr.hasOwnProperty(f)&&(l.a_attr[f]=a.a_attr[f]);if(a&&a.children&&a.children.length){for(f=0,g=a.children.length;g>f;f++)h=this._parse_model_from_json(a.children[f],l.id,d),i=j[h],l.children.push(h),i.children_d.length&&(l.children_d=l.children_d.concat(i.children_d));l.children_d=l.children_d.concat(l.children)}return a&&a.children&&a.children===!0&&(l.state.loaded=!1,l.children=[],l.children_d=[]),delete a.data,delete a.children,l.original=a,j[l.id]=l,l.state.selected&&this._data.core.selected.push(l.id),l.id},_redraw:function(){var b=this._model.force_full_redraw?this._model.data[a.jstree.root].children.concat([]):this._model.changed.concat([]),c=i.createElement("UL"),d,e,f,g=this._data.core.focused;for(e=0,f=b.length;f>e;e++)d=this.redraw_node(b[e],!0,this._model.force_full_redraw),d&&this._model.force_full_redraw&&c.appendChild(d);this._model.force_full_redraw&&(c.className=this.get_container_ul()[0].className,c.setAttribute("role","group"),this.element.empty().append(c)),null!==g&&(d=this.get_node(g,!0),d&&d.length&&d.children(".jstree-anchor")[0]!==i.activeElement?d.children(".jstree-anchor").focus():this._data.core.focused=null),this._model.force_full_redraw=!1,this._model.changed=[],this.trigger("redraw",{nodes:b})},redraw:function(a){a&&(this._model.force_full_redraw=!0),this._redraw()},draw_children:function(b){var c=this.get_node(b),d=!1,e=!1,f=!1,g=i;if(!c)return!1;if(c.id===a.jstree.root)return this.redraw(!0);if(b=this.get_node(b,!0),!b||!b.length)return!1;if(b.children(".jstree-children").remove(),b=b[0],c.children.length&&c.state.loaded){for(f=g.createElement("UL"),f.setAttribute("role","group"),f.className="jstree-children",d=0,e=c.children.length;e>d;d++)f.appendChild(this.redraw_node(c.children[d],!0,!0));b.appendChild(f)}},redraw_node:function(b,c,d,e){var f=this.get_node(b),g=!1,h=!1,j=!1,k=!1,l=!1,m=!1,n="",o=i,p=this._model.data,q=!1,r=!1,s=null,t=0,u=0,v=!1,w=!1; -if(!f)return!1;if(f.id===a.jstree.root)return this.redraw(!0);if(c=c||0===f.children.length,b=i.querySelector?this.element[0].querySelector("#"+(-1!=="0123456789".indexOf(f.id[0])?"\\3"+f.id[0]+" "+f.id.substr(1).replace(a.jstree.idregex,"\\$&"):f.id.replace(a.jstree.idregex,"\\$&"))):i.getElementById(f.id))b=a(b),d||(g=b.parent().parent()[0],g===this.element[0]&&(g=null),h=b.index()),c||!f.children.length||b.children(".jstree-children").length||(c=!0),c||(j=b.children(".jstree-children")[0]),q=b.children(".jstree-anchor")[0]===i.activeElement,b.remove();else if(c=!0,!d){if(g=f.parent!==a.jstree.root?a("#"+f.parent.replace(a.jstree.idregex,"\\$&"),this.element)[0]:null,!(null===g||g&&p[f.parent].state.opened))return!1;h=a.inArray(f.id,null===g?p[a.jstree.root].children:p[f.parent].children)}b=this._data.core.node.cloneNode(!0),n="jstree-node ";for(k in f.li_attr)if(f.li_attr.hasOwnProperty(k)){if("id"===k)continue;"class"!==k?b.setAttribute(k,f.li_attr[k]):n+=f.li_attr[k]}for(f.a_attr.id||(f.a_attr.id=f.id+"_anchor"),b.setAttribute("aria-selected",!!f.state.selected),b.setAttribute("aria-level",f.parents.length),b.setAttribute("aria-labelledby",f.a_attr.id),f.state.disabled&&b.setAttribute("aria-disabled",!0),k=0,l=f.children.length;l>k;k++)if(!p[f.children[k]].state.hidden){v=!0;break}if(null!==f.parent&&p[f.parent]&&!f.state.hidden&&(k=a.inArray(f.id,p[f.parent].children),w=f.id,-1!==k))for(k++,l=p[f.parent].children.length;l>k;k++)if(p[p[f.parent].children[k]].state.hidden||(w=p[f.parent].children[k]),w!==f.id)break;f.state.hidden&&(n+=" jstree-hidden"),f.state.loaded&&!v?n+=" jstree-leaf":(n+=f.state.opened&&f.state.loaded?" jstree-open":" jstree-closed",b.setAttribute("aria-expanded",f.state.opened&&f.state.loaded)),w===f.id&&(n+=" jstree-last"),b.id=f.id,b.className=n,n=(f.state.selected?" jstree-clicked":"")+(f.state.disabled?" jstree-disabled":"");for(l in f.a_attr)if(f.a_attr.hasOwnProperty(l)){if("href"===l&&"#"===f.a_attr[l])continue;"class"!==l?b.childNodes[1].setAttribute(l,f.a_attr[l]):n+=" "+f.a_attr[l]}if(n.length&&(b.childNodes[1].className="jstree-anchor "+n),(f.icon&&f.icon!==!0||f.icon===!1)&&(f.icon===!1?b.childNodes[1].childNodes[0].className+=" jstree-themeicon-hidden":-1===f.icon.indexOf("/")&&-1===f.icon.indexOf(".")?b.childNodes[1].childNodes[0].className+=" "+f.icon+" jstree-themeicon-custom":(b.childNodes[1].childNodes[0].style.backgroundImage='url("'+f.icon+'")',b.childNodes[1].childNodes[0].style.backgroundPosition="center center",b.childNodes[1].childNodes[0].style.backgroundSize="auto",b.childNodes[1].childNodes[0].className+=" jstree-themeicon-custom")),this.settings.core.force_text?b.childNodes[1].appendChild(o.createTextNode(f.text)):b.childNodes[1].innerHTML+=f.text,c&&f.children.length&&(f.state.opened||e)&&f.state.loaded){for(m=o.createElement("UL"),m.setAttribute("role","group"),m.className="jstree-children",k=0,l=f.children.length;l>k;k++)m.appendChild(this.redraw_node(f.children[k],c,!0));b.appendChild(m)}if(j&&b.appendChild(j),!d){for(g||(g=this.element[0]),k=0,l=g.childNodes.length;l>k;k++)if(g.childNodes[k]&&g.childNodes[k].className&&-1!==g.childNodes[k].className.indexOf("jstree-children")){s=g.childNodes[k];break}s||(s=o.createElement("UL"),s.setAttribute("role","group"),s.className="jstree-children",g.appendChild(s)),g=s,hf;f++)this.open_node(c[f],d,e);return!0}return c=this.get_node(c),c&&c.id!==a.jstree.root?(e=e===b?this.settings.core.animation:e,this.is_closed(c)?this.is_loaded(c)?(h=this.get_node(c,!0),i=this,h.length&&(e&&h.children(".jstree-children").length&&h.children(".jstree-children").stop(!0,!0),c.children.length&&!this._firstChild(h.children(".jstree-children")[0])&&this.draw_children(c),e?(this.trigger("before_open",{node:c}),h.children(".jstree-children").css("display","none").end().removeClass("jstree-closed").addClass("jstree-open").attr("aria-expanded",!0).children(".jstree-children").stop(!0,!0).slideDown(e,function(){this.style.display="",i.element&&i.trigger("after_open",{node:c})})):(this.trigger("before_open",{node:c}),h[0].className=h[0].className.replace("jstree-closed","jstree-open"),h[0].setAttribute("aria-expanded",!0))),c.state.opened=!0,d&&d.call(this,c,!0),h.length||this.trigger("before_open",{node:c}),this.trigger("open_node",{node:c}),e&&h.length||this.trigger("after_open",{node:c}),!0):this.is_loading(c)?setTimeout(a.proxy(function(){this.open_node(c,d,e)},this),500):void this.load_node(c,function(a,b){return b?this.open_node(a,d,e):d?d.call(this,a,!1):!1}):(d&&d.call(this,c,!1),!1)):!1},_open_to:function(b){if(b=this.get_node(b),!b||b.id===a.jstree.root)return!1;var c,d,e=b.parents;for(c=0,d=e.length;d>c;c+=1)c!==a.jstree.root&&this.open_node(e[c],!1,0);return a("#"+b.id.replace(a.jstree.idregex,"\\$&"),this.element)},close_node:function(c,d){var e,f,g,h;if(a.isArray(c)){for(c=c.slice(),e=0,f=c.length;f>e;e++)this.close_node(c[e],d);return!0}return c=this.get_node(c),c&&c.id!==a.jstree.root?this.is_closed(c)?!1:(d=d===b?this.settings.core.animation:d,g=this,h=this.get_node(c,!0),c.state.opened=!1,this.trigger("close_node",{node:c}),void(h.length?d?h.children(".jstree-children").attr("style","display:block !important").end().removeClass("jstree-open").addClass("jstree-closed").attr("aria-expanded",!1).children(".jstree-children").stop(!0,!0).slideUp(d,function(){this.style.display="",h.children(".jstree-children").remove(),g.element&&g.trigger("after_close",{node:c})}):(h[0].className=h[0].className.replace("jstree-open","jstree-closed"),h.attr("aria-expanded",!1).children(".jstree-children").remove(),this.trigger("after_close",{node:c})):this.trigger("after_close",{node:c}))):!1},toggle_node:function(b){var c,d;if(a.isArray(b)){for(b=b.slice(),c=0,d=b.length;d>c;c++)this.toggle_node(b[c]);return!0}return this.is_closed(b)?this.open_node(b):this.is_open(b)?this.close_node(b):void 0},open_all:function(b,c,d){if(b||(b=a.jstree.root),b=this.get_node(b),!b)return!1;var e=b.id===a.jstree.root?this.get_container_ul():this.get_node(b,!0),f,g,h;if(!e.length){for(f=0,g=b.children_d.length;g>f;f++)this.is_closed(this._model.data[b.children_d[f]])&&(this._model.data[b.children_d[f]].state.opened=!0);return this.trigger("open_all",{node:b})}d=d||e,h=this,e=this.is_closed(b)?e.find(".jstree-closed").addBack():e.find(".jstree-closed"),e.each(function(){h.open_node(this,function(a,b){b&&this.is_parent(a)&&this.open_all(a,c,d)},c||0)}),0===d.find(".jstree-closed").length&&this.trigger("open_all",{node:this.get_node(d)})},close_all:function(b,c){if(b||(b=a.jstree.root),b=this.get_node(b),!b)return!1;var d=b.id===a.jstree.root?this.get_container_ul():this.get_node(b,!0),e=this,f,g;for(d.length&&(d=this.is_open(b)?d.find(".jstree-open").addBack():d.find(".jstree-open"),a(d.get().reverse()).each(function(){e.close_node(this,c||0)})),f=0,g=b.children_d.length;g>f;f++)this._model.data[b.children_d[f]].state.opened=!1;this.trigger("close_all",{node:b})},is_disabled:function(a){return a=this.get_node(a),a&&a.state&&a.state.disabled},enable_node:function(b){var c,d;if(a.isArray(b)){for(b=b.slice(),c=0,d=b.length;d>c;c++)this.enable_node(b[c]);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(b.state.disabled=!1,this.get_node(b,!0).children(".jstree-anchor").removeClass("jstree-disabled").attr("aria-disabled",!1),void this.trigger("enable_node",{node:b})):!1},disable_node:function(b){var c,d;if(a.isArray(b)){for(b=b.slice(),c=0,d=b.length;d>c;c++)this.disable_node(b[c]);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(b.state.disabled=!0,this.get_node(b,!0).children(".jstree-anchor").addClass("jstree-disabled").attr("aria-disabled",!0),void this.trigger("disable_node",{node:b})):!1},is_hidden:function(a){return a=this.get_node(a),a.state.hidden===!0},hide_node:function(b,c){var d,e;if(a.isArray(b)){for(b=b.slice(),d=0,e=b.length;e>d;d++)this.hide_node(b[d],!0);return c||this.redraw(),!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?void(b.state.hidden||(b.state.hidden=!0,this._node_changed(b.parent),c||this.redraw(),this.trigger("hide_node",{node:b}))):!1},show_node:function(b,c){var d,e;if(a.isArray(b)){for(b=b.slice(),d=0,e=b.length;e>d;d++)this.show_node(b[d],!0);return c||this.redraw(),!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?void(b.state.hidden&&(b.state.hidden=!1,this._node_changed(b.parent),c||this.redraw(),this.trigger("show_node",{node:b}))):!1},hide_all:function(b){var c,d=this._model.data,e=[];for(c in d)d.hasOwnProperty(c)&&c!==a.jstree.root&&!d[c].state.hidden&&(d[c].state.hidden=!0,e.push(c));return this._model.force_full_redraw=!0,b||this.redraw(),this.trigger("hide_all",{nodes:e}),e},show_all:function(b){var c,d=this._model.data,e=[];for(c in d)d.hasOwnProperty(c)&&c!==a.jstree.root&&d[c].state.hidden&&(d[c].state.hidden=!1,e.push(c));return this._model.force_full_redraw=!0,b||this.redraw(),this.trigger("show_all",{nodes:e}),e},activate_node:function(a,c){if(this.is_disabled(a))return!1;if(c&&"object"==typeof c||(c={}),this._data.core.last_clicked=this._data.core.last_clicked&&this._data.core.last_clicked.id!==b?this.get_node(this._data.core.last_clicked.id):null,this._data.core.last_clicked&&!this._data.core.last_clicked.state.selected&&(this._data.core.last_clicked=null),!this._data.core.last_clicked&&this._data.core.selected.length&&(this._data.core.last_clicked=this.get_node(this._data.core.selected[this._data.core.selected.length-1])),this.settings.core.multiple&&(c.metaKey||c.ctrlKey||c.shiftKey)&&(!c.shiftKey||this._data.core.last_clicked&&this.get_parent(a)&&this.get_parent(a)===this._data.core.last_clicked.parent))if(c.shiftKey){var d=this.get_node(a).id,e=this._data.core.last_clicked.id,f=this.get_node(this._data.core.last_clicked.parent).children,g=!1,h,i;for(h=0,i=f.length;i>h;h+=1)f[h]===d&&(g=!g),f[h]===e&&(g=!g),this.is_disabled(f[h])||!g&&f[h]!==d&&f[h]!==e?this.deselect_node(f[h],!0,c):this.is_hidden(f[h])||this.select_node(f[h],!0,!1,c);this.trigger("changed",{action:"select_node",node:this.get_node(a),selected:this._data.core.selected,event:c})}else this.is_selected(a)?this.deselect_node(a,!1,c):this.select_node(a,!1,!1,c);else!this.settings.core.multiple&&(c.metaKey||c.ctrlKey||c.shiftKey)&&this.is_selected(a)?this.deselect_node(a,!1,c):(this.deselect_all(!0),this.select_node(a,!1,!1,c),this._data.core.last_clicked=this.get_node(a));this.trigger("activate_node",{node:this.get_node(a),event:c})},hover_node:function(a){if(a=this.get_node(a,!0),!a||!a.length||a.children(".jstree-hovered").length)return!1;var b=this.element.find(".jstree-hovered"),c=this.element;b&&b.length&&this.dehover_node(b),a.children(".jstree-anchor").addClass("jstree-hovered"),this.trigger("hover_node",{node:this.get_node(a)}),setTimeout(function(){c.attr("aria-activedescendant",a[0].id)},0)},dehover_node:function(a){return a=this.get_node(a,!0),a&&a.length&&a.children(".jstree-hovered").length?(a.children(".jstree-anchor").removeClass("jstree-hovered"),void this.trigger("dehover_node",{node:this.get_node(a)})):!1},select_node:function(b,c,d,e){var f,g,h,i;if(a.isArray(b)){for(b=b.slice(),g=0,h=b.length;h>g;g++)this.select_node(b[g],c,d,e);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(f=this.get_node(b,!0),void(b.state.selected||(b.state.selected=!0,this._data.core.selected.push(b.id),d||(f=this._open_to(b)),f&&f.length&&f.attr("aria-selected",!0).children(".jstree-anchor").addClass("jstree-clicked"),this.trigger("select_node",{node:b,selected:this._data.core.selected,event:e}),c||this.trigger("changed",{action:"select_node",node:b,selected:this._data.core.selected,event:e})))):!1},deselect_node:function(b,c,d){var e,f,g;if(a.isArray(b)){for(b=b.slice(),e=0,f=b.length;f>e;e++)this.deselect_node(b[e],c,d);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(g=this.get_node(b,!0),void(b.state.selected&&(b.state.selected=!1,this._data.core.selected=a.vakata.array_remove_item(this._data.core.selected,b.id),g.length&&g.attr("aria-selected",!1).children(".jstree-anchor").removeClass("jstree-clicked"),this.trigger("deselect_node",{node:b,selected:this._data.core.selected,event:d}),c||this.trigger("changed",{action:"deselect_node",node:b,selected:this._data.core.selected,event:d})))):!1},select_all:function(b){var c=this._data.core.selected.concat([]),d,e;for(this._data.core.selected=this._model.data[a.jstree.root].children_d.concat(),d=0,e=this._data.core.selected.length;e>d;d++)this._model.data[this._data.core.selected[d]]&&(this._model.data[this._data.core.selected[d]].state.selected=!0);this.redraw(!0),this.trigger("select_all",{selected:this._data.core.selected}),b||this.trigger("changed",{action:"select_all",selected:this._data.core.selected,old_selection:c})},deselect_all:function(a){var b=this._data.core.selected.concat([]),c,d;for(c=0,d=this._data.core.selected.length;d>c;c++)this._model.data[this._data.core.selected[c]]&&(this._model.data[this._data.core.selected[c]].state.selected=!1);this._data.core.selected=[],this.element.find(".jstree-clicked").removeClass("jstree-clicked").parent().attr("aria-selected",!1),this.trigger("deselect_all",{selected:this._data.core.selected,node:b}),a||this.trigger("changed",{action:"deselect_all",selected:this._data.core.selected,old_selection:b})},is_selected:function(b){return b=this.get_node(b),b&&b.id!==a.jstree.root?b.state.selected:!1},get_selected:function(b){return b?a.map(this._data.core.selected,a.proxy(function(a){return this.get_node(a)},this)):this._data.core.selected.slice()},get_top_selected:function(b){var c=this.get_selected(!0),d={},e,f,g,h;for(e=0,f=c.length;f>e;e++)d[c[e].id]=c[e];for(e=0,f=c.length;f>e;e++)for(g=0,h=c[e].children_d.length;h>g;g++)d[c[e].children_d[g]]&&delete d[c[e].children_d[g]];c=[];for(e in d)d.hasOwnProperty(e)&&c.push(e);return b?a.map(c,a.proxy(function(a){return this.get_node(a)},this)):c},get_bottom_selected:function(b){var c=this.get_selected(!0),d=[],e,f;for(e=0,f=c.length;f>e;e++)c[e].children.length||d.push(c[e].id);return b?a.map(d,a.proxy(function(a){return this.get_node(a)},this)):d},get_state:function(){var b={core:{open:[],scroll:{left:this.element.scrollLeft(),top:this.element.scrollTop()},selected:[]}},c;for(c in this._model.data)this._model.data.hasOwnProperty(c)&&c!==a.jstree.root&&(this._model.data[c].state.opened&&b.core.open.push(c),this._model.data[c].state.selected&&b.core.selected.push(c));return b},set_state:function(c,d){if(c){if(c.core){var e,f,g,h,i;if(c.core.open)return a.isArray(c.core.open)&&c.core.open.length?this._load_nodes(c.core.open,function(a){this.open_node(a,!1,0),delete c.core.open,this.set_state(c,d)}):(delete c.core.open,this.set_state(c,d)),!1;if(c.core.scroll)return c.core.scroll&&c.core.scroll.left!==b&&this.element.scrollLeft(c.core.scroll.left),c.core.scroll&&c.core.scroll.top!==b&&this.element.scrollTop(c.core.scroll.top),delete c.core.scroll,this.set_state(c,d),!1;if(c.core.selected)return h=this,this.deselect_all(),a.each(c.core.selected,function(a,b){h.select_node(b,!1,!0)}),delete c.core.selected,this.set_state(c,d),!1;for(i in c)c.hasOwnProperty(i)&&"core"!==i&&-1===a.inArray(i,this.settings.plugins)&&delete c[i];if(a.isEmptyObject(c.core))return delete c.core,this.set_state(c,d),!1}return a.isEmptyObject(c)?(c=null,d&&d.call(this),this.trigger("set_state"),!1):!0}return!1},refresh:function(b,c){this._data.core.state=c===!0?{}:this.get_state(),c&&a.isFunction(c)&&(this._data.core.state=c.call(this,this._data.core.state)),this._cnt=0,this._model.data={},this._model.data[a.jstree.root]={id:a.jstree.root,parent:null,parents:[],children:[],children_d:[],state:{loaded:!1}},this._data.core.selected=[],this._data.core.last_clicked=null,this._data.core.focused=null;var d=this.get_container_ul()[0].className;b||(this.element.html(""),this.element.attr("aria-activedescendant","j"+this._id+"_loading")),this.load_node(a.jstree.root,function(b,c){c&&(this.get_container_ul()[0].className=d,this._firstChild(this.get_container_ul()[0])&&this.element.attr("aria-activedescendant",this._firstChild(this.get_container_ul()[0]).id),this.set_state(a.extend(!0,{},this._data.core.state),function(){this.trigger("refresh")})),this._data.core.state=null})},refresh_node:function(b){if(b=this.get_node(b),!b||b.id===a.jstree.root)return!1;var c=[],d=[],e=this._data.core.selected.concat([]);d.push(b.id),b.state.opened===!0&&c.push(b.id),this.get_node(b,!0).find(".jstree-open").each(function(){d.push(this.id),c.push(this.id)}),this._load_nodes(d,a.proxy(function(a){this.open_node(c,!1,0),this.select_node(e),this.trigger("refresh_node",{node:b,nodes:a})},this),!1,!0)},set_id:function(b,c){if(b=this.get_node(b),!b||b.id===a.jstree.root)return!1;var d,e,f=this._model.data,g=b.id;for(c=c.toString(),f[b.parent].children[a.inArray(b.id,f[b.parent].children)]=c,d=0,e=b.parents.length;e>d;d++)f[b.parents[d]].children_d[a.inArray(b.id,f[b.parents[d]].children_d)]=c;for(d=0,e=b.children.length;e>d;d++)f[b.children[d]].parent=c;for(d=0,e=b.children_d.length;e>d;d++)f[b.children_d[d]].parents[a.inArray(b.id,f[b.children_d[d]].parents)]=c;return d=a.inArray(b.id,this._data.core.selected),-1!==d&&(this._data.core.selected[d]=c),d=this.get_node(b.id,!0),d&&(d.attr("id",c),this.element.attr("aria-activedescendant")===b.id&&this.element.attr("aria-activedescendant",c)),delete f[b.id],b.id=c,b.li_attr.id=c,f[c]=b,this.trigger("set_id",{node:b,"new":b.id,old:g}),!0},get_text:function(b){return b=this.get_node(b),b&&b.id!==a.jstree.root?b.text:!1},set_text:function(b,c){var d,e;if(a.isArray(b)){for(b=b.slice(),d=0,e=b.length;e>d;d++)this.set_text(b[d],c);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(b.text=c,this.get_node(b,!0).length&&this.redraw_node(b.id),this.trigger("set_text",{obj:b,text:c}),!0):!1},get_json:function(b,c,d){if(b=this.get_node(b||a.jstree.root),!b)return!1;c&&c.flat&&!d&&(d=[]);var e={id:b.id,text:b.text,icon:this.get_icon(b),li_attr:a.extend(!0,{},b.li_attr),a_attr:a.extend(!0,{},b.a_attr),state:{},data:c&&c.no_data?!1:a.extend(!0,{},b.data)},f,g;if(c&&c.flat?e.parent=b.parent:e.children=[],c&&c.no_state)delete e.state;else for(f in b.state)b.state.hasOwnProperty(f)&&(e.state[f]=b.state[f]);if(c&&c.no_li_attr&&delete e.li_attr,c&&c.no_a_attr&&delete e.a_attr,c&&c.no_id&&(delete e.id,e.li_attr&&e.li_attr.id&&delete e.li_attr.id,e.a_attr&&e.a_attr.id&&delete e.a_attr.id),c&&c.flat&&b.id!==a.jstree.root&&d.push(e),!c||!c.no_children)for(f=0,g=b.children.length;g>f;f++)c&&c.flat?this.get_json(b.children[f],c,d):e.children.push(this.get_json(b.children[f],c));return c&&c.flat?d:b.id===a.jstree.root?e.children:e},create_node:function(c,d,e,f,g){if(null===c&&(c=a.jstree.root),c=this.get_node(c),!c)return!1;if(e=e===b?"last":e,!e.toString().match(/^(before|after)$/)&&!g&&!this.is_loaded(c))return this.load_node(c,function(){this.create_node(c,d,e,f,!0)});d||(d={text:this.get_string("New node")}),"string"==typeof d&&(d={text:d}),d.text===b&&(d.text=this.get_string("New node"));var h,i,j,k;switch(c.id===a.jstree.root&&("before"===e&&(e="first"),"after"===e&&(e="last")),e){case"before":h=this.get_node(c.parent),e=a.inArray(c.id,h.children),c=h;break;case"after":h=this.get_node(c.parent),e=a.inArray(c.id,h.children)+1,c=h;break;case"inside":case"first":e=0;break;case"last":e=c.children.length;break;default:e||(e=0)}if(e>c.children.length&&(e=c.children.length),d.id||(d.id=!0),!this.check("create_node",d,c,e))return this.settings.core.error.call(this,this._data.core.last_error),!1;if(d.id===!0&&delete d.id,d=this._parse_model_from_json(d,c.id,c.parents.concat()),!d)return!1;for(h=this.get_node(d),i=[],i.push(d),i=i.concat(h.children_d),this.trigger("model",{nodes:i,parent:c.id}),c.children_d=c.children_d.concat(i),j=0,k=c.parents.length;k>j;j++)this._model.data[c.parents[j]].children_d=this._model.data[c.parents[j]].children_d.concat(i);for(d=h,h=[],j=0,k=c.children.length;k>j;j++)h[j>=e?j+1:j]=c.children[j];return h[e]=d.id,c.children=h,this.redraw_node(c,!0),f&&f.call(this,this.get_node(d)),this.trigger("create_node",{node:this.get_node(d),parent:c.id,position:e}),d.id},rename_node:function(b,c){var d,e,f;if(a.isArray(b)){for(b=b.slice(),d=0,e=b.length;e>d;d++)this.rename_node(b[d],c);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(f=b.text,this.check("rename_node",b,this.get_parent(b),c)?(this.set_text(b,c),this.trigger("rename_node",{node:b,text:c,old:f}),!0):(this.settings.core.error.call(this,this._data.core.last_error),!1)):!1},delete_node:function(b){var c,d,e,f,g,h,i,j,k,l,m,n;if(a.isArray(b)){for(b=b.slice(),c=0,d=b.length;d>c;c++)this.delete_node(b[c]);return!0}if(b=this.get_node(b),!b||b.id===a.jstree.root)return!1;if(e=this.get_node(b.parent),f=a.inArray(b.id,e.children),l=!1,!this.check("delete_node",b,e,f))return this.settings.core.error.call(this,this._data.core.last_error),!1;for(-1!==f&&(e.children=a.vakata.array_remove(e.children,f)),g=b.children_d.concat([]),g.push(b.id),h=0,i=b.parents.length;i>h;h++)this._model.data[b.parents[h]].children_d=a.vakata.array_filter(this._model.data[b.parents[h]].children_d,function(b){return-1===a.inArray(b,g)});for(j=0,k=g.length;k>j;j++)if(this._model.data[g[j]].state.selected){l=!0;break}for(l&&(this._data.core.selected=a.vakata.array_filter(this._data.core.selected,function(b){return-1===a.inArray(b,g)})),this.trigger("delete_node",{node:b,parent:e.id}),l&&this.trigger("changed",{action:"delete_node",node:b,selected:this._data.core.selected,parent:e.id}),j=0,k=g.length;k>j;j++)delete this._model.data[g[j]];return-1!==a.inArray(this._data.core.focused,g)&&(this._data.core.focused=null,m=this.element[0].scrollTop,n=this.element[0].scrollLeft,e.id===a.jstree.root?this._model.data[a.jstree.root].children[0]&&this.get_node(this._model.data[a.jstree.root].children[0],!0).children(".jstree-anchor").focus():this.get_node(e,!0).children(".jstree-anchor").focus(),this.element[0].scrollTop=m,this.element[0].scrollLeft=n),this.redraw_node(e,!0),!0},check:function(b,c,d,e,f){c=c&&c.id?c:this.get_node(c),d=d&&d.id?d:this.get_node(d);var g=b.match(/^move_node|copy_node|create_node$/i)?d:c,h=this.settings.core.check_callback;return"move_node"!==b&&"copy_node"!==b||f&&f.is_multi||c.id!==d.id&&("move_node"!==b||a.inArray(c.id,d.children)!==e)&&-1===a.inArray(d.id,c.children_d)?(g&&g.data&&(g=g.data),g&&g.functions&&(g.functions[b]===!1||g.functions[b]===!0)?(g.functions[b]===!1&&(this._data.core.last_error={error:"check",plugin:"core",id:"core_02",reason:"Node data prevents function: "+b,data:JSON.stringify({chk:b,pos:e,obj:c&&c.id?c.id:!1,par:d&&d.id?d.id:!1})}),g.functions[b]):h===!1||a.isFunction(h)&&h.call(this,b,c,d,e,f)===!1||h&&h[b]===!1?(this._data.core.last_error={error:"check",plugin:"core",id:"core_03",reason:"User config for core.check_callback prevents function: "+b,data:JSON.stringify({chk:b,pos:e,obj:c&&c.id?c.id:!1,par:d&&d.id?d.id:!1})},!1):!0):(this._data.core.last_error={error:"check",plugin:"core",id:"core_01",reason:"Moving parent inside child",data:JSON.stringify({chk:b,pos:e,obj:c&&c.id?c.id:!1,par:d&&d.id?d.id:!1})},!1)},last_error:function(){return this._data.core.last_error},move_node:function(c,d,e,f,g,h,i){var j,k,l,m,n,o,p,q,r,s,t,u,v,w;if(d=this.get_node(d),e=e===b?0:e,!d)return!1;if(!e.toString().match(/^(before|after)$/)&&!g&&!this.is_loaded(d))return this.load_node(d,function(){this.move_node(c,d,e,f,!0,!1,i)});if(a.isArray(c)){if(1!==c.length){for(j=0,k=c.length;k>j;j++)(r=this.move_node(c[j],d,e,f,g,!1,i))&&(d=r,e="after");return this.redraw(),!0}c=c[0]}if(c=c&&c.id?c:this.get_node(c),!c||c.id===a.jstree.root)return!1;if(l=(c.parent||a.jstree.root).toString(),n=e.toString().match(/^(before|after)$/)&&d.id!==a.jstree.root?this.get_node(d.parent):d,o=i?i:this._model.data[c.id]?this:a.jstree.reference(c.id),p=!o||!o._id||this._id!==o._id,m=o&&o._id&&l&&o._model.data[l]&&o._model.data[l].children?a.inArray(c.id,o._model.data[l].children):-1,o&&o._id&&(c=o._model.data[c.id]),p)return(r=this.copy_node(c,d,e,f,g,!1,i))?(o&&o.delete_node(c),r):!1;switch(d.id===a.jstree.root&&("before"===e&&(e="first"),"after"===e&&(e="last")),e){case"before":e=a.inArray(d.id,n.children);break;case"after":e=a.inArray(d.id,n.children)+1;break;case"inside":case"first":e=0;break;case"last":e=n.children.length;break;default:e||(e=0)}if(e>n.children.length&&(e=n.children.length),!this.check("move_node",c,n,e,{core:!0,origin:i,is_multi:o&&o._id&&o._id!==this._id,is_foreign:!o||!o._id}))return this.settings.core.error.call(this,this._data.core.last_error),!1;if(c.parent===n.id){for(q=n.children.concat(),r=a.inArray(c.id,q),-1!==r&&(q=a.vakata.array_remove(q,r),e>r&&e--),r=[],s=0,t=q.length;t>s;s++)r[s>=e?s+1:s]=q[s];r[e]=c.id,n.children=r,this._node_changed(n.id),this.redraw(n.id===a.jstree.root)}else{for(r=c.children_d.concat(),r.push(c.id),s=0,t=c.parents.length;t>s;s++){for(q=[],w=o._model.data[c.parents[s]].children_d,u=0,v=w.length;v>u;u++)-1===a.inArray(w[u],r)&&q.push(w[u]);o._model.data[c.parents[s]].children_d=q}for(o._model.data[l].children=a.vakata.array_remove_item(o._model.data[l].children,c.id),s=0,t=n.parents.length;t>s;s++)this._model.data[n.parents[s]].children_d=this._model.data[n.parents[s]].children_d.concat(r);for(q=[],s=0,t=n.children.length;t>s;s++)q[s>=e?s+1:s]=n.children[s];for(q[e]=c.id,n.children=q,n.children_d.push(c.id),n.children_d=n.children_d.concat(c.children_d),c.parent=n.id,r=n.parents.concat(),r.unshift(n.id),w=c.parents.length,c.parents=r,r=r.concat(),s=0,t=c.children_d.length;t>s;s++)this._model.data[c.children_d[s]].parents=this._model.data[c.children_d[s]].parents.slice(0,-1*w),Array.prototype.push.apply(this._model.data[c.children_d[s]].parents,r);(l===a.jstree.root||n.id===a.jstree.root)&&(this._model.force_full_redraw=!0),this._model.force_full_redraw||(this._node_changed(l),this._node_changed(n.id)),h||this.redraw()}return f&&f.call(this,c,n,e),this.trigger("move_node",{node:c,parent:n.id,position:e,old_parent:l,old_position:m,is_multi:o&&o._id&&o._id!==this._id,is_foreign:!o||!o._id,old_instance:o,new_instance:this}),c.id},copy_node:function(c,d,e,f,g,h,i){var j,k,l,m,n,o,p,q,r,s,t;if(d=this.get_node(d),e=e===b?0:e,!d)return!1;if(!e.toString().match(/^(before|after)$/)&&!g&&!this.is_loaded(d))return this.load_node(d,function(){this.copy_node(c,d,e,f,!0,!1,i)});if(a.isArray(c)){if(1!==c.length){for(j=0,k=c.length;k>j;j++)(m=this.copy_node(c[j],d,e,f,g,!0,i))&&(d=m,e="after");return this.redraw(),!0}c=c[0]}if(c=c&&c.id?c:this.get_node(c),!c||c.id===a.jstree.root)return!1;switch(q=(c.parent||a.jstree.root).toString(),r=e.toString().match(/^(before|after)$/)&&d.id!==a.jstree.root?this.get_node(d.parent):d,s=i?i:this._model.data[c.id]?this:a.jstree.reference(c.id),t=!s||!s._id||this._id!==s._id,s&&s._id&&(c=s._model.data[c.id]),d.id===a.jstree.root&&("before"===e&&(e="first"),"after"===e&&(e="last")),e){case"before":e=a.inArray(d.id,r.children);break;case"after":e=a.inArray(d.id,r.children)+1;break;case"inside":case"first":e=0;break;case"last":e=r.children.length;break;default:e||(e=0)}if(e>r.children.length&&(e=r.children.length),!this.check("copy_node",c,r,e,{core:!0,origin:i,is_multi:s&&s._id&&s._id!==this._id,is_foreign:!s||!s._id}))return this.settings.core.error.call(this,this._data.core.last_error),!1;if(p=s?s.get_json(c,{no_id:!0,no_data:!0,no_state:!0}):c,!p)return!1;if(p.id===!0&&delete p.id,p=this._parse_model_from_json(p,r.id,r.parents.concat()),!p)return!1;for(m=this.get_node(p),c&&c.state&&c.state.loaded===!1&&(m.state.loaded=!1),l=[],l.push(p),l=l.concat(m.children_d),this.trigger("model",{nodes:l,parent:r.id}),n=0,o=r.parents.length;o>n;n++)this._model.data[r.parents[n]].children_d=this._model.data[r.parents[n]].children_d.concat(l);for(l=[],n=0,o=r.children.length;o>n;n++)l[n>=e?n+1:n]=r.children[n];return l[e]=m.id,r.children=l,r.children_d.push(m.id),r.children_d=r.children_d.concat(m.children_d),r.id===a.jstree.root&&(this._model.force_full_redraw=!0),this._model.force_full_redraw||this._node_changed(r.id),h||this.redraw(r.id===a.jstree.root),f&&f.call(this,m,r,e),this.trigger("copy_node",{node:m,original:c,parent:r.id,position:e,old_parent:q,old_position:s&&s._id&&q&&s._model.data[q]&&s._model.data[q].children?a.inArray(c.id,s._model.data[q].children):-1,is_multi:s&&s._id&&s._id!==this._id,is_foreign:!s||!s._id,old_instance:s,new_instance:this}),m.id},cut:function(b){if(b||(b=this._data.core.selected.concat()),a.isArray(b)||(b=[b]),!b.length)return!1;var c=[],g,h,i;for(h=0,i=b.length;i>h;h++)g=this.get_node(b[h]),g&&g.id&&g.id!==a.jstree.root&&c.push(g);return c.length?(d=c,f=this,e="move_node",void this.trigger("cut",{node:b})):!1},copy:function(b){if(b||(b=this._data.core.selected.concat()),a.isArray(b)||(b=[b]),!b.length)return!1;var c=[],g,h,i;for(h=0,i=b.length;i>h;h++)g=this.get_node(b[h]),g&&g.id&&g.id!==a.jstree.root&&c.push(g);return c.length?(d=c,f=this,e="copy_node",void this.trigger("copy",{node:b})):!1},get_buffer:function(){return{mode:e,node:d,inst:f}},can_paste:function(){return e!==!1&&d!==!1},paste:function(a,b){return a=this.get_node(a),a&&e&&e.match(/^(copy_node|move_node)$/)&&d?(this[e](d,a,b,!1,!1,!1,f)&&this.trigger("paste",{parent:a.id,node:d,mode:e}),d=!1,e=!1,void(f=!1)):!1},clear_buffer:function(){d=!1,e=!1,f=!1,this.trigger("clear_buffer")},edit:function(b,c,d){var e,f,g,h,j,k,l,m,n,o=!1;return(b=this.get_node(b))?this.settings.core.check_callback===!1?(this._data.core.last_error={error:"check",plugin:"core",id:"core_07",reason:"Could not edit node because of check_callback"},this.settings.core.error.call(this,this._data.core.last_error),!1):(n=b,c="string"==typeof c?c:b.text,this.set_text(b,""),b=this._open_to(b),n.text=c,e=this._data.core.rtl,f=this.element.width(),this._data.core.focused=n.id,g=b.children(".jstree-anchor").focus(),h=a(""),j=c,k=a("
      ",{css:{position:"absolute",top:"-200px",left:e?"0px":"-1000px",visibility:"hidden"}}).appendTo("body"),l=a("",{value:j,"class":"jstree-rename-input",css:{padding:"0",border:"1px solid silver","box-sizing":"border-box",display:"inline-block",height:this._data.core.li_height+"px",lineHeight:this._data.core.li_height+"px",width:"150px"},blur:a.proxy(function(c){c.stopImmediatePropagation(),c.preventDefault();var e=h.children(".jstree-rename-input"),f=e.val(),i=this.settings.core.force_text,m;""===f&&(f=j),k.remove(),h.replaceWith(g),h.remove(),j=i?j:a("
      ").append(a.parseHTML(j)).html(),this.set_text(b,j),m=!!this.rename_node(b,i?a("
      ").text(f).text():a("
      ").append(a.parseHTML(f)).html()),m||this.set_text(b,j),this._data.core.focused=n.id,setTimeout(a.proxy(function(){var a=this.get_node(n.id,!0);a.length&&(this._data.core.focused=n.id,a.children(".jstree-anchor").focus())},this),0),d&&d.call(this,n,m,o),l=null},this),keydown:function(a){var b=a.which;27===b&&(o=!0,this.value=j),(27===b||13===b||37===b||38===b||39===b||40===b||32===b)&&a.stopImmediatePropagation(),(27===b||13===b)&&(a.preventDefault(),this.blur())},click:function(a){a.stopImmediatePropagation()},mousedown:function(a){a.stopImmediatePropagation()},keyup:function(a){l.width(Math.min(k.text("pW"+this.value).width(),f))},keypress:function(a){return 13===a.which?!1:void 0}}),m={fontFamily:g.css("fontFamily")||"",fontSize:g.css("fontSize")||"", -fontWeight:g.css("fontWeight")||"",fontStyle:g.css("fontStyle")||"",fontStretch:g.css("fontStretch")||"",fontVariant:g.css("fontVariant")||"",letterSpacing:g.css("letterSpacing")||"",wordSpacing:g.css("wordSpacing")||""},h.attr("class",g.attr("class")).append(g.contents().clone()).append(l),g.replaceWith(h),k.css(m),l.css(m).width(Math.min(k.text("pW"+l[0].value).width(),f))[0].select(),void a(i).one("mousedown.jstree touchstart.jstree dnd_start.vakata",function(b){l&&b.target!==l&&a(l).blur()})):!1},set_theme:function(b,c){if(!b)return!1;if(c===!0){var d=this.settings.core.themes.dir;d||(d=a.jstree.path+"/themes"),c=d+"/"+b+"/style.css"}c&&-1===a.inArray(c,g)&&(a("head").append(''),g.push(c)),this._data.core.themes.name&&this.element.removeClass("jstree-"+this._data.core.themes.name),this._data.core.themes.name=b,this.element.addClass("jstree-"+b),this.element[this.settings.core.themes.responsive?"addClass":"removeClass"]("jstree-"+b+"-responsive"),this.trigger("set_theme",{theme:b})},get_theme:function(){return this._data.core.themes.name},set_theme_variant:function(a){this._data.core.themes.variant&&this.element.removeClass("jstree-"+this._data.core.themes.name+"-"+this._data.core.themes.variant),this._data.core.themes.variant=a,a&&this.element.addClass("jstree-"+this._data.core.themes.name+"-"+this._data.core.themes.variant)},get_theme_variant:function(){return this._data.core.themes.variant},show_stripes:function(){this._data.core.themes.stripes=!0,this.get_container_ul().addClass("jstree-striped"),this.trigger("show_stripes")},hide_stripes:function(){this._data.core.themes.stripes=!1,this.get_container_ul().removeClass("jstree-striped"),this.trigger("hide_stripes")},toggle_stripes:function(){this._data.core.themes.stripes?this.hide_stripes():this.show_stripes()},show_dots:function(){this._data.core.themes.dots=!0,this.get_container_ul().removeClass("jstree-no-dots"),this.trigger("show_dots")},hide_dots:function(){this._data.core.themes.dots=!1,this.get_container_ul().addClass("jstree-no-dots"),this.trigger("hide_dots")},toggle_dots:function(){this._data.core.themes.dots?this.hide_dots():this.show_dots()},show_icons:function(){this._data.core.themes.icons=!0,this.get_container_ul().removeClass("jstree-no-icons"),this.trigger("show_icons")},hide_icons:function(){this._data.core.themes.icons=!1,this.get_container_ul().addClass("jstree-no-icons"),this.trigger("hide_icons")},toggle_icons:function(){this._data.core.themes.icons?this.hide_icons():this.show_icons()},show_ellipsis:function(){this._data.core.themes.ellipsis=!0,this.get_container_ul().addClass("jstree-ellipsis"),this.trigger("show_ellipsis")},hide_ellipsis:function(){this._data.core.themes.ellipsis=!1,this.get_container_ul().removeClass("jstree-ellipsis"),this.trigger("hide_ellipsis")},toggle_ellipsis:function(){this._data.core.themes.ellipsis?this.hide_ellipsis():this.show_ellipsis()},set_icon:function(c,d){var e,f,g,h;if(a.isArray(c)){for(c=c.slice(),e=0,f=c.length;f>e;e++)this.set_icon(c[e],d);return!0}return c=this.get_node(c),c&&c.id!==a.jstree.root?(h=c.icon,c.icon=d===!0||null===d||d===b||""===d?!0:d,g=this.get_node(c,!0).children(".jstree-anchor").children(".jstree-themeicon"),d===!1?this.hide_icon(c):d===!0||null===d||d===b||""===d?(g.removeClass("jstree-themeicon-custom "+h).css("background","").removeAttr("rel"),h===!1&&this.show_icon(c)):-1===d.indexOf("/")&&-1===d.indexOf(".")?(g.removeClass(h).css("background",""),g.addClass(d+" jstree-themeicon-custom").attr("rel",d),h===!1&&this.show_icon(c)):(g.removeClass(h).css("background",""),g.addClass("jstree-themeicon-custom").css("background","url('"+d+"') center center no-repeat").attr("rel",d),h===!1&&this.show_icon(c)),!0):!1},get_icon:function(b){return b=this.get_node(b),b&&b.id!==a.jstree.root?b.icon:!1},hide_icon:function(b){var c,d;if(a.isArray(b)){for(b=b.slice(),c=0,d=b.length;d>c;c++)this.hide_icon(b[c]);return!0}return b=this.get_node(b),b&&b!==a.jstree.root?(b.icon=!1,this.get_node(b,!0).children(".jstree-anchor").children(".jstree-themeicon").addClass("jstree-themeicon-hidden"),!0):!1},show_icon:function(b){var c,d,e;if(a.isArray(b)){for(b=b.slice(),c=0,d=b.length;d>c;c++)this.show_icon(b[c]);return!0}return b=this.get_node(b),b&&b!==a.jstree.root?(e=this.get_node(b,!0),b.icon=e.length?e.children(".jstree-anchor").children(".jstree-themeicon").attr("rel"):!0,b.icon||(b.icon=!0),e.children(".jstree-anchor").children(".jstree-themeicon").removeClass("jstree-themeicon-hidden"),!0):!1}},a.vakata={},a.vakata.attributes=function(b,c){b=a(b)[0];var d=c?{}:[];return b&&b.attributes&&a.each(b.attributes,function(b,e){-1===a.inArray(e.name.toLowerCase(),["style","contenteditable","hasfocus","tabindex"])&&null!==e.value&&""!==a.trim(e.value)&&(c?d[e.name]=e.value:d.push(e.name))}),d},a.vakata.array_unique=function(a){var c=[],d,e,f,g={};for(d=0,f=a.length;f>d;d++)g[a[d]]===b&&(c.push(a[d]),g[a[d]]=!0);return c},a.vakata.array_remove=function(a,b){return a.splice(b,1),a},a.vakata.array_remove_item=function(b,c){var d=a.inArray(c,b);return-1!==d?a.vakata.array_remove(b,d):b},a.vakata.array_filter=function(a,b,c,d,e){if(a.filter)return a.filter(b,c);d=[];for(e in a)~~e+""==e+""&&e>=0&&b.call(c,a[e],+e,a)&&d.push(a[e]);return d},a.jstree.plugins.changed=function(a,b){var c=[];this.trigger=function(a,d){var e,f;if(d||(d={}),"changed"===a.replace(".jstree","")){d.changed={selected:[],deselected:[]};var g={};for(e=0,f=c.length;f>e;e++)g[c[e]]=1;for(e=0,f=d.selected.length;f>e;e++)g[d.selected[e]]?g[d.selected[e]]=2:d.changed.selected.push(d.selected[e]);for(e=0,f=c.length;f>e;e++)1===g[c[e]]&&d.changed.deselected.push(c[e]);c=d.selected.slice()}b.trigger.call(this,a,d)},this.refresh=function(a,d){return c=[],b.refresh.apply(this,arguments)}};var j=i.createElement("I");j.className="jstree-icon jstree-checkbox",j.setAttribute("role","presentation"),a.jstree.defaults.checkbox={visible:!0,three_state:!0,whole_node:!0,keep_selected_style:!0,cascade:"",tie_selection:!0},a.jstree.plugins.checkbox=function(c,d){this.bind=function(){d.bind.call(this),this._data.checkbox.uto=!1,this._data.checkbox.selected=[],this.settings.checkbox.three_state&&(this.settings.checkbox.cascade="up+down+undetermined"),this.element.on("init.jstree",a.proxy(function(){this._data.checkbox.visible=this.settings.checkbox.visible,this.settings.checkbox.keep_selected_style||this.element.addClass("jstree-checkbox-no-clicked"),this.settings.checkbox.tie_selection&&this.element.addClass("jstree-checkbox-selection")},this)).on("loading.jstree",a.proxy(function(){this[this._data.checkbox.visible?"show_checkboxes":"hide_checkboxes"]()},this)),-1!==this.settings.checkbox.cascade.indexOf("undetermined")&&this.element.on("changed.jstree uncheck_node.jstree check_node.jstree uncheck_all.jstree check_all.jstree move_node.jstree copy_node.jstree redraw.jstree open_node.jstree",a.proxy(function(){this._data.checkbox.uto&&clearTimeout(this._data.checkbox.uto),this._data.checkbox.uto=setTimeout(a.proxy(this._undetermined,this),50)},this)),this.settings.checkbox.tie_selection||this.element.on("model.jstree",a.proxy(function(a,b){var c=this._model.data,d=c[b.parent],e=b.nodes,f,g;for(f=0,g=e.length;g>f;f++)c[e[f]].state.checked=c[e[f]].state.checked||c[e[f]].original&&c[e[f]].original.state&&c[e[f]].original.state.checked,c[e[f]].state.checked&&this._data.checkbox.selected.push(e[f])},this)),(-1!==this.settings.checkbox.cascade.indexOf("up")||-1!==this.settings.checkbox.cascade.indexOf("down"))&&this.element.on("model.jstree",a.proxy(function(b,c){var d=this._model.data,e=d[c.parent],f=c.nodes,g=[],h,i,j,k,l,m,n=this.settings.checkbox.cascade,o=this.settings.checkbox.tie_selection;if(-1!==n.indexOf("down"))if(e.state[o?"selected":"checked"]){for(i=0,j=f.length;j>i;i++)d[f[i]].state[o?"selected":"checked"]=!0;this._data[o?"core":"checkbox"].selected=this._data[o?"core":"checkbox"].selected.concat(f)}else for(i=0,j=f.length;j>i;i++)if(d[f[i]].state[o?"selected":"checked"]){for(k=0,l=d[f[i]].children_d.length;l>k;k++)d[d[f[i]].children_d[k]].state[o?"selected":"checked"]=!0;this._data[o?"core":"checkbox"].selected=this._data[o?"core":"checkbox"].selected.concat(d[f[i]].children_d)}if(-1!==n.indexOf("up")){for(i=0,j=e.children_d.length;j>i;i++)d[e.children_d[i]].children.length||g.push(d[e.children_d[i]].parent);for(g=a.vakata.array_unique(g),k=0,l=g.length;l>k;k++){e=d[g[k]];while(e&&e.id!==a.jstree.root){for(h=0,i=0,j=e.children.length;j>i;i++)h+=d[e.children[i]].state[o?"selected":"checked"];if(h!==j)break;e.state[o?"selected":"checked"]=!0,this._data[o?"core":"checkbox"].selected.push(e.id),m=this.get_node(e,!0),m&&m.length&&m.attr("aria-selected",!0).children(".jstree-anchor").addClass(o?"jstree-clicked":"jstree-checked"),e=this.get_node(e.parent)}}}this._data[o?"core":"checkbox"].selected=a.vakata.array_unique(this._data[o?"core":"checkbox"].selected)},this)).on(this.settings.checkbox.tie_selection?"select_node.jstree":"check_node.jstree",a.proxy(function(b,c){var d=c.node,e=this._model.data,f=this.get_node(d.parent),g=this.get_node(d,!0),h,i,j,k,l=this.settings.checkbox.cascade,m=this.settings.checkbox.tie_selection,n={},o=this._data[m?"core":"checkbox"].selected;for(h=0,i=o.length;i>h;h++)n[o[h]]=!0;if(-1!==l.indexOf("down"))for(h=0,i=d.children_d.length;i>h;h++)n[d.children_d[h]]=!0,k=e[d.children_d[h]],k.state[m?"selected":"checked"]=!0,k&&k.original&&k.original.state&&k.original.state.undetermined&&(k.original.state.undetermined=!1);if(-1!==l.indexOf("up"))while(f&&f.id!==a.jstree.root){for(j=0,h=0,i=f.children.length;i>h;h++)j+=e[f.children[h]].state[m?"selected":"checked"];if(j!==i)break;f.state[m?"selected":"checked"]=!0,n[f.id]=!0,k=this.get_node(f,!0),k&&k.length&&k.attr("aria-selected",!0).children(".jstree-anchor").addClass(m?"jstree-clicked":"jstree-checked"),f=this.get_node(f.parent)}o=[];for(h in n)n.hasOwnProperty(h)&&o.push(h);this._data[m?"core":"checkbox"].selected=o,-1!==l.indexOf("down")&&g.length&&g.find(".jstree-anchor").addClass(m?"jstree-clicked":"jstree-checked").parent().attr("aria-selected",!0)},this)).on(this.settings.checkbox.tie_selection?"deselect_all.jstree":"uncheck_all.jstree",a.proxy(function(b,c){var d=this.get_node(a.jstree.root),e=this._model.data,f,g,h;for(f=0,g=d.children_d.length;g>f;f++)h=e[d.children_d[f]],h&&h.original&&h.original.state&&h.original.state.undetermined&&(h.original.state.undetermined=!1)},this)).on(this.settings.checkbox.tie_selection?"deselect_node.jstree":"uncheck_node.jstree",a.proxy(function(b,c){var d=c.node,e=this.get_node(d,!0),f,g,h,i=this.settings.checkbox.cascade,j=this.settings.checkbox.tie_selection,k=this._data[j?"core":"checkbox"].selected,l={};if(d&&d.original&&d.original.state&&d.original.state.undetermined&&(d.original.state.undetermined=!1),-1!==i.indexOf("down"))for(f=0,g=d.children_d.length;g>f;f++)h=this._model.data[d.children_d[f]],h.state[j?"selected":"checked"]=!1,h&&h.original&&h.original.state&&h.original.state.undetermined&&(h.original.state.undetermined=!1);if(-1!==i.indexOf("up"))for(f=0,g=d.parents.length;g>f;f++)h=this._model.data[d.parents[f]],h.state[j?"selected":"checked"]=!1,h&&h.original&&h.original.state&&h.original.state.undetermined&&(h.original.state.undetermined=!1),h=this.get_node(d.parents[f],!0),h&&h.length&&h.attr("aria-selected",!1).children(".jstree-anchor").removeClass(j?"jstree-clicked":"jstree-checked");for(l={},f=0,g=k.length;g>f;f++)-1!==i.indexOf("down")&&-1!==a.inArray(k[f],d.children_d)||-1!==i.indexOf("up")&&-1!==a.inArray(k[f],d.parents)||(l[k[f]]=!0);k=[];for(f in l)l.hasOwnProperty(f)&&k.push(f);this._data[j?"core":"checkbox"].selected=k,-1!==i.indexOf("down")&&e.length&&e.find(".jstree-anchor").removeClass(j?"jstree-clicked":"jstree-checked").parent().attr("aria-selected",!1)},this)),-1!==this.settings.checkbox.cascade.indexOf("up")&&this.element.on("delete_node.jstree",a.proxy(function(b,c){var d=this.get_node(c.parent),e=this._model.data,f,g,h,i,j=this.settings.checkbox.tie_selection;while(d&&d.id!==a.jstree.root&&!d.state[j?"selected":"checked"]){for(h=0,f=0,g=d.children.length;g>f;f++)h+=e[d.children[f]].state[j?"selected":"checked"];if(!(g>0&&h===g))break;d.state[j?"selected":"checked"]=!0,this._data[j?"core":"checkbox"].selected.push(d.id),i=this.get_node(d,!0),i&&i.length&&i.attr("aria-selected",!0).children(".jstree-anchor").addClass(j?"jstree-clicked":"jstree-checked"),d=this.get_node(d.parent)}},this)).on("move_node.jstree",a.proxy(function(b,c){var d=c.is_multi,e=c.old_parent,f=this.get_node(c.parent),g=this._model.data,h,i,j,k,l,m=this.settings.checkbox.tie_selection;if(!d){h=this.get_node(e);while(h&&h.id!==a.jstree.root&&!h.state[m?"selected":"checked"]){for(i=0,j=0,k=h.children.length;k>j;j++)i+=g[h.children[j]].state[m?"selected":"checked"];if(!(k>0&&i===k))break;h.state[m?"selected":"checked"]=!0,this._data[m?"core":"checkbox"].selected.push(h.id),l=this.get_node(h,!0),l&&l.length&&l.attr("aria-selected",!0).children(".jstree-anchor").addClass(m?"jstree-clicked":"jstree-checked"),h=this.get_node(h.parent)}}h=f;while(h&&h.id!==a.jstree.root){for(i=0,j=0,k=h.children.length;k>j;j++)i+=g[h.children[j]].state[m?"selected":"checked"];if(i===k)h.state[m?"selected":"checked"]||(h.state[m?"selected":"checked"]=!0,this._data[m?"core":"checkbox"].selected.push(h.id),l=this.get_node(h,!0),l&&l.length&&l.attr("aria-selected",!0).children(".jstree-anchor").addClass(m?"jstree-clicked":"jstree-checked"));else{if(!h.state[m?"selected":"checked"])break;h.state[m?"selected":"checked"]=!1,this._data[m?"core":"checkbox"].selected=a.vakata.array_remove_item(this._data[m?"core":"checkbox"].selected,h.id),l=this.get_node(h,!0),l&&l.length&&l.attr("aria-selected",!1).children(".jstree-anchor").removeClass(m?"jstree-clicked":"jstree-checked")}h=this.get_node(h.parent)}},this))},this._undetermined=function(){if(null!==this.element){var c,d,e,f,g={},h=this._model.data,i=this.settings.checkbox.tie_selection,j=this._data[i?"core":"checkbox"].selected,k=[],l=this;for(c=0,d=j.length;d>c;c++)if(h[j[c]]&&h[j[c]].parents)for(e=0,f=h[j[c]].parents.length;f>e;e++){if(g[h[j[c]].parents[e]]!==b)break;h[j[c]].parents[e]!==a.jstree.root&&(g[h[j[c]].parents[e]]=!0,k.push(h[j[c]].parents[e]))}for(this.element.find(".jstree-closed").not(":has(.jstree-children)").each(function(){var i=l.get_node(this),j;if(i.state.loaded){for(c=0,d=i.children_d.length;d>c;c++)if(j=h[i.children_d[c]],!j.state.loaded&&j.original&&j.original.state&&j.original.state.undetermined&&j.original.state.undetermined===!0)for(g[j.id]===b&&j.id!==a.jstree.root&&(g[j.id]=!0,k.push(j.id)),e=0,f=j.parents.length;f>e;e++)g[j.parents[e]]===b&&j.parents[e]!==a.jstree.root&&(g[j.parents[e]]=!0,k.push(j.parents[e]))}else if(i.original&&i.original.state&&i.original.state.undetermined&&i.original.state.undetermined===!0)for(g[i.id]===b&&i.id!==a.jstree.root&&(g[i.id]=!0,k.push(i.id)),e=0,f=i.parents.length;f>e;e++)g[i.parents[e]]===b&&i.parents[e]!==a.jstree.root&&(g[i.parents[e]]=!0,k.push(i.parents[e]))}),this.element.find(".jstree-undetermined").removeClass("jstree-undetermined"),c=0,d=k.length;d>c;c++)h[k[c]].state[i?"selected":"checked"]||(j=this.get_node(k[c],!0),j&&j.length&&j.children(".jstree-anchor").children(".jstree-checkbox").addClass("jstree-undetermined"))}},this.redraw_node=function(b,c,e,f){if(b=d.redraw_node.apply(this,arguments)){var g,h,i=null,k=null;for(g=0,h=b.childNodes.length;h>g;g++)if(b.childNodes[g]&&b.childNodes[g].className&&-1!==b.childNodes[g].className.indexOf("jstree-anchor")){i=b.childNodes[g];break}i&&(!this.settings.checkbox.tie_selection&&this._model.data[b.id].state.checked&&(i.className+=" jstree-checked"),k=j.cloneNode(!1),this._model.data[b.id].state.checkbox_disabled&&(k.className+=" jstree-checkbox-disabled"),i.insertBefore(k,i.childNodes[0]))}return e||-1===this.settings.checkbox.cascade.indexOf("undetermined")||(this._data.checkbox.uto&&clearTimeout(this._data.checkbox.uto),this._data.checkbox.uto=setTimeout(a.proxy(this._undetermined,this),50)),b},this.show_checkboxes=function(){this._data.core.themes.checkboxes=!0,this.get_container_ul().removeClass("jstree-no-checkboxes")},this.hide_checkboxes=function(){this._data.core.themes.checkboxes=!1,this.get_container_ul().addClass("jstree-no-checkboxes")},this.toggle_checkboxes=function(){this._data.core.themes.checkboxes?this.hide_checkboxes():this.show_checkboxes()},this.is_undetermined=function(b){b=this.get_node(b);var c=this.settings.checkbox.cascade,d,e,f=this.settings.checkbox.tie_selection,g=this._data[f?"core":"checkbox"].selected,h=this._model.data;if(!b||b.state[f?"selected":"checked"]===!0||-1===c.indexOf("undetermined")||-1===c.indexOf("down")&&-1===c.indexOf("up"))return!1;if(!b.state.loaded&&b.original.state.undetermined===!0)return!0;for(d=0,e=b.children_d.length;e>d;d++)if(-1!==a.inArray(b.children_d[d],g)||!h[b.children_d[d]].state.loaded&&h[b.children_d[d]].original.state.undetermined)return!0;return!1},this.disable_checkbox=function(b){var c,d,e;if(a.isArray(b)){for(b=b.slice(),c=0,d=b.length;d>c;c++)this.disable_checkbox(b[c]);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(e=this.get_node(b,!0),void(b.state.checkbox_disabled||(b.state.checkbox_disabled=!0,e&&e.length&&e.children(".jstree-anchor").children(".jstree-checkbox").addClass("jstree-checkbox-disabled"),this.trigger("disable_checkbox",{node:b})))):!1},this.enable_checkbox=function(b){var c,d,e;if(a.isArray(b)){for(b=b.slice(),c=0,d=b.length;d>c;c++)this.enable_checkbox(b[c]);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(e=this.get_node(b,!0),void(b.state.checkbox_disabled&&(b.state.checkbox_disabled=!1,e&&e.length&&e.children(".jstree-anchor").children(".jstree-checkbox").removeClass("jstree-checkbox-disabled"),this.trigger("enable_checkbox",{node:b})))):!1},this.activate_node=function(b,c){return a(c.target).hasClass("jstree-checkbox-disabled")?!1:(this.settings.checkbox.tie_selection&&(this.settings.checkbox.whole_node||a(c.target).hasClass("jstree-checkbox"))&&(c.ctrlKey=!0),this.settings.checkbox.tie_selection||!this.settings.checkbox.whole_node&&!a(c.target).hasClass("jstree-checkbox")?d.activate_node.call(this,b,c):this.is_disabled(b)?!1:(this.is_checked(b)?this.uncheck_node(b,c):this.check_node(b,c),void this.trigger("activate_node",{node:this.get_node(b)})))},this.check_node=function(b,c){if(this.settings.checkbox.tie_selection)return this.select_node(b,!1,!0,c);var d,e,f,g;if(a.isArray(b)){for(b=b.slice(),e=0,f=b.length;f>e;e++)this.check_node(b[e],c);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(d=this.get_node(b,!0),void(b.state.checked||(b.state.checked=!0,this._data.checkbox.selected.push(b.id),d&&d.length&&d.children(".jstree-anchor").addClass("jstree-checked"),this.trigger("check_node",{node:b,selected:this._data.checkbox.selected,event:c})))):!1},this.uncheck_node=function(b,c){if(this.settings.checkbox.tie_selection)return this.deselect_node(b,!1,c);var d,e,f;if(a.isArray(b)){for(b=b.slice(),d=0,e=b.length;e>d;d++)this.uncheck_node(b[d],c);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(f=this.get_node(b,!0),void(b.state.checked&&(b.state.checked=!1,this._data.checkbox.selected=a.vakata.array_remove_item(this._data.checkbox.selected,b.id),f.length&&f.children(".jstree-anchor").removeClass("jstree-checked"),this.trigger("uncheck_node",{node:b,selected:this._data.checkbox.selected,event:c})))):!1},this.check_all=function(){if(this.settings.checkbox.tie_selection)return this.select_all();var b=this._data.checkbox.selected.concat([]),c,d;for(this._data.checkbox.selected=this._model.data[a.jstree.root].children_d.concat(),c=0,d=this._data.checkbox.selected.length;d>c;c++)this._model.data[this._data.checkbox.selected[c]]&&(this._model.data[this._data.checkbox.selected[c]].state.checked=!0);this.redraw(!0),this.trigger("check_all",{selected:this._data.checkbox.selected})},this.uncheck_all=function(){if(this.settings.checkbox.tie_selection)return this.deselect_all();var a=this._data.checkbox.selected.concat([]),b,c;for(b=0,c=this._data.checkbox.selected.length;c>b;b++)this._model.data[this._data.checkbox.selected[b]]&&(this._model.data[this._data.checkbox.selected[b]].state.checked=!1);this._data.checkbox.selected=[],this.element.find(".jstree-checked").removeClass("jstree-checked"),this.trigger("uncheck_all",{selected:this._data.checkbox.selected,node:a})},this.is_checked=function(b){return this.settings.checkbox.tie_selection?this.is_selected(b):(b=this.get_node(b),b&&b.id!==a.jstree.root?b.state.checked:!1)},this.get_checked=function(b){return this.settings.checkbox.tie_selection?this.get_selected(b):b?a.map(this._data.checkbox.selected,a.proxy(function(a){return this.get_node(a)},this)):this._data.checkbox.selected},this.get_top_checked=function(b){if(this.settings.checkbox.tie_selection)return this.get_top_selected(b);var c=this.get_checked(!0),d={},e,f,g,h;for(e=0,f=c.length;f>e;e++)d[c[e].id]=c[e];for(e=0,f=c.length;f>e;e++)for(g=0,h=c[e].children_d.length;h>g;g++)d[c[e].children_d[g]]&&delete d[c[e].children_d[g]];c=[];for(e in d)d.hasOwnProperty(e)&&c.push(e);return b?a.map(c,a.proxy(function(a){return this.get_node(a)},this)):c},this.get_bottom_checked=function(b){if(this.settings.checkbox.tie_selection)return this.get_bottom_selected(b);var c=this.get_checked(!0),d=[],e,f;for(e=0,f=c.length;f>e;e++)c[e].children.length||d.push(c[e].id);return b?a.map(d,a.proxy(function(a){return this.get_node(a)},this)):d},this.load_node=function(b,c){var e,f,g,h,i,j;if(!a.isArray(b)&&!this.settings.checkbox.tie_selection&&(j=this.get_node(b),j&&j.state.loaded))for(e=0,f=j.children_d.length;f>e;e++)this._model.data[j.children_d[e]].state.checked&&(i=!0,this._data.checkbox.selected=a.vakata.array_remove_item(this._data.checkbox.selected,j.children_d[e]));return d.load_node.apply(this,arguments)},this.get_state=function(){var a=d.get_state.apply(this,arguments);return this.settings.checkbox.tie_selection?a:(a.checkbox=this._data.checkbox.selected.slice(),a)},this.set_state=function(b,c){var e=d.set_state.apply(this,arguments);if(e&&b.checkbox){if(!this.settings.checkbox.tie_selection){this.uncheck_all();var f=this;a.each(b.checkbox,function(a,b){f.check_node(b)})}return delete b.checkbox,this.set_state(b,c),!1}return e},this.refresh=function(a,b){return this.settings.checkbox.tie_selection||(this._data.checkbox.selected=[]),d.refresh.apply(this,arguments)}},a.jstree.defaults.conditionalselect=function(){return!0},a.jstree.plugins.conditionalselect=function(a,b){this.activate_node=function(a,c){this.settings.conditionalselect.call(this,this.get_node(a),c)&&b.activate_node.call(this,a,c)}},a.jstree.defaults.contextmenu={select_node:!0,show_at_node:!0,items:function(b,c){return{create:{separator_before:!1,separator_after:!0,_disabled:!1,label:"Create",action:function(b){var c=a.jstree.reference(b.reference),d=c.get_node(b.reference);c.create_node(d,{},"last",function(a){setTimeout(function(){c.edit(a)},0)})}},rename:{separator_before:!1,separator_after:!1,_disabled:!1,label:"Rename",action:function(b){var c=a.jstree.reference(b.reference),d=c.get_node(b.reference);c.edit(d)}},remove:{separator_before:!1,icon:!1,separator_after:!1,_disabled:!1,label:"Delete",action:function(b){var c=a.jstree.reference(b.reference),d=c.get_node(b.reference);c.is_selected(d)?c.delete_node(c.get_selected()):c.delete_node(d)}},ccp:{separator_before:!0,icon:!1,separator_after:!1,label:"Edit",action:!1,submenu:{cut:{separator_before:!1,separator_after:!1,label:"Cut",action:function(b){var c=a.jstree.reference(b.reference),d=c.get_node(b.reference);c.is_selected(d)?c.cut(c.get_top_selected()):c.cut(d)}},copy:{separator_before:!1,icon:!1,separator_after:!1,label:"Copy",action:function(b){var c=a.jstree.reference(b.reference),d=c.get_node(b.reference);c.is_selected(d)?c.copy(c.get_top_selected()):c.copy(d)}},paste:{separator_before:!1,icon:!1,_disabled:function(b){return!a.jstree.reference(b.reference).can_paste()},separator_after:!1,label:"Paste",action:function(b){var c=a.jstree.reference(b.reference),d=c.get_node(b.reference);c.paste(d)}}}}}}},a.jstree.plugins.contextmenu=function(c,d){this.bind=function(){d.bind.call(this);var b=0,c=null,e,f;this.element.on("contextmenu.jstree",".jstree-anchor",a.proxy(function(a,d){"input"!==a.target.tagName.toLowerCase()&&(a.preventDefault(),b=a.ctrlKey?+new Date:0,(d||c)&&(b=+new Date+1e4),c&&clearTimeout(c),this.is_loading(a.currentTarget)||this.show_contextmenu(a.currentTarget,a.pageX,a.pageY,a))},this)).on("click.jstree",".jstree-anchor",a.proxy(function(c){this._data.contextmenu.visible&&(!b||+new Date-b>250)&&a.vakata.context.hide(),b=0},this)).on("touchstart.jstree",".jstree-anchor",function(b){b.originalEvent&&b.originalEvent.changedTouches&&b.originalEvent.changedTouches[0]&&(e=b.originalEvent.changedTouches[0].clientX,f=b.originalEvent.changedTouches[0].clientY,c=setTimeout(function(){a(b.currentTarget).trigger("contextmenu",!0)},750))}).on("touchmove.vakata.jstree",function(a){c&&a.originalEvent&&a.originalEvent.changedTouches&&a.originalEvent.changedTouches[0]&&(Math.abs(e-a.originalEvent.changedTouches[0].clientX)>50||Math.abs(f-a.originalEvent.changedTouches[0].clientY)>50)&&clearTimeout(c)}).on("touchend.vakata.jstree",function(a){c&&clearTimeout(c)}),a(i).on("context_hide.vakata.jstree",a.proxy(function(b,c){this._data.contextmenu.visible=!1,a(c.reference).removeClass("jstree-context")},this))},this.teardown=function(){this._data.contextmenu.visible&&a.vakata.context.hide(),d.teardown.call(this)},this.show_contextmenu=function(c,d,e,f){if(c=this.get_node(c),!c||c.id===a.jstree.root)return!1;var g=this.settings.contextmenu,h=this.get_node(c,!0),i=h.children(".jstree-anchor"),j=!1,k=!1;(g.show_at_node||d===b||e===b)&&(j=i.offset(),d=j.left,e=j.top+this._data.core.li_height),this.settings.contextmenu.select_node&&!this.is_selected(c)&&this.activate_node(c,f),k=g.items,a.isFunction(k)&&(k=k.call(this,c,a.proxy(function(a){this._show_contextmenu(c,d,e,a)},this))),a.isPlainObject(k)&&this._show_contextmenu(c,d,e,k)},this._show_contextmenu=function(b,c,d,e){var f=this.get_node(b,!0),g=f.children(".jstree-anchor");a(i).one("context_show.vakata.jstree",a.proxy(function(b,c){var d="jstree-contextmenu jstree-"+this.get_theme()+"-contextmenu";a(c.element).addClass(d),g.addClass("jstree-context")},this)),this._data.contextmenu.visible=!0,a.vakata.context.show(g,{x:c,y:d},e),this.trigger("show_contextmenu",{node:b,x:c,y:d})}},function(a){var b=!1,c={element:!1,reference:!1,position_x:0,position_y:0,items:[],html:"",is_visible:!1};a.vakata.context={settings:{hide_onmouseleave:0,icons:!0},_trigger:function(b){a(i).triggerHandler("context_"+b+".vakata",{reference:c.reference,element:c.element,position:{x:c.position_x,y:c.position_y}})},_execute:function(b){return b=c.items[b],b&&(!b._disabled||a.isFunction(b._disabled)&&!b._disabled({item:b,reference:c.reference,element:c.element}))&&b.action?b.action.call(null,{item:b,reference:c.reference,element:c.element,position:{x:c.position_x,y:c.position_y}}):!1},_parse:function(b,d){if(!b)return!1;d||(c.html="",c.items=[]);var e="",f=!1,g;return d&&(e+=""),d||(c.html=e,a.vakata.context._trigger("parse")),e.length>10?e:!1},_show_submenu:function(c){if(c=a(c),c.length&&c.children("ul").length){var d=c.children("ul"),e=c.offset().left,f=e+c.outerWidth(),g=c.offset().top,h=d.width(),i=d.height(),j=a(window).width()+a(window).scrollLeft(),k=a(window).height()+a(window).scrollTop();b?c[f-(h+10+c.outerWidth())<0?"addClass":"removeClass"]("vakata-context-left"):c[f+h>j&&e>j-f?"addClass":"removeClass"]("vakata-context-right"),g+i+10>k&&d.css("bottom","-1px"),c.hasClass("vakata-context-right")?h>e&&d.css("margin-right",e-h):h>j-f&&d.css("margin-left",j-f-h),d.show()}},show:function(d,e,f){var g,h,i,j,k,l,m,n,o=!0;switch(c.element&&c.element.length&&c.element.width(""),o){case!e&&!d:return!1;case!!e&&!!d:c.reference=d,c.position_x=e.x,c.position_y=e.y;break;case!e&&!!d:c.reference=d,g=d.offset(),c.position_x=g.left+d.outerHeight(),c.position_y=g.top;break;case!!e&&!d:c.position_x=e.x,c.position_y=e.y}d&&!f&&a(d).data("vakata_contextmenu")&&(f=a(d).data("vakata_contextmenu")),a.vakata.context._parse(f)&&c.element.html(c.html),c.items.length&&(c.element.appendTo("body"),h=c.element,i=c.position_x,j=c.position_y,k=h.width(),l=h.height(),m=a(window).width()+a(window).scrollLeft(),n=a(window).height()+a(window).scrollTop(),b&&(i-=h.outerWidth()-a(d).outerWidth(),im&&(i=m-(k+20)),j+l+20>n&&(j=n-(l+20)),c.element.css({left:i,top:j}).show().find("a").first().focus().parent().addClass("vakata-context-hover"),c.is_visible=!0,a.vakata.context._trigger("show"))},hide:function(){c.is_visible&&(c.element.hide().find("ul").hide().end().find(":focus").blur().end().detach(),c.is_visible=!1,a.vakata.context._trigger("hide"))}},a(function(){b="rtl"===a("body").css("direction");var d=!1;c.element=a("
        "),c.element.on("mouseenter","li",function(b){b.stopImmediatePropagation(),a.contains(this,b.relatedTarget)||(d&&clearTimeout(d),c.element.find(".vakata-context-hover").removeClass("vakata-context-hover").end(),a(this).siblings().find("ul").hide().end().end().parentsUntil(".vakata-context","li").addBack().addClass("vakata-context-hover"),a.vakata.context._show_submenu(this))}).on("mouseleave","li",function(b){a.contains(this,b.relatedTarget)||a(this).find(".vakata-context-hover").addBack().removeClass("vakata-context-hover")}).on("mouseleave",function(b){a(this).find(".vakata-context-hover").removeClass("vakata-context-hover"),a.vakata.context.settings.hide_onmouseleave&&(d=setTimeout(function(b){return function(){a.vakata.context.hide()}}(this),a.vakata.context.settings.hide_onmouseleave))}).on("click","a",function(b){b.preventDefault(),a(this).blur().parent().hasClass("vakata-context-disabled")||a.vakata.context._execute(a(this).attr("rel"))===!1||a.vakata.context.hide()}).on("keydown","a",function(b){var d=null;switch(b.which){case 13:case 32:b.type="click",b.preventDefault(),a(b.currentTarget).trigger(b);break;case 37:c.is_visible&&(c.element.find(".vakata-context-hover").last().closest("li").first().find("ul").hide().find(".vakata-context-hover").removeClass("vakata-context-hover").end().end().children("a").focus(),b.stopImmediatePropagation(),b.preventDefault());break;case 38:c.is_visible&&(d=c.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").prevAll("li:not(.vakata-context-separator)").first(), -d.length||(d=c.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").last()),d.addClass("vakata-context-hover").children("a").focus(),b.stopImmediatePropagation(),b.preventDefault());break;case 39:c.is_visible&&(c.element.find(".vakata-context-hover").last().children("ul").show().children("li:not(.vakata-context-separator)").removeClass("vakata-context-hover").first().addClass("vakata-context-hover").children("a").focus(),b.stopImmediatePropagation(),b.preventDefault());break;case 40:c.is_visible&&(d=c.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").nextAll("li:not(.vakata-context-separator)").first(),d.length||(d=c.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").first()),d.addClass("vakata-context-hover").children("a").focus(),b.stopImmediatePropagation(),b.preventDefault());break;case 27:a.vakata.context.hide(),b.preventDefault()}}).on("keydown",function(a){a.preventDefault();var b=c.element.find(".vakata-contextmenu-shortcut-"+a.which).parent();b.parent().not(".vakata-context-disabled")&&b.click()}),a(i).on("mousedown.vakata.jstree",function(b){c.is_visible&&!a.contains(c.element[0],b.target)&&a.vakata.context.hide()}).on("context_show.vakata.jstree",function(a,d){c.element.find("li:has(ul)").children("a").addClass("vakata-context-parent"),b&&c.element.addClass("vakata-context-rtl").css("direction","rtl"),c.element.find("ul").hide().end()})})}(a),a.jstree.defaults.dnd={copy:!0,open_timeout:500,is_draggable:!0,check_while_dragging:!0,always_copy:!1,inside_pos:0,drag_selection:!0,touch:!0,large_drop_target:!1,large_drag_target:!1,use_html5:!1};var k,l;a.jstree.plugins.dnd=function(b,c){this.init=function(a,b){c.init.call(this,a,b),this.settings.dnd.use_html5=this.settings.dnd.use_html5&&"draggable"in i.createElement("span")},this.bind=function(){c.bind.call(this),this.element.on(this.settings.dnd.use_html5?"dragstart.jstree":"mousedown.jstree touchstart.jstree",this.settings.dnd.large_drag_target?".jstree-node":".jstree-anchor",a.proxy(function(b){if(this.settings.dnd.large_drag_target&&a(b.target).closest(".jstree-node")[0]!==b.currentTarget)return!0;if("touchstart"===b.type&&(!this.settings.dnd.touch||"selected"===this.settings.dnd.touch&&!a(b.currentTarget).closest(".jstree-node").children(".jstree-anchor").hasClass("jstree-clicked")))return!0;var c=this.get_node(b.target),d=this.is_selected(c)&&this.settings.dnd.drag_selection?this.get_top_selected().length:1,e=d>1?d+" "+this.get_string("nodes"):this.get_text(b.currentTarget);if(this.settings.core.force_text&&(e=a.vakata.html.escape(e)),c&&c.id&&c.id!==a.jstree.root&&(1===b.which||"touchstart"===b.type||"dragstart"===b.type)&&(this.settings.dnd.is_draggable===!0||a.isFunction(this.settings.dnd.is_draggable)&&this.settings.dnd.is_draggable.call(this,d>1?this.get_top_selected(!0):[c],b))){if(k={jstree:!0,origin:this,obj:this.get_node(c,!0),nodes:d>1?this.get_top_selected():[c.id]},l=b.currentTarget,!this.settings.dnd.use_html5)return this.element.trigger("mousedown.jstree"),a.vakata.dnd.start(b,k,'
        '+e+'
        ');a.vakata.dnd._trigger("start",b,{helper:a(),element:l,data:k})}},this)),this.settings.dnd.use_html5&&this.element.on("dragover.jstree",function(b){return b.preventDefault(),a.vakata.dnd._trigger("move",b,{helper:a(),element:l,data:k}),!1}).on("drop.jstree",a.proxy(function(b){return b.preventDefault(),a.vakata.dnd._trigger("stop",b,{helper:a(),element:l,data:k}),!1},this))},this.redraw_node=function(a,b,d,e){if(a=c.redraw_node.apply(this,arguments),a&&this.settings.dnd.use_html5)if(this.settings.dnd.large_drag_target)a.setAttribute("draggable",!0);else{var f,g,h=null;for(f=0,g=a.childNodes.length;g>f;f++)if(a.childNodes[f]&&a.childNodes[f].className&&-1!==a.childNodes[f].className.indexOf("jstree-anchor")){h=a.childNodes[f];break}h&&h.setAttribute("draggable",!0)}return a}},a(function(){var c=!1,d=!1,e=!1,f=!1,g=a('
         
        ').hide();a(i).on("dnd_start.vakata.jstree",function(a,b){c=!1,e=!1,b&&b.data&&b.data.jstree&&g.appendTo("body")}).on("dnd_move.vakata.jstree",function(h,i){if(f&&(i.event&&"dragover"===i.event.type&&i.event.target===e.target||clearTimeout(f)),i&&i.data&&i.data.jstree&&(!i.event.target.id||"jstree-marker"!==i.event.target.id)){e=i.event;var j=a.jstree.reference(i.event.target),k=!1,l=!1,m=!1,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D;if(j&&j._data&&j._data.dnd)if(g.attr("class","jstree-"+j.get_theme()+(j.settings.core.themes.responsive?" jstree-dnd-responsive":"")),C=i.data.origin&&(i.data.origin.settings.dnd.always_copy||i.data.origin.settings.dnd.copy&&(i.event.metaKey||i.event.ctrlKey)),i.helper.children().attr("class","jstree-"+j.get_theme()+" jstree-"+j.get_theme()+"-"+j.get_theme_variant()+" "+(j.settings.core.themes.responsive?" jstree-dnd-responsive":"")).find(".jstree-copy").first()[C?"show":"hide"](),i.event.target!==j.element[0]&&i.event.target!==j.get_container_ul()[0]||0!==j.get_container_ul().children().length){if(k=j.settings.dnd.large_drop_target?a(i.event.target).closest(".jstree-node").children(".jstree-anchor"):a(i.event.target).closest(".jstree-anchor"),k&&k.length&&k.parent().is(".jstree-closed, .jstree-open, .jstree-leaf")&&(l=k.offset(),m=(i.event.pageY!==b?i.event.pageY:i.event.originalEvent.pageY)-l.top,q=k.outerHeight(),t=q/3>m?["b","i","a"]:m>q-q/3?["a","i","b"]:m>q/2?["i","a","b"]:["i","b","a"],a.each(t,function(b,e){switch(e){case"b":o=l.left-6,p=l.top,r=j.get_parent(k),s=k.parent().index();break;case"i":A=j.settings.dnd.inside_pos,B=j.get_node(k.parent()),o=l.left-2,p=l.top+q/2+1,r=B.id,s="first"===A?0:"last"===A?B.children.length:Math.min(A,B.children.length);break;case"a":o=l.left-6,p=l.top+q,r=j.get_parent(k),s=k.parent().index()+1}for(u=!0,v=0,w=i.data.nodes.length;w>v;v++)if(x=i.data.origin&&(i.data.origin.settings.dnd.always_copy||i.data.origin.settings.dnd.copy&&(i.event.metaKey||i.event.ctrlKey))?"copy_node":"move_node",y=s,"move_node"===x&&"a"===e&&i.data.origin&&i.data.origin===j&&r===j.get_parent(i.data.nodes[v])&&(z=j.get_node(r),y>a.inArray(i.data.nodes[v],z.children)&&(y-=1)),u=u&&(j&&j.settings&&j.settings.dnd&&j.settings.dnd.check_while_dragging===!1||j.check(x,i.data.origin&&i.data.origin!==j?i.data.origin.get_node(i.data.nodes[v]):i.data.nodes[v],r,y,{dnd:!0,ref:j.get_node(k.parent()),pos:e,origin:i.data.origin,is_multi:i.data.origin&&i.data.origin!==j,is_foreign:!i.data.origin})),!u){j&&j.last_error&&(d=j.last_error());break}return"i"===e&&k.parent().is(".jstree-closed")&&j.settings.dnd.open_timeout&&(f=setTimeout(function(a,b){return function(){a.open_node(b)}}(j,k),j.settings.dnd.open_timeout)),u?(D=j.get_node(r,!0),D.hasClass(".jstree-dnd-parent")||(a(".jstree-dnd-parent").removeClass("jstree-dnd-parent"),D.addClass("jstree-dnd-parent")),c={ins:j,par:r,pos:"i"!==e||"last"!==A||0!==s||j.is_loaded(B)?s:"last"},g.css({left:o+"px",top:p+"px"}).show(),i.helper.find(".jstree-icon").first().removeClass("jstree-er").addClass("jstree-ok"),i.event.originalEvent&&i.event.originalEvent.dataTransfer&&(i.event.originalEvent.dataTransfer.dropEffect=C?"copy":"move"),d={},t=!0,!1):void 0}),t===!0))return}else{for(u=!0,v=0,w=i.data.nodes.length;w>v;v++)if(u=u&&j.check(i.data.origin&&(i.data.origin.settings.dnd.always_copy||i.data.origin.settings.dnd.copy&&(i.event.metaKey||i.event.ctrlKey))?"copy_node":"move_node",i.data.origin&&i.data.origin!==j?i.data.origin.get_node(i.data.nodes[v]):i.data.nodes[v],a.jstree.root,"last",{dnd:!0,ref:j.get_node(a.jstree.root),pos:"i",origin:i.data.origin,is_multi:i.data.origin&&i.data.origin!==j,is_foreign:!i.data.origin}),!u)break;if(u)return c={ins:j,par:a.jstree.root,pos:"last"},g.hide(),i.helper.find(".jstree-icon").first().removeClass("jstree-er").addClass("jstree-ok"),void(i.event.originalEvent&&i.event.originalEvent.dataTransfer&&(i.event.originalEvent.dataTransfer.dropEffect=C?"copy":"move"))}a(".jstree-dnd-parent").removeClass("jstree-dnd-parent"),c=!1,i.helper.find(".jstree-icon").removeClass("jstree-ok").addClass("jstree-er"),i.event.originalEvent&&i.event.originalEvent.dataTransfer&&(i.event.originalEvent.dataTransfer.dropEffect="none"),g.hide()}}).on("dnd_scroll.vakata.jstree",function(a,b){b&&b.data&&b.data.jstree&&(g.hide(),c=!1,e=!1,b.helper.find(".jstree-icon").first().removeClass("jstree-ok").addClass("jstree-er"))}).on("dnd_stop.vakata.jstree",function(b,h){if(a(".jstree-dnd-parent").removeClass("jstree-dnd-parent"),f&&clearTimeout(f),h&&h.data&&h.data.jstree){g.hide().detach();var i,j,k=[];if(c){for(i=0,j=h.data.nodes.length;j>i;i++)k[i]=h.data.origin?h.data.origin.get_node(h.data.nodes[i]):h.data.nodes[i];c.ins[h.data.origin&&(h.data.origin.settings.dnd.always_copy||h.data.origin.settings.dnd.copy&&(h.event.metaKey||h.event.ctrlKey))?"copy_node":"move_node"](k,c.par,c.pos,!1,!1,!1,h.data.origin)}else i=a(h.event.target).closest(".jstree"),i.length&&d&&d.error&&"check"===d.error&&(i=i.jstree(!0),i&&i.settings.core.error.call(this,d));e=!1,c=!1}}).on("keyup.jstree keydown.jstree",function(b,h){h=a.vakata.dnd._get(),h&&h.data&&h.data.jstree&&("keyup"===b.type&&27===b.which?(f&&clearTimeout(f),c=!1,d=!1,e=!1,f=!1,g.hide().detach(),a.vakata.dnd._clean()):(h.helper.find(".jstree-copy").first()[h.data.origin&&(h.data.origin.settings.dnd.always_copy||h.data.origin.settings.dnd.copy&&(b.metaKey||b.ctrlKey))?"show":"hide"](),e&&(e.metaKey=b.metaKey,e.ctrlKey=b.ctrlKey,a.vakata.dnd._trigger("move",e))))})}),function(a){a.vakata.html={div:a("
        "),escape:function(b){return a.vakata.html.div.text(b).html()},strip:function(b){return a.vakata.html.div.empty().append(a.parseHTML(b)).text()}};var c={element:!1,target:!1,is_down:!1,is_drag:!1,helper:!1,helper_w:0,data:!1,init_x:0,init_y:0,scroll_l:0,scroll_t:0,scroll_e:!1,scroll_i:!1,is_touch:!1};a.vakata.dnd={settings:{scroll_speed:10,scroll_proximity:20,helper_left:5,helper_top:10,threshold:5,threshold_touch:50},_trigger:function(c,d,e){e===b&&(e=a.vakata.dnd._get()),e.event=d,a(i).triggerHandler("dnd_"+c+".vakata",e)},_get:function(){return{data:c.data,element:c.element,helper:c.helper}},_clean:function(){c.helper&&c.helper.remove(),c.scroll_i&&(clearInterval(c.scroll_i),c.scroll_i=!1),c={element:!1,target:!1,is_down:!1,is_drag:!1,helper:!1,helper_w:0,data:!1,init_x:0,init_y:0,scroll_l:0,scroll_t:0,scroll_e:!1,scroll_i:!1,is_touch:!1},a(i).off("mousemove.vakata.jstree touchmove.vakata.jstree",a.vakata.dnd.drag),a(i).off("mouseup.vakata.jstree touchend.vakata.jstree",a.vakata.dnd.stop)},_scroll:function(b){if(!c.scroll_e||!c.scroll_l&&!c.scroll_t)return c.scroll_i&&(clearInterval(c.scroll_i),c.scroll_i=!1),!1;if(!c.scroll_i)return c.scroll_i=setInterval(a.vakata.dnd._scroll,100),!1;if(b===!0)return!1;var d=c.scroll_e.scrollTop(),e=c.scroll_e.scrollLeft();c.scroll_e.scrollTop(d+c.scroll_t*a.vakata.dnd.settings.scroll_speed),c.scroll_e.scrollLeft(e+c.scroll_l*a.vakata.dnd.settings.scroll_speed),(d!==c.scroll_e.scrollTop()||e!==c.scroll_e.scrollLeft())&&a.vakata.dnd._trigger("scroll",c.scroll_e)},start:function(b,d,e){"touchstart"===b.type&&b.originalEvent&&b.originalEvent.changedTouches&&b.originalEvent.changedTouches[0]&&(b.pageX=b.originalEvent.changedTouches[0].pageX,b.pageY=b.originalEvent.changedTouches[0].pageY,b.target=i.elementFromPoint(b.originalEvent.changedTouches[0].pageX-window.pageXOffset,b.originalEvent.changedTouches[0].pageY-window.pageYOffset)),c.is_drag&&a.vakata.dnd.stop({});try{b.currentTarget.unselectable="on",b.currentTarget.onselectstart=function(){return!1},b.currentTarget.style&&(b.currentTarget.style.touchAction="none",b.currentTarget.style.msTouchAction="none",b.currentTarget.style.MozUserSelect="none")}catch(f){}return c.init_x=b.pageX,c.init_y=b.pageY,c.data=d,c.is_down=!0,c.element=b.currentTarget,c.target=b.target,c.is_touch="touchstart"===b.type,e!==!1&&(c.helper=a("
        ").html(e).css({display:"block",margin:"0",padding:"0",position:"absolute",top:"-2000px",lineHeight:"16px",zIndex:"10000"})),a(i).on("mousemove.vakata.jstree touchmove.vakata.jstree",a.vakata.dnd.drag),a(i).on("mouseup.vakata.jstree touchend.vakata.jstree",a.vakata.dnd.stop),!1},drag:function(b){if("touchmove"===b.type&&b.originalEvent&&b.originalEvent.changedTouches&&b.originalEvent.changedTouches[0]&&(b.pageX=b.originalEvent.changedTouches[0].pageX,b.pageY=b.originalEvent.changedTouches[0].pageY,b.target=i.elementFromPoint(b.originalEvent.changedTouches[0].pageX-window.pageXOffset,b.originalEvent.changedTouches[0].pageY-window.pageYOffset)),c.is_down){if(!c.is_drag){if(!(Math.abs(b.pageX-c.init_x)>(c.is_touch?a.vakata.dnd.settings.threshold_touch:a.vakata.dnd.settings.threshold)||Math.abs(b.pageY-c.init_y)>(c.is_touch?a.vakata.dnd.settings.threshold_touch:a.vakata.dnd.settings.threshold)))return;c.helper&&(c.helper.appendTo("body"),c.helper_w=c.helper.outerWidth()),c.is_drag=!0,a(c.target).one("click.vakata",!1),a.vakata.dnd._trigger("start",b)}var d=!1,e=!1,f=!1,g=!1,h=!1,j=!1,k=!1,l=!1,m=!1,n=!1;return c.scroll_t=0,c.scroll_l=0,c.scroll_e=!1,a(a(b.target).parentsUntil("body").addBack().get().reverse()).filter(function(){return/^auto|scroll$/.test(a(this).css("overflow"))&&(this.scrollHeight>this.offsetHeight||this.scrollWidth>this.offsetWidth)}).each(function(){var d=a(this),e=d.offset();return this.scrollHeight>this.offsetHeight&&(e.top+d.height()-b.pageYthis.offsetWidth&&(e.left+d.width()-b.pageXg&&b.pageY-kg&&g-(b.pageY-k)j&&b.pageX-lj&&j-(b.pageX-l)f&&(m=f-50),h&&n+c.helper_w>h&&(n=h-(c.helper_w+2)),c.helper.css({left:n+"px",top:m+"px"})),a.vakata.dnd._trigger("move",b),!1}},stop:function(b){if("touchend"===b.type&&b.originalEvent&&b.originalEvent.changedTouches&&b.originalEvent.changedTouches[0]&&(b.pageX=b.originalEvent.changedTouches[0].pageX,b.pageY=b.originalEvent.changedTouches[0].pageY,b.target=i.elementFromPoint(b.originalEvent.changedTouches[0].pageX-window.pageXOffset,b.originalEvent.changedTouches[0].pageY-window.pageYOffset)),c.is_drag)b.target!==c.target&&a(c.target).off("click.vakata"),a.vakata.dnd._trigger("stop",b);else if("touchend"===b.type&&b.target===c.target){var d=setTimeout(function(){a(b.target).click()},100);a(b.target).one("click",function(){d&&clearTimeout(d)})}return a.vakata.dnd._clean(),!1}}}(a),a.jstree.defaults.massload=null,a.jstree.plugins.massload=function(b,c){this.init=function(a,b){this._data.massload={},c.init.call(this,a,b)},this._load_nodes=function(b,d,e,f){var g=this.settings.massload,h=JSON.stringify(b),i=[],j=this._model.data,k,l,m;if(!e){for(k=0,l=b.length;l>k;k++)(!j[b[k]]||!j[b[k]].state.loaded&&!j[b[k]].state.failed||f)&&(i.push(b[k]),m=this.get_node(b[k],!0),m&&m.length&&m.addClass("jstree-loading").attr("aria-busy",!0));if(this._data.massload={},i.length){if(a.isFunction(g))return g.call(this,i,a.proxy(function(a){var g,h;if(a)for(g in a)a.hasOwnProperty(g)&&(this._data.massload[g]=a[g]);for(g=0,h=b.length;h>g;g++)m=this.get_node(b[g],!0),m&&m.length&&m.removeClass("jstree-loading").attr("aria-busy",!1);c._load_nodes.call(this,b,d,e,f)},this));if("object"==typeof g&&g&&g.url)return g=a.extend(!0,{},g),a.isFunction(g.url)&&(g.url=g.url.call(this,i)),a.isFunction(g.data)&&(g.data=g.data.call(this,i)),a.ajax(g).done(a.proxy(function(a,g,h){var i,j;if(a)for(i in a)a.hasOwnProperty(i)&&(this._data.massload[i]=a[i]);for(i=0,j=b.length;j>i;i++)m=this.get_node(b[i],!0),m&&m.length&&m.removeClass("jstree-loading").attr("aria-busy",!1);c._load_nodes.call(this,b,d,e,f)},this)).fail(a.proxy(function(a){c._load_nodes.call(this,b,d,e,f)},this))}}return c._load_nodes.call(this,b,d,e,f)},this._load_node=function(b,d){var e=this._data.massload[b.id],f=null,g;return e?(f=this["string"==typeof e?"_append_html_data":"_append_json_data"](b,"string"==typeof e?a(a.parseHTML(e)).filter(function(){return 3!==this.nodeType}):e,function(a){d.call(this,a)}),g=this.get_node(b.id,!0),g&&g.length&&g.removeClass("jstree-loading").attr("aria-busy",!1),delete this._data.massload[b.id],f):c._load_node.call(this,b,d)}},a.jstree.defaults.search={ajax:!1,fuzzy:!1,case_sensitive:!1,show_only_matches:!1,show_only_matches_children:!1,close_opened_onclear:!0,search_leaves_only:!1,search_callback:!1},a.jstree.plugins.search=function(c,d){this.bind=function(){d.bind.call(this),this._data.search.str="",this._data.search.dom=a(),this._data.search.res=[],this._data.search.opn=[],this._data.search.som=!1,this._data.search.smc=!1,this._data.search.hdn=[],this.element.on("search.jstree",a.proxy(function(b,c){if(this._data.search.som&&c.res.length){var d=this._model.data,e,f,g=[],h,i;for(e=0,f=c.res.length;f>e;e++)if(d[c.res[e]]&&!d[c.res[e]].state.hidden&&(g.push(c.res[e]),g=g.concat(d[c.res[e]].parents),this._data.search.smc))for(h=0,i=d[c.res[e]].children_d.length;i>h;h++)d[d[c.res[e]].children_d[h]]&&!d[d[c.res[e]].children_d[h]].state.hidden&&g.push(d[c.res[e]].children_d[h]);g=a.vakata.array_remove_item(a.vakata.array_unique(g),a.jstree.root),this._data.search.hdn=this.hide_all(!0),this.show_node(g,!0),this.redraw(!0)}},this)).on("clear_search.jstree",a.proxy(function(a,b){this._data.search.som&&b.res.length&&(this.show_node(this._data.search.hdn,!0),this.redraw(!0))},this))},this.search=function(c,d,e,f,g,h){if(c===!1||""===a.trim(c.toString()))return this.clear_search();f=this.get_node(f),f=f&&f.id?f.id:null,c=c.toString();var i=this.settings.search,j=i.ajax?i.ajax:!1,k=this._model.data,l=null,m=[],n=[],o,p;if(this._data.search.res.length&&!g&&this.clear_search(),e===b&&(e=i.show_only_matches),h===b&&(h=i.show_only_matches_children),!d&&j!==!1)return a.isFunction(j)?j.call(this,c,a.proxy(function(b){b&&b.d&&(b=b.d),this._load_nodes(a.isArray(b)?a.vakata.array_unique(b):[],function(){this.search(c,!0,e,f,g,h)})},this),f):(j=a.extend({},j),j.data||(j.data={}),j.data.str=c,f&&(j.data.inside=f),this._data.search.lastRequest&&this._data.search.lastRequest.abort(),this._data.search.lastRequest=a.ajax(j).fail(a.proxy(function(){this._data.core.last_error={error:"ajax",plugin:"search",id:"search_01",reason:"Could not load search parents",data:JSON.stringify(j)},this.settings.core.error.call(this,this._data.core.last_error)},this)).done(a.proxy(function(b){b&&b.d&&(b=b.d),this._load_nodes(a.isArray(b)?a.vakata.array_unique(b):[],function(){this.search(c,!0,e,f,g,h)})},this)),this._data.search.lastRequest);if(g||(this._data.search.str=c,this._data.search.dom=a(),this._data.search.res=[],this._data.search.opn=[],this._data.search.som=e,this._data.search.smc=h),l=new a.vakata.search(c,!0,{caseSensitive:i.case_sensitive,fuzzy:i.fuzzy}),a.each(k[f?f:a.jstree.root].children_d,function(a,b){var d=k[b];d.text&&!d.state.hidden&&(!i.search_leaves_only||d.state.loaded&&0===d.children.length)&&(i.search_callback&&i.search_callback.call(this,c,d)||!i.search_callback&&l.search(d.text).isMatch)&&(m.push(b),n=n.concat(d.parents))}),m.length){for(n=a.vakata.array_unique(n),o=0,p=n.length;p>o;o++)n[o]!==a.jstree.root&&k[n[o]]&&this.open_node(n[o],null,0)===!0&&this._data.search.opn.push(n[o]);g?(this._data.search.dom=this._data.search.dom.add(a(this.element[0].querySelectorAll("#"+a.map(m,function(b){return-1!=="0123456789".indexOf(b[0])?"\\3"+b[0]+" "+b.substr(1).replace(a.jstree.idregex,"\\$&"):b.replace(a.jstree.idregex,"\\$&")}).join(", #")))),this._data.search.res=a.vakata.array_unique(this._data.search.res.concat(m))):(this._data.search.dom=a(this.element[0].querySelectorAll("#"+a.map(m,function(b){return-1!=="0123456789".indexOf(b[0])?"\\3"+b[0]+" "+b.substr(1).replace(a.jstree.idregex,"\\$&"):b.replace(a.jstree.idregex,"\\$&")}).join(", #"))),this._data.search.res=m),this._data.search.dom.children(".jstree-anchor").addClass("jstree-search")}this.trigger("search",{nodes:this._data.search.dom,str:c,res:this._data.search.res,show_only_matches:e})},this.clear_search=function(){this.settings.search.close_opened_onclear&&this.close_node(this._data.search.opn,0),this.trigger("clear_search",{nodes:this._data.search.dom,str:this._data.search.str,res:this._data.search.res}),this._data.search.res.length&&(this._data.search.dom=a(this.element[0].querySelectorAll("#"+a.map(this._data.search.res,function(b){return-1!=="0123456789".indexOf(b[0])?"\\3"+b[0]+" "+b.substr(1).replace(a.jstree.idregex,"\\$&"):b.replace(a.jstree.idregex,"\\$&")}).join(", #"))),this._data.search.dom.children(".jstree-anchor").removeClass("jstree-search")),this._data.search.str="",this._data.search.res=[],this._data.search.opn=[],this._data.search.dom=a()},this.redraw_node=function(b,c,e,f){if(b=d.redraw_node.apply(this,arguments),b&&-1!==a.inArray(b.id,this._data.search.res)){var g,h,i=null;for(g=0,h=b.childNodes.length;h>g;g++)if(b.childNodes[g]&&b.childNodes[g].className&&-1!==b.childNodes[g].className.indexOf("jstree-anchor")){i=b.childNodes[g];break}i&&(i.className+=" jstree-search")}return b}},function(a){a.vakata.search=function(b,c,d){d=d||{},d=a.extend({},a.vakata.search.defaults,d),d.fuzzy!==!1&&(d.fuzzy=!0),b=d.caseSensitive?b:b.toLowerCase();var e=d.location,f=d.distance,g=d.threshold,h=b.length,i,j,k,l;return h>32&&(d.fuzzy=!1),d.fuzzy&&(i=1<c;c++)a[b.charAt(c)]=0;for(c=0;h>c;c++)a[b.charAt(c)]|=1<c;c++){o=0,p=q;while(p>o)k(c,e+p)<=m?o=p:q=p,p=Math.floor((q-o)/2+o);for(q=p,s=Math.max(1,e-p+1),t=Math.min(e+p,l)+h,u=new Array(t+2),u[t+1]=(1<=s;f--)if(v=j[a.charAt(f-1)],0===c?u[f]=(u[f+1]<<1|1)&v:u[f]=(u[f+1]<<1|1)&v|((r[f+1]|r[f])<<1|1)|r[f+1],u[f]&i&&(w=k(c,f-1),m>=w)){if(m=w,n=f-1,x.push(n),!(n>e))break;s=Math.max(1,2*e-n)}if(k(c+1,e)>m)break;r=u}return{isMatch:n>=0,score:w}},c===!0?{search:l}:l(c)},a.vakata.search.defaults={location:0,distance:100,threshold:.6,fuzzy:!1,caseSensitive:!1}}(a),a.jstree.defaults.sort=function(a,b){return this.get_text(a)>this.get_text(b)?1:-1},a.jstree.plugins.sort=function(b,c){this.bind=function(){c.bind.call(this),this.element.on("model.jstree",a.proxy(function(a,b){this.sort(b.parent,!0)},this)).on("rename_node.jstree create_node.jstree",a.proxy(function(a,b){this.sort(b.parent||b.node.parent,!1),this.redraw_node(b.parent||b.node.parent,!0)},this)).on("move_node.jstree copy_node.jstree",a.proxy(function(a,b){this.sort(b.parent,!1),this.redraw_node(b.parent,!0)},this))},this.sort=function(b,c){var d,e;if(b=this.get_node(b),b&&b.children&&b.children.length&&(b.children.sort(a.proxy(this.settings.sort,this)),c))for(d=0,e=b.children_d.length;e>d;d++)this.sort(b.children_d[d],!1)}};var m=!1;a.jstree.defaults.state={key:"jstree",events:"changed.jstree open_node.jstree close_node.jstree check_node.jstree uncheck_node.jstree",ttl:!1,filter:!1},a.jstree.plugins.state=function(b,c){this.bind=function(){c.bind.call(this);var b=a.proxy(function(){this.element.on(this.settings.state.events,a.proxy(function(){m&&clearTimeout(m),m=setTimeout(a.proxy(function(){this.save_state()},this),100)},this)),this.trigger("state_ready")},this);this.element.on("ready.jstree",a.proxy(function(a,c){this.element.one("restore_state.jstree",b),this.restore_state()||b()},this))},this.save_state=function(){var b={state:this.get_state(),ttl:this.settings.state.ttl,sec:+new Date};a.vakata.storage.set(this.settings.state.key,JSON.stringify(b))},this.restore_state=function(){var b=a.vakata.storage.get(this.settings.state.key);if(b)try{b=JSON.parse(b)}catch(c){return!1}return b&&b.ttl&&b.sec&&+new Date-b.sec>b.ttl?!1:(b&&b.state&&(b=b.state),b&&a.isFunction(this.settings.state.filter)&&(b=this.settings.state.filter.call(this,b)),b?(this.element.one("set_state.jstree",function(c,d){d.instance.trigger("restore_state",{state:a.extend(!0,{},b)})}),this.set_state(b),!0):!1)},this.clear_state=function(){return a.vakata.storage.del(this.settings.state.key)}},function(a,b){a.vakata.storage={set:function(a,b){return window.localStorage.setItem(a,b)},get:function(a){return window.localStorage.getItem(a)},del:function(a){return window.localStorage.removeItem(a)}}}(a),a.jstree.defaults.types={"default":{}},a.jstree.defaults.types[a.jstree.root]={},a.jstree.plugins.types=function(c,d){this.init=function(c,e){var f,g;if(e&&e.types&&e.types["default"])for(f in e.types)if("default"!==f&&f!==a.jstree.root&&e.types.hasOwnProperty(f))for(g in e.types["default"])e.types["default"].hasOwnProperty(g)&&e.types[f][g]===b&&(e.types[f][g]=e.types["default"][g]);d.init.call(this,c,e),this._model.data[a.jstree.root].type=a.jstree.root},this.refresh=function(b,c){d.refresh.call(this,b,c),this._model.data[a.jstree.root].type=a.jstree.root},this.bind=function(){this.element.on("model.jstree",a.proxy(function(c,d){var e=this._model.data,f=d.nodes,g=this.settings.types,h,i,j="default",k;for(h=0,i=f.length;i>h;h++){if(j="default",e[f[h]].original&&e[f[h]].original.type&&g[e[f[h]].original.type]&&(j=e[f[h]].original.type),e[f[h]].data&&e[f[h]].data.jstree&&e[f[h]].data.jstree.type&&g[e[f[h]].data.jstree.type]&&(j=e[f[h]].data.jstree.type),e[f[h]].type=j,e[f[h]].icon===!0&&g[j].icon!==b&&(e[f[h]].icon=g[j].icon),g[j].li_attr!==b&&"object"==typeof g[j].li_attr)for(k in g[j].li_attr)if(g[j].li_attr.hasOwnProperty(k)){if("id"===k)continue;e[f[h]].li_attr[k]===b?e[f[h]].li_attr[k]=g[j].li_attr[k]:"class"===k&&(e[f[h]].li_attr["class"]=g[j].li_attr["class"]+" "+e[f[h]].li_attr["class"])}if(g[j].a_attr!==b&&"object"==typeof g[j].a_attr)for(k in g[j].a_attr)if(g[j].a_attr.hasOwnProperty(k)){if("id"===k)continue;e[f[h]].a_attr[k]===b?e[f[h]].a_attr[k]=g[j].a_attr[k]:"href"===k&&"#"===e[f[h]].a_attr[k]?e[f[h]].a_attr.href=g[j].a_attr.href:"class"===k&&(e[f[h]].a_attr["class"]=g[j].a_attr["class"]+" "+e[f[h]].a_attr["class"])}}e[a.jstree.root].type=a.jstree.root},this)),d.bind.call(this)},this.get_json=function(b,c,e){var f,g,h=this._model.data,i=c?a.extend(!0,{},c,{no_id:!1}):{},j=d.get_json.call(this,b,i,e);if(j===!1)return!1;if(a.isArray(j))for(f=0,g=j.length;g>f;f++)j[f].type=j[f].id&&h[j[f].id]&&h[j[f].id].type?h[j[f].id].type:"default",c&&c.no_id&&(delete j[f].id,j[f].li_attr&&j[f].li_attr.id&&delete j[f].li_attr.id,j[f].a_attr&&j[f].a_attr.id&&delete j[f].a_attr.id);else j.type=j.id&&h[j.id]&&h[j.id].type?h[j.id].type:"default",c&&c.no_id&&(j=this._delete_ids(j));return j},this._delete_ids=function(b){if(a.isArray(b)){for(var c=0,d=b.length;d>c;c++)b[c]=this._delete_ids(b[c]);return b}return delete b.id,b.li_attr&&b.li_attr.id&&delete b.li_attr.id,b.a_attr&&b.a_attr.id&&delete b.a_attr.id,b.children&&a.isArray(b.children)&&(b.children=this._delete_ids(b.children)),b},this.check=function(c,e,f,g,h){if(d.check.call(this,c,e,f,g,h)===!1)return!1;e=e&&e.id?e:this.get_node(e),f=f&&f.id?f:this.get_node(f);var i=e&&e.id?h&&h.origin?h.origin:a.jstree.reference(e.id):null,j,k,l,m;switch(i=i&&i._model&&i._model.data?i._model.data:null,c){case"create_node":case"move_node":case"copy_node":if("move_node"!==c||-1===a.inArray(e.id,f.children)){if(j=this.get_rules(f),j.max_children!==b&&-1!==j.max_children&&j.max_children===f.children.length)return this._data.core.last_error={error:"check",plugin:"types",id:"types_01",reason:"max_children prevents function: "+c,data:JSON.stringify({chk:c,pos:g,obj:e&&e.id?e.id:!1,par:f&&f.id?f.id:!1})},!1;if(j.valid_children!==b&&-1!==j.valid_children&&-1===a.inArray(e.type||"default",j.valid_children))return this._data.core.last_error={error:"check",plugin:"types",id:"types_02",reason:"valid_children prevents function: "+c,data:JSON.stringify({chk:c,pos:g,obj:e&&e.id?e.id:!1,par:f&&f.id?f.id:!1})},!1;if(i&&e.children_d&&e.parents){for(k=0,l=0,m=e.children_d.length;m>l;l++)k=Math.max(k,i[e.children_d[l]].parents.length);k=k-e.parents.length+1}(0>=k||k===b)&&(k=1);do{if(j.max_depth!==b&&-1!==j.max_depth&&j.max_depthg;g++)this.set_type(c[g],d);return!0}if(f=this.settings.types,c=this.get_node(c),!f[d]||!c)return!1;if(l=this.get_node(c,!0),l&&l.length&&(m=l.children(".jstree-anchor")),i=c.type,j=this.get_icon(c),c.type=d,(j===!0||!f[i]||f[i].icon!==b&&j===f[i].icon)&&this.set_icon(c,f[d].icon!==b?f[d].icon:!0),f[i]&&f[i].li_attr!==b&&"object"==typeof f[i].li_attr)for(k in f[i].li_attr)if(f[i].li_attr.hasOwnProperty(k)){if("id"===k)continue;"class"===k?(e[c.id].li_attr["class"]=(e[c.id].li_attr["class"]||"").replace(f[i].li_attr[k],""),l&&l.removeClass(f[i].li_attr[k])):e[c.id].li_attr[k]===f[i].li_attr[k]&&(e[c.id].li_attr[k]=null,l&&l.removeAttr(k))}if(f[i]&&f[i].a_attr!==b&&"object"==typeof f[i].a_attr)for(k in f[i].a_attr)if(f[i].a_attr.hasOwnProperty(k)){if("id"===k)continue;"class"===k?(e[c.id].a_attr["class"]=(e[c.id].a_attr["class"]||"").replace(f[i].a_attr[k],""),m&&m.removeClass(f[i].a_attr[k])):e[c.id].a_attr[k]===f[i].a_attr[k]&&("href"===k?(e[c.id].a_attr[k]="#",m&&m.attr("href","#")):(delete e[c.id].a_attr[k],m&&m.removeAttr(k)))}if(f[d].li_attr!==b&&"object"==typeof f[d].li_attr)for(k in f[d].li_attr)if(f[d].li_attr.hasOwnProperty(k)){if("id"===k)continue;e[c.id].li_attr[k]===b?(e[c.id].li_attr[k]=f[d].li_attr[k],l&&("class"===k?l.addClass(f[d].li_attr[k]):l.attr(k,f[d].li_attr[k]))):"class"===k&&(e[c.id].li_attr["class"]=f[d].li_attr[k]+" "+e[c.id].li_attr["class"],l&&l.addClass(f[d].li_attr[k]))}if(f[d].a_attr!==b&&"object"==typeof f[d].a_attr)for(k in f[d].a_attr)if(f[d].a_attr.hasOwnProperty(k)){if("id"===k)continue;e[c.id].a_attr[k]===b?(e[c.id].a_attr[k]=f[d].a_attr[k],m&&("class"===k?m.addClass(f[d].a_attr[k]):m.attr(k,f[d].a_attr[k]))):"href"===k&&"#"===e[c.id].a_attr[k]?(e[c.id].a_attr.href=f[d].a_attr.href,m&&m.attr("href",f[d].a_attr.href)):"class"===k&&(e[c.id].a_attr["class"]=f[d].a_attr["class"]+" "+e[c.id].a_attr["class"],m&&m.addClass(f[d].a_attr[k]))}return!0}},a.jstree.defaults.unique={case_sensitive:!1,duplicate:function(a,b){return a+" ("+b+")"}},a.jstree.plugins.unique=function(c,d){this.check=function(b,c,e,f,g){if(d.check.call(this,b,c,e,f,g)===!1)return!1; -if(c=c&&c.id?c:this.get_node(c),e=e&&e.id?e:this.get_node(e),!e||!e.children)return!0;var h="rename_node"===b?f:c.text,i=[],j=this.settings.unique.case_sensitive,k=this._model.data,l,m;for(l=0,m=e.children.length;m>l;l++)i.push(j?k[e.children[l]].text:k[e.children[l]].text.toLowerCase());switch(j||(h=h.toLowerCase()),b){case"delete_node":return!0;case"rename_node":return l=-1===a.inArray(h,i)||c.text&&c.text[j?"toString":"toLowerCase"]()===h,l||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_01",reason:"Child with name "+h+" already exists. Preventing: "+b,data:JSON.stringify({chk:b,pos:f,obj:c&&c.id?c.id:!1,par:e&&e.id?e.id:!1})}),l;case"create_node":return l=-1===a.inArray(h,i),l||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_04",reason:"Child with name "+h+" already exists. Preventing: "+b,data:JSON.stringify({chk:b,pos:f,obj:c&&c.id?c.id:!1,par:e&&e.id?e.id:!1})}),l;case"copy_node":return l=-1===a.inArray(h,i),l||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_02",reason:"Child with name "+h+" already exists. Preventing: "+b,data:JSON.stringify({chk:b,pos:f,obj:c&&c.id?c.id:!1,par:e&&e.id?e.id:!1})}),l;case"move_node":return l=c.parent===e.id&&(!g||!g.is_multi)||-1===a.inArray(h,i),l||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_03",reason:"Child with name "+h+" already exists. Preventing: "+b,data:JSON.stringify({chk:b,pos:f,obj:c&&c.id?c.id:!1,par:e&&e.id?e.id:!1})}),l}return!0},this.create_node=function(c,e,f,g,h){if(!e||e.text===b){if(null===c&&(c=a.jstree.root),c=this.get_node(c),!c)return d.create_node.call(this,c,e,f,g,h);if(f=f===b?"last":f,!f.toString().match(/^(before|after)$/)&&!h&&!this.is_loaded(c))return d.create_node.call(this,c,e,f,g,h);e||(e={});var i,j,k,l,m,n=this._model.data,o=this.settings.unique.case_sensitive,p=this.settings.unique.duplicate;for(j=i=this.get_string("New node"),k=[],l=0,m=c.children.length;m>l;l++)k.push(o?n[c.children[l]].text:n[c.children[l]].text.toLowerCase());l=1;while(-1!==a.inArray(o?j:j.toLowerCase(),k))j=p.call(this,i,++l).toString();e.text=j}return d.create_node.call(this,c,e,f,g,h)}};var n=i.createElement("DIV");if(n.setAttribute("unselectable","on"),n.setAttribute("role","presentation"),n.className="jstree-wholerow",n.innerHTML=" ",a.jstree.plugins.wholerow=function(b,c){this.bind=function(){c.bind.call(this),this.element.on("ready.jstree set_state.jstree",a.proxy(function(){this.hide_dots()},this)).on("init.jstree loading.jstree ready.jstree",a.proxy(function(){this.get_container_ul().addClass("jstree-wholerow-ul")},this)).on("deselect_all.jstree",a.proxy(function(a,b){this.element.find(".jstree-wholerow-clicked").removeClass("jstree-wholerow-clicked")},this)).on("changed.jstree",a.proxy(function(a,b){this.element.find(".jstree-wholerow-clicked").removeClass("jstree-wholerow-clicked");var c=!1,d,e;for(d=0,e=b.selected.length;e>d;d++)c=this.get_node(b.selected[d],!0),c&&c.length&&c.children(".jstree-wholerow").addClass("jstree-wholerow-clicked")},this)).on("open_node.jstree",a.proxy(function(a,b){this.get_node(b.node,!0).find(".jstree-clicked").parent().children(".jstree-wholerow").addClass("jstree-wholerow-clicked")},this)).on("hover_node.jstree dehover_node.jstree",a.proxy(function(a,b){"hover_node"===a.type&&this.is_disabled(b.node)||this.get_node(b.node,!0).children(".jstree-wholerow")["hover_node"===a.type?"addClass":"removeClass"]("jstree-wholerow-hovered")},this)).on("contextmenu.jstree",".jstree-wholerow",a.proxy(function(b){if(this._data.contextmenu){b.preventDefault();var c=a.Event("contextmenu",{metaKey:b.metaKey,ctrlKey:b.ctrlKey,altKey:b.altKey,shiftKey:b.shiftKey,pageX:b.pageX,pageY:b.pageY});a(b.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(c)}},this)).on("click.jstree",".jstree-wholerow",function(b){b.stopImmediatePropagation();var c=a.Event("click",{metaKey:b.metaKey,ctrlKey:b.ctrlKey,altKey:b.altKey,shiftKey:b.shiftKey});a(b.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(c).focus()}).on("dblclick.jstree",".jstree-wholerow",function(b){b.stopImmediatePropagation();var c=a.Event("dblclick",{metaKey:b.metaKey,ctrlKey:b.ctrlKey,altKey:b.altKey,shiftKey:b.shiftKey});a(b.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(c).focus()}).on("click.jstree",".jstree-leaf > .jstree-ocl",a.proxy(function(b){b.stopImmediatePropagation();var c=a.Event("click",{metaKey:b.metaKey,ctrlKey:b.ctrlKey,altKey:b.altKey,shiftKey:b.shiftKey});a(b.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(c).focus()},this)).on("mouseover.jstree",".jstree-wholerow, .jstree-icon",a.proxy(function(a){return a.stopImmediatePropagation(),this.is_disabled(a.currentTarget)||this.hover_node(a.currentTarget),!1},this)).on("mouseleave.jstree",".jstree-node",a.proxy(function(a){this.dehover_node(a.currentTarget)},this))},this.teardown=function(){this.settings.wholerow&&this.element.find(".jstree-wholerow").remove(),c.teardown.call(this)},this.redraw_node=function(b,d,e,f){if(b=c.redraw_node.apply(this,arguments)){var g=n.cloneNode(!0);-1!==a.inArray(b.id,this._data.core.selected)&&(g.className+=" jstree-wholerow-clicked"),this._data.core.focused&&this._data.core.focused===b.id&&(g.className+=" jstree-wholerow-hovered"),b.insertBefore(g,b.childNodes[0])}return b}},i.registerElement&&Object&&Object.create){var o=Object.create(HTMLElement.prototype);o.createdCallback=function(){var b={core:{},plugins:[]},c;for(c in a.jstree.plugins)a.jstree.plugins.hasOwnProperty(c)&&this.attributes[c]&&(b.plugins.push(c),this.getAttribute(c)&&JSON.parse(this.getAttribute(c))&&(b[c]=JSON.parse(this.getAttribute(c))));for(c in a.jstree.defaults.core)a.jstree.defaults.core.hasOwnProperty(c)&&this.attributes[c]&&(b.core[c]=JSON.parse(this.getAttribute(c))||this.getAttribute(c));a(this).jstree(b)};try{i.registerElement("vakata-jstree",{prototype:o})}catch(p){}}}}); \ No newline at end of file diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/dist/themes/default-dark/32px.png b/mayan/apps/cabinets/static/cabinets/packages/jstree/dist/themes/default-dark/32px.png deleted file mode 100644 index d6fd72114f..0000000000 Binary files a/mayan/apps/cabinets/static/cabinets/packages/jstree/dist/themes/default-dark/32px.png and /dev/null differ diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/dist/themes/default-dark/40px.png b/mayan/apps/cabinets/static/cabinets/packages/jstree/dist/themes/default-dark/40px.png deleted file mode 100644 index 4fc88e41e6..0000000000 Binary files a/mayan/apps/cabinets/static/cabinets/packages/jstree/dist/themes/default-dark/40px.png and /dev/null differ diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/dist/themes/default-dark/style.css b/mayan/apps/cabinets/static/cabinets/packages/jstree/dist/themes/default-dark/style.css deleted file mode 100644 index 3af003f2d5..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/dist/themes/default-dark/style.css +++ /dev/null @@ -1,1146 +0,0 @@ -/* jsTree default dark theme */ -.jstree-node, -.jstree-children, -.jstree-container-ul { - display: block; - margin: 0; - padding: 0; - list-style-type: none; - list-style-image: none; -} -.jstree-node { - white-space: nowrap; -} -.jstree-anchor { - display: inline-block; - color: black; - white-space: nowrap; - padding: 0 4px 0 1px; - margin: 0; - vertical-align: top; -} -.jstree-anchor:focus { - outline: 0; -} -.jstree-anchor, -.jstree-anchor:link, -.jstree-anchor:visited, -.jstree-anchor:hover, -.jstree-anchor:active { - text-decoration: none; - color: inherit; -} -.jstree-icon { - display: inline-block; - text-decoration: none; - margin: 0; - padding: 0; - vertical-align: top; - text-align: center; -} -.jstree-icon:empty { - display: inline-block; - text-decoration: none; - margin: 0; - padding: 0; - vertical-align: top; - text-align: center; -} -.jstree-ocl { - cursor: pointer; -} -.jstree-leaf > .jstree-ocl { - cursor: default; -} -.jstree .jstree-open > .jstree-children { - display: block; -} -.jstree .jstree-closed > .jstree-children, -.jstree .jstree-leaf > .jstree-children { - display: none; -} -.jstree-anchor > .jstree-themeicon { - margin-right: 2px; -} -.jstree-no-icons .jstree-themeicon, -.jstree-anchor > .jstree-themeicon-hidden { - display: none; -} -.jstree-hidden, -.jstree-node.jstree-hidden { - display: none; -} -.jstree-rtl .jstree-anchor { - padding: 0 1px 0 4px; -} -.jstree-rtl .jstree-anchor > .jstree-themeicon { - margin-left: 2px; - margin-right: 0; -} -.jstree-rtl .jstree-node { - margin-left: 0; -} -.jstree-rtl .jstree-container-ul > .jstree-node { - margin-right: 0; -} -.jstree-wholerow-ul { - position: relative; - display: inline-block; - min-width: 100%; -} -.jstree-wholerow-ul .jstree-leaf > .jstree-ocl { - cursor: pointer; -} -.jstree-wholerow-ul .jstree-anchor, -.jstree-wholerow-ul .jstree-icon { - position: relative; -} -.jstree-wholerow-ul .jstree-wholerow { - width: 100%; - cursor: pointer; - position: absolute; - left: 0; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} -.vakata-context { - display: none; -} -.vakata-context, -.vakata-context ul { - margin: 0; - padding: 2px; - position: absolute; - background: #f5f5f5; - border: 1px solid #979797; - box-shadow: 2px 2px 2px #999999; -} -.vakata-context ul { - list-style: none; - left: 100%; - margin-top: -2.7em; - margin-left: -4px; -} -.vakata-context .vakata-context-right ul { - left: auto; - right: 100%; - margin-left: auto; - margin-right: -4px; -} -.vakata-context li { - list-style: none; -} -.vakata-context li > a { - display: block; - padding: 0 2em 0 2em; - text-decoration: none; - width: auto; - color: black; - white-space: nowrap; - line-height: 2.4em; - text-shadow: 1px 1px 0 white; - border-radius: 1px; -} -.vakata-context li > a:hover { - position: relative; - background-color: #e8eff7; - box-shadow: 0 0 2px #0a6aa1; -} -.vakata-context li > a.vakata-context-parent { - background-image: url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAIORI4JlrqN1oMSnmmZDQUAOw=="); - background-position: right center; - background-repeat: no-repeat; -} -.vakata-context li > a:focus { - outline: 0; -} -.vakata-context .vakata-context-hover > a { - position: relative; - background-color: #e8eff7; - box-shadow: 0 0 2px #0a6aa1; -} -.vakata-context .vakata-context-separator > a, -.vakata-context .vakata-context-separator > a:hover { - background: white; - border: 0; - border-top: 1px solid #e2e3e3; - height: 1px; - min-height: 1px; - max-height: 1px; - padding: 0; - margin: 0 0 0 2.4em; - border-left: 1px solid #e0e0e0; - text-shadow: 0 0 0 transparent; - box-shadow: 0 0 0 transparent; - border-radius: 0; -} -.vakata-context .vakata-contextmenu-disabled a, -.vakata-context .vakata-contextmenu-disabled a:hover { - color: silver; - background-color: transparent; - border: 0; - box-shadow: 0 0 0; -} -.vakata-context li > a > i { - text-decoration: none; - display: inline-block; - width: 2.4em; - height: 2.4em; - background: transparent; - margin: 0 0 0 -2em; - vertical-align: top; - text-align: center; - line-height: 2.4em; -} -.vakata-context li > a > i:empty { - width: 2.4em; - line-height: 2.4em; -} -.vakata-context li > a .vakata-contextmenu-sep { - display: inline-block; - width: 1px; - height: 2.4em; - background: white; - margin: 0 0.5em 0 0; - border-left: 1px solid #e2e3e3; -} -.vakata-context .vakata-contextmenu-shortcut { - font-size: 0.8em; - color: silver; - opacity: 0.5; - display: none; -} -.vakata-context-rtl ul { - left: auto; - right: 100%; - margin-left: auto; - margin-right: -4px; -} -.vakata-context-rtl li > a.vakata-context-parent { - background-image: url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAINjI+AC7rWHIsPtmoxLAA7"); - background-position: left center; - background-repeat: no-repeat; -} -.vakata-context-rtl .vakata-context-separator > a { - margin: 0 2.4em 0 0; - border-left: 0; - border-right: 1px solid #e2e3e3; -} -.vakata-context-rtl .vakata-context-left ul { - right: auto; - left: 100%; - margin-left: -4px; - margin-right: auto; -} -.vakata-context-rtl li > a > i { - margin: 0 -2em 0 0; -} -.vakata-context-rtl li > a .vakata-contextmenu-sep { - margin: 0 0 0 0.5em; - border-left-color: white; - background: #e2e3e3; -} -#jstree-marker { - position: absolute; - top: 0; - left: 0; - margin: -5px 0 0 0; - padding: 0; - border-right: 0; - border-top: 5px solid transparent; - border-bottom: 5px solid transparent; - border-left: 5px solid; - width: 0; - height: 0; - font-size: 0; - line-height: 0; -} -#jstree-dnd { - line-height: 16px; - margin: 0; - padding: 4px; -} -#jstree-dnd .jstree-icon, -#jstree-dnd .jstree-copy { - display: inline-block; - text-decoration: none; - margin: 0 2px 0 0; - padding: 0; - width: 16px; - height: 16px; -} -#jstree-dnd .jstree-ok { - background: green; -} -#jstree-dnd .jstree-er { - background: red; -} -#jstree-dnd .jstree-copy { - margin: 0 2px 0 2px; -} -.jstree-default-dark .jstree-node, -.jstree-default-dark .jstree-icon { - background-repeat: no-repeat; - background-color: transparent; -} -.jstree-default-dark .jstree-anchor, -.jstree-default-dark .jstree-animated, -.jstree-default-dark .jstree-wholerow { - transition: background-color 0.15s, box-shadow 0.15s; -} -.jstree-default-dark .jstree-hovered { - background: #555555; - border-radius: 2px; - box-shadow: inset 0 0 1px #555555; -} -.jstree-default-dark .jstree-context { - background: #555555; - border-radius: 2px; - box-shadow: inset 0 0 1px #555555; -} -.jstree-default-dark .jstree-clicked { - background: #5fa2db; - border-radius: 2px; - box-shadow: inset 0 0 1px #666666; -} -.jstree-default-dark .jstree-no-icons .jstree-anchor > .jstree-themeicon { - display: none; -} -.jstree-default-dark .jstree-disabled { - background: transparent; - color: #666666; -} -.jstree-default-dark .jstree-disabled.jstree-hovered { - background: transparent; - box-shadow: none; -} -.jstree-default-dark .jstree-disabled.jstree-clicked { - background: #333333; -} -.jstree-default-dark .jstree-disabled > .jstree-icon { - opacity: 0.8; - filter: url("data:image/svg+xml;utf8,#jstree-grayscale"); - /* Firefox 10+ */ - filter: gray; - /* IE6-9 */ - -webkit-filter: grayscale(100%); - /* Chrome 19+ & Safari 6+ */ -} -.jstree-default-dark .jstree-search { - font-style: italic; - color: #ffffff; - font-weight: bold; -} -.jstree-default-dark .jstree-no-checkboxes .jstree-checkbox { - display: none !important; -} -.jstree-default-dark.jstree-checkbox-no-clicked .jstree-clicked { - background: transparent; - box-shadow: none; -} -.jstree-default-dark.jstree-checkbox-no-clicked .jstree-clicked.jstree-hovered { - background: #555555; -} -.jstree-default-dark.jstree-checkbox-no-clicked > .jstree-wholerow-ul .jstree-wholerow-clicked { - background: transparent; -} -.jstree-default-dark.jstree-checkbox-no-clicked > .jstree-wholerow-ul .jstree-wholerow-clicked.jstree-wholerow-hovered { - background: #555555; -} -.jstree-default-dark > .jstree-striped { - min-width: 100%; - display: inline-block; - background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAkCAMAAAB/qqA+AAAABlBMVEUAAAAAAAClZ7nPAAAAAnRSTlMNAMM9s3UAAAAXSURBVHjajcEBAQAAAIKg/H/aCQZ70AUBjAATb6YPDgAAAABJRU5ErkJggg==") left top repeat; -} -.jstree-default-dark > .jstree-wholerow-ul .jstree-hovered, -.jstree-default-dark > .jstree-wholerow-ul .jstree-clicked { - background: transparent; - box-shadow: none; - border-radius: 0; -} -.jstree-default-dark .jstree-wholerow { - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - box-sizing: border-box; -} -.jstree-default-dark .jstree-wholerow-hovered { - background: #555555; -} -.jstree-default-dark .jstree-wholerow-clicked { - background: #5fa2db; - background: -webkit-linear-gradient(top, #5fa2db 0%, #5fa2db 100%); - background: linear-gradient(to bottom, #5fa2db 0%, #5fa2db 100%); -} -.jstree-default-dark .jstree-node { - min-height: 24px; - line-height: 24px; - margin-left: 24px; - min-width: 24px; -} -.jstree-default-dark .jstree-anchor { - line-height: 24px; - height: 24px; -} -.jstree-default-dark .jstree-icon { - width: 24px; - height: 24px; - line-height: 24px; -} -.jstree-default-dark .jstree-icon:empty { - width: 24px; - height: 24px; - line-height: 24px; -} -.jstree-default-dark.jstree-rtl .jstree-node { - margin-right: 24px; -} -.jstree-default-dark .jstree-wholerow { - height: 24px; -} -.jstree-default-dark .jstree-node, -.jstree-default-dark .jstree-icon { - background-image: url("32px.png"); -} -.jstree-default-dark .jstree-node { - background-position: -292px -4px; - background-repeat: repeat-y; -} -.jstree-default-dark .jstree-last { - background: transparent; -} -.jstree-default-dark .jstree-open > .jstree-ocl { - background-position: -132px -4px; -} -.jstree-default-dark .jstree-closed > .jstree-ocl { - background-position: -100px -4px; -} -.jstree-default-dark .jstree-leaf > .jstree-ocl { - background-position: -68px -4px; -} -.jstree-default-dark .jstree-themeicon { - background-position: -260px -4px; -} -.jstree-default-dark > .jstree-no-dots .jstree-node, -.jstree-default-dark > .jstree-no-dots .jstree-leaf > .jstree-ocl { - background: transparent; -} -.jstree-default-dark > .jstree-no-dots .jstree-open > .jstree-ocl { - background-position: -36px -4px; -} -.jstree-default-dark > .jstree-no-dots .jstree-closed > .jstree-ocl { - background-position: -4px -4px; -} -.jstree-default-dark .jstree-disabled { - background: transparent; -} -.jstree-default-dark .jstree-disabled.jstree-hovered { - background: transparent; -} -.jstree-default-dark .jstree-disabled.jstree-clicked { - background: #efefef; -} -.jstree-default-dark .jstree-checkbox { - background-position: -164px -4px; -} -.jstree-default-dark .jstree-checkbox:hover { - background-position: -164px -36px; -} -.jstree-default-dark.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox, -.jstree-default-dark .jstree-checked > .jstree-checkbox { - background-position: -228px -4px; -} -.jstree-default-dark.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover, -.jstree-default-dark .jstree-checked > .jstree-checkbox:hover { - background-position: -228px -36px; -} -.jstree-default-dark .jstree-anchor > .jstree-undetermined { - background-position: -196px -4px; -} -.jstree-default-dark .jstree-anchor > .jstree-undetermined:hover { - background-position: -196px -36px; -} -.jstree-default-dark .jstree-checkbox-disabled { - opacity: 0.8; - filter: url("data:image/svg+xml;utf8,#jstree-grayscale"); - /* Firefox 10+ */ - filter: gray; - /* IE6-9 */ - -webkit-filter: grayscale(100%); - /* Chrome 19+ & Safari 6+ */ -} -.jstree-default-dark > .jstree-striped { - background-size: auto 48px; -} -.jstree-default-dark.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg=="); - background-position: 100% 1px; - background-repeat: repeat-y; -} -.jstree-default-dark.jstree-rtl .jstree-last { - background: transparent; -} -.jstree-default-dark.jstree-rtl .jstree-open > .jstree-ocl { - background-position: -132px -36px; -} -.jstree-default-dark.jstree-rtl .jstree-closed > .jstree-ocl { - background-position: -100px -36px; -} -.jstree-default-dark.jstree-rtl .jstree-leaf > .jstree-ocl { - background-position: -68px -36px; -} -.jstree-default-dark.jstree-rtl > .jstree-no-dots .jstree-node, -.jstree-default-dark.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl { - background: transparent; -} -.jstree-default-dark.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl { - background-position: -36px -36px; -} -.jstree-default-dark.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl { - background-position: -4px -36px; -} -.jstree-default-dark .jstree-themeicon-custom { - background-color: transparent; - background-image: none; - background-position: 0 0; -} -.jstree-default-dark > .jstree-container-ul .jstree-loading > .jstree-ocl { - background: url("throbber.gif") center center no-repeat; -} -.jstree-default-dark .jstree-file { - background: url("32px.png") -100px -68px no-repeat; -} -.jstree-default-dark .jstree-folder { - background: url("32px.png") -260px -4px no-repeat; -} -.jstree-default-dark > .jstree-container-ul > .jstree-node { - margin-left: 0; - margin-right: 0; -} -#jstree-dnd.jstree-default-dark { - line-height: 24px; - padding: 0 4px; -} -#jstree-dnd.jstree-default-dark .jstree-ok, -#jstree-dnd.jstree-default-dark .jstree-er { - background-image: url("32px.png"); - background-repeat: no-repeat; - background-color: transparent; -} -#jstree-dnd.jstree-default-dark i { - background: transparent; - width: 24px; - height: 24px; - line-height: 24px; -} -#jstree-dnd.jstree-default-dark .jstree-ok { - background-position: -4px -68px; -} -#jstree-dnd.jstree-default-dark .jstree-er { - background-position: -36px -68px; -} -.jstree-default-dark .jstree-ellipsis { - overflow: hidden; -} -.jstree-default-dark .jstree-ellipsis .jstree-anchor { - width: calc(100% - 29px); - text-overflow: ellipsis; - overflow: hidden; -} -.jstree-default-dark .jstree-ellipsis.jstree-no-icons .jstree-anchor { - width: calc(100% - 5px); -} -.jstree-default-dark.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg=="); -} -.jstree-default-dark.jstree-rtl .jstree-last { - background: transparent; -} -.jstree-default-dark-small .jstree-node { - min-height: 18px; - line-height: 18px; - margin-left: 18px; - min-width: 18px; -} -.jstree-default-dark-small .jstree-anchor { - line-height: 18px; - height: 18px; -} -.jstree-default-dark-small .jstree-icon { - width: 18px; - height: 18px; - line-height: 18px; -} -.jstree-default-dark-small .jstree-icon:empty { - width: 18px; - height: 18px; - line-height: 18px; -} -.jstree-default-dark-small.jstree-rtl .jstree-node { - margin-right: 18px; -} -.jstree-default-dark-small .jstree-wholerow { - height: 18px; -} -.jstree-default-dark-small .jstree-node, -.jstree-default-dark-small .jstree-icon { - background-image: url("32px.png"); -} -.jstree-default-dark-small .jstree-node { - background-position: -295px -7px; - background-repeat: repeat-y; -} -.jstree-default-dark-small .jstree-last { - background: transparent; -} -.jstree-default-dark-small .jstree-open > .jstree-ocl { - background-position: -135px -7px; -} -.jstree-default-dark-small .jstree-closed > .jstree-ocl { - background-position: -103px -7px; -} -.jstree-default-dark-small .jstree-leaf > .jstree-ocl { - background-position: -71px -7px; -} -.jstree-default-dark-small .jstree-themeicon { - background-position: -263px -7px; -} -.jstree-default-dark-small > .jstree-no-dots .jstree-node, -.jstree-default-dark-small > .jstree-no-dots .jstree-leaf > .jstree-ocl { - background: transparent; -} -.jstree-default-dark-small > .jstree-no-dots .jstree-open > .jstree-ocl { - background-position: -39px -7px; -} -.jstree-default-dark-small > .jstree-no-dots .jstree-closed > .jstree-ocl { - background-position: -7px -7px; -} -.jstree-default-dark-small .jstree-disabled { - background: transparent; -} -.jstree-default-dark-small .jstree-disabled.jstree-hovered { - background: transparent; -} -.jstree-default-dark-small .jstree-disabled.jstree-clicked { - background: #efefef; -} -.jstree-default-dark-small .jstree-checkbox { - background-position: -167px -7px; -} -.jstree-default-dark-small .jstree-checkbox:hover { - background-position: -167px -39px; -} -.jstree-default-dark-small.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox, -.jstree-default-dark-small .jstree-checked > .jstree-checkbox { - background-position: -231px -7px; -} -.jstree-default-dark-small.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover, -.jstree-default-dark-small .jstree-checked > .jstree-checkbox:hover { - background-position: -231px -39px; -} -.jstree-default-dark-small .jstree-anchor > .jstree-undetermined { - background-position: -199px -7px; -} -.jstree-default-dark-small .jstree-anchor > .jstree-undetermined:hover { - background-position: -199px -39px; -} -.jstree-default-dark-small .jstree-checkbox-disabled { - opacity: 0.8; - filter: url("data:image/svg+xml;utf8,#jstree-grayscale"); - /* Firefox 10+ */ - filter: gray; - /* IE6-9 */ - -webkit-filter: grayscale(100%); - /* Chrome 19+ & Safari 6+ */ -} -.jstree-default-dark-small > .jstree-striped { - background-size: auto 36px; -} -.jstree-default-dark-small.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg=="); - background-position: 100% 1px; - background-repeat: repeat-y; -} -.jstree-default-dark-small.jstree-rtl .jstree-last { - background: transparent; -} -.jstree-default-dark-small.jstree-rtl .jstree-open > .jstree-ocl { - background-position: -135px -39px; -} -.jstree-default-dark-small.jstree-rtl .jstree-closed > .jstree-ocl { - background-position: -103px -39px; -} -.jstree-default-dark-small.jstree-rtl .jstree-leaf > .jstree-ocl { - background-position: -71px -39px; -} -.jstree-default-dark-small.jstree-rtl > .jstree-no-dots .jstree-node, -.jstree-default-dark-small.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl { - background: transparent; -} -.jstree-default-dark-small.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl { - background-position: -39px -39px; -} -.jstree-default-dark-small.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl { - background-position: -7px -39px; -} -.jstree-default-dark-small .jstree-themeicon-custom { - background-color: transparent; - background-image: none; - background-position: 0 0; -} -.jstree-default-dark-small > .jstree-container-ul .jstree-loading > .jstree-ocl { - background: url("throbber.gif") center center no-repeat; -} -.jstree-default-dark-small .jstree-file { - background: url("32px.png") -103px -71px no-repeat; -} -.jstree-default-dark-small .jstree-folder { - background: url("32px.png") -263px -7px no-repeat; -} -.jstree-default-dark-small > .jstree-container-ul > .jstree-node { - margin-left: 0; - margin-right: 0; -} -#jstree-dnd.jstree-default-dark-small { - line-height: 18px; - padding: 0 4px; -} -#jstree-dnd.jstree-default-dark-small .jstree-ok, -#jstree-dnd.jstree-default-dark-small .jstree-er { - background-image: url("32px.png"); - background-repeat: no-repeat; - background-color: transparent; -} -#jstree-dnd.jstree-default-dark-small i { - background: transparent; - width: 18px; - height: 18px; - line-height: 18px; -} -#jstree-dnd.jstree-default-dark-small .jstree-ok { - background-position: -7px -71px; -} -#jstree-dnd.jstree-default-dark-small .jstree-er { - background-position: -39px -71px; -} -.jstree-default-dark-small .jstree-ellipsis { - overflow: hidden; -} -.jstree-default-dark-small .jstree-ellipsis .jstree-anchor { - width: calc(100% - 23px); - text-overflow: ellipsis; - overflow: hidden; -} -.jstree-default-dark-small .jstree-ellipsis.jstree-no-icons .jstree-anchor { - width: calc(100% - 5px); -} -.jstree-default-dark-small.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAACAQMAAABv1h6PAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMHBgAAiABBI4gz9AAAAABJRU5ErkJggg=="); -} -.jstree-default-dark-small.jstree-rtl .jstree-last { - background: transparent; -} -.jstree-default-dark-large .jstree-node { - min-height: 32px; - line-height: 32px; - margin-left: 32px; - min-width: 32px; -} -.jstree-default-dark-large .jstree-anchor { - line-height: 32px; - height: 32px; -} -.jstree-default-dark-large .jstree-icon { - width: 32px; - height: 32px; - line-height: 32px; -} -.jstree-default-dark-large .jstree-icon:empty { - width: 32px; - height: 32px; - line-height: 32px; -} -.jstree-default-dark-large.jstree-rtl .jstree-node { - margin-right: 32px; -} -.jstree-default-dark-large .jstree-wholerow { - height: 32px; -} -.jstree-default-dark-large .jstree-node, -.jstree-default-dark-large .jstree-icon { - background-image: url("32px.png"); -} -.jstree-default-dark-large .jstree-node { - background-position: -288px 0px; - background-repeat: repeat-y; -} -.jstree-default-dark-large .jstree-last { - background: transparent; -} -.jstree-default-dark-large .jstree-open > .jstree-ocl { - background-position: -128px 0px; -} -.jstree-default-dark-large .jstree-closed > .jstree-ocl { - background-position: -96px 0px; -} -.jstree-default-dark-large .jstree-leaf > .jstree-ocl { - background-position: -64px 0px; -} -.jstree-default-dark-large .jstree-themeicon { - background-position: -256px 0px; -} -.jstree-default-dark-large > .jstree-no-dots .jstree-node, -.jstree-default-dark-large > .jstree-no-dots .jstree-leaf > .jstree-ocl { - background: transparent; -} -.jstree-default-dark-large > .jstree-no-dots .jstree-open > .jstree-ocl { - background-position: -32px 0px; -} -.jstree-default-dark-large > .jstree-no-dots .jstree-closed > .jstree-ocl { - background-position: 0px 0px; -} -.jstree-default-dark-large .jstree-disabled { - background: transparent; -} -.jstree-default-dark-large .jstree-disabled.jstree-hovered { - background: transparent; -} -.jstree-default-dark-large .jstree-disabled.jstree-clicked { - background: #efefef; -} -.jstree-default-dark-large .jstree-checkbox { - background-position: -160px 0px; -} -.jstree-default-dark-large .jstree-checkbox:hover { - background-position: -160px -32px; -} -.jstree-default-dark-large.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox, -.jstree-default-dark-large .jstree-checked > .jstree-checkbox { - background-position: -224px 0px; -} -.jstree-default-dark-large.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover, -.jstree-default-dark-large .jstree-checked > .jstree-checkbox:hover { - background-position: -224px -32px; -} -.jstree-default-dark-large .jstree-anchor > .jstree-undetermined { - background-position: -192px 0px; -} -.jstree-default-dark-large .jstree-anchor > .jstree-undetermined:hover { - background-position: -192px -32px; -} -.jstree-default-dark-large .jstree-checkbox-disabled { - opacity: 0.8; - filter: url("data:image/svg+xml;utf8,#jstree-grayscale"); - /* Firefox 10+ */ - filter: gray; - /* IE6-9 */ - -webkit-filter: grayscale(100%); - /* Chrome 19+ & Safari 6+ */ -} -.jstree-default-dark-large > .jstree-striped { - background-size: auto 64px; -} -.jstree-default-dark-large.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg=="); - background-position: 100% 1px; - background-repeat: repeat-y; -} -.jstree-default-dark-large.jstree-rtl .jstree-last { - background: transparent; -} -.jstree-default-dark-large.jstree-rtl .jstree-open > .jstree-ocl { - background-position: -128px -32px; -} -.jstree-default-dark-large.jstree-rtl .jstree-closed > .jstree-ocl { - background-position: -96px -32px; -} -.jstree-default-dark-large.jstree-rtl .jstree-leaf > .jstree-ocl { - background-position: -64px -32px; -} -.jstree-default-dark-large.jstree-rtl > .jstree-no-dots .jstree-node, -.jstree-default-dark-large.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl { - background: transparent; -} -.jstree-default-dark-large.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl { - background-position: -32px -32px; -} -.jstree-default-dark-large.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl { - background-position: 0px -32px; -} -.jstree-default-dark-large .jstree-themeicon-custom { - background-color: transparent; - background-image: none; - background-position: 0 0; -} -.jstree-default-dark-large > .jstree-container-ul .jstree-loading > .jstree-ocl { - background: url("throbber.gif") center center no-repeat; -} -.jstree-default-dark-large .jstree-file { - background: url("32px.png") -96px -64px no-repeat; -} -.jstree-default-dark-large .jstree-folder { - background: url("32px.png") -256px 0px no-repeat; -} -.jstree-default-dark-large > .jstree-container-ul > .jstree-node { - margin-left: 0; - margin-right: 0; -} -#jstree-dnd.jstree-default-dark-large { - line-height: 32px; - padding: 0 4px; -} -#jstree-dnd.jstree-default-dark-large .jstree-ok, -#jstree-dnd.jstree-default-dark-large .jstree-er { - background-image: url("32px.png"); - background-repeat: no-repeat; - background-color: transparent; -} -#jstree-dnd.jstree-default-dark-large i { - background: transparent; - width: 32px; - height: 32px; - line-height: 32px; -} -#jstree-dnd.jstree-default-dark-large .jstree-ok { - background-position: 0px -64px; -} -#jstree-dnd.jstree-default-dark-large .jstree-er { - background-position: -32px -64px; -} -.jstree-default-dark-large .jstree-ellipsis { - overflow: hidden; -} -.jstree-default-dark-large .jstree-ellipsis .jstree-anchor { - width: calc(100% - 37px); - text-overflow: ellipsis; - overflow: hidden; -} -.jstree-default-dark-large .jstree-ellipsis.jstree-no-icons .jstree-anchor { - width: calc(100% - 5px); -} -.jstree-default-dark-large.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAACAQMAAAAD0EyKAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjgIIGBgABCgCBvVLXcAAAAABJRU5ErkJggg=="); -} -.jstree-default-dark-large.jstree-rtl .jstree-last { - background: transparent; -} -@media (max-width: 768px) { - #jstree-dnd.jstree-dnd-responsive { - line-height: 40px; - font-weight: bold; - font-size: 1.1em; - text-shadow: 1px 1px white; - } - #jstree-dnd.jstree-dnd-responsive > i { - background: transparent; - width: 40px; - height: 40px; - } - #jstree-dnd.jstree-dnd-responsive > .jstree-ok { - background-image: url("40px.png"); - background-position: 0 -200px; - background-size: 120px 240px; - } - #jstree-dnd.jstree-dnd-responsive > .jstree-er { - background-image: url("40px.png"); - background-position: -40px -200px; - background-size: 120px 240px; - } - #jstree-marker.jstree-dnd-responsive { - border-left-width: 10px; - border-top-width: 10px; - border-bottom-width: 10px; - margin-top: -10px; - } -} -@media (max-width: 768px) { - .jstree-default-dark-responsive { - /* - .jstree-open > .jstree-ocl, - .jstree-closed > .jstree-ocl { border-radius:20px; background-color:white; } - */ - } - .jstree-default-dark-responsive .jstree-icon { - background-image: url("40px.png"); - } - .jstree-default-dark-responsive .jstree-node, - .jstree-default-dark-responsive .jstree-leaf > .jstree-ocl { - background: transparent; - } - .jstree-default-dark-responsive .jstree-node { - min-height: 40px; - line-height: 40px; - margin-left: 40px; - min-width: 40px; - white-space: nowrap; - } - .jstree-default-dark-responsive .jstree-anchor { - line-height: 40px; - height: 40px; - } - .jstree-default-dark-responsive .jstree-icon, - .jstree-default-dark-responsive .jstree-icon:empty { - width: 40px; - height: 40px; - line-height: 40px; - } - .jstree-default-dark-responsive > .jstree-container-ul > .jstree-node { - margin-left: 0; - } - .jstree-default-dark-responsive.jstree-rtl .jstree-node { - margin-left: 0; - margin-right: 40px; - background: transparent; - } - .jstree-default-dark-responsive.jstree-rtl .jstree-container-ul > .jstree-node { - margin-right: 0; - } - .jstree-default-dark-responsive .jstree-ocl, - .jstree-default-dark-responsive .jstree-themeicon, - .jstree-default-dark-responsive .jstree-checkbox { - background-size: 120px 240px; - } - .jstree-default-dark-responsive .jstree-leaf > .jstree-ocl, - .jstree-default-dark-responsive.jstree-rtl .jstree-leaf > .jstree-ocl { - background: transparent; - } - .jstree-default-dark-responsive .jstree-open > .jstree-ocl { - background-position: 0 0px !important; - } - .jstree-default-dark-responsive .jstree-closed > .jstree-ocl { - background-position: 0 -40px !important; - } - .jstree-default-dark-responsive.jstree-rtl .jstree-closed > .jstree-ocl { - background-position: -40px 0px !important; - } - .jstree-default-dark-responsive .jstree-themeicon { - background-position: -40px -40px; - } - .jstree-default-dark-responsive .jstree-checkbox, - .jstree-default-dark-responsive .jstree-checkbox:hover { - background-position: -40px -80px; - } - .jstree-default-dark-responsive.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox, - .jstree-default-dark-responsive.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover, - .jstree-default-dark-responsive .jstree-checked > .jstree-checkbox, - .jstree-default-dark-responsive .jstree-checked > .jstree-checkbox:hover { - background-position: 0 -80px; - } - .jstree-default-dark-responsive .jstree-anchor > .jstree-undetermined, - .jstree-default-dark-responsive .jstree-anchor > .jstree-undetermined:hover { - background-position: 0 -120px; - } - .jstree-default-dark-responsive .jstree-anchor { - font-weight: bold; - font-size: 1.1em; - text-shadow: 1px 1px white; - } - .jstree-default-dark-responsive > .jstree-striped { - background: transparent; - } - .jstree-default-dark-responsive .jstree-wholerow { - border-top: 1px solid #666666; - border-bottom: 1px solid #000000; - background: #333333; - height: 40px; - } - .jstree-default-dark-responsive .jstree-wholerow-hovered { - background: #555555; - } - .jstree-default-dark-responsive .jstree-wholerow-clicked { - background: #5fa2db; - } - .jstree-default-dark-responsive .jstree-children .jstree-last > .jstree-wholerow { - box-shadow: inset 0 -6px 3px -5px #111111; - } - .jstree-default-dark-responsive .jstree-children .jstree-open > .jstree-wholerow { - box-shadow: inset 0 6px 3px -5px #111111; - border-top: 0; - } - .jstree-default-dark-responsive .jstree-children .jstree-open + .jstree-open { - box-shadow: none; - } - .jstree-default-dark-responsive .jstree-node, - .jstree-default-dark-responsive .jstree-icon, - .jstree-default-dark-responsive .jstree-node > .jstree-ocl, - .jstree-default-dark-responsive .jstree-themeicon, - .jstree-default-dark-responsive .jstree-checkbox { - background-image: url("40px.png"); - background-size: 120px 240px; - } - .jstree-default-dark-responsive .jstree-node { - background-position: -80px 0; - background-repeat: repeat-y; - } - .jstree-default-dark-responsive .jstree-last { - background: transparent; - } - .jstree-default-dark-responsive .jstree-leaf > .jstree-ocl { - background-position: -40px -120px; - } - .jstree-default-dark-responsive .jstree-last > .jstree-ocl { - background-position: -40px -160px; - } - .jstree-default-dark-responsive .jstree-themeicon-custom { - background-color: transparent; - background-image: none; - background-position: 0 0; - } - .jstree-default-dark-responsive .jstree-file { - background: url("40px.png") 0 -160px no-repeat; - background-size: 120px 240px; - } - .jstree-default-dark-responsive .jstree-folder { - background: url("40px.png") -40px -40px no-repeat; - background-size: 120px 240px; - } - .jstree-default-dark-responsive > .jstree-container-ul > .jstree-node { - margin-left: 0; - margin-right: 0; - } -} -.jstree-default-dark { - background: #333; -} -.jstree-default-dark .jstree-anchor { - color: #999; - text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5); -} -.jstree-default-dark .jstree-clicked, -.jstree-default-dark .jstree-checked { - color: white; -} -.jstree-default-dark .jstree-hovered { - color: white; -} -#jstree-marker.jstree-default-dark { - border-left-color: #999; - background: transparent; -} -.jstree-default-dark .jstree-anchor > .jstree-icon { - opacity: 0.75; -} -.jstree-default-dark .jstree-clicked > .jstree-icon, -.jstree-default-dark .jstree-hovered > .jstree-icon, -.jstree-default-dark .jstree-checked > .jstree-icon { - opacity: 1; -} -.jstree-default-dark.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAACZmZl+9SADAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg=="); -} -.jstree-default-dark.jstree-rtl .jstree-last { - background: transparent; -} -.jstree-default-dark-small.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAACAQMAAABv1h6PAAAABlBMVEUAAACZmZl+9SADAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMHBgAAiABBI4gz9AAAAABJRU5ErkJggg=="); -} -.jstree-default-dark-small.jstree-rtl .jstree-last { - background: transparent; -} -.jstree-default-dark-large.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAACAQMAAAAD0EyKAAAABlBMVEUAAACZmZl+9SADAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjgIIGBgABCgCBvVLXcAAAAABJRU5ErkJggg=="); -} -.jstree-default-dark-large.jstree-rtl .jstree-last { - background: transparent; -} diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/dist/themes/default-dark/style.min.css b/mayan/apps/cabinets/static/cabinets/packages/jstree/dist/themes/default-dark/style.min.css deleted file mode 100644 index d9084d403c..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/dist/themes/default-dark/style.min.css +++ /dev/null @@ -1 +0,0 @@ -.jstree-node,.jstree-children,.jstree-container-ul{display:block;margin:0;padding:0;list-style-type:none;list-style-image:none}.jstree-node{white-space:nowrap}.jstree-anchor{display:inline-block;color:#000;white-space:nowrap;padding:0 4px 0 1px;margin:0;vertical-align:top}.jstree-anchor:focus{outline:0}.jstree-anchor,.jstree-anchor:link,.jstree-anchor:visited,.jstree-anchor:hover,.jstree-anchor:active{text-decoration:none;color:inherit}.jstree-icon{display:inline-block;text-decoration:none;margin:0;padding:0;vertical-align:top;text-align:center}.jstree-icon:empty{display:inline-block;text-decoration:none;margin:0;padding:0;vertical-align:top;text-align:center}.jstree-ocl{cursor:pointer}.jstree-leaf>.jstree-ocl{cursor:default}.jstree .jstree-open>.jstree-children{display:block}.jstree .jstree-closed>.jstree-children,.jstree .jstree-leaf>.jstree-children{display:none}.jstree-anchor>.jstree-themeicon{margin-right:2px}.jstree-no-icons .jstree-themeicon,.jstree-anchor>.jstree-themeicon-hidden{display:none}.jstree-hidden,.jstree-node.jstree-hidden{display:none}.jstree-rtl .jstree-anchor{padding:0 1px 0 4px}.jstree-rtl .jstree-anchor>.jstree-themeicon{margin-left:2px;margin-right:0}.jstree-rtl .jstree-node{margin-left:0}.jstree-rtl .jstree-container-ul>.jstree-node{margin-right:0}.jstree-wholerow-ul{position:relative;display:inline-block;min-width:100%}.jstree-wholerow-ul .jstree-leaf>.jstree-ocl{cursor:pointer}.jstree-wholerow-ul .jstree-anchor,.jstree-wholerow-ul .jstree-icon{position:relative}.jstree-wholerow-ul .jstree-wholerow{width:100%;cursor:pointer;position:absolute;left:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.vakata-context{display:none}.vakata-context,.vakata-context ul{margin:0;padding:2px;position:absolute;background:#f5f5f5;border:1px solid #979797;box-shadow:2px 2px 2px #999}.vakata-context ul{list-style:none;left:100%;margin-top:-2.7em;margin-left:-4px}.vakata-context .vakata-context-right ul{left:auto;right:100%;margin-left:auto;margin-right:-4px}.vakata-context li{list-style:none}.vakata-context li>a{display:block;padding:0 2em;text-decoration:none;width:auto;color:#000;white-space:nowrap;line-height:2.4em;text-shadow:1px 1px 0 #fff;border-radius:1px}.vakata-context li>a:hover{position:relative;background-color:#e8eff7;box-shadow:0 0 2px #0a6aa1}.vakata-context li>a.vakata-context-parent{background-image:url(data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAIORI4JlrqN1oMSnmmZDQUAOw==);background-position:right center;background-repeat:no-repeat}.vakata-context li>a:focus{outline:0}.vakata-context .vakata-context-hover>a{position:relative;background-color:#e8eff7;box-shadow:0 0 2px #0a6aa1}.vakata-context .vakata-context-separator>a,.vakata-context .vakata-context-separator>a:hover{background:#fff;border:0;border-top:1px solid #e2e3e3;height:1px;min-height:1px;max-height:1px;padding:0;margin:0 0 0 2.4em;border-left:1px solid #e0e0e0;text-shadow:0 0 0 transparent;box-shadow:0 0 0 transparent;border-radius:0}.vakata-context .vakata-contextmenu-disabled a,.vakata-context .vakata-contextmenu-disabled a:hover{color:silver;background-color:transparent;border:0;box-shadow:0 0 0}.vakata-context li>a>i{text-decoration:none;display:inline-block;width:2.4em;height:2.4em;background:0 0;margin:0 0 0 -2em;vertical-align:top;text-align:center;line-height:2.4em}.vakata-context li>a>i:empty{width:2.4em;line-height:2.4em}.vakata-context li>a .vakata-contextmenu-sep{display:inline-block;width:1px;height:2.4em;background:#fff;margin:0 .5em 0 0;border-left:1px solid #e2e3e3}.vakata-context .vakata-contextmenu-shortcut{font-size:.8em;color:silver;opacity:.5;display:none}.vakata-context-rtl ul{left:auto;right:100%;margin-left:auto;margin-right:-4px}.vakata-context-rtl li>a.vakata-context-parent{background-image:url(data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAINjI+AC7rWHIsPtmoxLAA7);background-position:left center;background-repeat:no-repeat}.vakata-context-rtl .vakata-context-separator>a{margin:0 2.4em 0 0;border-left:0;border-right:1px solid #e2e3e3}.vakata-context-rtl .vakata-context-left ul{right:auto;left:100%;margin-left:-4px;margin-right:auto}.vakata-context-rtl li>a>i{margin:0 -2em 0 0}.vakata-context-rtl li>a .vakata-contextmenu-sep{margin:0 0 0 .5em;border-left-color:#fff;background:#e2e3e3}#jstree-marker{position:absolute;top:0;left:0;margin:-5px 0 0 0;padding:0;border-right:0;border-top:5px solid transparent;border-bottom:5px solid transparent;border-left:5px solid;width:0;height:0;font-size:0;line-height:0}#jstree-dnd{line-height:16px;margin:0;padding:4px}#jstree-dnd .jstree-icon,#jstree-dnd .jstree-copy{display:inline-block;text-decoration:none;margin:0 2px 0 0;padding:0;width:16px;height:16px}#jstree-dnd .jstree-ok{background:green}#jstree-dnd .jstree-er{background:red}#jstree-dnd .jstree-copy{margin:0 2px}.jstree-default-dark .jstree-node,.jstree-default-dark .jstree-icon{background-repeat:no-repeat;background-color:transparent}.jstree-default-dark .jstree-anchor,.jstree-default-dark .jstree-animated,.jstree-default-dark .jstree-wholerow{transition:background-color .15s,box-shadow .15s}.jstree-default-dark .jstree-hovered{background:#555;border-radius:2px;box-shadow:inset 0 0 1px #555}.jstree-default-dark .jstree-context{background:#555;border-radius:2px;box-shadow:inset 0 0 1px #555}.jstree-default-dark .jstree-clicked{background:#5fa2db;border-radius:2px;box-shadow:inset 0 0 1px #666}.jstree-default-dark .jstree-no-icons .jstree-anchor>.jstree-themeicon{display:none}.jstree-default-dark .jstree-disabled{background:0 0;color:#666}.jstree-default-dark .jstree-disabled.jstree-hovered{background:0 0;box-shadow:none}.jstree-default-dark .jstree-disabled.jstree-clicked{background:#333}.jstree-default-dark .jstree-disabled>.jstree-icon{opacity:.8;filter:url("data:image/svg+xml;utf8,#jstree-grayscale");filter:gray;-webkit-filter:grayscale(100%)}.jstree-default-dark .jstree-search{font-style:italic;color:#fff;font-weight:700}.jstree-default-dark .jstree-no-checkboxes .jstree-checkbox{display:none!important}.jstree-default-dark.jstree-checkbox-no-clicked .jstree-clicked{background:0 0;box-shadow:none}.jstree-default-dark.jstree-checkbox-no-clicked .jstree-clicked.jstree-hovered{background:#555}.jstree-default-dark.jstree-checkbox-no-clicked>.jstree-wholerow-ul .jstree-wholerow-clicked{background:0 0}.jstree-default-dark.jstree-checkbox-no-clicked>.jstree-wholerow-ul .jstree-wholerow-clicked.jstree-wholerow-hovered{background:#555}.jstree-default-dark>.jstree-striped{min-width:100%;display:inline-block;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAkCAMAAAB/qqA+AAAABlBMVEUAAAAAAAClZ7nPAAAAAnRSTlMNAMM9s3UAAAAXSURBVHjajcEBAQAAAIKg/H/aCQZ70AUBjAATb6YPDgAAAABJRU5ErkJggg==) left top repeat}.jstree-default-dark>.jstree-wholerow-ul .jstree-hovered,.jstree-default-dark>.jstree-wholerow-ul .jstree-clicked{background:0 0;box-shadow:none;border-radius:0}.jstree-default-dark .jstree-wholerow{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.jstree-default-dark .jstree-wholerow-hovered{background:#555}.jstree-default-dark .jstree-wholerow-clicked{background:#5fa2db;background:-webkit-linear-gradient(top,#5fa2db 0,#5fa2db 100%);background:linear-gradient(to bottom,#5fa2db 0,#5fa2db 100%)}.jstree-default-dark .jstree-node{min-height:24px;line-height:24px;margin-left:24px;min-width:24px}.jstree-default-dark .jstree-anchor{line-height:24px;height:24px}.jstree-default-dark .jstree-icon{width:24px;height:24px;line-height:24px}.jstree-default-dark .jstree-icon:empty{width:24px;height:24px;line-height:24px}.jstree-default-dark.jstree-rtl .jstree-node{margin-right:24px}.jstree-default-dark .jstree-wholerow{height:24px}.jstree-default-dark .jstree-node,.jstree-default-dark .jstree-icon{background-image:url(32px.png)}.jstree-default-dark .jstree-node{background-position:-292px -4px;background-repeat:repeat-y}.jstree-default-dark .jstree-last{background:0 0}.jstree-default-dark .jstree-open>.jstree-ocl{background-position:-132px -4px}.jstree-default-dark .jstree-closed>.jstree-ocl{background-position:-100px -4px}.jstree-default-dark .jstree-leaf>.jstree-ocl{background-position:-68px -4px}.jstree-default-dark .jstree-themeicon{background-position:-260px -4px}.jstree-default-dark>.jstree-no-dots .jstree-node,.jstree-default-dark>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:0 0}.jstree-default-dark>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-36px -4px}.jstree-default-dark>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:-4px -4px}.jstree-default-dark .jstree-disabled{background:0 0}.jstree-default-dark .jstree-disabled.jstree-hovered{background:0 0}.jstree-default-dark .jstree-disabled.jstree-clicked{background:#efefef}.jstree-default-dark .jstree-checkbox{background-position:-164px -4px}.jstree-default-dark .jstree-checkbox:hover{background-position:-164px -36px}.jstree-default-dark.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox,.jstree-default-dark .jstree-checked>.jstree-checkbox{background-position:-228px -4px}.jstree-default-dark.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox:hover,.jstree-default-dark .jstree-checked>.jstree-checkbox:hover{background-position:-228px -36px}.jstree-default-dark .jstree-anchor>.jstree-undetermined{background-position:-196px -4px}.jstree-default-dark .jstree-anchor>.jstree-undetermined:hover{background-position:-196px -36px}.jstree-default-dark .jstree-checkbox-disabled{opacity:.8;filter:url("data:image/svg+xml;utf8,#jstree-grayscale");filter:gray;-webkit-filter:grayscale(100%)}.jstree-default-dark>.jstree-striped{background-size:auto 48px}.jstree-default-dark.jstree-rtl .jstree-node{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==);background-position:100% 1px;background-repeat:repeat-y}.jstree-default-dark.jstree-rtl .jstree-last{background:0 0}.jstree-default-dark.jstree-rtl .jstree-open>.jstree-ocl{background-position:-132px -36px}.jstree-default-dark.jstree-rtl .jstree-closed>.jstree-ocl{background-position:-100px -36px}.jstree-default-dark.jstree-rtl .jstree-leaf>.jstree-ocl{background-position:-68px -36px}.jstree-default-dark.jstree-rtl>.jstree-no-dots .jstree-node,.jstree-default-dark.jstree-rtl>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:0 0}.jstree-default-dark.jstree-rtl>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-36px -36px}.jstree-default-dark.jstree-rtl>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:-4px -36px}.jstree-default-dark .jstree-themeicon-custom{background-color:transparent;background-image:none;background-position:0 0}.jstree-default-dark>.jstree-container-ul .jstree-loading>.jstree-ocl{background:url(throbber.gif) center center no-repeat}.jstree-default-dark .jstree-file{background:url(32px.png) -100px -68px no-repeat}.jstree-default-dark .jstree-folder{background:url(32px.png) -260px -4px no-repeat}.jstree-default-dark>.jstree-container-ul>.jstree-node{margin-left:0;margin-right:0}#jstree-dnd.jstree-default-dark{line-height:24px;padding:0 4px}#jstree-dnd.jstree-default-dark .jstree-ok,#jstree-dnd.jstree-default-dark .jstree-er{background-image:url(32px.png);background-repeat:no-repeat;background-color:transparent}#jstree-dnd.jstree-default-dark i{background:0 0;width:24px;height:24px;line-height:24px}#jstree-dnd.jstree-default-dark .jstree-ok{background-position:-4px -68px}#jstree-dnd.jstree-default-dark .jstree-er{background-position:-36px -68px}.jstree-default-dark .jstree-ellipsis{overflow:hidden}.jstree-default-dark .jstree-ellipsis .jstree-anchor{width:calc(100% - 29px);text-overflow:ellipsis;overflow:hidden}.jstree-default-dark .jstree-ellipsis.jstree-no-icons .jstree-anchor{width:calc(100% - 5px)}.jstree-default-dark.jstree-rtl .jstree-node{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==)}.jstree-default-dark.jstree-rtl .jstree-last{background:0 0}.jstree-default-dark-small .jstree-node{min-height:18px;line-height:18px;margin-left:18px;min-width:18px}.jstree-default-dark-small .jstree-anchor{line-height:18px;height:18px}.jstree-default-dark-small .jstree-icon{width:18px;height:18px;line-height:18px}.jstree-default-dark-small .jstree-icon:empty{width:18px;height:18px;line-height:18px}.jstree-default-dark-small.jstree-rtl .jstree-node{margin-right:18px}.jstree-default-dark-small .jstree-wholerow{height:18px}.jstree-default-dark-small .jstree-node,.jstree-default-dark-small .jstree-icon{background-image:url(32px.png)}.jstree-default-dark-small .jstree-node{background-position:-295px -7px;background-repeat:repeat-y}.jstree-default-dark-small .jstree-last{background:0 0}.jstree-default-dark-small .jstree-open>.jstree-ocl{background-position:-135px -7px}.jstree-default-dark-small .jstree-closed>.jstree-ocl{background-position:-103px -7px}.jstree-default-dark-small .jstree-leaf>.jstree-ocl{background-position:-71px -7px}.jstree-default-dark-small .jstree-themeicon{background-position:-263px -7px}.jstree-default-dark-small>.jstree-no-dots .jstree-node,.jstree-default-dark-small>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:0 0}.jstree-default-dark-small>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-39px -7px}.jstree-default-dark-small>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:-7px -7px}.jstree-default-dark-small .jstree-disabled{background:0 0}.jstree-default-dark-small .jstree-disabled.jstree-hovered{background:0 0}.jstree-default-dark-small .jstree-disabled.jstree-clicked{background:#efefef}.jstree-default-dark-small .jstree-checkbox{background-position:-167px -7px}.jstree-default-dark-small .jstree-checkbox:hover{background-position:-167px -39px}.jstree-default-dark-small.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox,.jstree-default-dark-small .jstree-checked>.jstree-checkbox{background-position:-231px -7px}.jstree-default-dark-small.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox:hover,.jstree-default-dark-small .jstree-checked>.jstree-checkbox:hover{background-position:-231px -39px}.jstree-default-dark-small .jstree-anchor>.jstree-undetermined{background-position:-199px -7px}.jstree-default-dark-small .jstree-anchor>.jstree-undetermined:hover{background-position:-199px -39px}.jstree-default-dark-small .jstree-checkbox-disabled{opacity:.8;filter:url("data:image/svg+xml;utf8,#jstree-grayscale");filter:gray;-webkit-filter:grayscale(100%)}.jstree-default-dark-small>.jstree-striped{background-size:auto 36px}.jstree-default-dark-small.jstree-rtl .jstree-node{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==);background-position:100% 1px;background-repeat:repeat-y}.jstree-default-dark-small.jstree-rtl .jstree-last{background:0 0}.jstree-default-dark-small.jstree-rtl .jstree-open>.jstree-ocl{background-position:-135px -39px}.jstree-default-dark-small.jstree-rtl .jstree-closed>.jstree-ocl{background-position:-103px -39px}.jstree-default-dark-small.jstree-rtl .jstree-leaf>.jstree-ocl{background-position:-71px -39px}.jstree-default-dark-small.jstree-rtl>.jstree-no-dots .jstree-node,.jstree-default-dark-small.jstree-rtl>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:0 0}.jstree-default-dark-small.jstree-rtl>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-39px -39px}.jstree-default-dark-small.jstree-rtl>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:-7px -39px}.jstree-default-dark-small .jstree-themeicon-custom{background-color:transparent;background-image:none;background-position:0 0}.jstree-default-dark-small>.jstree-container-ul .jstree-loading>.jstree-ocl{background:url(throbber.gif) center center no-repeat}.jstree-default-dark-small .jstree-file{background:url(32px.png) -103px -71px no-repeat}.jstree-default-dark-small .jstree-folder{background:url(32px.png) -263px -7px no-repeat}.jstree-default-dark-small>.jstree-container-ul>.jstree-node{margin-left:0;margin-right:0}#jstree-dnd.jstree-default-dark-small{line-height:18px;padding:0 4px}#jstree-dnd.jstree-default-dark-small .jstree-ok,#jstree-dnd.jstree-default-dark-small .jstree-er{background-image:url(32px.png);background-repeat:no-repeat;background-color:transparent}#jstree-dnd.jstree-default-dark-small i{background:0 0;width:18px;height:18px;line-height:18px}#jstree-dnd.jstree-default-dark-small .jstree-ok{background-position:-7px -71px}#jstree-dnd.jstree-default-dark-small .jstree-er{background-position:-39px -71px}.jstree-default-dark-small .jstree-ellipsis{overflow:hidden}.jstree-default-dark-small .jstree-ellipsis .jstree-anchor{width:calc(100% - 23px);text-overflow:ellipsis;overflow:hidden}.jstree-default-dark-small .jstree-ellipsis.jstree-no-icons .jstree-anchor{width:calc(100% - 5px)}.jstree-default-dark-small.jstree-rtl .jstree-node{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAACAQMAAABv1h6PAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMHBgAAiABBI4gz9AAAAABJRU5ErkJggg==)}.jstree-default-dark-small.jstree-rtl .jstree-last{background:0 0}.jstree-default-dark-large .jstree-node{min-height:32px;line-height:32px;margin-left:32px;min-width:32px}.jstree-default-dark-large .jstree-anchor{line-height:32px;height:32px}.jstree-default-dark-large .jstree-icon{width:32px;height:32px;line-height:32px}.jstree-default-dark-large .jstree-icon:empty{width:32px;height:32px;line-height:32px}.jstree-default-dark-large.jstree-rtl .jstree-node{margin-right:32px}.jstree-default-dark-large .jstree-wholerow{height:32px}.jstree-default-dark-large .jstree-node,.jstree-default-dark-large .jstree-icon{background-image:url(32px.png)}.jstree-default-dark-large .jstree-node{background-position:-288px 0;background-repeat:repeat-y}.jstree-default-dark-large .jstree-last{background:0 0}.jstree-default-dark-large .jstree-open>.jstree-ocl{background-position:-128px 0}.jstree-default-dark-large .jstree-closed>.jstree-ocl{background-position:-96px 0}.jstree-default-dark-large .jstree-leaf>.jstree-ocl{background-position:-64px 0}.jstree-default-dark-large .jstree-themeicon{background-position:-256px 0}.jstree-default-dark-large>.jstree-no-dots .jstree-node,.jstree-default-dark-large>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:0 0}.jstree-default-dark-large>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-32px 0}.jstree-default-dark-large>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:0 0}.jstree-default-dark-large .jstree-disabled{background:0 0}.jstree-default-dark-large .jstree-disabled.jstree-hovered{background:0 0}.jstree-default-dark-large .jstree-disabled.jstree-clicked{background:#efefef}.jstree-default-dark-large .jstree-checkbox{background-position:-160px 0}.jstree-default-dark-large .jstree-checkbox:hover{background-position:-160px -32px}.jstree-default-dark-large.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox,.jstree-default-dark-large .jstree-checked>.jstree-checkbox{background-position:-224px 0}.jstree-default-dark-large.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox:hover,.jstree-default-dark-large .jstree-checked>.jstree-checkbox:hover{background-position:-224px -32px}.jstree-default-dark-large .jstree-anchor>.jstree-undetermined{background-position:-192px 0}.jstree-default-dark-large .jstree-anchor>.jstree-undetermined:hover{background-position:-192px -32px}.jstree-default-dark-large .jstree-checkbox-disabled{opacity:.8;filter:url("data:image/svg+xml;utf8,#jstree-grayscale");filter:gray;-webkit-filter:grayscale(100%)}.jstree-default-dark-large>.jstree-striped{background-size:auto 64px}.jstree-default-dark-large.jstree-rtl .jstree-node{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==);background-position:100% 1px;background-repeat:repeat-y}.jstree-default-dark-large.jstree-rtl .jstree-last{background:0 0}.jstree-default-dark-large.jstree-rtl .jstree-open>.jstree-ocl{background-position:-128px -32px}.jstree-default-dark-large.jstree-rtl .jstree-closed>.jstree-ocl{background-position:-96px -32px}.jstree-default-dark-large.jstree-rtl .jstree-leaf>.jstree-ocl{background-position:-64px -32px}.jstree-default-dark-large.jstree-rtl>.jstree-no-dots .jstree-node,.jstree-default-dark-large.jstree-rtl>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:0 0}.jstree-default-dark-large.jstree-rtl>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-32px -32px}.jstree-default-dark-large.jstree-rtl>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:0 -32px}.jstree-default-dark-large .jstree-themeicon-custom{background-color:transparent;background-image:none;background-position:0 0}.jstree-default-dark-large>.jstree-container-ul .jstree-loading>.jstree-ocl{background:url(throbber.gif) center center no-repeat}.jstree-default-dark-large .jstree-file{background:url(32px.png) -96px -64px no-repeat}.jstree-default-dark-large .jstree-folder{background:url(32px.png) -256px 0 no-repeat}.jstree-default-dark-large>.jstree-container-ul>.jstree-node{margin-left:0;margin-right:0}#jstree-dnd.jstree-default-dark-large{line-height:32px;padding:0 4px}#jstree-dnd.jstree-default-dark-large .jstree-ok,#jstree-dnd.jstree-default-dark-large .jstree-er{background-image:url(32px.png);background-repeat:no-repeat;background-color:transparent}#jstree-dnd.jstree-default-dark-large i{background:0 0;width:32px;height:32px;line-height:32px}#jstree-dnd.jstree-default-dark-large .jstree-ok{background-position:0 -64px}#jstree-dnd.jstree-default-dark-large .jstree-er{background-position:-32px -64px}.jstree-default-dark-large .jstree-ellipsis{overflow:hidden}.jstree-default-dark-large .jstree-ellipsis .jstree-anchor{width:calc(100% - 37px);text-overflow:ellipsis;overflow:hidden}.jstree-default-dark-large .jstree-ellipsis.jstree-no-icons .jstree-anchor{width:calc(100% - 5px)}.jstree-default-dark-large.jstree-rtl .jstree-node{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAACAQMAAAAD0EyKAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjgIIGBgABCgCBvVLXcAAAAABJRU5ErkJggg==)}.jstree-default-dark-large.jstree-rtl .jstree-last{background:0 0}@media (max-width:768px){#jstree-dnd.jstree-dnd-responsive{line-height:40px;font-weight:700;font-size:1.1em;text-shadow:1px 1px #fff}#jstree-dnd.jstree-dnd-responsive>i{background:0 0;width:40px;height:40px}#jstree-dnd.jstree-dnd-responsive>.jstree-ok{background-image:url(40px.png);background-position:0 -200px;background-size:120px 240px}#jstree-dnd.jstree-dnd-responsive>.jstree-er{background-image:url(40px.png);background-position:-40px -200px;background-size:120px 240px}#jstree-marker.jstree-dnd-responsive{border-left-width:10px;border-top-width:10px;border-bottom-width:10px;margin-top:-10px}}@media (max-width:768px){.jstree-default-dark-responsive .jstree-icon{background-image:url(40px.png)}.jstree-default-dark-responsive .jstree-node,.jstree-default-dark-responsive .jstree-leaf>.jstree-ocl{background:0 0}.jstree-default-dark-responsive .jstree-node{min-height:40px;line-height:40px;margin-left:40px;min-width:40px;white-space:nowrap}.jstree-default-dark-responsive .jstree-anchor{line-height:40px;height:40px}.jstree-default-dark-responsive .jstree-icon,.jstree-default-dark-responsive .jstree-icon:empty{width:40px;height:40px;line-height:40px}.jstree-default-dark-responsive>.jstree-container-ul>.jstree-node{margin-left:0}.jstree-default-dark-responsive.jstree-rtl .jstree-node{margin-left:0;margin-right:40px;background:0 0}.jstree-default-dark-responsive.jstree-rtl .jstree-container-ul>.jstree-node{margin-right:0}.jstree-default-dark-responsive .jstree-ocl,.jstree-default-dark-responsive .jstree-themeicon,.jstree-default-dark-responsive .jstree-checkbox{background-size:120px 240px}.jstree-default-dark-responsive .jstree-leaf>.jstree-ocl,.jstree-default-dark-responsive.jstree-rtl .jstree-leaf>.jstree-ocl{background:0 0}.jstree-default-dark-responsive .jstree-open>.jstree-ocl{background-position:0 0!important}.jstree-default-dark-responsive .jstree-closed>.jstree-ocl{background-position:0 -40px!important}.jstree-default-dark-responsive.jstree-rtl .jstree-closed>.jstree-ocl{background-position:-40px 0!important}.jstree-default-dark-responsive .jstree-themeicon{background-position:-40px -40px}.jstree-default-dark-responsive .jstree-checkbox,.jstree-default-dark-responsive .jstree-checkbox:hover{background-position:-40px -80px}.jstree-default-dark-responsive.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox,.jstree-default-dark-responsive.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox:hover,.jstree-default-dark-responsive .jstree-checked>.jstree-checkbox,.jstree-default-dark-responsive .jstree-checked>.jstree-checkbox:hover{background-position:0 -80px}.jstree-default-dark-responsive .jstree-anchor>.jstree-undetermined,.jstree-default-dark-responsive .jstree-anchor>.jstree-undetermined:hover{background-position:0 -120px}.jstree-default-dark-responsive .jstree-anchor{font-weight:700;font-size:1.1em;text-shadow:1px 1px #fff}.jstree-default-dark-responsive>.jstree-striped{background:0 0}.jstree-default-dark-responsive .jstree-wholerow{border-top:1px solid #666;border-bottom:1px solid #000;background:#333;height:40px}.jstree-default-dark-responsive .jstree-wholerow-hovered{background:#555}.jstree-default-dark-responsive .jstree-wholerow-clicked{background:#5fa2db}.jstree-default-dark-responsive .jstree-children .jstree-last>.jstree-wholerow{box-shadow:inset 0 -6px 3px -5px #111}.jstree-default-dark-responsive .jstree-children .jstree-open>.jstree-wholerow{box-shadow:inset 0 6px 3px -5px #111;border-top:0}.jstree-default-dark-responsive .jstree-children .jstree-open+.jstree-open{box-shadow:none}.jstree-default-dark-responsive .jstree-node,.jstree-default-dark-responsive .jstree-icon,.jstree-default-dark-responsive .jstree-node>.jstree-ocl,.jstree-default-dark-responsive .jstree-themeicon,.jstree-default-dark-responsive .jstree-checkbox{background-image:url(40px.png);background-size:120px 240px}.jstree-default-dark-responsive .jstree-node{background-position:-80px 0;background-repeat:repeat-y}.jstree-default-dark-responsive .jstree-last{background:0 0}.jstree-default-dark-responsive .jstree-leaf>.jstree-ocl{background-position:-40px -120px}.jstree-default-dark-responsive .jstree-last>.jstree-ocl{background-position:-40px -160px}.jstree-default-dark-responsive .jstree-themeicon-custom{background-color:transparent;background-image:none;background-position:0 0}.jstree-default-dark-responsive .jstree-file{background:url(40px.png) 0 -160px no-repeat;background-size:120px 240px}.jstree-default-dark-responsive .jstree-folder{background:url(40px.png) -40px -40px no-repeat;background-size:120px 240px}.jstree-default-dark-responsive>.jstree-container-ul>.jstree-node{margin-left:0;margin-right:0}}.jstree-default-dark{background:#333}.jstree-default-dark .jstree-anchor{color:#999;text-shadow:1px 1px 0 rgba(0,0,0,.5)}.jstree-default-dark .jstree-clicked,.jstree-default-dark .jstree-checked{color:#fff}.jstree-default-dark .jstree-hovered{color:#fff}#jstree-marker.jstree-default-dark{border-left-color:#999;background:0 0}.jstree-default-dark .jstree-anchor>.jstree-icon{opacity:.75}.jstree-default-dark .jstree-clicked>.jstree-icon,.jstree-default-dark .jstree-hovered>.jstree-icon,.jstree-default-dark .jstree-checked>.jstree-icon{opacity:1}.jstree-default-dark.jstree-rtl .jstree-node{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAACZmZl+9SADAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==)}.jstree-default-dark.jstree-rtl .jstree-last{background:0 0}.jstree-default-dark-small.jstree-rtl .jstree-node{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAACAQMAAABv1h6PAAAABlBMVEUAAACZmZl+9SADAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMHBgAAiABBI4gz9AAAAABJRU5ErkJggg==)}.jstree-default-dark-small.jstree-rtl .jstree-last{background:0 0}.jstree-default-dark-large.jstree-rtl .jstree-node{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAACAQMAAAAD0EyKAAAABlBMVEUAAACZmZl+9SADAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjgIIGBgABCgCBvVLXcAAAAABJRU5ErkJggg==)}.jstree-default-dark-large.jstree-rtl .jstree-last{background:0 0} \ No newline at end of file diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/dist/themes/default-dark/throbber.gif b/mayan/apps/cabinets/static/cabinets/packages/jstree/dist/themes/default-dark/throbber.gif deleted file mode 100644 index cd75035ce8..0000000000 Binary files a/mayan/apps/cabinets/static/cabinets/packages/jstree/dist/themes/default-dark/throbber.gif and /dev/null differ diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/dist/themes/default/32px.png b/mayan/apps/cabinets/static/cabinets/packages/jstree/dist/themes/default/32px.png deleted file mode 100644 index 1532715248..0000000000 Binary files a/mayan/apps/cabinets/static/cabinets/packages/jstree/dist/themes/default/32px.png and /dev/null differ diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/dist/themes/default/40px.png b/mayan/apps/cabinets/static/cabinets/packages/jstree/dist/themes/default/40px.png deleted file mode 100644 index 1959347aea..0000000000 Binary files a/mayan/apps/cabinets/static/cabinets/packages/jstree/dist/themes/default/40px.png and /dev/null differ diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/dist/themes/default/style.css b/mayan/apps/cabinets/static/cabinets/packages/jstree/dist/themes/default/style.css deleted file mode 100644 index 616be241be..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/dist/themes/default/style.css +++ /dev/null @@ -1,1102 +0,0 @@ -/* jsTree default theme */ -.jstree-node, -.jstree-children, -.jstree-container-ul { - display: block; - margin: 0; - padding: 0; - list-style-type: none; - list-style-image: none; -} -.jstree-node { - white-space: nowrap; -} -.jstree-anchor { - display: inline-block; - color: black; - white-space: nowrap; - padding: 0 4px 0 1px; - margin: 0; - vertical-align: top; -} -.jstree-anchor:focus { - outline: 0; -} -.jstree-anchor, -.jstree-anchor:link, -.jstree-anchor:visited, -.jstree-anchor:hover, -.jstree-anchor:active { - text-decoration: none; - color: inherit; -} -.jstree-icon { - display: inline-block; - text-decoration: none; - margin: 0; - padding: 0; - vertical-align: top; - text-align: center; -} -.jstree-icon:empty { - display: inline-block; - text-decoration: none; - margin: 0; - padding: 0; - vertical-align: top; - text-align: center; -} -.jstree-ocl { - cursor: pointer; -} -.jstree-leaf > .jstree-ocl { - cursor: default; -} -.jstree .jstree-open > .jstree-children { - display: block; -} -.jstree .jstree-closed > .jstree-children, -.jstree .jstree-leaf > .jstree-children { - display: none; -} -.jstree-anchor > .jstree-themeicon { - margin-right: 2px; -} -.jstree-no-icons .jstree-themeicon, -.jstree-anchor > .jstree-themeicon-hidden { - display: none; -} -.jstree-hidden, -.jstree-node.jstree-hidden { - display: none; -} -.jstree-rtl .jstree-anchor { - padding: 0 1px 0 4px; -} -.jstree-rtl .jstree-anchor > .jstree-themeicon { - margin-left: 2px; - margin-right: 0; -} -.jstree-rtl .jstree-node { - margin-left: 0; -} -.jstree-rtl .jstree-container-ul > .jstree-node { - margin-right: 0; -} -.jstree-wholerow-ul { - position: relative; - display: inline-block; - min-width: 100%; -} -.jstree-wholerow-ul .jstree-leaf > .jstree-ocl { - cursor: pointer; -} -.jstree-wholerow-ul .jstree-anchor, -.jstree-wholerow-ul .jstree-icon { - position: relative; -} -.jstree-wholerow-ul .jstree-wholerow { - width: 100%; - cursor: pointer; - position: absolute; - left: 0; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} -.vakata-context { - display: none; -} -.vakata-context, -.vakata-context ul { - margin: 0; - padding: 2px; - position: absolute; - background: #f5f5f5; - border: 1px solid #979797; - box-shadow: 2px 2px 2px #999999; -} -.vakata-context ul { - list-style: none; - left: 100%; - margin-top: -2.7em; - margin-left: -4px; -} -.vakata-context .vakata-context-right ul { - left: auto; - right: 100%; - margin-left: auto; - margin-right: -4px; -} -.vakata-context li { - list-style: none; -} -.vakata-context li > a { - display: block; - padding: 0 2em 0 2em; - text-decoration: none; - width: auto; - color: black; - white-space: nowrap; - line-height: 2.4em; - text-shadow: 1px 1px 0 white; - border-radius: 1px; -} -.vakata-context li > a:hover { - position: relative; - background-color: #e8eff7; - box-shadow: 0 0 2px #0a6aa1; -} -.vakata-context li > a.vakata-context-parent { - background-image: url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAIORI4JlrqN1oMSnmmZDQUAOw=="); - background-position: right center; - background-repeat: no-repeat; -} -.vakata-context li > a:focus { - outline: 0; -} -.vakata-context .vakata-context-hover > a { - position: relative; - background-color: #e8eff7; - box-shadow: 0 0 2px #0a6aa1; -} -.vakata-context .vakata-context-separator > a, -.vakata-context .vakata-context-separator > a:hover { - background: white; - border: 0; - border-top: 1px solid #e2e3e3; - height: 1px; - min-height: 1px; - max-height: 1px; - padding: 0; - margin: 0 0 0 2.4em; - border-left: 1px solid #e0e0e0; - text-shadow: 0 0 0 transparent; - box-shadow: 0 0 0 transparent; - border-radius: 0; -} -.vakata-context .vakata-contextmenu-disabled a, -.vakata-context .vakata-contextmenu-disabled a:hover { - color: silver; - background-color: transparent; - border: 0; - box-shadow: 0 0 0; -} -.vakata-context li > a > i { - text-decoration: none; - display: inline-block; - width: 2.4em; - height: 2.4em; - background: transparent; - margin: 0 0 0 -2em; - vertical-align: top; - text-align: center; - line-height: 2.4em; -} -.vakata-context li > a > i:empty { - width: 2.4em; - line-height: 2.4em; -} -.vakata-context li > a .vakata-contextmenu-sep { - display: inline-block; - width: 1px; - height: 2.4em; - background: white; - margin: 0 0.5em 0 0; - border-left: 1px solid #e2e3e3; -} -.vakata-context .vakata-contextmenu-shortcut { - font-size: 0.8em; - color: silver; - opacity: 0.5; - display: none; -} -.vakata-context-rtl ul { - left: auto; - right: 100%; - margin-left: auto; - margin-right: -4px; -} -.vakata-context-rtl li > a.vakata-context-parent { - background-image: url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAINjI+AC7rWHIsPtmoxLAA7"); - background-position: left center; - background-repeat: no-repeat; -} -.vakata-context-rtl .vakata-context-separator > a { - margin: 0 2.4em 0 0; - border-left: 0; - border-right: 1px solid #e2e3e3; -} -.vakata-context-rtl .vakata-context-left ul { - right: auto; - left: 100%; - margin-left: -4px; - margin-right: auto; -} -.vakata-context-rtl li > a > i { - margin: 0 -2em 0 0; -} -.vakata-context-rtl li > a .vakata-contextmenu-sep { - margin: 0 0 0 0.5em; - border-left-color: white; - background: #e2e3e3; -} -#jstree-marker { - position: absolute; - top: 0; - left: 0; - margin: -5px 0 0 0; - padding: 0; - border-right: 0; - border-top: 5px solid transparent; - border-bottom: 5px solid transparent; - border-left: 5px solid; - width: 0; - height: 0; - font-size: 0; - line-height: 0; -} -#jstree-dnd { - line-height: 16px; - margin: 0; - padding: 4px; -} -#jstree-dnd .jstree-icon, -#jstree-dnd .jstree-copy { - display: inline-block; - text-decoration: none; - margin: 0 2px 0 0; - padding: 0; - width: 16px; - height: 16px; -} -#jstree-dnd .jstree-ok { - background: green; -} -#jstree-dnd .jstree-er { - background: red; -} -#jstree-dnd .jstree-copy { - margin: 0 2px 0 2px; -} -.jstree-default .jstree-node, -.jstree-default .jstree-icon { - background-repeat: no-repeat; - background-color: transparent; -} -.jstree-default .jstree-anchor, -.jstree-default .jstree-animated, -.jstree-default .jstree-wholerow { - transition: background-color 0.15s, box-shadow 0.15s; -} -.jstree-default .jstree-hovered { - background: #e7f4f9; - border-radius: 2px; - box-shadow: inset 0 0 1px #cccccc; -} -.jstree-default .jstree-context { - background: #e7f4f9; - border-radius: 2px; - box-shadow: inset 0 0 1px #cccccc; -} -.jstree-default .jstree-clicked { - background: #beebff; - border-radius: 2px; - box-shadow: inset 0 0 1px #999999; -} -.jstree-default .jstree-no-icons .jstree-anchor > .jstree-themeicon { - display: none; -} -.jstree-default .jstree-disabled { - background: transparent; - color: #666666; -} -.jstree-default .jstree-disabled.jstree-hovered { - background: transparent; - box-shadow: none; -} -.jstree-default .jstree-disabled.jstree-clicked { - background: #efefef; -} -.jstree-default .jstree-disabled > .jstree-icon { - opacity: 0.8; - filter: url("data:image/svg+xml;utf8,#jstree-grayscale"); - /* Firefox 10+ */ - filter: gray; - /* IE6-9 */ - -webkit-filter: grayscale(100%); - /* Chrome 19+ & Safari 6+ */ -} -.jstree-default .jstree-search { - font-style: italic; - color: #8b0000; - font-weight: bold; -} -.jstree-default .jstree-no-checkboxes .jstree-checkbox { - display: none !important; -} -.jstree-default.jstree-checkbox-no-clicked .jstree-clicked { - background: transparent; - box-shadow: none; -} -.jstree-default.jstree-checkbox-no-clicked .jstree-clicked.jstree-hovered { - background: #e7f4f9; -} -.jstree-default.jstree-checkbox-no-clicked > .jstree-wholerow-ul .jstree-wholerow-clicked { - background: transparent; -} -.jstree-default.jstree-checkbox-no-clicked > .jstree-wholerow-ul .jstree-wholerow-clicked.jstree-wholerow-hovered { - background: #e7f4f9; -} -.jstree-default > .jstree-striped { - min-width: 100%; - display: inline-block; - background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAkCAMAAAB/qqA+AAAABlBMVEUAAAAAAAClZ7nPAAAAAnRSTlMNAMM9s3UAAAAXSURBVHjajcEBAQAAAIKg/H/aCQZ70AUBjAATb6YPDgAAAABJRU5ErkJggg==") left top repeat; -} -.jstree-default > .jstree-wholerow-ul .jstree-hovered, -.jstree-default > .jstree-wholerow-ul .jstree-clicked { - background: transparent; - box-shadow: none; - border-radius: 0; -} -.jstree-default .jstree-wholerow { - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - box-sizing: border-box; -} -.jstree-default .jstree-wholerow-hovered { - background: #e7f4f9; -} -.jstree-default .jstree-wholerow-clicked { - background: #beebff; - background: -webkit-linear-gradient(top, #beebff 0%, #a8e4ff 100%); - background: linear-gradient(to bottom, #beebff 0%, #a8e4ff 100%); -} -.jstree-default .jstree-node { - min-height: 24px; - line-height: 24px; - margin-left: 24px; - min-width: 24px; -} -.jstree-default .jstree-anchor { - line-height: 24px; - height: 24px; -} -.jstree-default .jstree-icon { - width: 24px; - height: 24px; - line-height: 24px; -} -.jstree-default .jstree-icon:empty { - width: 24px; - height: 24px; - line-height: 24px; -} -.jstree-default.jstree-rtl .jstree-node { - margin-right: 24px; -} -.jstree-default .jstree-wholerow { - height: 24px; -} -.jstree-default .jstree-node, -.jstree-default .jstree-icon { - background-image: url("32px.png"); -} -.jstree-default .jstree-node { - background-position: -292px -4px; - background-repeat: repeat-y; -} -.jstree-default .jstree-last { - background: transparent; -} -.jstree-default .jstree-open > .jstree-ocl { - background-position: -132px -4px; -} -.jstree-default .jstree-closed > .jstree-ocl { - background-position: -100px -4px; -} -.jstree-default .jstree-leaf > .jstree-ocl { - background-position: -68px -4px; -} -.jstree-default .jstree-themeicon { - background-position: -260px -4px; -} -.jstree-default > .jstree-no-dots .jstree-node, -.jstree-default > .jstree-no-dots .jstree-leaf > .jstree-ocl { - background: transparent; -} -.jstree-default > .jstree-no-dots .jstree-open > .jstree-ocl { - background-position: -36px -4px; -} -.jstree-default > .jstree-no-dots .jstree-closed > .jstree-ocl { - background-position: -4px -4px; -} -.jstree-default .jstree-disabled { - background: transparent; -} -.jstree-default .jstree-disabled.jstree-hovered { - background: transparent; -} -.jstree-default .jstree-disabled.jstree-clicked { - background: #efefef; -} -.jstree-default .jstree-checkbox { - background-position: -164px -4px; -} -.jstree-default .jstree-checkbox:hover { - background-position: -164px -36px; -} -.jstree-default.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox, -.jstree-default .jstree-checked > .jstree-checkbox { - background-position: -228px -4px; -} -.jstree-default.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover, -.jstree-default .jstree-checked > .jstree-checkbox:hover { - background-position: -228px -36px; -} -.jstree-default .jstree-anchor > .jstree-undetermined { - background-position: -196px -4px; -} -.jstree-default .jstree-anchor > .jstree-undetermined:hover { - background-position: -196px -36px; -} -.jstree-default .jstree-checkbox-disabled { - opacity: 0.8; - filter: url("data:image/svg+xml;utf8,#jstree-grayscale"); - /* Firefox 10+ */ - filter: gray; - /* IE6-9 */ - -webkit-filter: grayscale(100%); - /* Chrome 19+ & Safari 6+ */ -} -.jstree-default > .jstree-striped { - background-size: auto 48px; -} -.jstree-default.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg=="); - background-position: 100% 1px; - background-repeat: repeat-y; -} -.jstree-default.jstree-rtl .jstree-last { - background: transparent; -} -.jstree-default.jstree-rtl .jstree-open > .jstree-ocl { - background-position: -132px -36px; -} -.jstree-default.jstree-rtl .jstree-closed > .jstree-ocl { - background-position: -100px -36px; -} -.jstree-default.jstree-rtl .jstree-leaf > .jstree-ocl { - background-position: -68px -36px; -} -.jstree-default.jstree-rtl > .jstree-no-dots .jstree-node, -.jstree-default.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl { - background: transparent; -} -.jstree-default.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl { - background-position: -36px -36px; -} -.jstree-default.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl { - background-position: -4px -36px; -} -.jstree-default .jstree-themeicon-custom { - background-color: transparent; - background-image: none; - background-position: 0 0; -} -.jstree-default > .jstree-container-ul .jstree-loading > .jstree-ocl { - background: url("throbber.gif") center center no-repeat; -} -.jstree-default .jstree-file { - background: url("32px.png") -100px -68px no-repeat; -} -.jstree-default .jstree-folder { - background: url("32px.png") -260px -4px no-repeat; -} -.jstree-default > .jstree-container-ul > .jstree-node { - margin-left: 0; - margin-right: 0; -} -#jstree-dnd.jstree-default { - line-height: 24px; - padding: 0 4px; -} -#jstree-dnd.jstree-default .jstree-ok, -#jstree-dnd.jstree-default .jstree-er { - background-image: url("32px.png"); - background-repeat: no-repeat; - background-color: transparent; -} -#jstree-dnd.jstree-default i { - background: transparent; - width: 24px; - height: 24px; - line-height: 24px; -} -#jstree-dnd.jstree-default .jstree-ok { - background-position: -4px -68px; -} -#jstree-dnd.jstree-default .jstree-er { - background-position: -36px -68px; -} -.jstree-default .jstree-ellipsis { - overflow: hidden; -} -.jstree-default .jstree-ellipsis .jstree-anchor { - width: calc(100% - 29px); - text-overflow: ellipsis; - overflow: hidden; -} -.jstree-default .jstree-ellipsis.jstree-no-icons .jstree-anchor { - width: calc(100% - 5px); -} -.jstree-default.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg=="); -} -.jstree-default.jstree-rtl .jstree-last { - background: transparent; -} -.jstree-default-small .jstree-node { - min-height: 18px; - line-height: 18px; - margin-left: 18px; - min-width: 18px; -} -.jstree-default-small .jstree-anchor { - line-height: 18px; - height: 18px; -} -.jstree-default-small .jstree-icon { - width: 18px; - height: 18px; - line-height: 18px; -} -.jstree-default-small .jstree-icon:empty { - width: 18px; - height: 18px; - line-height: 18px; -} -.jstree-default-small.jstree-rtl .jstree-node { - margin-right: 18px; -} -.jstree-default-small .jstree-wholerow { - height: 18px; -} -.jstree-default-small .jstree-node, -.jstree-default-small .jstree-icon { - background-image: url("32px.png"); -} -.jstree-default-small .jstree-node { - background-position: -295px -7px; - background-repeat: repeat-y; -} -.jstree-default-small .jstree-last { - background: transparent; -} -.jstree-default-small .jstree-open > .jstree-ocl { - background-position: -135px -7px; -} -.jstree-default-small .jstree-closed > .jstree-ocl { - background-position: -103px -7px; -} -.jstree-default-small .jstree-leaf > .jstree-ocl { - background-position: -71px -7px; -} -.jstree-default-small .jstree-themeicon { - background-position: -263px -7px; -} -.jstree-default-small > .jstree-no-dots .jstree-node, -.jstree-default-small > .jstree-no-dots .jstree-leaf > .jstree-ocl { - background: transparent; -} -.jstree-default-small > .jstree-no-dots .jstree-open > .jstree-ocl { - background-position: -39px -7px; -} -.jstree-default-small > .jstree-no-dots .jstree-closed > .jstree-ocl { - background-position: -7px -7px; -} -.jstree-default-small .jstree-disabled { - background: transparent; -} -.jstree-default-small .jstree-disabled.jstree-hovered { - background: transparent; -} -.jstree-default-small .jstree-disabled.jstree-clicked { - background: #efefef; -} -.jstree-default-small .jstree-checkbox { - background-position: -167px -7px; -} -.jstree-default-small .jstree-checkbox:hover { - background-position: -167px -39px; -} -.jstree-default-small.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox, -.jstree-default-small .jstree-checked > .jstree-checkbox { - background-position: -231px -7px; -} -.jstree-default-small.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover, -.jstree-default-small .jstree-checked > .jstree-checkbox:hover { - background-position: -231px -39px; -} -.jstree-default-small .jstree-anchor > .jstree-undetermined { - background-position: -199px -7px; -} -.jstree-default-small .jstree-anchor > .jstree-undetermined:hover { - background-position: -199px -39px; -} -.jstree-default-small .jstree-checkbox-disabled { - opacity: 0.8; - filter: url("data:image/svg+xml;utf8,#jstree-grayscale"); - /* Firefox 10+ */ - filter: gray; - /* IE6-9 */ - -webkit-filter: grayscale(100%); - /* Chrome 19+ & Safari 6+ */ -} -.jstree-default-small > .jstree-striped { - background-size: auto 36px; -} -.jstree-default-small.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg=="); - background-position: 100% 1px; - background-repeat: repeat-y; -} -.jstree-default-small.jstree-rtl .jstree-last { - background: transparent; -} -.jstree-default-small.jstree-rtl .jstree-open > .jstree-ocl { - background-position: -135px -39px; -} -.jstree-default-small.jstree-rtl .jstree-closed > .jstree-ocl { - background-position: -103px -39px; -} -.jstree-default-small.jstree-rtl .jstree-leaf > .jstree-ocl { - background-position: -71px -39px; -} -.jstree-default-small.jstree-rtl > .jstree-no-dots .jstree-node, -.jstree-default-small.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl { - background: transparent; -} -.jstree-default-small.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl { - background-position: -39px -39px; -} -.jstree-default-small.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl { - background-position: -7px -39px; -} -.jstree-default-small .jstree-themeicon-custom { - background-color: transparent; - background-image: none; - background-position: 0 0; -} -.jstree-default-small > .jstree-container-ul .jstree-loading > .jstree-ocl { - background: url("throbber.gif") center center no-repeat; -} -.jstree-default-small .jstree-file { - background: url("32px.png") -103px -71px no-repeat; -} -.jstree-default-small .jstree-folder { - background: url("32px.png") -263px -7px no-repeat; -} -.jstree-default-small > .jstree-container-ul > .jstree-node { - margin-left: 0; - margin-right: 0; -} -#jstree-dnd.jstree-default-small { - line-height: 18px; - padding: 0 4px; -} -#jstree-dnd.jstree-default-small .jstree-ok, -#jstree-dnd.jstree-default-small .jstree-er { - background-image: url("32px.png"); - background-repeat: no-repeat; - background-color: transparent; -} -#jstree-dnd.jstree-default-small i { - background: transparent; - width: 18px; - height: 18px; - line-height: 18px; -} -#jstree-dnd.jstree-default-small .jstree-ok { - background-position: -7px -71px; -} -#jstree-dnd.jstree-default-small .jstree-er { - background-position: -39px -71px; -} -.jstree-default-small .jstree-ellipsis { - overflow: hidden; -} -.jstree-default-small .jstree-ellipsis .jstree-anchor { - width: calc(100% - 23px); - text-overflow: ellipsis; - overflow: hidden; -} -.jstree-default-small .jstree-ellipsis.jstree-no-icons .jstree-anchor { - width: calc(100% - 5px); -} -.jstree-default-small.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAACAQMAAABv1h6PAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMHBgAAiABBI4gz9AAAAABJRU5ErkJggg=="); -} -.jstree-default-small.jstree-rtl .jstree-last { - background: transparent; -} -.jstree-default-large .jstree-node { - min-height: 32px; - line-height: 32px; - margin-left: 32px; - min-width: 32px; -} -.jstree-default-large .jstree-anchor { - line-height: 32px; - height: 32px; -} -.jstree-default-large .jstree-icon { - width: 32px; - height: 32px; - line-height: 32px; -} -.jstree-default-large .jstree-icon:empty { - width: 32px; - height: 32px; - line-height: 32px; -} -.jstree-default-large.jstree-rtl .jstree-node { - margin-right: 32px; -} -.jstree-default-large .jstree-wholerow { - height: 32px; -} -.jstree-default-large .jstree-node, -.jstree-default-large .jstree-icon { - background-image: url("32px.png"); -} -.jstree-default-large .jstree-node { - background-position: -288px 0px; - background-repeat: repeat-y; -} -.jstree-default-large .jstree-last { - background: transparent; -} -.jstree-default-large .jstree-open > .jstree-ocl { - background-position: -128px 0px; -} -.jstree-default-large .jstree-closed > .jstree-ocl { - background-position: -96px 0px; -} -.jstree-default-large .jstree-leaf > .jstree-ocl { - background-position: -64px 0px; -} -.jstree-default-large .jstree-themeicon { - background-position: -256px 0px; -} -.jstree-default-large > .jstree-no-dots .jstree-node, -.jstree-default-large > .jstree-no-dots .jstree-leaf > .jstree-ocl { - background: transparent; -} -.jstree-default-large > .jstree-no-dots .jstree-open > .jstree-ocl { - background-position: -32px 0px; -} -.jstree-default-large > .jstree-no-dots .jstree-closed > .jstree-ocl { - background-position: 0px 0px; -} -.jstree-default-large .jstree-disabled { - background: transparent; -} -.jstree-default-large .jstree-disabled.jstree-hovered { - background: transparent; -} -.jstree-default-large .jstree-disabled.jstree-clicked { - background: #efefef; -} -.jstree-default-large .jstree-checkbox { - background-position: -160px 0px; -} -.jstree-default-large .jstree-checkbox:hover { - background-position: -160px -32px; -} -.jstree-default-large.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox, -.jstree-default-large .jstree-checked > .jstree-checkbox { - background-position: -224px 0px; -} -.jstree-default-large.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover, -.jstree-default-large .jstree-checked > .jstree-checkbox:hover { - background-position: -224px -32px; -} -.jstree-default-large .jstree-anchor > .jstree-undetermined { - background-position: -192px 0px; -} -.jstree-default-large .jstree-anchor > .jstree-undetermined:hover { - background-position: -192px -32px; -} -.jstree-default-large .jstree-checkbox-disabled { - opacity: 0.8; - filter: url("data:image/svg+xml;utf8,#jstree-grayscale"); - /* Firefox 10+ */ - filter: gray; - /* IE6-9 */ - -webkit-filter: grayscale(100%); - /* Chrome 19+ & Safari 6+ */ -} -.jstree-default-large > .jstree-striped { - background-size: auto 64px; -} -.jstree-default-large.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg=="); - background-position: 100% 1px; - background-repeat: repeat-y; -} -.jstree-default-large.jstree-rtl .jstree-last { - background: transparent; -} -.jstree-default-large.jstree-rtl .jstree-open > .jstree-ocl { - background-position: -128px -32px; -} -.jstree-default-large.jstree-rtl .jstree-closed > .jstree-ocl { - background-position: -96px -32px; -} -.jstree-default-large.jstree-rtl .jstree-leaf > .jstree-ocl { - background-position: -64px -32px; -} -.jstree-default-large.jstree-rtl > .jstree-no-dots .jstree-node, -.jstree-default-large.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl { - background: transparent; -} -.jstree-default-large.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl { - background-position: -32px -32px; -} -.jstree-default-large.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl { - background-position: 0px -32px; -} -.jstree-default-large .jstree-themeicon-custom { - background-color: transparent; - background-image: none; - background-position: 0 0; -} -.jstree-default-large > .jstree-container-ul .jstree-loading > .jstree-ocl { - background: url("throbber.gif") center center no-repeat; -} -.jstree-default-large .jstree-file { - background: url("32px.png") -96px -64px no-repeat; -} -.jstree-default-large .jstree-folder { - background: url("32px.png") -256px 0px no-repeat; -} -.jstree-default-large > .jstree-container-ul > .jstree-node { - margin-left: 0; - margin-right: 0; -} -#jstree-dnd.jstree-default-large { - line-height: 32px; - padding: 0 4px; -} -#jstree-dnd.jstree-default-large .jstree-ok, -#jstree-dnd.jstree-default-large .jstree-er { - background-image: url("32px.png"); - background-repeat: no-repeat; - background-color: transparent; -} -#jstree-dnd.jstree-default-large i { - background: transparent; - width: 32px; - height: 32px; - line-height: 32px; -} -#jstree-dnd.jstree-default-large .jstree-ok { - background-position: 0px -64px; -} -#jstree-dnd.jstree-default-large .jstree-er { - background-position: -32px -64px; -} -.jstree-default-large .jstree-ellipsis { - overflow: hidden; -} -.jstree-default-large .jstree-ellipsis .jstree-anchor { - width: calc(100% - 37px); - text-overflow: ellipsis; - overflow: hidden; -} -.jstree-default-large .jstree-ellipsis.jstree-no-icons .jstree-anchor { - width: calc(100% - 5px); -} -.jstree-default-large.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAACAQMAAAAD0EyKAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjgIIGBgABCgCBvVLXcAAAAABJRU5ErkJggg=="); -} -.jstree-default-large.jstree-rtl .jstree-last { - background: transparent; -} -@media (max-width: 768px) { - #jstree-dnd.jstree-dnd-responsive { - line-height: 40px; - font-weight: bold; - font-size: 1.1em; - text-shadow: 1px 1px white; - } - #jstree-dnd.jstree-dnd-responsive > i { - background: transparent; - width: 40px; - height: 40px; - } - #jstree-dnd.jstree-dnd-responsive > .jstree-ok { - background-image: url("40px.png"); - background-position: 0 -200px; - background-size: 120px 240px; - } - #jstree-dnd.jstree-dnd-responsive > .jstree-er { - background-image: url("40px.png"); - background-position: -40px -200px; - background-size: 120px 240px; - } - #jstree-marker.jstree-dnd-responsive { - border-left-width: 10px; - border-top-width: 10px; - border-bottom-width: 10px; - margin-top: -10px; - } -} -@media (max-width: 768px) { - .jstree-default-responsive { - /* - .jstree-open > .jstree-ocl, - .jstree-closed > .jstree-ocl { border-radius:20px; background-color:white; } - */ - } - .jstree-default-responsive .jstree-icon { - background-image: url("40px.png"); - } - .jstree-default-responsive .jstree-node, - .jstree-default-responsive .jstree-leaf > .jstree-ocl { - background: transparent; - } - .jstree-default-responsive .jstree-node { - min-height: 40px; - line-height: 40px; - margin-left: 40px; - min-width: 40px; - white-space: nowrap; - } - .jstree-default-responsive .jstree-anchor { - line-height: 40px; - height: 40px; - } - .jstree-default-responsive .jstree-icon, - .jstree-default-responsive .jstree-icon:empty { - width: 40px; - height: 40px; - line-height: 40px; - } - .jstree-default-responsive > .jstree-container-ul > .jstree-node { - margin-left: 0; - } - .jstree-default-responsive.jstree-rtl .jstree-node { - margin-left: 0; - margin-right: 40px; - background: transparent; - } - .jstree-default-responsive.jstree-rtl .jstree-container-ul > .jstree-node { - margin-right: 0; - } - .jstree-default-responsive .jstree-ocl, - .jstree-default-responsive .jstree-themeicon, - .jstree-default-responsive .jstree-checkbox { - background-size: 120px 240px; - } - .jstree-default-responsive .jstree-leaf > .jstree-ocl, - .jstree-default-responsive.jstree-rtl .jstree-leaf > .jstree-ocl { - background: transparent; - } - .jstree-default-responsive .jstree-open > .jstree-ocl { - background-position: 0 0px !important; - } - .jstree-default-responsive .jstree-closed > .jstree-ocl { - background-position: 0 -40px !important; - } - .jstree-default-responsive.jstree-rtl .jstree-closed > .jstree-ocl { - background-position: -40px 0px !important; - } - .jstree-default-responsive .jstree-themeicon { - background-position: -40px -40px; - } - .jstree-default-responsive .jstree-checkbox, - .jstree-default-responsive .jstree-checkbox:hover { - background-position: -40px -80px; - } - .jstree-default-responsive.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox, - .jstree-default-responsive.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover, - .jstree-default-responsive .jstree-checked > .jstree-checkbox, - .jstree-default-responsive .jstree-checked > .jstree-checkbox:hover { - background-position: 0 -80px; - } - .jstree-default-responsive .jstree-anchor > .jstree-undetermined, - .jstree-default-responsive .jstree-anchor > .jstree-undetermined:hover { - background-position: 0 -120px; - } - .jstree-default-responsive .jstree-anchor { - font-weight: bold; - font-size: 1.1em; - text-shadow: 1px 1px white; - } - .jstree-default-responsive > .jstree-striped { - background: transparent; - } - .jstree-default-responsive .jstree-wholerow { - border-top: 1px solid rgba(255, 255, 255, 0.7); - border-bottom: 1px solid rgba(64, 64, 64, 0.2); - background: #ebebeb; - height: 40px; - } - .jstree-default-responsive .jstree-wholerow-hovered { - background: #e7f4f9; - } - .jstree-default-responsive .jstree-wholerow-clicked { - background: #beebff; - } - .jstree-default-responsive .jstree-children .jstree-last > .jstree-wholerow { - box-shadow: inset 0 -6px 3px -5px #666666; - } - .jstree-default-responsive .jstree-children .jstree-open > .jstree-wholerow { - box-shadow: inset 0 6px 3px -5px #666666; - border-top: 0; - } - .jstree-default-responsive .jstree-children .jstree-open + .jstree-open { - box-shadow: none; - } - .jstree-default-responsive .jstree-node, - .jstree-default-responsive .jstree-icon, - .jstree-default-responsive .jstree-node > .jstree-ocl, - .jstree-default-responsive .jstree-themeicon, - .jstree-default-responsive .jstree-checkbox { - background-image: url("40px.png"); - background-size: 120px 240px; - } - .jstree-default-responsive .jstree-node { - background-position: -80px 0; - background-repeat: repeat-y; - } - .jstree-default-responsive .jstree-last { - background: transparent; - } - .jstree-default-responsive .jstree-leaf > .jstree-ocl { - background-position: -40px -120px; - } - .jstree-default-responsive .jstree-last > .jstree-ocl { - background-position: -40px -160px; - } - .jstree-default-responsive .jstree-themeicon-custom { - background-color: transparent; - background-image: none; - background-position: 0 0; - } - .jstree-default-responsive .jstree-file { - background: url("40px.png") 0 -160px no-repeat; - background-size: 120px 240px; - } - .jstree-default-responsive .jstree-folder { - background: url("40px.png") -40px -40px no-repeat; - background-size: 120px 240px; - } - .jstree-default-responsive > .jstree-container-ul > .jstree-node { - margin-left: 0; - margin-right: 0; - } -} diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/dist/themes/default/style.min.css b/mayan/apps/cabinets/static/cabinets/packages/jstree/dist/themes/default/style.min.css deleted file mode 100644 index a76f15c094..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/dist/themes/default/style.min.css +++ /dev/null @@ -1 +0,0 @@ -.jstree-node,.jstree-children,.jstree-container-ul{display:block;margin:0;padding:0;list-style-type:none;list-style-image:none}.jstree-node{white-space:nowrap}.jstree-anchor{display:inline-block;color:#000;white-space:nowrap;padding:0 4px 0 1px;margin:0;vertical-align:top}.jstree-anchor:focus{outline:0}.jstree-anchor,.jstree-anchor:link,.jstree-anchor:visited,.jstree-anchor:hover,.jstree-anchor:active{text-decoration:none;color:inherit}.jstree-icon{display:inline-block;text-decoration:none;margin:0;padding:0;vertical-align:top;text-align:center}.jstree-icon:empty{display:inline-block;text-decoration:none;margin:0;padding:0;vertical-align:top;text-align:center}.jstree-ocl{cursor:pointer}.jstree-leaf>.jstree-ocl{cursor:default}.jstree .jstree-open>.jstree-children{display:block}.jstree .jstree-closed>.jstree-children,.jstree .jstree-leaf>.jstree-children{display:none}.jstree-anchor>.jstree-themeicon{margin-right:2px}.jstree-no-icons .jstree-themeicon,.jstree-anchor>.jstree-themeicon-hidden{display:none}.jstree-hidden,.jstree-node.jstree-hidden{display:none}.jstree-rtl .jstree-anchor{padding:0 1px 0 4px}.jstree-rtl .jstree-anchor>.jstree-themeicon{margin-left:2px;margin-right:0}.jstree-rtl .jstree-node{margin-left:0}.jstree-rtl .jstree-container-ul>.jstree-node{margin-right:0}.jstree-wholerow-ul{position:relative;display:inline-block;min-width:100%}.jstree-wholerow-ul .jstree-leaf>.jstree-ocl{cursor:pointer}.jstree-wholerow-ul .jstree-anchor,.jstree-wholerow-ul .jstree-icon{position:relative}.jstree-wholerow-ul .jstree-wholerow{width:100%;cursor:pointer;position:absolute;left:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.vakata-context{display:none}.vakata-context,.vakata-context ul{margin:0;padding:2px;position:absolute;background:#f5f5f5;border:1px solid #979797;box-shadow:2px 2px 2px #999}.vakata-context ul{list-style:none;left:100%;margin-top:-2.7em;margin-left:-4px}.vakata-context .vakata-context-right ul{left:auto;right:100%;margin-left:auto;margin-right:-4px}.vakata-context li{list-style:none}.vakata-context li>a{display:block;padding:0 2em;text-decoration:none;width:auto;color:#000;white-space:nowrap;line-height:2.4em;text-shadow:1px 1px 0 #fff;border-radius:1px}.vakata-context li>a:hover{position:relative;background-color:#e8eff7;box-shadow:0 0 2px #0a6aa1}.vakata-context li>a.vakata-context-parent{background-image:url(data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAIORI4JlrqN1oMSnmmZDQUAOw==);background-position:right center;background-repeat:no-repeat}.vakata-context li>a:focus{outline:0}.vakata-context .vakata-context-hover>a{position:relative;background-color:#e8eff7;box-shadow:0 0 2px #0a6aa1}.vakata-context .vakata-context-separator>a,.vakata-context .vakata-context-separator>a:hover{background:#fff;border:0;border-top:1px solid #e2e3e3;height:1px;min-height:1px;max-height:1px;padding:0;margin:0 0 0 2.4em;border-left:1px solid #e0e0e0;text-shadow:0 0 0 transparent;box-shadow:0 0 0 transparent;border-radius:0}.vakata-context .vakata-contextmenu-disabled a,.vakata-context .vakata-contextmenu-disabled a:hover{color:silver;background-color:transparent;border:0;box-shadow:0 0 0}.vakata-context li>a>i{text-decoration:none;display:inline-block;width:2.4em;height:2.4em;background:0 0;margin:0 0 0 -2em;vertical-align:top;text-align:center;line-height:2.4em}.vakata-context li>a>i:empty{width:2.4em;line-height:2.4em}.vakata-context li>a .vakata-contextmenu-sep{display:inline-block;width:1px;height:2.4em;background:#fff;margin:0 .5em 0 0;border-left:1px solid #e2e3e3}.vakata-context .vakata-contextmenu-shortcut{font-size:.8em;color:silver;opacity:.5;display:none}.vakata-context-rtl ul{left:auto;right:100%;margin-left:auto;margin-right:-4px}.vakata-context-rtl li>a.vakata-context-parent{background-image:url(data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAINjI+AC7rWHIsPtmoxLAA7);background-position:left center;background-repeat:no-repeat}.vakata-context-rtl .vakata-context-separator>a{margin:0 2.4em 0 0;border-left:0;border-right:1px solid #e2e3e3}.vakata-context-rtl .vakata-context-left ul{right:auto;left:100%;margin-left:-4px;margin-right:auto}.vakata-context-rtl li>a>i{margin:0 -2em 0 0}.vakata-context-rtl li>a .vakata-contextmenu-sep{margin:0 0 0 .5em;border-left-color:#fff;background:#e2e3e3}#jstree-marker{position:absolute;top:0;left:0;margin:-5px 0 0 0;padding:0;border-right:0;border-top:5px solid transparent;border-bottom:5px solid transparent;border-left:5px solid;width:0;height:0;font-size:0;line-height:0}#jstree-dnd{line-height:16px;margin:0;padding:4px}#jstree-dnd .jstree-icon,#jstree-dnd .jstree-copy{display:inline-block;text-decoration:none;margin:0 2px 0 0;padding:0;width:16px;height:16px}#jstree-dnd .jstree-ok{background:green}#jstree-dnd .jstree-er{background:red}#jstree-dnd .jstree-copy{margin:0 2px}.jstree-default .jstree-node,.jstree-default .jstree-icon{background-repeat:no-repeat;background-color:transparent}.jstree-default .jstree-anchor,.jstree-default .jstree-animated,.jstree-default .jstree-wholerow{transition:background-color .15s,box-shadow .15s}.jstree-default .jstree-hovered{background:#e7f4f9;border-radius:2px;box-shadow:inset 0 0 1px #ccc}.jstree-default .jstree-context{background:#e7f4f9;border-radius:2px;box-shadow:inset 0 0 1px #ccc}.jstree-default .jstree-clicked{background:#beebff;border-radius:2px;box-shadow:inset 0 0 1px #999}.jstree-default .jstree-no-icons .jstree-anchor>.jstree-themeicon{display:none}.jstree-default .jstree-disabled{background:0 0;color:#666}.jstree-default .jstree-disabled.jstree-hovered{background:0 0;box-shadow:none}.jstree-default .jstree-disabled.jstree-clicked{background:#efefef}.jstree-default .jstree-disabled>.jstree-icon{opacity:.8;filter:url("data:image/svg+xml;utf8,#jstree-grayscale");filter:gray;-webkit-filter:grayscale(100%)}.jstree-default .jstree-search{font-style:italic;color:#8b0000;font-weight:700}.jstree-default .jstree-no-checkboxes .jstree-checkbox{display:none!important}.jstree-default.jstree-checkbox-no-clicked .jstree-clicked{background:0 0;box-shadow:none}.jstree-default.jstree-checkbox-no-clicked .jstree-clicked.jstree-hovered{background:#e7f4f9}.jstree-default.jstree-checkbox-no-clicked>.jstree-wholerow-ul .jstree-wholerow-clicked{background:0 0}.jstree-default.jstree-checkbox-no-clicked>.jstree-wholerow-ul .jstree-wholerow-clicked.jstree-wholerow-hovered{background:#e7f4f9}.jstree-default>.jstree-striped{min-width:100%;display:inline-block;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAkCAMAAAB/qqA+AAAABlBMVEUAAAAAAAClZ7nPAAAAAnRSTlMNAMM9s3UAAAAXSURBVHjajcEBAQAAAIKg/H/aCQZ70AUBjAATb6YPDgAAAABJRU5ErkJggg==) left top repeat}.jstree-default>.jstree-wholerow-ul .jstree-hovered,.jstree-default>.jstree-wholerow-ul .jstree-clicked{background:0 0;box-shadow:none;border-radius:0}.jstree-default .jstree-wholerow{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.jstree-default .jstree-wholerow-hovered{background:#e7f4f9}.jstree-default .jstree-wholerow-clicked{background:#beebff;background:-webkit-linear-gradient(top,#beebff 0,#a8e4ff 100%);background:linear-gradient(to bottom,#beebff 0,#a8e4ff 100%)}.jstree-default .jstree-node{min-height:24px;line-height:24px;margin-left:24px;min-width:24px}.jstree-default .jstree-anchor{line-height:24px;height:24px}.jstree-default .jstree-icon{width:24px;height:24px;line-height:24px}.jstree-default .jstree-icon:empty{width:24px;height:24px;line-height:24px}.jstree-default.jstree-rtl .jstree-node{margin-right:24px}.jstree-default .jstree-wholerow{height:24px}.jstree-default .jstree-node,.jstree-default .jstree-icon{background-image:url(32px.png)}.jstree-default .jstree-node{background-position:-292px -4px;background-repeat:repeat-y}.jstree-default .jstree-last{background:0 0}.jstree-default .jstree-open>.jstree-ocl{background-position:-132px -4px}.jstree-default .jstree-closed>.jstree-ocl{background-position:-100px -4px}.jstree-default .jstree-leaf>.jstree-ocl{background-position:-68px -4px}.jstree-default .jstree-themeicon{background-position:-260px -4px}.jstree-default>.jstree-no-dots .jstree-node,.jstree-default>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:0 0}.jstree-default>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-36px -4px}.jstree-default>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:-4px -4px}.jstree-default .jstree-disabled{background:0 0}.jstree-default .jstree-disabled.jstree-hovered{background:0 0}.jstree-default .jstree-disabled.jstree-clicked{background:#efefef}.jstree-default .jstree-checkbox{background-position:-164px -4px}.jstree-default .jstree-checkbox:hover{background-position:-164px -36px}.jstree-default.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox,.jstree-default .jstree-checked>.jstree-checkbox{background-position:-228px -4px}.jstree-default.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox:hover,.jstree-default .jstree-checked>.jstree-checkbox:hover{background-position:-228px -36px}.jstree-default .jstree-anchor>.jstree-undetermined{background-position:-196px -4px}.jstree-default .jstree-anchor>.jstree-undetermined:hover{background-position:-196px -36px}.jstree-default .jstree-checkbox-disabled{opacity:.8;filter:url("data:image/svg+xml;utf8,#jstree-grayscale");filter:gray;-webkit-filter:grayscale(100%)}.jstree-default>.jstree-striped{background-size:auto 48px}.jstree-default.jstree-rtl .jstree-node{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==);background-position:100% 1px;background-repeat:repeat-y}.jstree-default.jstree-rtl .jstree-last{background:0 0}.jstree-default.jstree-rtl .jstree-open>.jstree-ocl{background-position:-132px -36px}.jstree-default.jstree-rtl .jstree-closed>.jstree-ocl{background-position:-100px -36px}.jstree-default.jstree-rtl .jstree-leaf>.jstree-ocl{background-position:-68px -36px}.jstree-default.jstree-rtl>.jstree-no-dots .jstree-node,.jstree-default.jstree-rtl>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:0 0}.jstree-default.jstree-rtl>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-36px -36px}.jstree-default.jstree-rtl>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:-4px -36px}.jstree-default .jstree-themeicon-custom{background-color:transparent;background-image:none;background-position:0 0}.jstree-default>.jstree-container-ul .jstree-loading>.jstree-ocl{background:url(throbber.gif) center center no-repeat}.jstree-default .jstree-file{background:url(32px.png) -100px -68px no-repeat}.jstree-default .jstree-folder{background:url(32px.png) -260px -4px no-repeat}.jstree-default>.jstree-container-ul>.jstree-node{margin-left:0;margin-right:0}#jstree-dnd.jstree-default{line-height:24px;padding:0 4px}#jstree-dnd.jstree-default .jstree-ok,#jstree-dnd.jstree-default .jstree-er{background-image:url(32px.png);background-repeat:no-repeat;background-color:transparent}#jstree-dnd.jstree-default i{background:0 0;width:24px;height:24px;line-height:24px}#jstree-dnd.jstree-default .jstree-ok{background-position:-4px -68px}#jstree-dnd.jstree-default .jstree-er{background-position:-36px -68px}.jstree-default .jstree-ellipsis{overflow:hidden}.jstree-default .jstree-ellipsis .jstree-anchor{width:calc(100% - 29px);text-overflow:ellipsis;overflow:hidden}.jstree-default .jstree-ellipsis.jstree-no-icons .jstree-anchor{width:calc(100% - 5px)}.jstree-default.jstree-rtl .jstree-node{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==)}.jstree-default.jstree-rtl .jstree-last{background:0 0}.jstree-default-small .jstree-node{min-height:18px;line-height:18px;margin-left:18px;min-width:18px}.jstree-default-small .jstree-anchor{line-height:18px;height:18px}.jstree-default-small .jstree-icon{width:18px;height:18px;line-height:18px}.jstree-default-small .jstree-icon:empty{width:18px;height:18px;line-height:18px}.jstree-default-small.jstree-rtl .jstree-node{margin-right:18px}.jstree-default-small .jstree-wholerow{height:18px}.jstree-default-small .jstree-node,.jstree-default-small .jstree-icon{background-image:url(32px.png)}.jstree-default-small .jstree-node{background-position:-295px -7px;background-repeat:repeat-y}.jstree-default-small .jstree-last{background:0 0}.jstree-default-small .jstree-open>.jstree-ocl{background-position:-135px -7px}.jstree-default-small .jstree-closed>.jstree-ocl{background-position:-103px -7px}.jstree-default-small .jstree-leaf>.jstree-ocl{background-position:-71px -7px}.jstree-default-small .jstree-themeicon{background-position:-263px -7px}.jstree-default-small>.jstree-no-dots .jstree-node,.jstree-default-small>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:0 0}.jstree-default-small>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-39px -7px}.jstree-default-small>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:-7px -7px}.jstree-default-small .jstree-disabled{background:0 0}.jstree-default-small .jstree-disabled.jstree-hovered{background:0 0}.jstree-default-small .jstree-disabled.jstree-clicked{background:#efefef}.jstree-default-small .jstree-checkbox{background-position:-167px -7px}.jstree-default-small .jstree-checkbox:hover{background-position:-167px -39px}.jstree-default-small.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox,.jstree-default-small .jstree-checked>.jstree-checkbox{background-position:-231px -7px}.jstree-default-small.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox:hover,.jstree-default-small .jstree-checked>.jstree-checkbox:hover{background-position:-231px -39px}.jstree-default-small .jstree-anchor>.jstree-undetermined{background-position:-199px -7px}.jstree-default-small .jstree-anchor>.jstree-undetermined:hover{background-position:-199px -39px}.jstree-default-small .jstree-checkbox-disabled{opacity:.8;filter:url("data:image/svg+xml;utf8,#jstree-grayscale");filter:gray;-webkit-filter:grayscale(100%)}.jstree-default-small>.jstree-striped{background-size:auto 36px}.jstree-default-small.jstree-rtl .jstree-node{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==);background-position:100% 1px;background-repeat:repeat-y}.jstree-default-small.jstree-rtl .jstree-last{background:0 0}.jstree-default-small.jstree-rtl .jstree-open>.jstree-ocl{background-position:-135px -39px}.jstree-default-small.jstree-rtl .jstree-closed>.jstree-ocl{background-position:-103px -39px}.jstree-default-small.jstree-rtl .jstree-leaf>.jstree-ocl{background-position:-71px -39px}.jstree-default-small.jstree-rtl>.jstree-no-dots .jstree-node,.jstree-default-small.jstree-rtl>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:0 0}.jstree-default-small.jstree-rtl>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-39px -39px}.jstree-default-small.jstree-rtl>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:-7px -39px}.jstree-default-small .jstree-themeicon-custom{background-color:transparent;background-image:none;background-position:0 0}.jstree-default-small>.jstree-container-ul .jstree-loading>.jstree-ocl{background:url(throbber.gif) center center no-repeat}.jstree-default-small .jstree-file{background:url(32px.png) -103px -71px no-repeat}.jstree-default-small .jstree-folder{background:url(32px.png) -263px -7px no-repeat}.jstree-default-small>.jstree-container-ul>.jstree-node{margin-left:0;margin-right:0}#jstree-dnd.jstree-default-small{line-height:18px;padding:0 4px}#jstree-dnd.jstree-default-small .jstree-ok,#jstree-dnd.jstree-default-small .jstree-er{background-image:url(32px.png);background-repeat:no-repeat;background-color:transparent}#jstree-dnd.jstree-default-small i{background:0 0;width:18px;height:18px;line-height:18px}#jstree-dnd.jstree-default-small .jstree-ok{background-position:-7px -71px}#jstree-dnd.jstree-default-small .jstree-er{background-position:-39px -71px}.jstree-default-small .jstree-ellipsis{overflow:hidden}.jstree-default-small .jstree-ellipsis .jstree-anchor{width:calc(100% - 23px);text-overflow:ellipsis;overflow:hidden}.jstree-default-small .jstree-ellipsis.jstree-no-icons .jstree-anchor{width:calc(100% - 5px)}.jstree-default-small.jstree-rtl .jstree-node{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAACAQMAAABv1h6PAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMHBgAAiABBI4gz9AAAAABJRU5ErkJggg==)}.jstree-default-small.jstree-rtl .jstree-last{background:0 0}.jstree-default-large .jstree-node{min-height:32px;line-height:32px;margin-left:32px;min-width:32px}.jstree-default-large .jstree-anchor{line-height:32px;height:32px}.jstree-default-large .jstree-icon{width:32px;height:32px;line-height:32px}.jstree-default-large .jstree-icon:empty{width:32px;height:32px;line-height:32px}.jstree-default-large.jstree-rtl .jstree-node{margin-right:32px}.jstree-default-large .jstree-wholerow{height:32px}.jstree-default-large .jstree-node,.jstree-default-large .jstree-icon{background-image:url(32px.png)}.jstree-default-large .jstree-node{background-position:-288px 0;background-repeat:repeat-y}.jstree-default-large .jstree-last{background:0 0}.jstree-default-large .jstree-open>.jstree-ocl{background-position:-128px 0}.jstree-default-large .jstree-closed>.jstree-ocl{background-position:-96px 0}.jstree-default-large .jstree-leaf>.jstree-ocl{background-position:-64px 0}.jstree-default-large .jstree-themeicon{background-position:-256px 0}.jstree-default-large>.jstree-no-dots .jstree-node,.jstree-default-large>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:0 0}.jstree-default-large>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-32px 0}.jstree-default-large>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:0 0}.jstree-default-large .jstree-disabled{background:0 0}.jstree-default-large .jstree-disabled.jstree-hovered{background:0 0}.jstree-default-large .jstree-disabled.jstree-clicked{background:#efefef}.jstree-default-large .jstree-checkbox{background-position:-160px 0}.jstree-default-large .jstree-checkbox:hover{background-position:-160px -32px}.jstree-default-large.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox,.jstree-default-large .jstree-checked>.jstree-checkbox{background-position:-224px 0}.jstree-default-large.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox:hover,.jstree-default-large .jstree-checked>.jstree-checkbox:hover{background-position:-224px -32px}.jstree-default-large .jstree-anchor>.jstree-undetermined{background-position:-192px 0}.jstree-default-large .jstree-anchor>.jstree-undetermined:hover{background-position:-192px -32px}.jstree-default-large .jstree-checkbox-disabled{opacity:.8;filter:url("data:image/svg+xml;utf8,#jstree-grayscale");filter:gray;-webkit-filter:grayscale(100%)}.jstree-default-large>.jstree-striped{background-size:auto 64px}.jstree-default-large.jstree-rtl .jstree-node{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==);background-position:100% 1px;background-repeat:repeat-y}.jstree-default-large.jstree-rtl .jstree-last{background:0 0}.jstree-default-large.jstree-rtl .jstree-open>.jstree-ocl{background-position:-128px -32px}.jstree-default-large.jstree-rtl .jstree-closed>.jstree-ocl{background-position:-96px -32px}.jstree-default-large.jstree-rtl .jstree-leaf>.jstree-ocl{background-position:-64px -32px}.jstree-default-large.jstree-rtl>.jstree-no-dots .jstree-node,.jstree-default-large.jstree-rtl>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:0 0}.jstree-default-large.jstree-rtl>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-32px -32px}.jstree-default-large.jstree-rtl>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:0 -32px}.jstree-default-large .jstree-themeicon-custom{background-color:transparent;background-image:none;background-position:0 0}.jstree-default-large>.jstree-container-ul .jstree-loading>.jstree-ocl{background:url(throbber.gif) center center no-repeat}.jstree-default-large .jstree-file{background:url(32px.png) -96px -64px no-repeat}.jstree-default-large .jstree-folder{background:url(32px.png) -256px 0 no-repeat}.jstree-default-large>.jstree-container-ul>.jstree-node{margin-left:0;margin-right:0}#jstree-dnd.jstree-default-large{line-height:32px;padding:0 4px}#jstree-dnd.jstree-default-large .jstree-ok,#jstree-dnd.jstree-default-large .jstree-er{background-image:url(32px.png);background-repeat:no-repeat;background-color:transparent}#jstree-dnd.jstree-default-large i{background:0 0;width:32px;height:32px;line-height:32px}#jstree-dnd.jstree-default-large .jstree-ok{background-position:0 -64px}#jstree-dnd.jstree-default-large .jstree-er{background-position:-32px -64px}.jstree-default-large .jstree-ellipsis{overflow:hidden}.jstree-default-large .jstree-ellipsis .jstree-anchor{width:calc(100% - 37px);text-overflow:ellipsis;overflow:hidden}.jstree-default-large .jstree-ellipsis.jstree-no-icons .jstree-anchor{width:calc(100% - 5px)}.jstree-default-large.jstree-rtl .jstree-node{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAACAQMAAAAD0EyKAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjgIIGBgABCgCBvVLXcAAAAABJRU5ErkJggg==)}.jstree-default-large.jstree-rtl .jstree-last{background:0 0}@media (max-width:768px){#jstree-dnd.jstree-dnd-responsive{line-height:40px;font-weight:700;font-size:1.1em;text-shadow:1px 1px #fff}#jstree-dnd.jstree-dnd-responsive>i{background:0 0;width:40px;height:40px}#jstree-dnd.jstree-dnd-responsive>.jstree-ok{background-image:url(40px.png);background-position:0 -200px;background-size:120px 240px}#jstree-dnd.jstree-dnd-responsive>.jstree-er{background-image:url(40px.png);background-position:-40px -200px;background-size:120px 240px}#jstree-marker.jstree-dnd-responsive{border-left-width:10px;border-top-width:10px;border-bottom-width:10px;margin-top:-10px}}@media (max-width:768px){.jstree-default-responsive .jstree-icon{background-image:url(40px.png)}.jstree-default-responsive .jstree-node,.jstree-default-responsive .jstree-leaf>.jstree-ocl{background:0 0}.jstree-default-responsive .jstree-node{min-height:40px;line-height:40px;margin-left:40px;min-width:40px;white-space:nowrap}.jstree-default-responsive .jstree-anchor{line-height:40px;height:40px}.jstree-default-responsive .jstree-icon,.jstree-default-responsive .jstree-icon:empty{width:40px;height:40px;line-height:40px}.jstree-default-responsive>.jstree-container-ul>.jstree-node{margin-left:0}.jstree-default-responsive.jstree-rtl .jstree-node{margin-left:0;margin-right:40px;background:0 0}.jstree-default-responsive.jstree-rtl .jstree-container-ul>.jstree-node{margin-right:0}.jstree-default-responsive .jstree-ocl,.jstree-default-responsive .jstree-themeicon,.jstree-default-responsive .jstree-checkbox{background-size:120px 240px}.jstree-default-responsive .jstree-leaf>.jstree-ocl,.jstree-default-responsive.jstree-rtl .jstree-leaf>.jstree-ocl{background:0 0}.jstree-default-responsive .jstree-open>.jstree-ocl{background-position:0 0!important}.jstree-default-responsive .jstree-closed>.jstree-ocl{background-position:0 -40px!important}.jstree-default-responsive.jstree-rtl .jstree-closed>.jstree-ocl{background-position:-40px 0!important}.jstree-default-responsive .jstree-themeicon{background-position:-40px -40px}.jstree-default-responsive .jstree-checkbox,.jstree-default-responsive .jstree-checkbox:hover{background-position:-40px -80px}.jstree-default-responsive.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox,.jstree-default-responsive.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox:hover,.jstree-default-responsive .jstree-checked>.jstree-checkbox,.jstree-default-responsive .jstree-checked>.jstree-checkbox:hover{background-position:0 -80px}.jstree-default-responsive .jstree-anchor>.jstree-undetermined,.jstree-default-responsive .jstree-anchor>.jstree-undetermined:hover{background-position:0 -120px}.jstree-default-responsive .jstree-anchor{font-weight:700;font-size:1.1em;text-shadow:1px 1px #fff}.jstree-default-responsive>.jstree-striped{background:0 0}.jstree-default-responsive .jstree-wholerow{border-top:1px solid rgba(255,255,255,.7);border-bottom:1px solid rgba(64,64,64,.2);background:#ebebeb;height:40px}.jstree-default-responsive .jstree-wholerow-hovered{background:#e7f4f9}.jstree-default-responsive .jstree-wholerow-clicked{background:#beebff}.jstree-default-responsive .jstree-children .jstree-last>.jstree-wholerow{box-shadow:inset 0 -6px 3px -5px #666}.jstree-default-responsive .jstree-children .jstree-open>.jstree-wholerow{box-shadow:inset 0 6px 3px -5px #666;border-top:0}.jstree-default-responsive .jstree-children .jstree-open+.jstree-open{box-shadow:none}.jstree-default-responsive .jstree-node,.jstree-default-responsive .jstree-icon,.jstree-default-responsive .jstree-node>.jstree-ocl,.jstree-default-responsive .jstree-themeicon,.jstree-default-responsive .jstree-checkbox{background-image:url(40px.png);background-size:120px 240px}.jstree-default-responsive .jstree-node{background-position:-80px 0;background-repeat:repeat-y}.jstree-default-responsive .jstree-last{background:0 0}.jstree-default-responsive .jstree-leaf>.jstree-ocl{background-position:-40px -120px}.jstree-default-responsive .jstree-last>.jstree-ocl{background-position:-40px -160px}.jstree-default-responsive .jstree-themeicon-custom{background-color:transparent;background-image:none;background-position:0 0}.jstree-default-responsive .jstree-file{background:url(40px.png) 0 -160px no-repeat;background-size:120px 240px}.jstree-default-responsive .jstree-folder{background:url(40px.png) -40px -40px no-repeat;background-size:120px 240px}.jstree-default-responsive>.jstree-container-ul>.jstree-node{margin-left:0;margin-right:0}} \ No newline at end of file diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/dist/themes/default/throbber.gif b/mayan/apps/cabinets/static/cabinets/packages/jstree/dist/themes/default/throbber.gif deleted file mode 100644 index 1b5b2fde42..0000000000 Binary files a/mayan/apps/cabinets/static/cabinets/packages/jstree/dist/themes/default/throbber.gif and /dev/null differ diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/gruntfile.js b/mayan/apps/cabinets/static/cabinets/packages/jstree/gruntfile.js deleted file mode 100644 index 45a5f94e3c..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/gruntfile.js +++ /dev/null @@ -1,241 +0,0 @@ -/*global module:false, require:false, __dirname:false*/ - -module.exports = function(grunt) { - grunt.util.linefeed = "\n"; - - // Project configuration. - grunt.initConfig({ - pkg: grunt.file.readJSON('package.json'), - concat: { - options : { - separator : "\n" - }, - dist: { - src: ['src/<%= pkg.name %>.js', 'src/<%= pkg.name %>.*.js', 'src/vakata-jstree.js'], - dest: 'dist/<%= pkg.name %>.js' - } - }, - copy: { - libs : { - files : [ - { expand: true, cwd : 'libs/', src: ['*'], dest: 'dist/libs/' } - ] - }, - docs : { - files : [ - { expand: true, cwd : 'dist/', src: ['**/*'], dest: 'docs/assets/dist/' } - ] - } - }, - uglify: { - options: { - banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %> - (<%= _.pluck(pkg.licenses, "type").join(", ") %>) */\n', - preserveComments: false, - //sourceMap: "dist/jstree.min.map", - //sourceMappingURL: "jstree.min.map", - report: "min", - beautify: { - ascii_only: true - }, - compress: { - hoist_funs: false, - loops: false, - unused: false - } - }, - dist: { - src: ['<%= concat.dist.dest %>'], - dest: 'dist/<%= pkg.name %>.min.js' - } - }, - qunit: { - files: ['test/unit/**/*.html'] - }, - jshint: { - options: { - 'curly' : true, - 'eqeqeq' : true, - 'latedef' : true, - 'newcap' : true, - 'noarg' : true, - 'sub' : true, - 'undef' : true, - 'boss' : true, - 'eqnull' : true, - 'browser' : true, - 'trailing' : true, - 'globals' : { - 'console' : true, - 'jQuery' : true, - 'browser' : true, - 'XSLTProcessor' : true, - 'ActiveXObject' : true - } - }, - beforeconcat: ['src/<%= pkg.name %>.js', 'src/<%= pkg.name %>.*.js'], - afterconcat: ['dist/<%= pkg.name %>.js'] - }, - dox: { - files: { - src: ['src/*.js'], - dest: 'docs' - } - }, - amd : { - files: { - src: ['dist/jstree.js'], - dest: 'dist/jstree.js' - } - }, - less: { - production: { - options : { - cleancss : true, - compress : true - }, - files: { - "dist/themes/default/style.min.css" : "src/themes/default/style.less", - "dist/themes/default-dark/style.min.css" : "src/themes/default-dark/style.less" - } - }, - development: { - files: { - "src/themes/default/style.css" : "src/themes/default/style.less", - "dist/themes/default/style.css" : "src/themes/default/style.less", - "src/themes/default-dark/style.css" : "src/themes/default-dark/style.less", - "dist/themes/default-dark/style.css" : "src/themes/default-dark/style.less" - } - } - }, - watch: { - js : { - files: ['src/**/*.js'], - tasks: ['js'], - options : { - atBegin : true - } - }, - css : { - files: ['src/**/*.less','src/**/*.png','src/**/*.gif'], - tasks: ['css'], - options : { - atBegin : true - } - }, - }, - resemble: { - options: { - screenshotRoot: 'test/visual/screenshots/', - url: 'http://127.0.0.1/jstree/test/visual/', - gm: false - }, - desktop: { - options: { - width: 1280, - }, - src: ['desktop'], - dest: 'desktop', - }, - mobile: { - options: { - width: 360, - }, - src: ['mobile'], - dest: 'mobile' - } - }, - imagemin: { - dynamic: { - options: { // Target options - optimizationLevel: 7, - pngquant : true - }, - files: [{ - expand: true, // Enable dynamic expansion - cwd: 'src/themes/default/', // Src matches are relative to this path - src: ['**/*.{png,jpg,gif}'], // Actual patterns to match - dest: 'dist/themes/default/' // Destination path prefix - },{ - expand: true, // Enable dynamic expansion - cwd: 'src/themes/default-dark/', // Src matches are relative to this path - src: ['**/*.{png,jpg,gif}'], // Actual patterns to match - dest: 'dist/themes/default-dark/' // Destination path prefix - }] - } - }, - replace: { - files: { - src: ['dist/*.js', 'bower.json', 'component.json', 'jstree.jquery.json'], - overwrite: true, - replacements: [ - { - from: '{{VERSION}}', - to: "<%= pkg.version %>" - }, - { - from: /"version": "[^"]+"/g, - to: "\"version\": \"<%= pkg.version %>\"" - }, - ] - } - } - }); - - grunt.loadNpmTasks('grunt-contrib-jshint'); - grunt.loadNpmTasks('grunt-contrib-concat'); - grunt.loadNpmTasks('grunt-contrib-copy'); - grunt.loadNpmTasks('grunt-contrib-uglify'); - grunt.loadNpmTasks('grunt-contrib-less'); - grunt.loadNpmTasks('grunt-contrib-qunit'); - grunt.loadNpmTasks('grunt-resemble-cli'); - grunt.loadNpmTasks('grunt-contrib-watch'); - grunt.loadNpmTasks('grunt-contrib-imagemin'); - grunt.loadNpmTasks('grunt-text-replace'); - - grunt.registerMultiTask('amd', 'Clean up AMD', function () { - var s, d; - this.files.forEach(function (f) { - s = f.src; - d = f.dest; - }); - grunt.file.copy(s, d, { - process: function (contents) { - contents = contents.replace(/\s*if\(\$\.jstree\.plugins\.[a-z]+\)\s*\{\s*return;\s*\}/ig, ''); - contents = contents.replace(/\/\*globals[^\/]+\//ig, ''); - //contents = contents.replace(/\(function \(factory[\s\S]*?undefined/mig, '(function ($, undefined'); - //contents = contents.replace(/\}\)\);/g, '}(jQuery));'); - contents = contents.replace(/\(function \(factory[\s\S]*?undefined\s*\)[^\n]+/mig, ''); - contents = contents.replace(/\}\)\);/g, ''); - contents = contents.replace(/\s*("|')use strict("|');/g, ''); - contents = contents.replace(/\s*return \$\.fn\.jstree;/g, ''); - return grunt.file.read('src/intro.js') + contents + grunt.file.read('src/outro.js'); - } - }); - }); - - grunt.registerMultiTask('dox', 'Generate dox output ', function() { - var exec = require('child_process').exec, - path = require('path'), - done = this.async(), - doxPath = path.resolve(__dirname), - formatter = [doxPath, 'node_modules', '.bin', 'dox'].join(path.sep); - exec(formatter + ' < "dist/jstree.js" > "docs/jstree.json"', {maxBuffer: 5000*1024}, function(error, stout, sterr){ - if (error) { - grunt.log.error(formatter); - grunt.log.error("WARN: "+ error); - } - if (!error) { - grunt.log.writeln('dist/jstree.js doxxed.'); - done(); - } - }); - }); - - grunt.util.linefeed = "\n"; - - // Default task. - grunt.registerTask('default', ['jshint:beforeconcat','concat','amd','jshint:afterconcat','copy:libs','uglify','less','imagemin','replace','copy:docs','qunit','resemble','dox']); - grunt.registerTask('js', ['concat','amd','uglify']); - grunt.registerTask('css', ['copy','less']); - -}; diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/jstree.jquery.json b/mayan/apps/cabinets/static/cabinets/packages/jstree/jstree.jquery.json deleted file mode 100644 index c0e4945b59..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/jstree.jquery.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "jstree", - "title": "jsTree", - "description": "Tree view for jQuery", - "version": "3.3.3", - "homepage": "http://jstree.com", - "keywords": [ - "ui", - "tree", - "jstree" - ], - "author": { - "name": "Ivan Bozhanov", - "email": "jstree@jstree.com", - "url": "http://vakata.com" - }, - "licenses": [ - { - "type": "MIT", - "url": "https://github.com/vakata/jstree/blob/master/LICENSE-MIT" - } - ], - "bugs": "https://github.com/vakata/jstree/issues", - "demo": "http://jstree.com/demo", - "dependencies": { - "jquery": ">=1.9.1" - } -} \ No newline at end of file diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/package.json b/mayan/apps/cabinets/static/cabinets/packages/jstree/package.json deleted file mode 100644 index 709242cba6..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "jstree", - "title": "jsTree", - "description": "jQuery tree plugin", - "version": "3.3.3", - "homepage": "http://jstree.com", - "main": "./dist/jstree.js", - "author": { - "name": "Ivan Bozhanov", - "email": "jstree@jstree.com", - "url": "http://vakata.com" - }, - "repository": { - "type": "git", - "url": "git://github.com/vakata/jstree.git" - }, - "bugs": { - "url": "https://github.com/vakata/jstree/issues" - }, - "license": "MIT", - "licenses": [ - { - "type": "MIT", - "url": "https://github.com/vakata/jstree/blob/master/LICENSE-MIT" - } - ], - "keywords": [], - "devDependencies": { - "dox": "~0.4.4", - "grunt": "~0.4.0", - "grunt-contrib-concat": "*", - "grunt-contrib-copy": "*", - "grunt-contrib-imagemin": "~0.4.0", - "grunt-contrib-jshint": "*", - "grunt-contrib-less": "~0.8.2", - "grunt-contrib-qunit": "~v0.3.0", - "grunt-contrib-uglify": "*", - "grunt-contrib-watch": "~0.5.3", - "grunt-phantomcss-gitdiff": "0.0.7", - "grunt-resemble-cli": "0.0.8", - "grunt-text-replace": "~0.3.11" - }, - "dependencies": { - "jquery": ">=1.9.1" - }, - "npmName": "jstree", - "npmFileMap": [ - { - "basePath": "/dist/", - "files": [ - "jstree.min.js", - "themes/**/*.png", - "themes/**/*.gif", - "themes/**/*.min.css" - ] - } - ] -} diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/intro.js b/mayan/apps/cabinets/static/cabinets/packages/jstree/src/intro.js deleted file mode 100644 index 5c95a5cdfb..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/intro.js +++ /dev/null @@ -1,14 +0,0 @@ -/*globals jQuery, define, module, exports, require, window, document, postMessage */ -(function (factory) { - "use strict"; - if (typeof define === 'function' && define.amd) { - define(['jquery'], factory); - } - else if(typeof module !== 'undefined' && module.exports) { - module.exports = factory(require('jquery')); - } - else { - factory(jQuery); - } -}(function ($, undefined) { - "use strict"; diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/jstree.changed.js b/mayan/apps/cabinets/static/cabinets/packages/jstree/src/jstree.changed.js deleted file mode 100644 index be8cfd7d12..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/jstree.changed.js +++ /dev/null @@ -1,69 +0,0 @@ -/** - * ### Changed plugin - * - * This plugin adds more information to the `changed.jstree` event. The new data is contained in the `changed` event data property, and contains a lists of `selected` and `deselected` nodes. - */ -/*globals jQuery, define, exports, require, document */ -(function (factory) { - "use strict"; - if (typeof define === 'function' && define.amd) { - define('jstree.changed', ['jquery','jstree'], factory); - } - else if(typeof exports === 'object') { - factory(require('jquery'), require('jstree')); - } - else { - factory(jQuery, jQuery.jstree); - } -}(function ($, jstree, undefined) { - "use strict"; - - if($.jstree.plugins.changed) { return; } - - $.jstree.plugins.changed = function (options, parent) { - var last = []; - this.trigger = function (ev, data) { - var i, j; - if(!data) { - data = {}; - } - if(ev.replace('.jstree','') === 'changed') { - data.changed = { selected : [], deselected : [] }; - var tmp = {}; - for(i = 0, j = last.length; i < j; i++) { - tmp[last[i]] = 1; - } - for(i = 0, j = data.selected.length; i < j; i++) { - if(!tmp[data.selected[i]]) { - data.changed.selected.push(data.selected[i]); - } - else { - tmp[data.selected[i]] = 2; - } - } - for(i = 0, j = last.length; i < j; i++) { - if(tmp[last[i]] === 1) { - data.changed.deselected.push(last[i]); - } - } - last = data.selected.slice(); - } - /** - * triggered when selection changes (the "changed" plugin enhances the original event with more data) - * @event - * @name changed.jstree - * @param {Object} node - * @param {Object} action the action that caused the selection to change - * @param {Array} selected the current selection - * @param {Object} changed an object containing two properties `selected` and `deselected` - both arrays of node IDs, which were selected or deselected since the last changed event - * @param {Object} event the event (if any) that triggered this changed event - * @plugin changed - */ - parent.trigger.call(this, ev, data); - }; - this.refresh = function (skip_loading, forget_state) { - last = []; - return parent.refresh.apply(this, arguments); - }; - }; -})); \ No newline at end of file diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/jstree.checkbox.js b/mayan/apps/cabinets/static/cabinets/packages/jstree/src/jstree.checkbox.js deleted file mode 100644 index 5dd9837d75..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/jstree.checkbox.js +++ /dev/null @@ -1,871 +0,0 @@ -/** - * ### Checkbox plugin - * - * This plugin renders checkbox icons in front of each node, making multiple selection much easier. - * It also supports tri-state behavior, meaning that if a node has a few of its children checked it will be rendered as undetermined, and state will be propagated up. - */ -/*globals jQuery, define, exports, require, document */ -(function (factory) { - "use strict"; - if (typeof define === 'function' && define.amd) { - define('jstree.checkbox', ['jquery','jstree'], factory); - } - else if(typeof exports === 'object') { - factory(require('jquery'), require('jstree')); - } - else { - factory(jQuery, jQuery.jstree); - } -}(function ($, jstree, undefined) { - "use strict"; - - if($.jstree.plugins.checkbox) { return; } - - var _i = document.createElement('I'); - _i.className = 'jstree-icon jstree-checkbox'; - _i.setAttribute('role', 'presentation'); - /** - * stores all defaults for the checkbox plugin - * @name $.jstree.defaults.checkbox - * @plugin checkbox - */ - $.jstree.defaults.checkbox = { - /** - * a boolean indicating if checkboxes should be visible (can be changed at a later time using `show_checkboxes()` and `hide_checkboxes`). Defaults to `true`. - * @name $.jstree.defaults.checkbox.visible - * @plugin checkbox - */ - visible : true, - /** - * a boolean indicating if checkboxes should cascade down and have an undetermined state. Defaults to `true`. - * @name $.jstree.defaults.checkbox.three_state - * @plugin checkbox - */ - three_state : true, - /** - * a boolean indicating if clicking anywhere on the node should act as clicking on the checkbox. Defaults to `true`. - * @name $.jstree.defaults.checkbox.whole_node - * @plugin checkbox - */ - whole_node : true, - /** - * a boolean indicating if the selected style of a node should be kept, or removed. Defaults to `true`. - * @name $.jstree.defaults.checkbox.keep_selected_style - * @plugin checkbox - */ - keep_selected_style : true, - /** - * This setting controls how cascading and undetermined nodes are applied. - * If 'up' is in the string - cascading up is enabled, if 'down' is in the string - cascading down is enabled, if 'undetermined' is in the string - undetermined nodes will be used. - * If `three_state` is set to `true` this setting is automatically set to 'up+down+undetermined'. Defaults to ''. - * @name $.jstree.defaults.checkbox.cascade - * @plugin checkbox - */ - cascade : '', - /** - * This setting controls if checkbox are bound to the general tree selection or to an internal array maintained by the checkbox plugin. Defaults to `true`, only set to `false` if you know exactly what you are doing. - * @name $.jstree.defaults.checkbox.tie_selection - * @plugin checkbox - */ - tie_selection : true - }; - $.jstree.plugins.checkbox = function (options, parent) { - this.bind = function () { - parent.bind.call(this); - this._data.checkbox.uto = false; - this._data.checkbox.selected = []; - if(this.settings.checkbox.three_state) { - this.settings.checkbox.cascade = 'up+down+undetermined'; - } - this.element - .on("init.jstree", $.proxy(function () { - this._data.checkbox.visible = this.settings.checkbox.visible; - if(!this.settings.checkbox.keep_selected_style) { - this.element.addClass('jstree-checkbox-no-clicked'); - } - if(this.settings.checkbox.tie_selection) { - this.element.addClass('jstree-checkbox-selection'); - } - }, this)) - .on("loading.jstree", $.proxy(function () { - this[ this._data.checkbox.visible ? 'show_checkboxes' : 'hide_checkboxes' ](); - }, this)); - if(this.settings.checkbox.cascade.indexOf('undetermined') !== -1) { - this.element - .on('changed.jstree uncheck_node.jstree check_node.jstree uncheck_all.jstree check_all.jstree move_node.jstree copy_node.jstree redraw.jstree open_node.jstree', $.proxy(function () { - // only if undetermined is in setting - if(this._data.checkbox.uto) { clearTimeout(this._data.checkbox.uto); } - this._data.checkbox.uto = setTimeout($.proxy(this._undetermined, this), 50); - }, this)); - } - if(!this.settings.checkbox.tie_selection) { - this.element - .on('model.jstree', $.proxy(function (e, data) { - var m = this._model.data, - p = m[data.parent], - dpc = data.nodes, - i, j; - for(i = 0, j = dpc.length; i < j; i++) { - m[dpc[i]].state.checked = m[dpc[i]].state.checked || (m[dpc[i]].original && m[dpc[i]].original.state && m[dpc[i]].original.state.checked); - if(m[dpc[i]].state.checked) { - this._data.checkbox.selected.push(dpc[i]); - } - } - }, this)); - } - if(this.settings.checkbox.cascade.indexOf('up') !== -1 || this.settings.checkbox.cascade.indexOf('down') !== -1) { - this.element - .on('model.jstree', $.proxy(function (e, data) { - var m = this._model.data, - p = m[data.parent], - dpc = data.nodes, - chd = [], - c, i, j, k, l, tmp, s = this.settings.checkbox.cascade, t = this.settings.checkbox.tie_selection; - - if(s.indexOf('down') !== -1) { - // apply down - if(p.state[ t ? 'selected' : 'checked' ]) { - for(i = 0, j = dpc.length; i < j; i++) { - m[dpc[i]].state[ t ? 'selected' : 'checked' ] = true; - } - this._data[ t ? 'core' : 'checkbox' ].selected = this._data[ t ? 'core' : 'checkbox' ].selected.concat(dpc); - } - else { - for(i = 0, j = dpc.length; i < j; i++) { - if(m[dpc[i]].state[ t ? 'selected' : 'checked' ]) { - for(k = 0, l = m[dpc[i]].children_d.length; k < l; k++) { - m[m[dpc[i]].children_d[k]].state[ t ? 'selected' : 'checked' ] = true; - } - this._data[ t ? 'core' : 'checkbox' ].selected = this._data[ t ? 'core' : 'checkbox' ].selected.concat(m[dpc[i]].children_d); - } - } - } - } - - if(s.indexOf('up') !== -1) { - // apply up - for(i = 0, j = p.children_d.length; i < j; i++) { - if(!m[p.children_d[i]].children.length) { - chd.push(m[p.children_d[i]].parent); - } - } - chd = $.vakata.array_unique(chd); - for(k = 0, l = chd.length; k < l; k++) { - p = m[chd[k]]; - while(p && p.id !== $.jstree.root) { - c = 0; - for(i = 0, j = p.children.length; i < j; i++) { - c += m[p.children[i]].state[ t ? 'selected' : 'checked' ]; - } - if(c === j) { - p.state[ t ? 'selected' : 'checked' ] = true; - this._data[ t ? 'core' : 'checkbox' ].selected.push(p.id); - tmp = this.get_node(p, true); - if(tmp && tmp.length) { - tmp.attr('aria-selected', true).children('.jstree-anchor').addClass( t ? 'jstree-clicked' : 'jstree-checked'); - } - } - else { - break; - } - p = this.get_node(p.parent); - } - } - } - - this._data[ t ? 'core' : 'checkbox' ].selected = $.vakata.array_unique(this._data[ t ? 'core' : 'checkbox' ].selected); - }, this)) - .on(this.settings.checkbox.tie_selection ? 'select_node.jstree' : 'check_node.jstree', $.proxy(function (e, data) { - var obj = data.node, - m = this._model.data, - par = this.get_node(obj.parent), - dom = this.get_node(obj, true), - i, j, c, tmp, s = this.settings.checkbox.cascade, t = this.settings.checkbox.tie_selection, - sel = {}, cur = this._data[ t ? 'core' : 'checkbox' ].selected; - - for (i = 0, j = cur.length; i < j; i++) { - sel[cur[i]] = true; - } - // apply down - if(s.indexOf('down') !== -1) { - //this._data[ t ? 'core' : 'checkbox' ].selected = $.vakata.array_unique(this._data[ t ? 'core' : 'checkbox' ].selected.concat(obj.children_d)); - for(i = 0, j = obj.children_d.length; i < j; i++) { - sel[obj.children_d[i]] = true; - tmp = m[obj.children_d[i]]; - tmp.state[ t ? 'selected' : 'checked' ] = true; - if(tmp && tmp.original && tmp.original.state && tmp.original.state.undetermined) { - tmp.original.state.undetermined = false; - } - } - } - - // apply up - if(s.indexOf('up') !== -1) { - while(par && par.id !== $.jstree.root) { - c = 0; - for(i = 0, j = par.children.length; i < j; i++) { - c += m[par.children[i]].state[ t ? 'selected' : 'checked' ]; - } - if(c === j) { - par.state[ t ? 'selected' : 'checked' ] = true; - sel[par.id] = true; - //this._data[ t ? 'core' : 'checkbox' ].selected.push(par.id); - tmp = this.get_node(par, true); - if(tmp && tmp.length) { - tmp.attr('aria-selected', true).children('.jstree-anchor').addClass(t ? 'jstree-clicked' : 'jstree-checked'); - } - } - else { - break; - } - par = this.get_node(par.parent); - } - } - - cur = []; - for (i in sel) { - if (sel.hasOwnProperty(i)) { - cur.push(i); - } - } - this._data[ t ? 'core' : 'checkbox' ].selected = cur; - - // apply down (process .children separately?) - if(s.indexOf('down') !== -1 && dom.length) { - dom.find('.jstree-anchor').addClass(t ? 'jstree-clicked' : 'jstree-checked').parent().attr('aria-selected', true); - } - }, this)) - .on(this.settings.checkbox.tie_selection ? 'deselect_all.jstree' : 'uncheck_all.jstree', $.proxy(function (e, data) { - var obj = this.get_node($.jstree.root), - m = this._model.data, - i, j, tmp; - for(i = 0, j = obj.children_d.length; i < j; i++) { - tmp = m[obj.children_d[i]]; - if(tmp && tmp.original && tmp.original.state && tmp.original.state.undetermined) { - tmp.original.state.undetermined = false; - } - } - }, this)) - .on(this.settings.checkbox.tie_selection ? 'deselect_node.jstree' : 'uncheck_node.jstree', $.proxy(function (e, data) { - var obj = data.node, - dom = this.get_node(obj, true), - i, j, tmp, s = this.settings.checkbox.cascade, t = this.settings.checkbox.tie_selection, - cur = this._data[ t ? 'core' : 'checkbox' ].selected, sel = {}; - if(obj && obj.original && obj.original.state && obj.original.state.undetermined) { - obj.original.state.undetermined = false; - } - - // apply down - if(s.indexOf('down') !== -1) { - for(i = 0, j = obj.children_d.length; i < j; i++) { - tmp = this._model.data[obj.children_d[i]]; - tmp.state[ t ? 'selected' : 'checked' ] = false; - if(tmp && tmp.original && tmp.original.state && tmp.original.state.undetermined) { - tmp.original.state.undetermined = false; - } - } - } - - // apply up - if(s.indexOf('up') !== -1) { - for(i = 0, j = obj.parents.length; i < j; i++) { - tmp = this._model.data[obj.parents[i]]; - tmp.state[ t ? 'selected' : 'checked' ] = false; - if(tmp && tmp.original && tmp.original.state && tmp.original.state.undetermined) { - tmp.original.state.undetermined = false; - } - tmp = this.get_node(obj.parents[i], true); - if(tmp && tmp.length) { - tmp.attr('aria-selected', false).children('.jstree-anchor').removeClass(t ? 'jstree-clicked' : 'jstree-checked'); - } - } - } - sel = {}; - for(i = 0, j = cur.length; i < j; i++) { - // apply down + apply up - if( - (s.indexOf('down') === -1 || $.inArray(cur[i], obj.children_d) === -1) && - (s.indexOf('up') === -1 || $.inArray(cur[i], obj.parents) === -1) - ) { - sel[cur[i]] = true; - } - } - cur = []; - for (i in sel) { - if (sel.hasOwnProperty(i)) { - cur.push(i); - } - } - this._data[ t ? 'core' : 'checkbox' ].selected = cur; - - // apply down (process .children separately?) - if(s.indexOf('down') !== -1 && dom.length) { - dom.find('.jstree-anchor').removeClass(t ? 'jstree-clicked' : 'jstree-checked').parent().attr('aria-selected', false); - } - }, this)); - } - if(this.settings.checkbox.cascade.indexOf('up') !== -1) { - this.element - .on('delete_node.jstree', $.proxy(function (e, data) { - // apply up (whole handler) - var p = this.get_node(data.parent), - m = this._model.data, - i, j, c, tmp, t = this.settings.checkbox.tie_selection; - while(p && p.id !== $.jstree.root && !p.state[ t ? 'selected' : 'checked' ]) { - c = 0; - for(i = 0, j = p.children.length; i < j; i++) { - c += m[p.children[i]].state[ t ? 'selected' : 'checked' ]; - } - if(j > 0 && c === j) { - p.state[ t ? 'selected' : 'checked' ] = true; - this._data[ t ? 'core' : 'checkbox' ].selected.push(p.id); - tmp = this.get_node(p, true); - if(tmp && tmp.length) { - tmp.attr('aria-selected', true).children('.jstree-anchor').addClass(t ? 'jstree-clicked' : 'jstree-checked'); - } - } - else { - break; - } - p = this.get_node(p.parent); - } - }, this)) - .on('move_node.jstree', $.proxy(function (e, data) { - // apply up (whole handler) - var is_multi = data.is_multi, - old_par = data.old_parent, - new_par = this.get_node(data.parent), - m = this._model.data, - p, c, i, j, tmp, t = this.settings.checkbox.tie_selection; - if(!is_multi) { - p = this.get_node(old_par); - while(p && p.id !== $.jstree.root && !p.state[ t ? 'selected' : 'checked' ]) { - c = 0; - for(i = 0, j = p.children.length; i < j; i++) { - c += m[p.children[i]].state[ t ? 'selected' : 'checked' ]; - } - if(j > 0 && c === j) { - p.state[ t ? 'selected' : 'checked' ] = true; - this._data[ t ? 'core' : 'checkbox' ].selected.push(p.id); - tmp = this.get_node(p, true); - if(tmp && tmp.length) { - tmp.attr('aria-selected', true).children('.jstree-anchor').addClass(t ? 'jstree-clicked' : 'jstree-checked'); - } - } - else { - break; - } - p = this.get_node(p.parent); - } - } - p = new_par; - while(p && p.id !== $.jstree.root) { - c = 0; - for(i = 0, j = p.children.length; i < j; i++) { - c += m[p.children[i]].state[ t ? 'selected' : 'checked' ]; - } - if(c === j) { - if(!p.state[ t ? 'selected' : 'checked' ]) { - p.state[ t ? 'selected' : 'checked' ] = true; - this._data[ t ? 'core' : 'checkbox' ].selected.push(p.id); - tmp = this.get_node(p, true); - if(tmp && tmp.length) { - tmp.attr('aria-selected', true).children('.jstree-anchor').addClass(t ? 'jstree-clicked' : 'jstree-checked'); - } - } - } - else { - if(p.state[ t ? 'selected' : 'checked' ]) { - p.state[ t ? 'selected' : 'checked' ] = false; - this._data[ t ? 'core' : 'checkbox' ].selected = $.vakata.array_remove_item(this._data[ t ? 'core' : 'checkbox' ].selected, p.id); - tmp = this.get_node(p, true); - if(tmp && tmp.length) { - tmp.attr('aria-selected', false).children('.jstree-anchor').removeClass(t ? 'jstree-clicked' : 'jstree-checked'); - } - } - else { - break; - } - } - p = this.get_node(p.parent); - } - }, this)); - } - }; - /** - * set the undetermined state where and if necessary. Used internally. - * @private - * @name _undetermined() - * @plugin checkbox - */ - this._undetermined = function () { - if(this.element === null) { return; } - var i, j, k, l, o = {}, m = this._model.data, t = this.settings.checkbox.tie_selection, s = this._data[ t ? 'core' : 'checkbox' ].selected, p = [], tt = this; - for(i = 0, j = s.length; i < j; i++) { - if(m[s[i]] && m[s[i]].parents) { - for(k = 0, l = m[s[i]].parents.length; k < l; k++) { - if(o[m[s[i]].parents[k]] !== undefined) { - break; - } - if(m[s[i]].parents[k] !== $.jstree.root) { - o[m[s[i]].parents[k]] = true; - p.push(m[s[i]].parents[k]); - } - } - } - } - // attempt for server side undetermined state - this.element.find('.jstree-closed').not(':has(.jstree-children)') - .each(function () { - var tmp = tt.get_node(this), tmp2; - if(!tmp.state.loaded) { - if(tmp.original && tmp.original.state && tmp.original.state.undetermined && tmp.original.state.undetermined === true) { - if(o[tmp.id] === undefined && tmp.id !== $.jstree.root) { - o[tmp.id] = true; - p.push(tmp.id); - } - for(k = 0, l = tmp.parents.length; k < l; k++) { - if(o[tmp.parents[k]] === undefined && tmp.parents[k] !== $.jstree.root) { - o[tmp.parents[k]] = true; - p.push(tmp.parents[k]); - } - } - } - } - else { - for(i = 0, j = tmp.children_d.length; i < j; i++) { - tmp2 = m[tmp.children_d[i]]; - if(!tmp2.state.loaded && tmp2.original && tmp2.original.state && tmp2.original.state.undetermined && tmp2.original.state.undetermined === true) { - if(o[tmp2.id] === undefined && tmp2.id !== $.jstree.root) { - o[tmp2.id] = true; - p.push(tmp2.id); - } - for(k = 0, l = tmp2.parents.length; k < l; k++) { - if(o[tmp2.parents[k]] === undefined && tmp2.parents[k] !== $.jstree.root) { - o[tmp2.parents[k]] = true; - p.push(tmp2.parents[k]); - } - } - } - } - } - }); - - this.element.find('.jstree-undetermined').removeClass('jstree-undetermined'); - for(i = 0, j = p.length; i < j; i++) { - if(!m[p[i]].state[ t ? 'selected' : 'checked' ]) { - s = this.get_node(p[i], true); - if(s && s.length) { - s.children('.jstree-anchor').children('.jstree-checkbox').addClass('jstree-undetermined'); - } - } - } - }; - this.redraw_node = function(obj, deep, is_callback, force_render) { - obj = parent.redraw_node.apply(this, arguments); - if(obj) { - var i, j, tmp = null, icon = null; - for(i = 0, j = obj.childNodes.length; i < j; i++) { - if(obj.childNodes[i] && obj.childNodes[i].className && obj.childNodes[i].className.indexOf("jstree-anchor") !== -1) { - tmp = obj.childNodes[i]; - break; - } - } - if(tmp) { - if(!this.settings.checkbox.tie_selection && this._model.data[obj.id].state.checked) { tmp.className += ' jstree-checked'; } - icon = _i.cloneNode(false); - if(this._model.data[obj.id].state.checkbox_disabled) { icon.className += ' jstree-checkbox-disabled'; } - tmp.insertBefore(icon, tmp.childNodes[0]); - } - } - if(!is_callback && this.settings.checkbox.cascade.indexOf('undetermined') !== -1) { - if(this._data.checkbox.uto) { clearTimeout(this._data.checkbox.uto); } - this._data.checkbox.uto = setTimeout($.proxy(this._undetermined, this), 50); - } - return obj; - }; - /** - * show the node checkbox icons - * @name show_checkboxes() - * @plugin checkbox - */ - this.show_checkboxes = function () { this._data.core.themes.checkboxes = true; this.get_container_ul().removeClass("jstree-no-checkboxes"); }; - /** - * hide the node checkbox icons - * @name hide_checkboxes() - * @plugin checkbox - */ - this.hide_checkboxes = function () { this._data.core.themes.checkboxes = false; this.get_container_ul().addClass("jstree-no-checkboxes"); }; - /** - * toggle the node icons - * @name toggle_checkboxes() - * @plugin checkbox - */ - this.toggle_checkboxes = function () { if(this._data.core.themes.checkboxes) { this.hide_checkboxes(); } else { this.show_checkboxes(); } }; - /** - * checks if a node is in an undetermined state - * @name is_undetermined(obj) - * @param {mixed} obj - * @return {Boolean} - */ - this.is_undetermined = function (obj) { - obj = this.get_node(obj); - var s = this.settings.checkbox.cascade, i, j, t = this.settings.checkbox.tie_selection, d = this._data[ t ? 'core' : 'checkbox' ].selected, m = this._model.data; - if(!obj || obj.state[ t ? 'selected' : 'checked' ] === true || s.indexOf('undetermined') === -1 || (s.indexOf('down') === -1 && s.indexOf('up') === -1)) { - return false; - } - if(!obj.state.loaded && obj.original.state.undetermined === true) { - return true; - } - for(i = 0, j = obj.children_d.length; i < j; i++) { - if($.inArray(obj.children_d[i], d) !== -1 || (!m[obj.children_d[i]].state.loaded && m[obj.children_d[i]].original.state.undetermined)) { - return true; - } - } - return false; - }; - /** - * disable a node's checkbox - * @name disable_checkbox(obj) - * @param {mixed} obj an array can be used too - * @trigger disable_checkbox.jstree - * @plugin checkbox - */ - this.disable_checkbox = function (obj) { - var t1, t2, dom; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.disable_checkbox(obj[t1]); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { - return false; - } - dom = this.get_node(obj, true); - if(!obj.state.checkbox_disabled) { - obj.state.checkbox_disabled = true; - if(dom && dom.length) { - dom.children('.jstree-anchor').children('.jstree-checkbox').addClass('jstree-checkbox-disabled'); - } - /** - * triggered when an node's checkbox is disabled - * @event - * @name disable_checkbox.jstree - * @param {Object} node - * @plugin checkbox - */ - this.trigger('disable_checkbox', { 'node' : obj }); - } - }; - /** - * enable a node's checkbox - * @name disable_checkbox(obj) - * @param {mixed} obj an array can be used too - * @trigger enable_checkbox.jstree - * @plugin checkbox - */ - this.enable_checkbox = function (obj) { - var t1, t2, dom; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.enable_checkbox(obj[t1]); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { - return false; - } - dom = this.get_node(obj, true); - if(obj.state.checkbox_disabled) { - obj.state.checkbox_disabled = false; - if(dom && dom.length) { - dom.children('.jstree-anchor').children('.jstree-checkbox').removeClass('jstree-checkbox-disabled'); - } - /** - * triggered when an node's checkbox is enabled - * @event - * @name enable_checkbox.jstree - * @param {Object} node - * @plugin checkbox - */ - this.trigger('enable_checkbox', { 'node' : obj }); - } - }; - - this.activate_node = function (obj, e) { - if($(e.target).hasClass('jstree-checkbox-disabled')) { - return false; - } - if(this.settings.checkbox.tie_selection && (this.settings.checkbox.whole_node || $(e.target).hasClass('jstree-checkbox'))) { - e.ctrlKey = true; - } - if(this.settings.checkbox.tie_selection || (!this.settings.checkbox.whole_node && !$(e.target).hasClass('jstree-checkbox'))) { - return parent.activate_node.call(this, obj, e); - } - if(this.is_disabled(obj)) { - return false; - } - if(this.is_checked(obj)) { - this.uncheck_node(obj, e); - } - else { - this.check_node(obj, e); - } - this.trigger('activate_node', { 'node' : this.get_node(obj) }); - }; - - /** - * check a node (only if tie_selection in checkbox settings is false, otherwise select_node will be called internally) - * @name check_node(obj) - * @param {mixed} obj an array can be used to check multiple nodes - * @trigger check_node.jstree - * @plugin checkbox - */ - this.check_node = function (obj, e) { - if(this.settings.checkbox.tie_selection) { return this.select_node(obj, false, true, e); } - var dom, t1, t2, th; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.check_node(obj[t1], e); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { - return false; - } - dom = this.get_node(obj, true); - if(!obj.state.checked) { - obj.state.checked = true; - this._data.checkbox.selected.push(obj.id); - if(dom && dom.length) { - dom.children('.jstree-anchor').addClass('jstree-checked'); - } - /** - * triggered when an node is checked (only if tie_selection in checkbox settings is false) - * @event - * @name check_node.jstree - * @param {Object} node - * @param {Array} selected the current selection - * @param {Object} event the event (if any) that triggered this check_node - * @plugin checkbox - */ - this.trigger('check_node', { 'node' : obj, 'selected' : this._data.checkbox.selected, 'event' : e }); - } - }; - /** - * uncheck a node (only if tie_selection in checkbox settings is false, otherwise deselect_node will be called internally) - * @name uncheck_node(obj) - * @param {mixed} obj an array can be used to uncheck multiple nodes - * @trigger uncheck_node.jstree - * @plugin checkbox - */ - this.uncheck_node = function (obj, e) { - if(this.settings.checkbox.tie_selection) { return this.deselect_node(obj, false, e); } - var t1, t2, dom; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.uncheck_node(obj[t1], e); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { - return false; - } - dom = this.get_node(obj, true); - if(obj.state.checked) { - obj.state.checked = false; - this._data.checkbox.selected = $.vakata.array_remove_item(this._data.checkbox.selected, obj.id); - if(dom.length) { - dom.children('.jstree-anchor').removeClass('jstree-checked'); - } - /** - * triggered when an node is unchecked (only if tie_selection in checkbox settings is false) - * @event - * @name uncheck_node.jstree - * @param {Object} node - * @param {Array} selected the current selection - * @param {Object} event the event (if any) that triggered this uncheck_node - * @plugin checkbox - */ - this.trigger('uncheck_node', { 'node' : obj, 'selected' : this._data.checkbox.selected, 'event' : e }); - } - }; - /** - * checks all nodes in the tree (only if tie_selection in checkbox settings is false, otherwise select_all will be called internally) - * @name check_all() - * @trigger check_all.jstree, changed.jstree - * @plugin checkbox - */ - this.check_all = function () { - if(this.settings.checkbox.tie_selection) { return this.select_all(); } - var tmp = this._data.checkbox.selected.concat([]), i, j; - this._data.checkbox.selected = this._model.data[$.jstree.root].children_d.concat(); - for(i = 0, j = this._data.checkbox.selected.length; i < j; i++) { - if(this._model.data[this._data.checkbox.selected[i]]) { - this._model.data[this._data.checkbox.selected[i]].state.checked = true; - } - } - this.redraw(true); - /** - * triggered when all nodes are checked (only if tie_selection in checkbox settings is false) - * @event - * @name check_all.jstree - * @param {Array} selected the current selection - * @plugin checkbox - */ - this.trigger('check_all', { 'selected' : this._data.checkbox.selected }); - }; - /** - * uncheck all checked nodes (only if tie_selection in checkbox settings is false, otherwise deselect_all will be called internally) - * @name uncheck_all() - * @trigger uncheck_all.jstree - * @plugin checkbox - */ - this.uncheck_all = function () { - if(this.settings.checkbox.tie_selection) { return this.deselect_all(); } - var tmp = this._data.checkbox.selected.concat([]), i, j; - for(i = 0, j = this._data.checkbox.selected.length; i < j; i++) { - if(this._model.data[this._data.checkbox.selected[i]]) { - this._model.data[this._data.checkbox.selected[i]].state.checked = false; - } - } - this._data.checkbox.selected = []; - this.element.find('.jstree-checked').removeClass('jstree-checked'); - /** - * triggered when all nodes are unchecked (only if tie_selection in checkbox settings is false) - * @event - * @name uncheck_all.jstree - * @param {Object} node the previous selection - * @param {Array} selected the current selection - * @plugin checkbox - */ - this.trigger('uncheck_all', { 'selected' : this._data.checkbox.selected, 'node' : tmp }); - }; - /** - * checks if a node is checked (if tie_selection is on in the settings this function will return the same as is_selected) - * @name is_checked(obj) - * @param {mixed} obj - * @return {Boolean} - * @plugin checkbox - */ - this.is_checked = function (obj) { - if(this.settings.checkbox.tie_selection) { return this.is_selected(obj); } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { return false; } - return obj.state.checked; - }; - /** - * get an array of all checked nodes (if tie_selection is on in the settings this function will return the same as get_selected) - * @name get_checked([full]) - * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned - * @return {Array} - * @plugin checkbox - */ - this.get_checked = function (full) { - if(this.settings.checkbox.tie_selection) { return this.get_selected(full); } - return full ? $.map(this._data.checkbox.selected, $.proxy(function (i) { return this.get_node(i); }, this)) : this._data.checkbox.selected; - }; - /** - * get an array of all top level checked nodes (ignoring children of checked nodes) (if tie_selection is on in the settings this function will return the same as get_top_selected) - * @name get_top_checked([full]) - * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned - * @return {Array} - * @plugin checkbox - */ - this.get_top_checked = function (full) { - if(this.settings.checkbox.tie_selection) { return this.get_top_selected(full); } - var tmp = this.get_checked(true), - obj = {}, i, j, k, l; - for(i = 0, j = tmp.length; i < j; i++) { - obj[tmp[i].id] = tmp[i]; - } - for(i = 0, j = tmp.length; i < j; i++) { - for(k = 0, l = tmp[i].children_d.length; k < l; k++) { - if(obj[tmp[i].children_d[k]]) { - delete obj[tmp[i].children_d[k]]; - } - } - } - tmp = []; - for(i in obj) { - if(obj.hasOwnProperty(i)) { - tmp.push(i); - } - } - return full ? $.map(tmp, $.proxy(function (i) { return this.get_node(i); }, this)) : tmp; - }; - /** - * get an array of all bottom level checked nodes (ignoring selected parents) (if tie_selection is on in the settings this function will return the same as get_bottom_selected) - * @name get_bottom_checked([full]) - * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned - * @return {Array} - * @plugin checkbox - */ - this.get_bottom_checked = function (full) { - if(this.settings.checkbox.tie_selection) { return this.get_bottom_selected(full); } - var tmp = this.get_checked(true), - obj = [], i, j; - for(i = 0, j = tmp.length; i < j; i++) { - if(!tmp[i].children.length) { - obj.push(tmp[i].id); - } - } - return full ? $.map(obj, $.proxy(function (i) { return this.get_node(i); }, this)) : obj; - }; - this.load_node = function (obj, callback) { - var k, l, i, j, c, tmp; - if(!$.isArray(obj) && !this.settings.checkbox.tie_selection) { - tmp = this.get_node(obj); - if(tmp && tmp.state.loaded) { - for(k = 0, l = tmp.children_d.length; k < l; k++) { - if(this._model.data[tmp.children_d[k]].state.checked) { - c = true; - this._data.checkbox.selected = $.vakata.array_remove_item(this._data.checkbox.selected, tmp.children_d[k]); - } - } - } - } - return parent.load_node.apply(this, arguments); - }; - this.get_state = function () { - var state = parent.get_state.apply(this, arguments); - if(this.settings.checkbox.tie_selection) { return state; } - state.checkbox = this._data.checkbox.selected.slice(); - return state; - }; - this.set_state = function (state, callback) { - var res = parent.set_state.apply(this, arguments); - if(res && state.checkbox) { - if(!this.settings.checkbox.tie_selection) { - this.uncheck_all(); - var _this = this; - $.each(state.checkbox, function (i, v) { - _this.check_node(v); - }); - } - delete state.checkbox; - this.set_state(state, callback); - return false; - } - return res; - }; - this.refresh = function (skip_loading, forget_state) { - if(!this.settings.checkbox.tie_selection) { - this._data.checkbox.selected = []; - } - return parent.refresh.apply(this, arguments); - }; - }; - - // include the checkbox plugin by default - // $.jstree.defaults.plugins.push("checkbox"); -})); \ No newline at end of file diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/jstree.conditionalselect.js b/mayan/apps/cabinets/static/cabinets/packages/jstree/src/jstree.conditionalselect.js deleted file mode 100644 index 012562ec10..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/jstree.conditionalselect.js +++ /dev/null @@ -1,38 +0,0 @@ -/** - * ### Conditionalselect plugin - * - * This plugin allows defining a callback to allow or deny node selection by user input (activate node method). - */ -/*globals jQuery, define, exports, require, document */ -(function (factory) { - "use strict"; - if (typeof define === 'function' && define.amd) { - define('jstree.conditionalselect', ['jquery','jstree'], factory); - } - else if(typeof exports === 'object') { - factory(require('jquery'), require('jstree')); - } - else { - factory(jQuery, jQuery.jstree); - } -}(function ($, jstree, undefined) { - "use strict"; - - if($.jstree.plugins.conditionalselect) { return; } - - /** - * a callback (function) which is invoked in the instance's scope and receives two arguments - the node and the event that triggered the `activate_node` call. Returning false prevents working with the node, returning true allows invoking activate_node. Defaults to returning `true`. - * @name $.jstree.defaults.checkbox.visible - * @plugin checkbox - */ - $.jstree.defaults.conditionalselect = function () { return true; }; - $.jstree.plugins.conditionalselect = function (options, parent) { - // own function - this.activate_node = function (obj, e) { - if(this.settings.conditionalselect.call(this, this.get_node(obj), e)) { - parent.activate_node.call(this, obj, e); - } - }; - }; - -})); \ No newline at end of file diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/jstree.contextmenu.js b/mayan/apps/cabinets/static/cabinets/packages/jstree/src/jstree.contextmenu.js deleted file mode 100644 index 00f4517510..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/jstree.contextmenu.js +++ /dev/null @@ -1,653 +0,0 @@ -/** - * ### Contextmenu plugin - * - * Shows a context menu when a node is right-clicked. - */ -/*globals jQuery, define, exports, require, document */ -(function (factory) { - "use strict"; - if (typeof define === 'function' && define.amd) { - define('jstree.contextmenu', ['jquery','jstree'], factory); - } - else if(typeof exports === 'object') { - factory(require('jquery'), require('jstree')); - } - else { - factory(jQuery, jQuery.jstree); - } -}(function ($, jstree, undefined) { - "use strict"; - - if($.jstree.plugins.contextmenu) { return; } - - /** - * stores all defaults for the contextmenu plugin - * @name $.jstree.defaults.contextmenu - * @plugin contextmenu - */ - $.jstree.defaults.contextmenu = { - /** - * a boolean indicating if the node should be selected when the context menu is invoked on it. Defaults to `true`. - * @name $.jstree.defaults.contextmenu.select_node - * @plugin contextmenu - */ - select_node : true, - /** - * a boolean indicating if the menu should be shown aligned with the node. Defaults to `true`, otherwise the mouse coordinates are used. - * @name $.jstree.defaults.contextmenu.show_at_node - * @plugin contextmenu - */ - show_at_node : true, - /** - * an object of actions, or a function that accepts a node and a callback function and calls the callback function with an object of actions available for that node (you can also return the items too). - * - * Each action consists of a key (a unique name) and a value which is an object with the following properties (only label and action are required). Once a menu item is activated the `action` function will be invoked with an object containing the following keys: item - the contextmenu item definition as seen below, reference - the DOM node that was used (the tree node), element - the contextmenu DOM element, position - an object with x/y properties indicating the position of the menu. - * - * * `separator_before` - a boolean indicating if there should be a separator before this item - * * `separator_after` - a boolean indicating if there should be a separator after this item - * * `_disabled` - a boolean indicating if this action should be disabled - * * `label` - a string - the name of the action (could be a function returning a string) - * * `title` - a string - an optional tooltip for the item - * * `action` - a function to be executed if this item is chosen, the function will receive - * * `icon` - a string, can be a path to an icon or a className, if using an image that is in the current directory use a `./` prefix, otherwise it will be detected as a class - * * `shortcut` - keyCode which will trigger the action if the menu is open (for example `113` for rename, which equals F2) - * * `shortcut_label` - shortcut label (like for example `F2` for rename) - * * `submenu` - an object with the same structure as $.jstree.defaults.contextmenu.items which can be used to create a submenu - each key will be rendered as a separate option in a submenu that will appear once the current item is hovered - * - * @name $.jstree.defaults.contextmenu.items - * @plugin contextmenu - */ - items : function (o, cb) { // Could be an object directly - return { - "create" : { - "separator_before" : false, - "separator_after" : true, - "_disabled" : false, //(this.check("create_node", data.reference, {}, "last")), - "label" : "Create", - "action" : function (data) { - var inst = $.jstree.reference(data.reference), - obj = inst.get_node(data.reference); - inst.create_node(obj, {}, "last", function (new_node) { - setTimeout(function () { inst.edit(new_node); },0); - }); - } - }, - "rename" : { - "separator_before" : false, - "separator_after" : false, - "_disabled" : false, //(this.check("rename_node", data.reference, this.get_parent(data.reference), "")), - "label" : "Rename", - /*! - "shortcut" : 113, - "shortcut_label" : 'F2', - "icon" : "glyphicon glyphicon-leaf", - */ - "action" : function (data) { - var inst = $.jstree.reference(data.reference), - obj = inst.get_node(data.reference); - inst.edit(obj); - } - }, - "remove" : { - "separator_before" : false, - "icon" : false, - "separator_after" : false, - "_disabled" : false, //(this.check("delete_node", data.reference, this.get_parent(data.reference), "")), - "label" : "Delete", - "action" : function (data) { - var inst = $.jstree.reference(data.reference), - obj = inst.get_node(data.reference); - if(inst.is_selected(obj)) { - inst.delete_node(inst.get_selected()); - } - else { - inst.delete_node(obj); - } - } - }, - "ccp" : { - "separator_before" : true, - "icon" : false, - "separator_after" : false, - "label" : "Edit", - "action" : false, - "submenu" : { - "cut" : { - "separator_before" : false, - "separator_after" : false, - "label" : "Cut", - "action" : function (data) { - var inst = $.jstree.reference(data.reference), - obj = inst.get_node(data.reference); - if(inst.is_selected(obj)) { - inst.cut(inst.get_top_selected()); - } - else { - inst.cut(obj); - } - } - }, - "copy" : { - "separator_before" : false, - "icon" : false, - "separator_after" : false, - "label" : "Copy", - "action" : function (data) { - var inst = $.jstree.reference(data.reference), - obj = inst.get_node(data.reference); - if(inst.is_selected(obj)) { - inst.copy(inst.get_top_selected()); - } - else { - inst.copy(obj); - } - } - }, - "paste" : { - "separator_before" : false, - "icon" : false, - "_disabled" : function (data) { - return !$.jstree.reference(data.reference).can_paste(); - }, - "separator_after" : false, - "label" : "Paste", - "action" : function (data) { - var inst = $.jstree.reference(data.reference), - obj = inst.get_node(data.reference); - inst.paste(obj); - } - } - } - } - }; - } - }; - - $.jstree.plugins.contextmenu = function (options, parent) { - this.bind = function () { - parent.bind.call(this); - - var last_ts = 0, cto = null, ex, ey; - this.element - .on("contextmenu.jstree", ".jstree-anchor", $.proxy(function (e, data) { - if (e.target.tagName.toLowerCase() === 'input') { - return; - } - e.preventDefault(); - last_ts = e.ctrlKey ? +new Date() : 0; - if(data || cto) { - last_ts = (+new Date()) + 10000; - } - if(cto) { - clearTimeout(cto); - } - if(!this.is_loading(e.currentTarget)) { - this.show_contextmenu(e.currentTarget, e.pageX, e.pageY, e); - } - }, this)) - .on("click.jstree", ".jstree-anchor", $.proxy(function (e) { - if(this._data.contextmenu.visible && (!last_ts || (+new Date()) - last_ts > 250)) { // work around safari & macOS ctrl+click - $.vakata.context.hide(); - } - last_ts = 0; - }, this)) - .on("touchstart.jstree", ".jstree-anchor", function (e) { - if(!e.originalEvent || !e.originalEvent.changedTouches || !e.originalEvent.changedTouches[0]) { - return; - } - ex = e.originalEvent.changedTouches[0].clientX; - ey = e.originalEvent.changedTouches[0].clientY; - cto = setTimeout(function () { - $(e.currentTarget).trigger('contextmenu', true); - }, 750); - }) - .on('touchmove.vakata.jstree', function (e) { - if(cto && e.originalEvent && e.originalEvent.changedTouches && e.originalEvent.changedTouches[0] && (Math.abs(ex - e.originalEvent.changedTouches[0].clientX) > 50 || Math.abs(ey - e.originalEvent.changedTouches[0].clientY) > 50)) { - clearTimeout(cto); - } - }) - .on('touchend.vakata.jstree', function (e) { - if(cto) { - clearTimeout(cto); - } - }); - - /*! - if(!('oncontextmenu' in document.body) && ('ontouchstart' in document.body)) { - var el = null, tm = null; - this.element - .on("touchstart", ".jstree-anchor", function (e) { - el = e.currentTarget; - tm = +new Date(); - $(document).one("touchend", function (e) { - e.target = document.elementFromPoint(e.originalEvent.targetTouches[0].pageX - window.pageXOffset, e.originalEvent.targetTouches[0].pageY - window.pageYOffset); - e.currentTarget = e.target; - tm = ((+(new Date())) - tm); - if(e.target === el && tm > 600 && tm < 1000) { - e.preventDefault(); - $(el).trigger('contextmenu', e); - } - el = null; - tm = null; - }); - }); - } - */ - $(document).on("context_hide.vakata.jstree", $.proxy(function (e, data) { - this._data.contextmenu.visible = false; - $(data.reference).removeClass('jstree-context'); - }, this)); - }; - this.teardown = function () { - if(this._data.contextmenu.visible) { - $.vakata.context.hide(); - } - parent.teardown.call(this); - }; - - /** - * prepare and show the context menu for a node - * @name show_contextmenu(obj [, x, y]) - * @param {mixed} obj the node - * @param {Number} x the x-coordinate relative to the document to show the menu at - * @param {Number} y the y-coordinate relative to the document to show the menu at - * @param {Object} e the event if available that triggered the contextmenu - * @plugin contextmenu - * @trigger show_contextmenu.jstree - */ - this.show_contextmenu = function (obj, x, y, e) { - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { return false; } - var s = this.settings.contextmenu, - d = this.get_node(obj, true), - a = d.children(".jstree-anchor"), - o = false, - i = false; - if(s.show_at_node || x === undefined || y === undefined) { - o = a.offset(); - x = o.left; - y = o.top + this._data.core.li_height; - } - if(this.settings.contextmenu.select_node && !this.is_selected(obj)) { - this.activate_node(obj, e); - } - - i = s.items; - if($.isFunction(i)) { - i = i.call(this, obj, $.proxy(function (i) { - this._show_contextmenu(obj, x, y, i); - }, this)); - } - if($.isPlainObject(i)) { - this._show_contextmenu(obj, x, y, i); - } - }; - /** - * show the prepared context menu for a node - * @name _show_contextmenu(obj, x, y, i) - * @param {mixed} obj the node - * @param {Number} x the x-coordinate relative to the document to show the menu at - * @param {Number} y the y-coordinate relative to the document to show the menu at - * @param {Number} i the object of items to show - * @plugin contextmenu - * @trigger show_contextmenu.jstree - * @private - */ - this._show_contextmenu = function (obj, x, y, i) { - var d = this.get_node(obj, true), - a = d.children(".jstree-anchor"); - $(document).one("context_show.vakata.jstree", $.proxy(function (e, data) { - var cls = 'jstree-contextmenu jstree-' + this.get_theme() + '-contextmenu'; - $(data.element).addClass(cls); - a.addClass('jstree-context'); - }, this)); - this._data.contextmenu.visible = true; - $.vakata.context.show(a, { 'x' : x, 'y' : y }, i); - /** - * triggered when the contextmenu is shown for a node - * @event - * @name show_contextmenu.jstree - * @param {Object} node the node - * @param {Number} x the x-coordinate of the menu relative to the document - * @param {Number} y the y-coordinate of the menu relative to the document - * @plugin contextmenu - */ - this.trigger('show_contextmenu', { "node" : obj, "x" : x, "y" : y }); - }; - }; - - // contextmenu helper - (function ($) { - var right_to_left = false, - vakata_context = { - element : false, - reference : false, - position_x : 0, - position_y : 0, - items : [], - html : "", - is_visible : false - }; - - $.vakata.context = { - settings : { - hide_onmouseleave : 0, - icons : true - }, - _trigger : function (event_name) { - $(document).triggerHandler("context_" + event_name + ".vakata", { - "reference" : vakata_context.reference, - "element" : vakata_context.element, - "position" : { - "x" : vakata_context.position_x, - "y" : vakata_context.position_y - } - }); - }, - _execute : function (i) { - i = vakata_context.items[i]; - return i && (!i._disabled || ($.isFunction(i._disabled) && !i._disabled({ "item" : i, "reference" : vakata_context.reference, "element" : vakata_context.element }))) && i.action ? i.action.call(null, { - "item" : i, - "reference" : vakata_context.reference, - "element" : vakata_context.element, - "position" : { - "x" : vakata_context.position_x, - "y" : vakata_context.position_y - } - }) : false; - }, - _parse : function (o, is_callback) { - if(!o) { return false; } - if(!is_callback) { - vakata_context.html = ""; - vakata_context.items = []; - } - var str = "", - sep = false, - tmp; - - if(is_callback) { str += "<"+"ul>"; } - $.each(o, function (i, val) { - if(!val) { return true; } - vakata_context.items.push(val); - if(!sep && val.separator_before) { - str += "<"+"li class='vakata-context-separator'><"+"a href='#' " + ($.vakata.context.settings.icons ? '' : 'style="margin-left:0px;"') + "> <"+"/a><"+"/li>"; - } - sep = false; - str += "<"+"li class='" + (val._class || "") + (val._disabled === true || ($.isFunction(val._disabled) && val._disabled({ "item" : val, "reference" : vakata_context.reference, "element" : vakata_context.element })) ? " vakata-contextmenu-disabled " : "") + "' "+(val.shortcut?" data-shortcut='"+val.shortcut+"' ":'')+">"; - str += "<"+"a href='#' rel='" + (vakata_context.items.length - 1) + "' " + (val.title ? "title='" + val.title + "'" : "") + ">"; - if($.vakata.context.settings.icons) { - str += "<"+"i "; - if(val.icon) { - if(val.icon.indexOf("/") !== -1 || val.icon.indexOf(".") !== -1) { str += " style='background:url(\"" + val.icon + "\") center center no-repeat' "; } - else { str += " class='" + val.icon + "' "; } - } - str += "><"+"/i><"+"span class='vakata-contextmenu-sep'> <"+"/span>"; - } - str += ($.isFunction(val.label) ? val.label({ "item" : i, "reference" : vakata_context.reference, "element" : vakata_context.element }) : val.label) + (val.shortcut?' '+ (val.shortcut_label || '') +'':'') + "<"+"/a>"; - if(val.submenu) { - tmp = $.vakata.context._parse(val.submenu, true); - if(tmp) { str += tmp; } - } - str += "<"+"/li>"; - if(val.separator_after) { - str += "<"+"li class='vakata-context-separator'><"+"a href='#' " + ($.vakata.context.settings.icons ? '' : 'style="margin-left:0px;"') + "> <"+"/a><"+"/li>"; - sep = true; - } - }); - str = str.replace(/
      • <\/li\>$/,""); - if(is_callback) { str += ""; } - /** - * triggered on the document when the contextmenu is parsed (HTML is built) - * @event - * @plugin contextmenu - * @name context_parse.vakata - * @param {jQuery} reference the element that was right clicked - * @param {jQuery} element the DOM element of the menu itself - * @param {Object} position the x & y coordinates of the menu - */ - if(!is_callback) { vakata_context.html = str; $.vakata.context._trigger("parse"); } - return str.length > 10 ? str : false; - }, - _show_submenu : function (o) { - o = $(o); - if(!o.length || !o.children("ul").length) { return; } - var e = o.children("ul"), - xl = o.offset().left, - x = xl + o.outerWidth(), - y = o.offset().top, - w = e.width(), - h = e.height(), - dw = $(window).width() + $(window).scrollLeft(), - dh = $(window).height() + $(window).scrollTop(); - // може да се спести е една проверка - дали няма някой от класовете вече нагоре - if(right_to_left) { - o[x - (w + 10 + o.outerWidth()) < 0 ? "addClass" : "removeClass"]("vakata-context-left"); - } - else { - o[x + w > dw && xl > dw - x ? "addClass" : "removeClass"]("vakata-context-right"); - } - if(y + h + 10 > dh) { - e.css("bottom","-1px"); - } - - //if does not fit - stick it to the side - if (o.hasClass('vakata-context-right')) { - if (xl < w) { - e.css("margin-right", xl - w); - } - } else { - if (dw - x < w) { - e.css("margin-left", dw - x - w); - } - } - - e.show(); - }, - show : function (reference, position, data) { - var o, e, x, y, w, h, dw, dh, cond = true; - if(vakata_context.element && vakata_context.element.length) { - vakata_context.element.width(''); - } - switch(cond) { - case (!position && !reference): - return false; - case (!!position && !!reference): - vakata_context.reference = reference; - vakata_context.position_x = position.x; - vakata_context.position_y = position.y; - break; - case (!position && !!reference): - vakata_context.reference = reference; - o = reference.offset(); - vakata_context.position_x = o.left + reference.outerHeight(); - vakata_context.position_y = o.top; - break; - case (!!position && !reference): - vakata_context.position_x = position.x; - vakata_context.position_y = position.y; - break; - } - if(!!reference && !data && $(reference).data('vakata_contextmenu')) { - data = $(reference).data('vakata_contextmenu'); - } - if($.vakata.context._parse(data)) { - vakata_context.element.html(vakata_context.html); - } - if(vakata_context.items.length) { - vakata_context.element.appendTo("body"); - e = vakata_context.element; - x = vakata_context.position_x; - y = vakata_context.position_y; - w = e.width(); - h = e.height(); - dw = $(window).width() + $(window).scrollLeft(); - dh = $(window).height() + $(window).scrollTop(); - if(right_to_left) { - x -= (e.outerWidth() - $(reference).outerWidth()); - if(x < $(window).scrollLeft() + 20) { - x = $(window).scrollLeft() + 20; - } - } - if(x + w + 20 > dw) { - x = dw - (w + 20); - } - if(y + h + 20 > dh) { - y = dh - (h + 20); - } - - vakata_context.element - .css({ "left" : x, "top" : y }) - .show() - .find('a').first().focus().parent().addClass("vakata-context-hover"); - vakata_context.is_visible = true; - /** - * triggered on the document when the contextmenu is shown - * @event - * @plugin contextmenu - * @name context_show.vakata - * @param {jQuery} reference the element that was right clicked - * @param {jQuery} element the DOM element of the menu itself - * @param {Object} position the x & y coordinates of the menu - */ - $.vakata.context._trigger("show"); - } - }, - hide : function () { - if(vakata_context.is_visible) { - vakata_context.element.hide().find("ul").hide().end().find(':focus').blur().end().detach(); - vakata_context.is_visible = false; - /** - * triggered on the document when the contextmenu is hidden - * @event - * @plugin contextmenu - * @name context_hide.vakata - * @param {jQuery} reference the element that was right clicked - * @param {jQuery} element the DOM element of the menu itself - * @param {Object} position the x & y coordinates of the menu - */ - $.vakata.context._trigger("hide"); - } - } - }; - $(function () { - right_to_left = $("body").css("direction") === "rtl"; - var to = false; - - vakata_context.element = $("
          "); - vakata_context.element - .on("mouseenter", "li", function (e) { - e.stopImmediatePropagation(); - - if($.contains(this, e.relatedTarget)) { - // премахнато заради delegate mouseleave по-долу - // $(this).find(".vakata-context-hover").removeClass("vakata-context-hover"); - return; - } - - if(to) { clearTimeout(to); } - vakata_context.element.find(".vakata-context-hover").removeClass("vakata-context-hover").end(); - - $(this) - .siblings().find("ul").hide().end().end() - .parentsUntil(".vakata-context", "li").addBack().addClass("vakata-context-hover"); - $.vakata.context._show_submenu(this); - }) - // тестово - дали не натоварва? - .on("mouseleave", "li", function (e) { - if($.contains(this, e.relatedTarget)) { return; } - $(this).find(".vakata-context-hover").addBack().removeClass("vakata-context-hover"); - }) - .on("mouseleave", function (e) { - $(this).find(".vakata-context-hover").removeClass("vakata-context-hover"); - if($.vakata.context.settings.hide_onmouseleave) { - to = setTimeout( - (function (t) { - return function () { $.vakata.context.hide(); }; - }(this)), $.vakata.context.settings.hide_onmouseleave); - } - }) - .on("click", "a", function (e) { - e.preventDefault(); - //}) - //.on("mouseup", "a", function (e) { - if(!$(this).blur().parent().hasClass("vakata-context-disabled") && $.vakata.context._execute($(this).attr("rel")) !== false) { - $.vakata.context.hide(); - } - }) - .on('keydown', 'a', function (e) { - var o = null; - switch(e.which) { - case 13: - case 32: - e.type = "click"; - e.preventDefault(); - $(e.currentTarget).trigger(e); - break; - case 37: - if(vakata_context.is_visible) { - vakata_context.element.find(".vakata-context-hover").last().closest("li").first().find("ul").hide().find(".vakata-context-hover").removeClass("vakata-context-hover").end().end().children('a').focus(); - e.stopImmediatePropagation(); - e.preventDefault(); - } - break; - case 38: - if(vakata_context.is_visible) { - o = vakata_context.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").prevAll("li:not(.vakata-context-separator)").first(); - if(!o.length) { o = vakata_context.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").last(); } - o.addClass("vakata-context-hover").children('a').focus(); - e.stopImmediatePropagation(); - e.preventDefault(); - } - break; - case 39: - if(vakata_context.is_visible) { - vakata_context.element.find(".vakata-context-hover").last().children("ul").show().children("li:not(.vakata-context-separator)").removeClass("vakata-context-hover").first().addClass("vakata-context-hover").children('a').focus(); - e.stopImmediatePropagation(); - e.preventDefault(); - } - break; - case 40: - if(vakata_context.is_visible) { - o = vakata_context.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").nextAll("li:not(.vakata-context-separator)").first(); - if(!o.length) { o = vakata_context.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").first(); } - o.addClass("vakata-context-hover").children('a').focus(); - e.stopImmediatePropagation(); - e.preventDefault(); - } - break; - case 27: - $.vakata.context.hide(); - e.preventDefault(); - break; - default: - //console.log(e.which); - break; - } - }) - .on('keydown', function (e) { - e.preventDefault(); - var a = vakata_context.element.find('.vakata-contextmenu-shortcut-' + e.which).parent(); - if(a.parent().not('.vakata-context-disabled')) { - a.click(); - } - }); - - $(document) - .on("mousedown.vakata.jstree", function (e) { - if(vakata_context.is_visible && !$.contains(vakata_context.element[0], e.target)) { - $.vakata.context.hide(); - } - }) - .on("context_show.vakata.jstree", function (e, data) { - vakata_context.element.find("li:has(ul)").children("a").addClass("vakata-context-parent"); - if(right_to_left) { - vakata_context.element.addClass("vakata-context-rtl").css("direction", "rtl"); - } - // also apply a RTL class? - vakata_context.element.find("ul").hide().end(); - }); - }); - }($)); - // $.jstree.defaults.plugins.push("contextmenu"); -})); diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/jstree.dnd.js b/mayan/apps/cabinets/static/cabinets/packages/jstree/src/jstree.dnd.js deleted file mode 100644 index a8a4cec2ec..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/jstree.dnd.js +++ /dev/null @@ -1,653 +0,0 @@ -/** - * ### Drag'n'drop plugin - * - * Enables dragging and dropping of nodes in the tree, resulting in a move or copy operations. - */ -/*globals jQuery, define, exports, require, document */ -(function (factory) { - "use strict"; - if (typeof define === 'function' && define.amd) { - define('jstree.dnd', ['jquery','jstree'], factory); - } - else if(typeof exports === 'object') { - factory(require('jquery'), require('jstree')); - } - else { - factory(jQuery, jQuery.jstree); - } -}(function ($, jstree, undefined) { - "use strict"; - - if($.jstree.plugins.dnd) { return; } - - /** - * stores all defaults for the drag'n'drop plugin - * @name $.jstree.defaults.dnd - * @plugin dnd - */ - $.jstree.defaults.dnd = { - /** - * a boolean indicating if a copy should be possible while dragging (by pressint the meta key or Ctrl). Defaults to `true`. - * @name $.jstree.defaults.dnd.copy - * @plugin dnd - */ - copy : true, - /** - * a number indicating how long a node should remain hovered while dragging to be opened. Defaults to `500`. - * @name $.jstree.defaults.dnd.open_timeout - * @plugin dnd - */ - open_timeout : 500, - /** - * a function invoked each time a node is about to be dragged, invoked in the tree's scope and receives the nodes about to be dragged as an argument (array) and the event that started the drag - return `false` to prevent dragging - * @name $.jstree.defaults.dnd.is_draggable - * @plugin dnd - */ - is_draggable : true, - /** - * a boolean indicating if checks should constantly be made while the user is dragging the node (as opposed to checking only on drop), default is `true` - * @name $.jstree.defaults.dnd.check_while_dragging - * @plugin dnd - */ - check_while_dragging : true, - /** - * a boolean indicating if nodes from this tree should only be copied with dnd (as opposed to moved), default is `false` - * @name $.jstree.defaults.dnd.always_copy - * @plugin dnd - */ - always_copy : false, - /** - * when dropping a node "inside", this setting indicates the position the node should go to - it can be an integer or a string: "first" (same as 0) or "last", default is `0` - * @name $.jstree.defaults.dnd.inside_pos - * @plugin dnd - */ - inside_pos : 0, - /** - * when starting the drag on a node that is selected this setting controls if all selected nodes are dragged or only the single node, default is `true`, which means all selected nodes are dragged when the drag is started on a selected node - * @name $.jstree.defaults.dnd.drag_selection - * @plugin dnd - */ - drag_selection : true, - /** - * controls whether dnd works on touch devices. If left as boolean true dnd will work the same as in desktop browsers, which in some cases may impair scrolling. If set to boolean false dnd will not work on touch devices. There is a special third option - string "selected" which means only selected nodes can be dragged on touch devices. - * @name $.jstree.defaults.dnd.touch - * @plugin dnd - */ - touch : true, - /** - * controls whether items can be dropped anywhere on the node, not just on the anchor, by default only the node anchor is a valid drop target. Works best with the wholerow plugin. If enabled on mobile depending on the interface it might be hard for the user to cancel the drop, since the whole tree container will be a valid drop target. - * @name $.jstree.defaults.dnd.large_drop_target - * @plugin dnd - */ - large_drop_target : false, - /** - * controls whether a drag can be initiated from any part of the node and not just the text/icon part, works best with the wholerow plugin. Keep in mind it can cause problems with tree scrolling on mobile depending on the interface - in that case set the touch option to "selected". - * @name $.jstree.defaults.dnd.large_drag_target - * @plugin dnd - */ - large_drag_target : false, - /** - * controls whether use HTML5 dnd api instead of classical. That will allow better integration of dnd events with other HTML5 controls. - * @reference http://caniuse.com/#feat=dragndrop - * @name $.jstree.defaults.dnd.use_html5 - * @plugin dnd - */ - use_html5: false - }; - var drg, elm; - // TODO: now check works by checking for each node individually, how about max_children, unique, etc? - $.jstree.plugins.dnd = function (options, parent) { - this.init = function (el, options) { - parent.init.call(this, el, options); - this.settings.dnd.use_html5 = this.settings.dnd.use_html5 && ('draggable' in document.createElement('span')); - }; - this.bind = function () { - parent.bind.call(this); - - this.element - .on(this.settings.dnd.use_html5 ? 'dragstart.jstree' : 'mousedown.jstree touchstart.jstree', this.settings.dnd.large_drag_target ? '.jstree-node' : '.jstree-anchor', $.proxy(function (e) { - if(this.settings.dnd.large_drag_target && $(e.target).closest('.jstree-node')[0] !== e.currentTarget) { - return true; - } - if(e.type === "touchstart" && (!this.settings.dnd.touch || (this.settings.dnd.touch === 'selected' && !$(e.currentTarget).closest('.jstree-node').children('.jstree-anchor').hasClass('jstree-clicked')))) { - return true; - } - var obj = this.get_node(e.target), - mlt = this.is_selected(obj) && this.settings.dnd.drag_selection ? this.get_top_selected().length : 1, - txt = (mlt > 1 ? mlt + ' ' + this.get_string('nodes') : this.get_text(e.currentTarget)); - if(this.settings.core.force_text) { - txt = $.vakata.html.escape(txt); - } - if(obj && obj.id && obj.id !== $.jstree.root && (e.which === 1 || e.type === "touchstart" || e.type === "dragstart") && - (this.settings.dnd.is_draggable === true || ($.isFunction(this.settings.dnd.is_draggable) && this.settings.dnd.is_draggable.call(this, (mlt > 1 ? this.get_top_selected(true) : [obj]), e))) - ) { - drg = { 'jstree' : true, 'origin' : this, 'obj' : this.get_node(obj,true), 'nodes' : mlt > 1 ? this.get_top_selected() : [obj.id] }; - elm = e.currentTarget; - if (this.settings.dnd.use_html5) { - $.vakata.dnd._trigger('start', e, { 'helper': $(), 'element': elm, 'data': drg }); - } else { - this.element.trigger('mousedown.jstree'); - return $.vakata.dnd.start(e, drg, '
          ' + txt + '
          '); - } - } - }, this)); - if (this.settings.dnd.use_html5) { - this.element - .on('dragover.jstree', function (e) { - e.preventDefault(); - $.vakata.dnd._trigger('move', e, { 'helper': $(), 'element': elm, 'data': drg }); - return false; - }) - //.on('dragenter.jstree', this.settings.dnd.large_drop_target ? '.jstree-node' : '.jstree-anchor', $.proxy(function (e) { - // e.preventDefault(); - // $.vakata.dnd._trigger('move', e, { 'helper': $(), 'element': elm, 'data': drg }); - // return false; - // }, this)) - .on('drop.jstree', $.proxy(function (e) { - e.preventDefault(); - $.vakata.dnd._trigger('stop', e, { 'helper': $(), 'element': elm, 'data': drg }); - return false; - }, this)); - } - }; - this.redraw_node = function(obj, deep, callback, force_render) { - obj = parent.redraw_node.apply(this, arguments); - if (obj && this.settings.dnd.use_html5) { - if (this.settings.dnd.large_drag_target) { - obj.setAttribute('draggable', true); - } else { - var i, j, tmp = null; - for(i = 0, j = obj.childNodes.length; i < j; i++) { - if(obj.childNodes[i] && obj.childNodes[i].className && obj.childNodes[i].className.indexOf("jstree-anchor") !== -1) { - tmp = obj.childNodes[i]; - break; - } - } - if(tmp) { - tmp.setAttribute('draggable', true); - } - } - } - return obj; - }; - }; - - $(function() { - // bind only once for all instances - var lastmv = false, - laster = false, - lastev = false, - opento = false, - marker = $('
           
          ').hide(); //.appendTo('body'); - - $(document) - .on('dnd_start.vakata.jstree', function (e, data) { - lastmv = false; - lastev = false; - if(!data || !data.data || !data.data.jstree) { return; } - marker.appendTo('body'); //.show(); - }) - .on('dnd_move.vakata.jstree', function (e, data) { - if(opento) { - if (!data.event || data.event.type !== 'dragover' || data.event.target !== lastev.target) { - clearTimeout(opento); - } - } - if(!data || !data.data || !data.data.jstree) { return; } - - // if we are hovering the marker image do nothing (can happen on "inside" drags) - if(data.event.target.id && data.event.target.id === 'jstree-marker') { - return; - } - lastev = data.event; - - var ins = $.jstree.reference(data.event.target), - ref = false, - off = false, - rel = false, - tmp, l, t, h, p, i, o, ok, t1, t2, op, ps, pr, ip, tm, is_copy, pn; - // if we are over an instance - if(ins && ins._data && ins._data.dnd) { - marker.attr('class', 'jstree-' + ins.get_theme() + ( ins.settings.core.themes.responsive ? ' jstree-dnd-responsive' : '' )); - is_copy = data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (data.event.metaKey || data.event.ctrlKey))); - data.helper - .children().attr('class', 'jstree-' + ins.get_theme() + ' jstree-' + ins.get_theme() + '-' + ins.get_theme_variant() + ' ' + ( ins.settings.core.themes.responsive ? ' jstree-dnd-responsive' : '' )) - .find('.jstree-copy').first()[ is_copy ? 'show' : 'hide' ](); - - // if are hovering the container itself add a new root node - //console.log(data.event); - if( (data.event.target === ins.element[0] || data.event.target === ins.get_container_ul()[0]) && ins.get_container_ul().children().length === 0) { - ok = true; - for(t1 = 0, t2 = data.data.nodes.length; t1 < t2; t1++) { - ok = ok && ins.check( (data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (data.event.metaKey || data.event.ctrlKey)) ) ? "copy_node" : "move_node"), (data.data.origin && data.data.origin !== ins ? data.data.origin.get_node(data.data.nodes[t1]) : data.data.nodes[t1]), $.jstree.root, 'last', { 'dnd' : true, 'ref' : ins.get_node($.jstree.root), 'pos' : 'i', 'origin' : data.data.origin, 'is_multi' : (data.data.origin && data.data.origin !== ins), 'is_foreign' : (!data.data.origin) }); - if(!ok) { break; } - } - if(ok) { - lastmv = { 'ins' : ins, 'par' : $.jstree.root, 'pos' : 'last' }; - marker.hide(); - data.helper.find('.jstree-icon').first().removeClass('jstree-er').addClass('jstree-ok'); - if (data.event.originalEvent && data.event.originalEvent.dataTransfer) { - data.event.originalEvent.dataTransfer.dropEffect = is_copy ? 'copy' : 'move'; - } - return; - } - } - else { - // if we are hovering a tree node - ref = ins.settings.dnd.large_drop_target ? $(data.event.target).closest('.jstree-node').children('.jstree-anchor') : $(data.event.target).closest('.jstree-anchor'); - if(ref && ref.length && ref.parent().is('.jstree-closed, .jstree-open, .jstree-leaf')) { - off = ref.offset(); - rel = (data.event.pageY !== undefined ? data.event.pageY : data.event.originalEvent.pageY) - off.top; - h = ref.outerHeight(); - if(rel < h / 3) { - o = ['b', 'i', 'a']; - } - else if(rel > h - h / 3) { - o = ['a', 'i', 'b']; - } - else { - o = rel > h / 2 ? ['i', 'a', 'b'] : ['i', 'b', 'a']; - } - $.each(o, function (j, v) { - switch(v) { - case 'b': - l = off.left - 6; - t = off.top; - p = ins.get_parent(ref); - i = ref.parent().index(); - break; - case 'i': - ip = ins.settings.dnd.inside_pos; - tm = ins.get_node(ref.parent()); - l = off.left - 2; - t = off.top + h / 2 + 1; - p = tm.id; - i = ip === 'first' ? 0 : (ip === 'last' ? tm.children.length : Math.min(ip, tm.children.length)); - break; - case 'a': - l = off.left - 6; - t = off.top + h; - p = ins.get_parent(ref); - i = ref.parent().index() + 1; - break; - } - ok = true; - for(t1 = 0, t2 = data.data.nodes.length; t1 < t2; t1++) { - op = data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (data.event.metaKey || data.event.ctrlKey))) ? "copy_node" : "move_node"; - ps = i; - if(op === "move_node" && v === 'a' && (data.data.origin && data.data.origin === ins) && p === ins.get_parent(data.data.nodes[t1])) { - pr = ins.get_node(p); - if(ps > $.inArray(data.data.nodes[t1], pr.children)) { - ps -= 1; - } - } - ok = ok && ( (ins && ins.settings && ins.settings.dnd && ins.settings.dnd.check_while_dragging === false) || ins.check(op, (data.data.origin && data.data.origin !== ins ? data.data.origin.get_node(data.data.nodes[t1]) : data.data.nodes[t1]), p, ps, { 'dnd' : true, 'ref' : ins.get_node(ref.parent()), 'pos' : v, 'origin' : data.data.origin, 'is_multi' : (data.data.origin && data.data.origin !== ins), 'is_foreign' : (!data.data.origin) }) ); - if(!ok) { - if(ins && ins.last_error) { laster = ins.last_error(); } - break; - } - } - if(v === 'i' && ref.parent().is('.jstree-closed') && ins.settings.dnd.open_timeout) { - opento = setTimeout((function (x, z) { return function () { x.open_node(z); }; }(ins, ref)), ins.settings.dnd.open_timeout); - } - if(ok) { - pn = ins.get_node(p, true); - if (!pn.hasClass('.jstree-dnd-parent')) { - $('.jstree-dnd-parent').removeClass('jstree-dnd-parent'); - pn.addClass('jstree-dnd-parent'); - } - lastmv = { 'ins' : ins, 'par' : p, 'pos' : v === 'i' && ip === 'last' && i === 0 && !ins.is_loaded(tm) ? 'last' : i }; - marker.css({ 'left' : l + 'px', 'top' : t + 'px' }).show(); - data.helper.find('.jstree-icon').first().removeClass('jstree-er').addClass('jstree-ok'); - if (data.event.originalEvent && data.event.originalEvent.dataTransfer) { - data.event.originalEvent.dataTransfer.dropEffect = is_copy ? 'copy' : 'move'; - } - laster = {}; - o = true; - return false; - } - }); - if(o === true) { return; } - } - } - } - $('.jstree-dnd-parent').removeClass('jstree-dnd-parent'); - lastmv = false; - data.helper.find('.jstree-icon').removeClass('jstree-ok').addClass('jstree-er'); - if (data.event.originalEvent && data.event.originalEvent.dataTransfer) { - data.event.originalEvent.dataTransfer.dropEffect = 'none'; - } - marker.hide(); - }) - .on('dnd_scroll.vakata.jstree', function (e, data) { - if(!data || !data.data || !data.data.jstree) { return; } - marker.hide(); - lastmv = false; - lastev = false; - data.helper.find('.jstree-icon').first().removeClass('jstree-ok').addClass('jstree-er'); - }) - .on('dnd_stop.vakata.jstree', function (e, data) { - $('.jstree-dnd-parent').removeClass('jstree-dnd-parent'); - if(opento) { clearTimeout(opento); } - if(!data || !data.data || !data.data.jstree) { return; } - marker.hide().detach(); - var i, j, nodes = []; - if(lastmv) { - for(i = 0, j = data.data.nodes.length; i < j; i++) { - nodes[i] = data.data.origin ? data.data.origin.get_node(data.data.nodes[i]) : data.data.nodes[i]; - } - lastmv.ins[ data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (data.event.metaKey || data.event.ctrlKey))) ? 'copy_node' : 'move_node' ](nodes, lastmv.par, lastmv.pos, false, false, false, data.data.origin); - } - else { - i = $(data.event.target).closest('.jstree'); - if(i.length && laster && laster.error && laster.error === 'check') { - i = i.jstree(true); - if(i) { - i.settings.core.error.call(this, laster); - } - } - } - lastev = false; - lastmv = false; - }) - .on('keyup.jstree keydown.jstree', function (e, data) { - data = $.vakata.dnd._get(); - if(data && data.data && data.data.jstree) { - if (e.type === "keyup" && e.which === 27) { - if (opento) { clearTimeout(opento); } - lastmv = false; - laster = false; - lastev = false; - opento = false; - marker.hide().detach(); - $.vakata.dnd._clean(); - } else { - data.helper.find('.jstree-copy').first()[ data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (e.metaKey || e.ctrlKey))) ? 'show' : 'hide' ](); - if(lastev) { - lastev.metaKey = e.metaKey; - lastev.ctrlKey = e.ctrlKey; - $.vakata.dnd._trigger('move', lastev); - } - } - } - }); - }); - - // helpers - (function ($) { - $.vakata.html = { - div : $('
          '), - escape : function (str) { - return $.vakata.html.div.text(str).html(); - }, - strip : function (str) { - return $.vakata.html.div.empty().append($.parseHTML(str)).text(); - } - }; - // private variable - var vakata_dnd = { - element : false, - target : false, - is_down : false, - is_drag : false, - helper : false, - helper_w: 0, - data : false, - init_x : 0, - init_y : 0, - scroll_l: 0, - scroll_t: 0, - scroll_e: false, - scroll_i: false, - is_touch: false - }; - $.vakata.dnd = { - settings : { - scroll_speed : 10, - scroll_proximity : 20, - helper_left : 5, - helper_top : 10, - threshold : 5, - threshold_touch : 50 - }, - _trigger : function (event_name, e, data) { - if (data === undefined) { - data = $.vakata.dnd._get(); - } - data.event = e; - $(document).triggerHandler("dnd_" + event_name + ".vakata", data); - }, - _get : function () { - return { - "data" : vakata_dnd.data, - "element" : vakata_dnd.element, - "helper" : vakata_dnd.helper - }; - }, - _clean : function () { - if(vakata_dnd.helper) { vakata_dnd.helper.remove(); } - if(vakata_dnd.scroll_i) { clearInterval(vakata_dnd.scroll_i); vakata_dnd.scroll_i = false; } - vakata_dnd = { - element : false, - target : false, - is_down : false, - is_drag : false, - helper : false, - helper_w: 0, - data : false, - init_x : 0, - init_y : 0, - scroll_l: 0, - scroll_t: 0, - scroll_e: false, - scroll_i: false, - is_touch: false - }; - $(document).off("mousemove.vakata.jstree touchmove.vakata.jstree", $.vakata.dnd.drag); - $(document).off("mouseup.vakata.jstree touchend.vakata.jstree", $.vakata.dnd.stop); - }, - _scroll : function (init_only) { - if(!vakata_dnd.scroll_e || (!vakata_dnd.scroll_l && !vakata_dnd.scroll_t)) { - if(vakata_dnd.scroll_i) { clearInterval(vakata_dnd.scroll_i); vakata_dnd.scroll_i = false; } - return false; - } - if(!vakata_dnd.scroll_i) { - vakata_dnd.scroll_i = setInterval($.vakata.dnd._scroll, 100); - return false; - } - if(init_only === true) { return false; } - - var i = vakata_dnd.scroll_e.scrollTop(), - j = vakata_dnd.scroll_e.scrollLeft(); - vakata_dnd.scroll_e.scrollTop(i + vakata_dnd.scroll_t * $.vakata.dnd.settings.scroll_speed); - vakata_dnd.scroll_e.scrollLeft(j + vakata_dnd.scroll_l * $.vakata.dnd.settings.scroll_speed); - if(i !== vakata_dnd.scroll_e.scrollTop() || j !== vakata_dnd.scroll_e.scrollLeft()) { - /** - * triggered on the document when a drag causes an element to scroll - * @event - * @plugin dnd - * @name dnd_scroll.vakata - * @param {Mixed} data any data supplied with the call to $.vakata.dnd.start - * @param {DOM} element the DOM element being dragged - * @param {jQuery} helper the helper shown next to the mouse - * @param {jQuery} event the element that is scrolling - */ - $.vakata.dnd._trigger("scroll", vakata_dnd.scroll_e); - } - }, - start : function (e, data, html) { - if(e.type === "touchstart" && e.originalEvent && e.originalEvent.changedTouches && e.originalEvent.changedTouches[0]) { - e.pageX = e.originalEvent.changedTouches[0].pageX; - e.pageY = e.originalEvent.changedTouches[0].pageY; - e.target = document.elementFromPoint(e.originalEvent.changedTouches[0].pageX - window.pageXOffset, e.originalEvent.changedTouches[0].pageY - window.pageYOffset); - } - if(vakata_dnd.is_drag) { $.vakata.dnd.stop({}); } - try { - e.currentTarget.unselectable = "on"; - e.currentTarget.onselectstart = function() { return false; }; - if(e.currentTarget.style) { - e.currentTarget.style.touchAction = "none"; - e.currentTarget.style.msTouchAction = "none"; - e.currentTarget.style.MozUserSelect = "none"; - } - } catch(ignore) { } - vakata_dnd.init_x = e.pageX; - vakata_dnd.init_y = e.pageY; - vakata_dnd.data = data; - vakata_dnd.is_down = true; - vakata_dnd.element = e.currentTarget; - vakata_dnd.target = e.target; - vakata_dnd.is_touch = e.type === "touchstart"; - if(html !== false) { - vakata_dnd.helper = $("
          ").html(html).css({ - "display" : "block", - "margin" : "0", - "padding" : "0", - "position" : "absolute", - "top" : "-2000px", - "lineHeight" : "16px", - "zIndex" : "10000" - }); - } - $(document).on("mousemove.vakata.jstree touchmove.vakata.jstree", $.vakata.dnd.drag); - $(document).on("mouseup.vakata.jstree touchend.vakata.jstree", $.vakata.dnd.stop); - return false; - }, - drag : function (e) { - if(e.type === "touchmove" && e.originalEvent && e.originalEvent.changedTouches && e.originalEvent.changedTouches[0]) { - e.pageX = e.originalEvent.changedTouches[0].pageX; - e.pageY = e.originalEvent.changedTouches[0].pageY; - e.target = document.elementFromPoint(e.originalEvent.changedTouches[0].pageX - window.pageXOffset, e.originalEvent.changedTouches[0].pageY - window.pageYOffset); - } - if(!vakata_dnd.is_down) { return; } - if(!vakata_dnd.is_drag) { - if( - Math.abs(e.pageX - vakata_dnd.init_x) > (vakata_dnd.is_touch ? $.vakata.dnd.settings.threshold_touch : $.vakata.dnd.settings.threshold) || - Math.abs(e.pageY - vakata_dnd.init_y) > (vakata_dnd.is_touch ? $.vakata.dnd.settings.threshold_touch : $.vakata.dnd.settings.threshold) - ) { - if(vakata_dnd.helper) { - vakata_dnd.helper.appendTo("body"); - vakata_dnd.helper_w = vakata_dnd.helper.outerWidth(); - } - vakata_dnd.is_drag = true; - $(vakata_dnd.target).one('click.vakata', false); - /** - * triggered on the document when a drag starts - * @event - * @plugin dnd - * @name dnd_start.vakata - * @param {Mixed} data any data supplied with the call to $.vakata.dnd.start - * @param {DOM} element the DOM element being dragged - * @param {jQuery} helper the helper shown next to the mouse - * @param {Object} event the event that caused the start (probably mousemove) - */ - $.vakata.dnd._trigger("start", e); - } - else { return; } - } - - var d = false, w = false, - dh = false, wh = false, - dw = false, ww = false, - dt = false, dl = false, - ht = false, hl = false; - - vakata_dnd.scroll_t = 0; - vakata_dnd.scroll_l = 0; - vakata_dnd.scroll_e = false; - $($(e.target).parentsUntil("body").addBack().get().reverse()) - .filter(function () { - return (/^auto|scroll$/).test($(this).css("overflow")) && - (this.scrollHeight > this.offsetHeight || this.scrollWidth > this.offsetWidth); - }) - .each(function () { - var t = $(this), o = t.offset(); - if(this.scrollHeight > this.offsetHeight) { - if(o.top + t.height() - e.pageY < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_t = 1; } - if(e.pageY - o.top < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_t = -1; } - } - if(this.scrollWidth > this.offsetWidth) { - if(o.left + t.width() - e.pageX < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_l = 1; } - if(e.pageX - o.left < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_l = -1; } - } - if(vakata_dnd.scroll_t || vakata_dnd.scroll_l) { - vakata_dnd.scroll_e = $(this); - return false; - } - }); - - if(!vakata_dnd.scroll_e) { - d = $(document); w = $(window); - dh = d.height(); wh = w.height(); - dw = d.width(); ww = w.width(); - dt = d.scrollTop(); dl = d.scrollLeft(); - if(dh > wh && e.pageY - dt < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_t = -1; } - if(dh > wh && wh - (e.pageY - dt) < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_t = 1; } - if(dw > ww && e.pageX - dl < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_l = -1; } - if(dw > ww && ww - (e.pageX - dl) < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_l = 1; } - if(vakata_dnd.scroll_t || vakata_dnd.scroll_l) { - vakata_dnd.scroll_e = d; - } - } - if(vakata_dnd.scroll_e) { $.vakata.dnd._scroll(true); } - - if(vakata_dnd.helper) { - ht = parseInt(e.pageY + $.vakata.dnd.settings.helper_top, 10); - hl = parseInt(e.pageX + $.vakata.dnd.settings.helper_left, 10); - if(dh && ht + 25 > dh) { ht = dh - 50; } - if(dw && hl + vakata_dnd.helper_w > dw) { hl = dw - (vakata_dnd.helper_w + 2); } - vakata_dnd.helper.css({ - left : hl + "px", - top : ht + "px" - }); - } - /** - * triggered on the document when a drag is in progress - * @event - * @plugin dnd - * @name dnd_move.vakata - * @param {Mixed} data any data supplied with the call to $.vakata.dnd.start - * @param {DOM} element the DOM element being dragged - * @param {jQuery} helper the helper shown next to the mouse - * @param {Object} event the event that caused this to trigger (most likely mousemove) - */ - $.vakata.dnd._trigger("move", e); - return false; - }, - stop : function (e) { - if(e.type === "touchend" && e.originalEvent && e.originalEvent.changedTouches && e.originalEvent.changedTouches[0]) { - e.pageX = e.originalEvent.changedTouches[0].pageX; - e.pageY = e.originalEvent.changedTouches[0].pageY; - e.target = document.elementFromPoint(e.originalEvent.changedTouches[0].pageX - window.pageXOffset, e.originalEvent.changedTouches[0].pageY - window.pageYOffset); - } - if(vakata_dnd.is_drag) { - /** - * triggered on the document when a drag stops (the dragged element is dropped) - * @event - * @plugin dnd - * @name dnd_stop.vakata - * @param {Mixed} data any data supplied with the call to $.vakata.dnd.start - * @param {DOM} element the DOM element being dragged - * @param {jQuery} helper the helper shown next to the mouse - * @param {Object} event the event that caused the stop - */ - if (e.target !== vakata_dnd.target) { - $(vakata_dnd.target).off('click.vakata'); - } - $.vakata.dnd._trigger("stop", e); - } - else { - if(e.type === "touchend" && e.target === vakata_dnd.target) { - var to = setTimeout(function () { $(e.target).click(); }, 100); - $(e.target).one('click', function() { if(to) { clearTimeout(to); } }); - } - } - $.vakata.dnd._clean(); - return false; - } - }; - }($)); - - // include the dnd plugin by default - // $.jstree.defaults.plugins.push("dnd"); -})); diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/jstree.js b/mayan/apps/cabinets/static/cabinets/packages/jstree/src/jstree.js deleted file mode 100644 index a867704590..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/jstree.js +++ /dev/null @@ -1,4810 +0,0 @@ -/*! - * jsTree {{VERSION}} - * http://jstree.com/ - * - * Copyright (c) 2014 Ivan Bozhanov (http://vakata.com) - * - * Licensed same as jquery - under the terms of the MIT License - * http://www.opensource.org/licenses/mit-license.php - */ -/*! - * if using jslint please allow for the jQuery global and use following options: - * jslint: loopfunc: true, browser: true, ass: true, bitwise: true, continue: true, nomen: true, plusplus: true, regexp: true, unparam: true, todo: true, white: true - */ -/*jshint -W083 */ -/*globals jQuery, define, module, exports, require, window, document, postMessage */ -(function (factory) { - "use strict"; - if (typeof define === 'function' && define.amd) { - define(['jquery'], factory); - } - else if(typeof module !== 'undefined' && module.exports) { - module.exports = factory(require('jquery')); - } - else { - factory(jQuery); - } -}(function ($, undefined) { - "use strict"; - - // prevent another load? maybe there is a better way? - if($.jstree) { - return; - } - - /** - * ### jsTree core functionality - */ - - // internal variables - var instance_counter = 0, - ccp_node = false, - ccp_mode = false, - ccp_inst = false, - themes_loaded = [], - src = $('script:last').attr('src'), - document = window.document; // local variable is always faster to access then a global - - /** - * holds all jstree related functions and variables, including the actual class and methods to create, access and manipulate instances. - * @name $.jstree - */ - $.jstree = { - /** - * specifies the jstree version in use - * @name $.jstree.version - */ - version : '{{VERSION}}', - /** - * holds all the default options used when creating new instances - * @name $.jstree.defaults - */ - defaults : { - /** - * configure which plugins will be active on an instance. Should be an array of strings, where each element is a plugin name. The default is `[]` - * @name $.jstree.defaults.plugins - */ - plugins : [] - }, - /** - * stores all loaded jstree plugins (used internally) - * @name $.jstree.plugins - */ - plugins : {}, - path : src && src.indexOf('/') !== -1 ? src.replace(/\/[^\/]+$/,'') : '', - idregex : /[\\:&!^|()\[\]<>@*'+~#";.,=\- \/${}%?`]/g, - root : '#' - }; - - /** - * creates a jstree instance - * @name $.jstree.create(el [, options]) - * @param {DOMElement|jQuery|String} el the element to create the instance on, can be jQuery extended or a selector - * @param {Object} options options for this instance (extends `$.jstree.defaults`) - * @return {jsTree} the new instance - */ - $.jstree.create = function (el, options) { - var tmp = new $.jstree.core(++instance_counter), - opt = options; - options = $.extend(true, {}, $.jstree.defaults, options); - if(opt && opt.plugins) { - options.plugins = opt.plugins; - } - $.each(options.plugins, function (i, k) { - if(i !== 'core') { - tmp = tmp.plugin(k, options[k]); - } - }); - $(el).data('jstree', tmp); - tmp.init(el, options); - return tmp; - }; - /** - * remove all traces of jstree from the DOM and destroy all instances - * @name $.jstree.destroy() - */ - $.jstree.destroy = function () { - $('.jstree:jstree').jstree('destroy'); - $(document).off('.jstree'); - }; - /** - * the jstree class constructor, used only internally - * @private - * @name $.jstree.core(id) - * @param {Number} id this instance's index - */ - $.jstree.core = function (id) { - this._id = id; - this._cnt = 0; - this._wrk = null; - this._data = { - core : { - themes : { - name : false, - dots : false, - icons : false, - ellipsis : false - }, - selected : [], - last_error : {}, - working : false, - worker_queue : [], - focused : null - } - }; - }; - /** - * get a reference to an existing instance - * - * __Examples__ - * - * // provided a container with an ID of "tree", and a nested node with an ID of "branch" - * // all of there will return the same instance - * $.jstree.reference('tree'); - * $.jstree.reference('#tree'); - * $.jstree.reference($('#tree')); - * $.jstree.reference(document.getElementByID('tree')); - * $.jstree.reference('branch'); - * $.jstree.reference('#branch'); - * $.jstree.reference($('#branch')); - * $.jstree.reference(document.getElementByID('branch')); - * - * @name $.jstree.reference(needle) - * @param {DOMElement|jQuery|String} needle - * @return {jsTree|null} the instance or `null` if not found - */ - $.jstree.reference = function (needle) { - var tmp = null, - obj = null; - if(needle && needle.id && (!needle.tagName || !needle.nodeType)) { needle = needle.id; } - - if(!obj || !obj.length) { - try { obj = $(needle); } catch (ignore) { } - } - if(!obj || !obj.length) { - try { obj = $('#' + needle.replace($.jstree.idregex,'\\$&')); } catch (ignore) { } - } - if(obj && obj.length && (obj = obj.closest('.jstree')).length && (obj = obj.data('jstree'))) { - tmp = obj; - } - else { - $('.jstree').each(function () { - var inst = $(this).data('jstree'); - if(inst && inst._model.data[needle]) { - tmp = inst; - return false; - } - }); - } - return tmp; - }; - /** - * Create an instance, get an instance or invoke a command on a instance. - * - * If there is no instance associated with the current node a new one is created and `arg` is used to extend `$.jstree.defaults` for this new instance. There would be no return value (chaining is not broken). - * - * If there is an existing instance and `arg` is a string the command specified by `arg` is executed on the instance, with any additional arguments passed to the function. If the function returns a value it will be returned (chaining could break depending on function). - * - * If there is an existing instance and `arg` is not a string the instance itself is returned (similar to `$.jstree.reference`). - * - * In any other case - nothing is returned and chaining is not broken. - * - * __Examples__ - * - * $('#tree1').jstree(); // creates an instance - * $('#tree2').jstree({ plugins : [] }); // create an instance with some options - * $('#tree1').jstree('open_node', '#branch_1'); // call a method on an existing instance, passing additional arguments - * $('#tree2').jstree(); // get an existing instance (or create an instance) - * $('#tree2').jstree(true); // get an existing instance (will not create new instance) - * $('#branch_1').jstree().select_node('#branch_1'); // get an instance (using a nested element and call a method) - * - * @name $().jstree([arg]) - * @param {String|Object} arg - * @return {Mixed} - */ - $.fn.jstree = function (arg) { - // check for string argument - var is_method = (typeof arg === 'string'), - args = Array.prototype.slice.call(arguments, 1), - result = null; - if(arg === true && !this.length) { return false; } - this.each(function () { - // get the instance (if there is one) and method (if it exists) - var instance = $.jstree.reference(this), - method = is_method && instance ? instance[arg] : null; - // if calling a method, and method is available - execute on the instance - result = is_method && method ? - method.apply(instance, args) : - null; - // if there is no instance and no method is being called - create one - if(!instance && !is_method && (arg === undefined || $.isPlainObject(arg))) { - $.jstree.create(this, arg); - } - // if there is an instance and no method is called - return the instance - if( (instance && !is_method) || arg === true ) { - result = instance || false; - } - // if there was a method call which returned a result - break and return the value - if(result !== null && result !== undefined) { - return false; - } - }); - // if there was a method call with a valid return value - return that, otherwise continue the chain - return result !== null && result !== undefined ? - result : this; - }; - /** - * used to find elements containing an instance - * - * __Examples__ - * - * $('div:jstree').each(function () { - * $(this).jstree('destroy'); - * }); - * - * @name $(':jstree') - * @return {jQuery} - */ - $.expr.pseudos.jstree = $.expr.createPseudo(function(search) { - return function(a) { - return $(a).hasClass('jstree') && - $(a).data('jstree') !== undefined; - }; - }); - - /** - * stores all defaults for the core - * @name $.jstree.defaults.core - */ - $.jstree.defaults.core = { - /** - * data configuration - * - * If left as `false` the HTML inside the jstree container element is used to populate the tree (that should be an unordered list with list items). - * - * You can also pass in a HTML string or a JSON array here. - * - * It is possible to pass in a standard jQuery-like AJAX config and jstree will automatically determine if the response is JSON or HTML and use that to populate the tree. - * In addition to the standard jQuery ajax options here you can suppy functions for `data` and `url`, the functions will be run in the current instance's scope and a param will be passed indicating which node is being loaded, the return value of those functions will be used. - * - * The last option is to specify a function, that function will receive the node being loaded as argument and a second param which is a function which should be called with the result. - * - * __Examples__ - * - * // AJAX - * $('#tree').jstree({ - * 'core' : { - * 'data' : { - * 'url' : '/get/children/', - * 'data' : function (node) { - * return { 'id' : node.id }; - * } - * } - * }); - * - * // direct data - * $('#tree').jstree({ - * 'core' : { - * 'data' : [ - * 'Simple root node', - * { - * 'id' : 'node_2', - * 'text' : 'Root node with options', - * 'state' : { 'opened' : true, 'selected' : true }, - * 'children' : [ { 'text' : 'Child 1' }, 'Child 2'] - * } - * ] - * } - * }); - * - * // function - * $('#tree').jstree({ - * 'core' : { - * 'data' : function (obj, callback) { - * callback.call(this, ['Root 1', 'Root 2']); - * } - * }); - * - * @name $.jstree.defaults.core.data - */ - data : false, - /** - * configure the various strings used throughout the tree - * - * You can use an object where the key is the string you need to replace and the value is your replacement. - * Another option is to specify a function which will be called with an argument of the needed string and should return the replacement. - * If left as `false` no replacement is made. - * - * __Examples__ - * - * $('#tree').jstree({ - * 'core' : { - * 'strings' : { - * 'Loading ...' : 'Please wait ...' - * } - * } - * }); - * - * @name $.jstree.defaults.core.strings - */ - strings : false, - /** - * determines what happens when a user tries to modify the structure of the tree - * If left as `false` all operations like create, rename, delete, move or copy are prevented. - * You can set this to `true` to allow all interactions or use a function to have better control. - * - * __Examples__ - * - * $('#tree').jstree({ - * 'core' : { - * 'check_callback' : function (operation, node, node_parent, node_position, more) { - * // operation can be 'create_node', 'rename_node', 'delete_node', 'move_node' or 'copy_node' - * // in case of 'rename_node' node_position is filled with the new node name - * return operation === 'rename_node' ? true : false; - * } - * } - * }); - * - * @name $.jstree.defaults.core.check_callback - */ - check_callback : false, - /** - * a callback called with a single object parameter in the instance's scope when something goes wrong (operation prevented, ajax failed, etc) - * @name $.jstree.defaults.core.error - */ - error : $.noop, - /** - * the open / close animation duration in milliseconds - set this to `false` to disable the animation (default is `200`) - * @name $.jstree.defaults.core.animation - */ - animation : 200, - /** - * a boolean indicating if multiple nodes can be selected - * @name $.jstree.defaults.core.multiple - */ - multiple : true, - /** - * theme configuration object - * @name $.jstree.defaults.core.themes - */ - themes : { - /** - * the name of the theme to use (if left as `false` the default theme is used) - * @name $.jstree.defaults.core.themes.name - */ - name : false, - /** - * the URL of the theme's CSS file, leave this as `false` if you have manually included the theme CSS (recommended). You can set this to `true` too which will try to autoload the theme. - * @name $.jstree.defaults.core.themes.url - */ - url : false, - /** - * the location of all jstree themes - only used if `url` is set to `true` - * @name $.jstree.defaults.core.themes.dir - */ - dir : false, - /** - * a boolean indicating if connecting dots are shown - * @name $.jstree.defaults.core.themes.dots - */ - dots : true, - /** - * a boolean indicating if node icons are shown - * @name $.jstree.defaults.core.themes.icons - */ - icons : true, - /** - * a boolean indicating if node ellipsis should be shown - this only works with a fixed with on the container - * @name $.jstree.defaults.core.themes.ellipsis - */ - ellipsis : false, - /** - * a boolean indicating if the tree background is striped - * @name $.jstree.defaults.core.themes.stripes - */ - stripes : false, - /** - * a string (or boolean `false`) specifying the theme variant to use (if the theme supports variants) - * @name $.jstree.defaults.core.themes.variant - */ - variant : false, - /** - * a boolean specifying if a reponsive version of the theme should kick in on smaller screens (if the theme supports it). Defaults to `false`. - * @name $.jstree.defaults.core.themes.responsive - */ - responsive : false - }, - /** - * if left as `true` all parents of all selected nodes will be opened once the tree loads (so that all selected nodes are visible to the user) - * @name $.jstree.defaults.core.expand_selected_onload - */ - expand_selected_onload : true, - /** - * if left as `true` web workers will be used to parse incoming JSON data where possible, so that the UI will not be blocked by large requests. Workers are however about 30% slower. Defaults to `true` - * @name $.jstree.defaults.core.worker - */ - worker : true, - /** - * Force node text to plain text (and escape HTML). Defaults to `false` - * @name $.jstree.defaults.core.force_text - */ - force_text : false, - /** - * Should the node should be toggled if the text is double clicked . Defaults to `true` - * @name $.jstree.defaults.core.dblclick_toggle - */ - dblclick_toggle : true - }; - $.jstree.core.prototype = { - /** - * used to decorate an instance with a plugin. Used internally. - * @private - * @name plugin(deco [, opts]) - * @param {String} deco the plugin to decorate with - * @param {Object} opts options for the plugin - * @return {jsTree} - */ - plugin : function (deco, opts) { - var Child = $.jstree.plugins[deco]; - if(Child) { - this._data[deco] = {}; - Child.prototype = this; - return new Child(opts, this); - } - return this; - }, - /** - * initialize the instance. Used internally. - * @private - * @name init(el, optons) - * @param {DOMElement|jQuery|String} el the element we are transforming - * @param {Object} options options for this instance - * @trigger init.jstree, loading.jstree, loaded.jstree, ready.jstree, changed.jstree - */ - init : function (el, options) { - this._model = { - data : {}, - changed : [], - force_full_redraw : false, - redraw_timeout : false, - default_state : { - loaded : true, - opened : false, - selected : false, - disabled : false - } - }; - this._model.data[$.jstree.root] = { - id : $.jstree.root, - parent : null, - parents : [], - children : [], - children_d : [], - state : { loaded : false } - }; - - this.element = $(el).addClass('jstree jstree-' + this._id); - this.settings = options; - - this._data.core.ready = false; - this._data.core.loaded = false; - this._data.core.rtl = (this.element.css("direction") === "rtl"); - this.element[this._data.core.rtl ? 'addClass' : 'removeClass']("jstree-rtl"); - this.element.attr('role','tree'); - if(this.settings.core.multiple) { - this.element.attr('aria-multiselectable', true); - } - if(!this.element.attr('tabindex')) { - this.element.attr('tabindex','0'); - } - - this.bind(); - /** - * triggered after all events are bound - * @event - * @name init.jstree - */ - this.trigger("init"); - - this._data.core.original_container_html = this.element.find(" > ul > li").clone(true); - this._data.core.original_container_html - .find("li").addBack() - .contents().filter(function() { - return this.nodeType === 3 && (!this.nodeValue || /^\s+$/.test(this.nodeValue)); - }) - .remove(); - this.element.html("<"+"ul class='jstree-container-ul jstree-children' role='group'><"+"li id='j"+this._id+"_loading' class='jstree-initial-node jstree-loading jstree-leaf jstree-last' role='tree-item'><"+"a class='jstree-anchor' href='#'>" + this.get_string("Loading ...") + "
        • "); - this.element.attr('aria-activedescendant','j' + this._id + '_loading'); - this._data.core.li_height = this.get_container_ul().children("li").first().height() || 24; - this._data.core.node = this._create_prototype_node(); - /** - * triggered after the loading text is shown and before loading starts - * @event - * @name loading.jstree - */ - this.trigger("loading"); - this.load_node($.jstree.root); - }, - /** - * destroy an instance - * @name destroy() - * @param {Boolean} keep_html if not set to `true` the container will be emptied, otherwise the current DOM elements will be kept intact - */ - destroy : function (keep_html) { - if(this._wrk) { - try { - window.URL.revokeObjectURL(this._wrk); - this._wrk = null; - } - catch (ignore) { } - } - if(!keep_html) { this.element.empty(); } - this.teardown(); - }, - /** - * Create prototype node - */ - _create_prototype_node : function () { - var _node = document.createElement('LI'), _temp1, _temp2; - _node.setAttribute('role', 'treeitem'); - _temp1 = document.createElement('I'); - _temp1.className = 'jstree-icon jstree-ocl'; - _temp1.setAttribute('role', 'presentation'); - _node.appendChild(_temp1); - _temp1 = document.createElement('A'); - _temp1.className = 'jstree-anchor'; - _temp1.setAttribute('href','#'); - _temp1.setAttribute('tabindex','-1'); - _temp2 = document.createElement('I'); - _temp2.className = 'jstree-icon jstree-themeicon'; - _temp2.setAttribute('role', 'presentation'); - _temp1.appendChild(_temp2); - _node.appendChild(_temp1); - _temp1 = _temp2 = null; - - return _node; - }, - /** - * part of the destroying of an instance. Used internally. - * @private - * @name teardown() - */ - teardown : function () { - this.unbind(); - this.element - .removeClass('jstree') - .removeData('jstree') - .find("[class^='jstree']") - .addBack() - .attr("class", function () { return this.className.replace(/jstree[^ ]*|$/ig,''); }); - this.element = null; - }, - /** - * bind all events. Used internally. - * @private - * @name bind() - */ - bind : function () { - var word = '', - tout = null, - was_click = 0; - this.element - .on("dblclick.jstree", function (e) { - if(e.target.tagName && e.target.tagName.toLowerCase() === "input") { return true; } - if(document.selection && document.selection.empty) { - document.selection.empty(); - } - else { - if(window.getSelection) { - var sel = window.getSelection(); - try { - sel.removeAllRanges(); - sel.collapse(); - } catch (ignore) { } - } - } - }) - .on("mousedown.jstree", $.proxy(function (e) { - if(e.target === this.element[0]) { - e.preventDefault(); // prevent losing focus when clicking scroll arrows (FF, Chrome) - was_click = +(new Date()); // ie does not allow to prevent losing focus - } - }, this)) - .on("mousedown.jstree", ".jstree-ocl", function (e) { - e.preventDefault(); // prevent any node inside from losing focus when clicking the open/close icon - }) - .on("click.jstree", ".jstree-ocl", $.proxy(function (e) { - this.toggle_node(e.target); - }, this)) - .on("dblclick.jstree", ".jstree-anchor", $.proxy(function (e) { - if(e.target.tagName && e.target.tagName.toLowerCase() === "input") { return true; } - if(this.settings.core.dblclick_toggle) { - this.toggle_node(e.target); - } - }, this)) - .on("click.jstree", ".jstree-anchor", $.proxy(function (e) { - e.preventDefault(); - if(e.currentTarget !== document.activeElement) { $(e.currentTarget).focus(); } - this.activate_node(e.currentTarget, e); - }, this)) - .on('keydown.jstree', '.jstree-anchor', $.proxy(function (e) { - if(e.target.tagName && e.target.tagName.toLowerCase() === "input") { return true; } - if(e.which !== 32 && e.which !== 13 && (e.shiftKey || e.ctrlKey || e.altKey || e.metaKey)) { return true; } - var o = null; - if(this._data.core.rtl) { - if(e.which === 37) { e.which = 39; } - else if(e.which === 39) { e.which = 37; } - } - switch(e.which) { - case 32: // aria defines space only with Ctrl - if(e.ctrlKey) { - e.type = "click"; - $(e.currentTarget).trigger(e); - } - break; - case 13: // enter - e.type = "click"; - $(e.currentTarget).trigger(e); - break; - case 37: // left - e.preventDefault(); - if(this.is_open(e.currentTarget)) { - this.close_node(e.currentTarget); - } - else { - o = this.get_parent(e.currentTarget); - if(o && o.id !== $.jstree.root) { this.get_node(o, true).children('.jstree-anchor').focus(); } - } - break; - case 38: // up - e.preventDefault(); - o = this.get_prev_dom(e.currentTarget); - if(o && o.length) { o.children('.jstree-anchor').focus(); } - break; - case 39: // right - e.preventDefault(); - if(this.is_closed(e.currentTarget)) { - this.open_node(e.currentTarget, function (o) { this.get_node(o, true).children('.jstree-anchor').focus(); }); - } - else if (this.is_open(e.currentTarget)) { - o = this.get_node(e.currentTarget, true).children('.jstree-children')[0]; - if(o) { $(this._firstChild(o)).children('.jstree-anchor').focus(); } - } - break; - case 40: // down - e.preventDefault(); - o = this.get_next_dom(e.currentTarget); - if(o && o.length) { o.children('.jstree-anchor').focus(); } - break; - case 106: // aria defines * on numpad as open_all - not very common - this.open_all(); - break; - case 36: // home - e.preventDefault(); - o = this._firstChild(this.get_container_ul()[0]); - if(o) { $(o).children('.jstree-anchor').filter(':visible').focus(); } - break; - case 35: // end - e.preventDefault(); - this.element.find('.jstree-anchor').filter(':visible').last().focus(); - break; - case 113: // f2 - safe to include - if check_callback is false it will fail - e.preventDefault(); - this.edit(e.currentTarget); - break; - default: - break; - /*! - // delete - case 46: - e.preventDefault(); - o = this.get_node(e.currentTarget); - if(o && o.id && o.id !== $.jstree.root) { - o = this.is_selected(o) ? this.get_selected() : o; - this.delete_node(o); - } - break; - - */ - } - }, this)) - .on("load_node.jstree", $.proxy(function (e, data) { - if(data.status) { - if(data.node.id === $.jstree.root && !this._data.core.loaded) { - this._data.core.loaded = true; - if(this._firstChild(this.get_container_ul()[0])) { - this.element.attr('aria-activedescendant',this._firstChild(this.get_container_ul()[0]).id); - } - /** - * triggered after the root node is loaded for the first time - * @event - * @name loaded.jstree - */ - this.trigger("loaded"); - } - if(!this._data.core.ready) { - setTimeout($.proxy(function() { - if(this.element && !this.get_container_ul().find('.jstree-loading').length) { - this._data.core.ready = true; - if(this._data.core.selected.length) { - if(this.settings.core.expand_selected_onload) { - var tmp = [], i, j; - for(i = 0, j = this._data.core.selected.length; i < j; i++) { - tmp = tmp.concat(this._model.data[this._data.core.selected[i]].parents); - } - tmp = $.vakata.array_unique(tmp); - for(i = 0, j = tmp.length; i < j; i++) { - this.open_node(tmp[i], false, 0); - } - } - this.trigger('changed', { 'action' : 'ready', 'selected' : this._data.core.selected }); - } - /** - * triggered after all nodes are finished loading - * @event - * @name ready.jstree - */ - this.trigger("ready"); - } - }, this), 0); - } - } - }, this)) - // quick searching when the tree is focused - .on('keypress.jstree', $.proxy(function (e) { - if(e.target.tagName && e.target.tagName.toLowerCase() === "input") { return true; } - if(tout) { clearTimeout(tout); } - tout = setTimeout(function () { - word = ''; - }, 500); - - var chr = String.fromCharCode(e.which).toLowerCase(), - col = this.element.find('.jstree-anchor').filter(':visible'), - ind = col.index(document.activeElement) || 0, - end = false; - word += chr; - - // match for whole word from current node down (including the current node) - if(word.length > 1) { - col.slice(ind).each($.proxy(function (i, v) { - if($(v).text().toLowerCase().indexOf(word) === 0) { - $(v).focus(); - end = true; - return false; - } - }, this)); - if(end) { return; } - - // match for whole word from the beginning of the tree - col.slice(0, ind).each($.proxy(function (i, v) { - if($(v).text().toLowerCase().indexOf(word) === 0) { - $(v).focus(); - end = true; - return false; - } - }, this)); - if(end) { return; } - } - // list nodes that start with that letter (only if word consists of a single char) - if(new RegExp('^' + chr.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&') + '+$').test(word)) { - // search for the next node starting with that letter - col.slice(ind + 1).each($.proxy(function (i, v) { - if($(v).text().toLowerCase().charAt(0) === chr) { - $(v).focus(); - end = true; - return false; - } - }, this)); - if(end) { return; } - - // search from the beginning - col.slice(0, ind + 1).each($.proxy(function (i, v) { - if($(v).text().toLowerCase().charAt(0) === chr) { - $(v).focus(); - end = true; - return false; - } - }, this)); - if(end) { return; } - } - }, this)) - // THEME RELATED - .on("init.jstree", $.proxy(function () { - var s = this.settings.core.themes; - this._data.core.themes.dots = s.dots; - this._data.core.themes.stripes = s.stripes; - this._data.core.themes.icons = s.icons; - this._data.core.themes.ellipsis = s.ellipsis; - this.set_theme(s.name || "default", s.url); - this.set_theme_variant(s.variant); - }, this)) - .on("loading.jstree", $.proxy(function () { - this[ this._data.core.themes.dots ? "show_dots" : "hide_dots" ](); - this[ this._data.core.themes.icons ? "show_icons" : "hide_icons" ](); - this[ this._data.core.themes.stripes ? "show_stripes" : "hide_stripes" ](); - this[ this._data.core.themes.ellipsis ? "show_ellipsis" : "hide_ellipsis" ](); - }, this)) - .on('blur.jstree', '.jstree-anchor', $.proxy(function (e) { - this._data.core.focused = null; - $(e.currentTarget).filter('.jstree-hovered').mouseleave(); - this.element.attr('tabindex', '0'); - }, this)) - .on('focus.jstree', '.jstree-anchor', $.proxy(function (e) { - var tmp = this.get_node(e.currentTarget); - if(tmp && tmp.id) { - this._data.core.focused = tmp.id; - } - this.element.find('.jstree-hovered').not(e.currentTarget).mouseleave(); - $(e.currentTarget).mouseenter(); - this.element.attr('tabindex', '-1'); - }, this)) - .on('focus.jstree', $.proxy(function () { - if(+(new Date()) - was_click > 500 && !this._data.core.focused) { - was_click = 0; - var act = this.get_node(this.element.attr('aria-activedescendant'), true); - if(act) { - act.find('> .jstree-anchor').focus(); - } - } - }, this)) - .on('mouseenter.jstree', '.jstree-anchor', $.proxy(function (e) { - this.hover_node(e.currentTarget); - }, this)) - .on('mouseleave.jstree', '.jstree-anchor', $.proxy(function (e) { - this.dehover_node(e.currentTarget); - }, this)); - }, - /** - * part of the destroying of an instance. Used internally. - * @private - * @name unbind() - */ - unbind : function () { - this.element.off('.jstree'); - $(document).off('.jstree-' + this._id); - }, - /** - * trigger an event. Used internally. - * @private - * @name trigger(ev [, data]) - * @param {String} ev the name of the event to trigger - * @param {Object} data additional data to pass with the event - */ - trigger : function (ev, data) { - if(!data) { - data = {}; - } - data.instance = this; - this.element.triggerHandler(ev.replace('.jstree','') + '.jstree', data); - }, - /** - * returns the jQuery extended instance container - * @name get_container() - * @return {jQuery} - */ - get_container : function () { - return this.element; - }, - /** - * returns the jQuery extended main UL node inside the instance container. Used internally. - * @private - * @name get_container_ul() - * @return {jQuery} - */ - get_container_ul : function () { - return this.element.children(".jstree-children").first(); - }, - /** - * gets string replacements (localization). Used internally. - * @private - * @name get_string(key) - * @param {String} key - * @return {String} - */ - get_string : function (key) { - var a = this.settings.core.strings; - if($.isFunction(a)) { return a.call(this, key); } - if(a && a[key]) { return a[key]; } - return key; - }, - /** - * gets the first child of a DOM node. Used internally. - * @private - * @name _firstChild(dom) - * @param {DOMElement} dom - * @return {DOMElement} - */ - _firstChild : function (dom) { - dom = dom ? dom.firstChild : null; - while(dom !== null && dom.nodeType !== 1) { - dom = dom.nextSibling; - } - return dom; - }, - /** - * gets the next sibling of a DOM node. Used internally. - * @private - * @name _nextSibling(dom) - * @param {DOMElement} dom - * @return {DOMElement} - */ - _nextSibling : function (dom) { - dom = dom ? dom.nextSibling : null; - while(dom !== null && dom.nodeType !== 1) { - dom = dom.nextSibling; - } - return dom; - }, - /** - * gets the previous sibling of a DOM node. Used internally. - * @private - * @name _previousSibling(dom) - * @param {DOMElement} dom - * @return {DOMElement} - */ - _previousSibling : function (dom) { - dom = dom ? dom.previousSibling : null; - while(dom !== null && dom.nodeType !== 1) { - dom = dom.previousSibling; - } - return dom; - }, - /** - * get the JSON representation of a node (or the actual jQuery extended DOM node) by using any input (child DOM element, ID string, selector, etc) - * @name get_node(obj [, as_dom]) - * @param {mixed} obj - * @param {Boolean} as_dom - * @return {Object|jQuery} - */ - get_node : function (obj, as_dom) { - if(obj && obj.id) { - obj = obj.id; - } - var dom; - try { - if(this._model.data[obj]) { - obj = this._model.data[obj]; - } - else if(typeof obj === "string" && this._model.data[obj.replace(/^#/, '')]) { - obj = this._model.data[obj.replace(/^#/, '')]; - } - else if(typeof obj === "string" && (dom = $('#' + obj.replace($.jstree.idregex,'\\$&'), this.element)).length && this._model.data[dom.closest('.jstree-node').attr('id')]) { - obj = this._model.data[dom.closest('.jstree-node').attr('id')]; - } - else if((dom = $(obj, this.element)).length && this._model.data[dom.closest('.jstree-node').attr('id')]) { - obj = this._model.data[dom.closest('.jstree-node').attr('id')]; - } - else if((dom = $(obj, this.element)).length && dom.hasClass('jstree')) { - obj = this._model.data[$.jstree.root]; - } - else { - return false; - } - - if(as_dom) { - obj = obj.id === $.jstree.root ? this.element : $('#' + obj.id.replace($.jstree.idregex,'\\$&'), this.element); - } - return obj; - } catch (ex) { return false; } - }, - /** - * get the path to a node, either consisting of node texts, or of node IDs, optionally glued together (otherwise an array) - * @name get_path(obj [, glue, ids]) - * @param {mixed} obj the node - * @param {String} glue if you want the path as a string - pass the glue here (for example '/'), if a falsy value is supplied here, an array is returned - * @param {Boolean} ids if set to true build the path using ID, otherwise node text is used - * @return {mixed} - */ - get_path : function (obj, glue, ids) { - obj = obj.parents ? obj : this.get_node(obj); - if(!obj || obj.id === $.jstree.root || !obj.parents) { - return false; - } - var i, j, p = []; - p.push(ids ? obj.id : obj.text); - for(i = 0, j = obj.parents.length; i < j; i++) { - p.push(ids ? obj.parents[i] : this.get_text(obj.parents[i])); - } - p = p.reverse().slice(1); - return glue ? p.join(glue) : p; - }, - /** - * get the next visible node that is below the `obj` node. If `strict` is set to `true` only sibling nodes are returned. - * @name get_next_dom(obj [, strict]) - * @param {mixed} obj - * @param {Boolean} strict - * @return {jQuery} - */ - get_next_dom : function (obj, strict) { - var tmp; - obj = this.get_node(obj, true); - if(obj[0] === this.element[0]) { - tmp = this._firstChild(this.get_container_ul()[0]); - while (tmp && tmp.offsetHeight === 0) { - tmp = this._nextSibling(tmp); - } - return tmp ? $(tmp) : false; - } - if(!obj || !obj.length) { - return false; - } - if(strict) { - tmp = obj[0]; - do { - tmp = this._nextSibling(tmp); - } while (tmp && tmp.offsetHeight === 0); - return tmp ? $(tmp) : false; - } - if(obj.hasClass("jstree-open")) { - tmp = this._firstChild(obj.children('.jstree-children')[0]); - while (tmp && tmp.offsetHeight === 0) { - tmp = this._nextSibling(tmp); - } - if(tmp !== null) { - return $(tmp); - } - } - tmp = obj[0]; - do { - tmp = this._nextSibling(tmp); - } while (tmp && tmp.offsetHeight === 0); - if(tmp !== null) { - return $(tmp); - } - return obj.parentsUntil(".jstree",".jstree-node").nextAll(".jstree-node:visible").first(); - }, - /** - * get the previous visible node that is above the `obj` node. If `strict` is set to `true` only sibling nodes are returned. - * @name get_prev_dom(obj [, strict]) - * @param {mixed} obj - * @param {Boolean} strict - * @return {jQuery} - */ - get_prev_dom : function (obj, strict) { - var tmp; - obj = this.get_node(obj, true); - if(obj[0] === this.element[0]) { - tmp = this.get_container_ul()[0].lastChild; - while (tmp && tmp.offsetHeight === 0) { - tmp = this._previousSibling(tmp); - } - return tmp ? $(tmp) : false; - } - if(!obj || !obj.length) { - return false; - } - if(strict) { - tmp = obj[0]; - do { - tmp = this._previousSibling(tmp); - } while (tmp && tmp.offsetHeight === 0); - return tmp ? $(tmp) : false; - } - tmp = obj[0]; - do { - tmp = this._previousSibling(tmp); - } while (tmp && tmp.offsetHeight === 0); - if(tmp !== null) { - obj = $(tmp); - while(obj.hasClass("jstree-open")) { - obj = obj.children(".jstree-children").first().children(".jstree-node:visible:last"); - } - return obj; - } - tmp = obj[0].parentNode.parentNode; - return tmp && tmp.className && tmp.className.indexOf('jstree-node') !== -1 ? $(tmp) : false; - }, - /** - * get the parent ID of a node - * @name get_parent(obj) - * @param {mixed} obj - * @return {String} - */ - get_parent : function (obj) { - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { - return false; - } - return obj.parent; - }, - /** - * get a jQuery collection of all the children of a node (node must be rendered) - * @name get_children_dom(obj) - * @param {mixed} obj - * @return {jQuery} - */ - get_children_dom : function (obj) { - obj = this.get_node(obj, true); - if(obj[0] === this.element[0]) { - return this.get_container_ul().children(".jstree-node"); - } - if(!obj || !obj.length) { - return false; - } - return obj.children(".jstree-children").children(".jstree-node"); - }, - /** - * checks if a node has children - * @name is_parent(obj) - * @param {mixed} obj - * @return {Boolean} - */ - is_parent : function (obj) { - obj = this.get_node(obj); - return obj && (obj.state.loaded === false || obj.children.length > 0); - }, - /** - * checks if a node is loaded (its children are available) - * @name is_loaded(obj) - * @param {mixed} obj - * @return {Boolean} - */ - is_loaded : function (obj) { - obj = this.get_node(obj); - return obj && obj.state.loaded; - }, - /** - * check if a node is currently loading (fetching children) - * @name is_loading(obj) - * @param {mixed} obj - * @return {Boolean} - */ - is_loading : function (obj) { - obj = this.get_node(obj); - return obj && obj.state && obj.state.loading; - }, - /** - * check if a node is opened - * @name is_open(obj) - * @param {mixed} obj - * @return {Boolean} - */ - is_open : function (obj) { - obj = this.get_node(obj); - return obj && obj.state.opened; - }, - /** - * check if a node is in a closed state - * @name is_closed(obj) - * @param {mixed} obj - * @return {Boolean} - */ - is_closed : function (obj) { - obj = this.get_node(obj); - return obj && this.is_parent(obj) && !obj.state.opened; - }, - /** - * check if a node has no children - * @name is_leaf(obj) - * @param {mixed} obj - * @return {Boolean} - */ - is_leaf : function (obj) { - return !this.is_parent(obj); - }, - /** - * loads a node (fetches its children using the `core.data` setting). Multiple nodes can be passed to by using an array. - * @name load_node(obj [, callback]) - * @param {mixed} obj - * @param {function} callback a function to be executed once loading is complete, the function is executed in the instance's scope and receives two arguments - the node and a boolean status - * @return {Boolean} - * @trigger load_node.jstree - */ - load_node : function (obj, callback) { - var k, l, i, j, c; - if($.isArray(obj)) { - this._load_nodes(obj.slice(), callback); - return true; - } - obj = this.get_node(obj); - if(!obj) { - if(callback) { callback.call(this, obj, false); } - return false; - } - // if(obj.state.loading) { } // the node is already loading - just wait for it to load and invoke callback? but if called implicitly it should be loaded again? - if(obj.state.loaded) { - obj.state.loaded = false; - for(i = 0, j = obj.parents.length; i < j; i++) { - this._model.data[obj.parents[i]].children_d = $.vakata.array_filter(this._model.data[obj.parents[i]].children_d, function (v) { - return $.inArray(v, obj.children_d) === -1; - }); - } - for(k = 0, l = obj.children_d.length; k < l; k++) { - if(this._model.data[obj.children_d[k]].state.selected) { - c = true; - } - delete this._model.data[obj.children_d[k]]; - } - if (c) { - this._data.core.selected = $.vakata.array_filter(this._data.core.selected, function (v) { - return $.inArray(v, obj.children_d) === -1; - }); - } - obj.children = []; - obj.children_d = []; - if(c) { - this.trigger('changed', { 'action' : 'load_node', 'node' : obj, 'selected' : this._data.core.selected }); - } - } - obj.state.failed = false; - obj.state.loading = true; - this.get_node(obj, true).addClass("jstree-loading").attr('aria-busy',true); - this._load_node(obj, $.proxy(function (status) { - obj = this._model.data[obj.id]; - obj.state.loading = false; - obj.state.loaded = status; - obj.state.failed = !obj.state.loaded; - var dom = this.get_node(obj, true), i = 0, j = 0, m = this._model.data, has_children = false; - for(i = 0, j = obj.children.length; i < j; i++) { - if(m[obj.children[i]] && !m[obj.children[i]].state.hidden) { - has_children = true; - break; - } - } - if(obj.state.loaded && dom && dom.length) { - dom.removeClass('jstree-closed jstree-open jstree-leaf'); - if (!has_children) { - dom.addClass('jstree-leaf'); - } - else { - if (obj.id !== '#') { - dom.addClass(obj.state.opened ? 'jstree-open' : 'jstree-closed'); - } - } - } - dom.removeClass("jstree-loading").attr('aria-busy',false); - /** - * triggered after a node is loaded - * @event - * @name load_node.jstree - * @param {Object} node the node that was loading - * @param {Boolean} status was the node loaded successfully - */ - this.trigger('load_node', { "node" : obj, "status" : status }); - if(callback) { - callback.call(this, obj, status); - } - }, this)); - return true; - }, - /** - * load an array of nodes (will also load unavailable nodes as soon as the appear in the structure). Used internally. - * @private - * @name _load_nodes(nodes [, callback]) - * @param {array} nodes - * @param {function} callback a function to be executed once loading is complete, the function is executed in the instance's scope and receives one argument - the array passed to _load_nodes - */ - _load_nodes : function (nodes, callback, is_callback, force_reload) { - var r = true, - c = function () { this._load_nodes(nodes, callback, true); }, - m = this._model.data, i, j, tmp = []; - for(i = 0, j = nodes.length; i < j; i++) { - if(m[nodes[i]] && ( (!m[nodes[i]].state.loaded && !m[nodes[i]].state.failed) || (!is_callback && force_reload) )) { - if(!this.is_loading(nodes[i])) { - this.load_node(nodes[i], c); - } - r = false; - } - } - if(r) { - for(i = 0, j = nodes.length; i < j; i++) { - if(m[nodes[i]] && m[nodes[i]].state.loaded) { - tmp.push(nodes[i]); - } - } - if(callback && !callback.done) { - callback.call(this, tmp); - callback.done = true; - } - } - }, - /** - * loads all unloaded nodes - * @name load_all([obj, callback]) - * @param {mixed} obj the node to load recursively, omit to load all nodes in the tree - * @param {function} callback a function to be executed once loading all the nodes is complete, - * @trigger load_all.jstree - */ - load_all : function (obj, callback) { - if(!obj) { obj = $.jstree.root; } - obj = this.get_node(obj); - if(!obj) { return false; } - var to_load = [], - m = this._model.data, - c = m[obj.id].children_d, - i, j; - if(obj.state && !obj.state.loaded) { - to_load.push(obj.id); - } - for(i = 0, j = c.length; i < j; i++) { - if(m[c[i]] && m[c[i]].state && !m[c[i]].state.loaded) { - to_load.push(c[i]); - } - } - if(to_load.length) { - this._load_nodes(to_load, function () { - this.load_all(obj, callback); - }); - } - else { - /** - * triggered after a load_all call completes - * @event - * @name load_all.jstree - * @param {Object} node the recursively loaded node - */ - if(callback) { callback.call(this, obj); } - this.trigger('load_all', { "node" : obj }); - } - }, - /** - * handles the actual loading of a node. Used only internally. - * @private - * @name _load_node(obj [, callback]) - * @param {mixed} obj - * @param {function} callback a function to be executed once loading is complete, the function is executed in the instance's scope and receives one argument - a boolean status - * @return {Boolean} - */ - _load_node : function (obj, callback) { - var s = this.settings.core.data, t; - var notTextOrCommentNode = function notTextOrCommentNode () { - return this.nodeType !== 3 && this.nodeType !== 8; - }; - // use original HTML - if(!s) { - if(obj.id === $.jstree.root) { - return this._append_html_data(obj, this._data.core.original_container_html.clone(true), function (status) { - callback.call(this, status); - }); - } - else { - return callback.call(this, false); - } - // return callback.call(this, obj.id === $.jstree.root ? this._append_html_data(obj, this._data.core.original_container_html.clone(true)) : false); - } - if($.isFunction(s)) { - return s.call(this, obj, $.proxy(function (d) { - if(d === false) { - callback.call(this, false); - } - else { - this[typeof d === 'string' ? '_append_html_data' : '_append_json_data'](obj, typeof d === 'string' ? $($.parseHTML(d)).filter(notTextOrCommentNode) : d, function (status) { - callback.call(this, status); - }); - } - // return d === false ? callback.call(this, false) : callback.call(this, this[typeof d === 'string' ? '_append_html_data' : '_append_json_data'](obj, typeof d === 'string' ? $(d) : d)); - }, this)); - } - if(typeof s === 'object') { - if(s.url) { - s = $.extend(true, {}, s); - if($.isFunction(s.url)) { - s.url = s.url.call(this, obj); - } - if($.isFunction(s.data)) { - s.data = s.data.call(this, obj); - } - return $.ajax(s) - .done($.proxy(function (d,t,x) { - var type = x.getResponseHeader('Content-Type'); - if((type && type.indexOf('json') !== -1) || typeof d === "object") { - return this._append_json_data(obj, d, function (status) { callback.call(this, status); }); - //return callback.call(this, this._append_json_data(obj, d)); - } - if((type && type.indexOf('html') !== -1) || typeof d === "string") { - return this._append_html_data(obj, $($.parseHTML(d)).filter(notTextOrCommentNode), function (status) { callback.call(this, status); }); - // return callback.call(this, this._append_html_data(obj, $(d))); - } - this._data.core.last_error = { 'error' : 'ajax', 'plugin' : 'core', 'id' : 'core_04', 'reason' : 'Could not load node', 'data' : JSON.stringify({ 'id' : obj.id, 'xhr' : x }) }; - this.settings.core.error.call(this, this._data.core.last_error); - return callback.call(this, false); - }, this)) - .fail($.proxy(function (f) { - callback.call(this, false); - this._data.core.last_error = { 'error' : 'ajax', 'plugin' : 'core', 'id' : 'core_04', 'reason' : 'Could not load node', 'data' : JSON.stringify({ 'id' : obj.id, 'xhr' : f }) }; - this.settings.core.error.call(this, this._data.core.last_error); - }, this)); - } - t = ($.isArray(s) || $.isPlainObject(s)) ? JSON.parse(JSON.stringify(s)) : s; - if(obj.id === $.jstree.root) { - return this._append_json_data(obj, t, function (status) { - callback.call(this, status); - }); - } - else { - this._data.core.last_error = { 'error' : 'nodata', 'plugin' : 'core', 'id' : 'core_05', 'reason' : 'Could not load node', 'data' : JSON.stringify({ 'id' : obj.id }) }; - this.settings.core.error.call(this, this._data.core.last_error); - return callback.call(this, false); - } - //return callback.call(this, (obj.id === $.jstree.root ? this._append_json_data(obj, t) : false) ); - } - if(typeof s === 'string') { - if(obj.id === $.jstree.root) { - return this._append_html_data(obj, $($.parseHTML(s)).filter(notTextOrCommentNode), function (status) { - callback.call(this, status); - }); - } - else { - this._data.core.last_error = { 'error' : 'nodata', 'plugin' : 'core', 'id' : 'core_06', 'reason' : 'Could not load node', 'data' : JSON.stringify({ 'id' : obj.id }) }; - this.settings.core.error.call(this, this._data.core.last_error); - return callback.call(this, false); - } - //return callback.call(this, (obj.id === $.jstree.root ? this._append_html_data(obj, $(s)) : false) ); - } - return callback.call(this, false); - }, - /** - * adds a node to the list of nodes to redraw. Used only internally. - * @private - * @name _node_changed(obj [, callback]) - * @param {mixed} obj - */ - _node_changed : function (obj) { - obj = this.get_node(obj); - if(obj) { - this._model.changed.push(obj.id); - } - }, - /** - * appends HTML content to the tree. Used internally. - * @private - * @name _append_html_data(obj, data) - * @param {mixed} obj the node to append to - * @param {String} data the HTML string to parse and append - * @trigger model.jstree, changed.jstree - */ - _append_html_data : function (dom, data, cb) { - dom = this.get_node(dom); - dom.children = []; - dom.children_d = []; - var dat = data.is('ul') ? data.children() : data, - par = dom.id, - chd = [], - dpc = [], - m = this._model.data, - p = m[par], - s = this._data.core.selected.length, - tmp, i, j; - dat.each($.proxy(function (i, v) { - tmp = this._parse_model_from_html($(v), par, p.parents.concat()); - if(tmp) { - chd.push(tmp); - dpc.push(tmp); - if(m[tmp].children_d.length) { - dpc = dpc.concat(m[tmp].children_d); - } - } - }, this)); - p.children = chd; - p.children_d = dpc; - for(i = 0, j = p.parents.length; i < j; i++) { - m[p.parents[i]].children_d = m[p.parents[i]].children_d.concat(dpc); - } - /** - * triggered when new data is inserted to the tree model - * @event - * @name model.jstree - * @param {Array} nodes an array of node IDs - * @param {String} parent the parent ID of the nodes - */ - this.trigger('model', { "nodes" : dpc, 'parent' : par }); - if(par !== $.jstree.root) { - this._node_changed(par); - this.redraw(); - } - else { - this.get_container_ul().children('.jstree-initial-node').remove(); - this.redraw(true); - } - if(this._data.core.selected.length !== s) { - this.trigger('changed', { 'action' : 'model', 'selected' : this._data.core.selected }); - } - cb.call(this, true); - }, - /** - * appends JSON content to the tree. Used internally. - * @private - * @name _append_json_data(obj, data) - * @param {mixed} obj the node to append to - * @param {String} data the JSON object to parse and append - * @param {Boolean} force_processing internal param - do not set - * @trigger model.jstree, changed.jstree - */ - _append_json_data : function (dom, data, cb, force_processing) { - if(this.element === null) { return; } - dom = this.get_node(dom); - dom.children = []; - dom.children_d = []; - // *%$@!!! - if(data.d) { - data = data.d; - if(typeof data === "string") { - data = JSON.parse(data); - } - } - if(!$.isArray(data)) { data = [data]; } - var w = null, - args = { - 'df' : this._model.default_state, - 'dat' : data, - 'par' : dom.id, - 'm' : this._model.data, - 't_id' : this._id, - 't_cnt' : this._cnt, - 'sel' : this._data.core.selected - }, - func = function (data, undefined) { - if(data.data) { data = data.data; } - var dat = data.dat, - par = data.par, - chd = [], - dpc = [], - add = [], - df = data.df, - t_id = data.t_id, - t_cnt = data.t_cnt, - m = data.m, - p = m[par], - sel = data.sel, - tmp, i, j, rslt, - parse_flat = function (d, p, ps) { - if(!ps) { ps = []; } - else { ps = ps.concat(); } - if(p) { ps.unshift(p); } - var tid = d.id.toString(), - i, j, c, e, - tmp = { - id : tid, - text : d.text || '', - icon : d.icon !== undefined ? d.icon : true, - parent : p, - parents : ps, - children : d.children || [], - children_d : d.children_d || [], - data : d.data, - state : { }, - li_attr : { id : false }, - a_attr : { href : '#' }, - original : false - }; - for(i in df) { - if(df.hasOwnProperty(i)) { - tmp.state[i] = df[i]; - } - } - if(d && d.data && d.data.jstree && d.data.jstree.icon) { - tmp.icon = d.data.jstree.icon; - } - if(tmp.icon === undefined || tmp.icon === null || tmp.icon === "") { - tmp.icon = true; - } - if(d && d.data) { - tmp.data = d.data; - if(d.data.jstree) { - for(i in d.data.jstree) { - if(d.data.jstree.hasOwnProperty(i)) { - tmp.state[i] = d.data.jstree[i]; - } - } - } - } - if(d && typeof d.state === 'object') { - for (i in d.state) { - if(d.state.hasOwnProperty(i)) { - tmp.state[i] = d.state[i]; - } - } - } - if(d && typeof d.li_attr === 'object') { - for (i in d.li_attr) { - if(d.li_attr.hasOwnProperty(i)) { - tmp.li_attr[i] = d.li_attr[i]; - } - } - } - if(!tmp.li_attr.id) { - tmp.li_attr.id = tid; - } - if(d && typeof d.a_attr === 'object') { - for (i in d.a_attr) { - if(d.a_attr.hasOwnProperty(i)) { - tmp.a_attr[i] = d.a_attr[i]; - } - } - } - if(d && d.children && d.children === true) { - tmp.state.loaded = false; - tmp.children = []; - tmp.children_d = []; - } - m[tmp.id] = tmp; - for(i = 0, j = tmp.children.length; i < j; i++) { - c = parse_flat(m[tmp.children[i]], tmp.id, ps); - e = m[c]; - tmp.children_d.push(c); - if(e.children_d.length) { - tmp.children_d = tmp.children_d.concat(e.children_d); - } - } - delete d.data; - delete d.children; - m[tmp.id].original = d; - if(tmp.state.selected) { - add.push(tmp.id); - } - return tmp.id; - }, - parse_nest = function (d, p, ps) { - if(!ps) { ps = []; } - else { ps = ps.concat(); } - if(p) { ps.unshift(p); } - var tid = false, i, j, c, e, tmp; - do { - tid = 'j' + t_id + '_' + (++t_cnt); - } while(m[tid]); - - tmp = { - id : false, - text : typeof d === 'string' ? d : '', - icon : typeof d === 'object' && d.icon !== undefined ? d.icon : true, - parent : p, - parents : ps, - children : [], - children_d : [], - data : null, - state : { }, - li_attr : { id : false }, - a_attr : { href : '#' }, - original : false - }; - for(i in df) { - if(df.hasOwnProperty(i)) { - tmp.state[i] = df[i]; - } - } - if(d && d.id) { tmp.id = d.id.toString(); } - if(d && d.text) { tmp.text = d.text; } - if(d && d.data && d.data.jstree && d.data.jstree.icon) { - tmp.icon = d.data.jstree.icon; - } - if(tmp.icon === undefined || tmp.icon === null || tmp.icon === "") { - tmp.icon = true; - } - if(d && d.data) { - tmp.data = d.data; - if(d.data.jstree) { - for(i in d.data.jstree) { - if(d.data.jstree.hasOwnProperty(i)) { - tmp.state[i] = d.data.jstree[i]; - } - } - } - } - if(d && typeof d.state === 'object') { - for (i in d.state) { - if(d.state.hasOwnProperty(i)) { - tmp.state[i] = d.state[i]; - } - } - } - if(d && typeof d.li_attr === 'object') { - for (i in d.li_attr) { - if(d.li_attr.hasOwnProperty(i)) { - tmp.li_attr[i] = d.li_attr[i]; - } - } - } - if(tmp.li_attr.id && !tmp.id) { - tmp.id = tmp.li_attr.id.toString(); - } - if(!tmp.id) { - tmp.id = tid; - } - if(!tmp.li_attr.id) { - tmp.li_attr.id = tmp.id; - } - if(d && typeof d.a_attr === 'object') { - for (i in d.a_attr) { - if(d.a_attr.hasOwnProperty(i)) { - tmp.a_attr[i] = d.a_attr[i]; - } - } - } - if(d && d.children && d.children.length) { - for(i = 0, j = d.children.length; i < j; i++) { - c = parse_nest(d.children[i], tmp.id, ps); - e = m[c]; - tmp.children.push(c); - if(e.children_d.length) { - tmp.children_d = tmp.children_d.concat(e.children_d); - } - } - tmp.children_d = tmp.children_d.concat(tmp.children); - } - if(d && d.children && d.children === true) { - tmp.state.loaded = false; - tmp.children = []; - tmp.children_d = []; - } - delete d.data; - delete d.children; - tmp.original = d; - m[tmp.id] = tmp; - if(tmp.state.selected) { - add.push(tmp.id); - } - return tmp.id; - }; - - if(dat.length && dat[0].id !== undefined && dat[0].parent !== undefined) { - // Flat JSON support (for easy import from DB): - // 1) convert to object (foreach) - for(i = 0, j = dat.length; i < j; i++) { - if(!dat[i].children) { - dat[i].children = []; - } - m[dat[i].id.toString()] = dat[i]; - } - // 2) populate children (foreach) - for(i = 0, j = dat.length; i < j; i++) { - m[dat[i].parent.toString()].children.push(dat[i].id.toString()); - // populate parent.children_d - p.children_d.push(dat[i].id.toString()); - } - // 3) normalize && populate parents and children_d with recursion - for(i = 0, j = p.children.length; i < j; i++) { - tmp = parse_flat(m[p.children[i]], par, p.parents.concat()); - dpc.push(tmp); - if(m[tmp].children_d.length) { - dpc = dpc.concat(m[tmp].children_d); - } - } - for(i = 0, j = p.parents.length; i < j; i++) { - m[p.parents[i]].children_d = m[p.parents[i]].children_d.concat(dpc); - } - // ?) three_state selection - p.state.selected && t - (if three_state foreach(dat => ch) -> foreach(parents) if(parent.selected) child.selected = true; - rslt = { - 'cnt' : t_cnt, - 'mod' : m, - 'sel' : sel, - 'par' : par, - 'dpc' : dpc, - 'add' : add - }; - } - else { - for(i = 0, j = dat.length; i < j; i++) { - tmp = parse_nest(dat[i], par, p.parents.concat()); - if(tmp) { - chd.push(tmp); - dpc.push(tmp); - if(m[tmp].children_d.length) { - dpc = dpc.concat(m[tmp].children_d); - } - } - } - p.children = chd; - p.children_d = dpc; - for(i = 0, j = p.parents.length; i < j; i++) { - m[p.parents[i]].children_d = m[p.parents[i]].children_d.concat(dpc); - } - rslt = { - 'cnt' : t_cnt, - 'mod' : m, - 'sel' : sel, - 'par' : par, - 'dpc' : dpc, - 'add' : add - }; - } - if(typeof window === 'undefined' || typeof window.document === 'undefined') { - postMessage(rslt); - } - else { - return rslt; - } - }, - rslt = function (rslt, worker) { - if(this.element === null) { return; } - this._cnt = rslt.cnt; - var i, m = this._model.data; - for (i in m) { - if (m.hasOwnProperty(i) && m[i].state && m[i].state.loading && rslt.mod[i]) { - rslt.mod[i].state.loading = true; - } - } - this._model.data = rslt.mod; // breaks the reference in load_node - careful - - if(worker) { - var j, a = rslt.add, r = rslt.sel, s = this._data.core.selected.slice(); - m = this._model.data; - // if selection was changed while calculating in worker - if(r.length !== s.length || $.vakata.array_unique(r.concat(s)).length !== r.length) { - // deselect nodes that are no longer selected - for(i = 0, j = r.length; i < j; i++) { - if($.inArray(r[i], a) === -1 && $.inArray(r[i], s) === -1) { - m[r[i]].state.selected = false; - } - } - // select nodes that were selected in the mean time - for(i = 0, j = s.length; i < j; i++) { - if($.inArray(s[i], r) === -1) { - m[s[i]].state.selected = true; - } - } - } - } - if(rslt.add.length) { - this._data.core.selected = this._data.core.selected.concat(rslt.add); - } - - this.trigger('model', { "nodes" : rslt.dpc, 'parent' : rslt.par }); - - if(rslt.par !== $.jstree.root) { - this._node_changed(rslt.par); - this.redraw(); - } - else { - // this.get_container_ul().children('.jstree-initial-node').remove(); - this.redraw(true); - } - if(rslt.add.length) { - this.trigger('changed', { 'action' : 'model', 'selected' : this._data.core.selected }); - } - cb.call(this, true); - }; - if(this.settings.core.worker && window.Blob && window.URL && window.Worker) { - try { - if(this._wrk === null) { - this._wrk = window.URL.createObjectURL( - new window.Blob( - ['self.onmessage = ' + func.toString()], - {type:"text/javascript"} - ) - ); - } - if(!this._data.core.working || force_processing) { - this._data.core.working = true; - w = new window.Worker(this._wrk); - w.onmessage = $.proxy(function (e) { - rslt.call(this, e.data, true); - try { w.terminate(); w = null; } catch(ignore) { } - if(this._data.core.worker_queue.length) { - this._append_json_data.apply(this, this._data.core.worker_queue.shift()); - } - else { - this._data.core.working = false; - } - }, this); - if(!args.par) { - if(this._data.core.worker_queue.length) { - this._append_json_data.apply(this, this._data.core.worker_queue.shift()); - } - else { - this._data.core.working = false; - } - } - else { - w.postMessage(args); - } - } - else { - this._data.core.worker_queue.push([dom, data, cb, true]); - } - } - catch(e) { - rslt.call(this, func(args), false); - if(this._data.core.worker_queue.length) { - this._append_json_data.apply(this, this._data.core.worker_queue.shift()); - } - else { - this._data.core.working = false; - } - } - } - else { - rslt.call(this, func(args), false); - } - }, - /** - * parses a node from a jQuery object and appends them to the in memory tree model. Used internally. - * @private - * @name _parse_model_from_html(d [, p, ps]) - * @param {jQuery} d the jQuery object to parse - * @param {String} p the parent ID - * @param {Array} ps list of all parents - * @return {String} the ID of the object added to the model - */ - _parse_model_from_html : function (d, p, ps) { - if(!ps) { ps = []; } - else { ps = [].concat(ps); } - if(p) { ps.unshift(p); } - var c, e, m = this._model.data, - data = { - id : false, - text : false, - icon : true, - parent : p, - parents : ps, - children : [], - children_d : [], - data : null, - state : { }, - li_attr : { id : false }, - a_attr : { href : '#' }, - original : false - }, i, tmp, tid; - for(i in this._model.default_state) { - if(this._model.default_state.hasOwnProperty(i)) { - data.state[i] = this._model.default_state[i]; - } - } - tmp = $.vakata.attributes(d, true); - $.each(tmp, function (i, v) { - v = $.trim(v); - if(!v.length) { return true; } - data.li_attr[i] = v; - if(i === 'id') { - data.id = v.toString(); - } - }); - tmp = d.children('a').first(); - if(tmp.length) { - tmp = $.vakata.attributes(tmp, true); - $.each(tmp, function (i, v) { - v = $.trim(v); - if(v.length) { - data.a_attr[i] = v; - } - }); - } - tmp = d.children("a").first().length ? d.children("a").first().clone() : d.clone(); - tmp.children("ins, i, ul").remove(); - tmp = tmp.html(); - tmp = $('
          ').html(tmp); - data.text = this.settings.core.force_text ? tmp.text() : tmp.html(); - tmp = d.data(); - data.data = tmp ? $.extend(true, {}, tmp) : null; - data.state.opened = d.hasClass('jstree-open'); - data.state.selected = d.children('a').hasClass('jstree-clicked'); - data.state.disabled = d.children('a').hasClass('jstree-disabled'); - if(data.data && data.data.jstree) { - for(i in data.data.jstree) { - if(data.data.jstree.hasOwnProperty(i)) { - data.state[i] = data.data.jstree[i]; - } - } - } - tmp = d.children("a").children(".jstree-themeicon"); - if(tmp.length) { - data.icon = tmp.hasClass('jstree-themeicon-hidden') ? false : tmp.attr('rel'); - } - if(data.state.icon !== undefined) { - data.icon = data.state.icon; - } - if(data.icon === undefined || data.icon === null || data.icon === "") { - data.icon = true; - } - tmp = d.children("ul").children("li"); - do { - tid = 'j' + this._id + '_' + (++this._cnt); - } while(m[tid]); - data.id = data.li_attr.id ? data.li_attr.id.toString() : tid; - if(tmp.length) { - tmp.each($.proxy(function (i, v) { - c = this._parse_model_from_html($(v), data.id, ps); - e = this._model.data[c]; - data.children.push(c); - if(e.children_d.length) { - data.children_d = data.children_d.concat(e.children_d); - } - }, this)); - data.children_d = data.children_d.concat(data.children); - } - else { - if(d.hasClass('jstree-closed')) { - data.state.loaded = false; - } - } - if(data.li_attr['class']) { - data.li_attr['class'] = data.li_attr['class'].replace('jstree-closed','').replace('jstree-open',''); - } - if(data.a_attr['class']) { - data.a_attr['class'] = data.a_attr['class'].replace('jstree-clicked','').replace('jstree-disabled',''); - } - m[data.id] = data; - if(data.state.selected) { - this._data.core.selected.push(data.id); - } - return data.id; - }, - /** - * parses a node from a JSON object (used when dealing with flat data, which has no nesting of children, but has id and parent properties) and appends it to the in memory tree model. Used internally. - * @private - * @name _parse_model_from_flat_json(d [, p, ps]) - * @param {Object} d the JSON object to parse - * @param {String} p the parent ID - * @param {Array} ps list of all parents - * @return {String} the ID of the object added to the model - */ - _parse_model_from_flat_json : function (d, p, ps) { - if(!ps) { ps = []; } - else { ps = ps.concat(); } - if(p) { ps.unshift(p); } - var tid = d.id.toString(), - m = this._model.data, - df = this._model.default_state, - i, j, c, e, - tmp = { - id : tid, - text : d.text || '', - icon : d.icon !== undefined ? d.icon : true, - parent : p, - parents : ps, - children : d.children || [], - children_d : d.children_d || [], - data : d.data, - state : { }, - li_attr : { id : false }, - a_attr : { href : '#' }, - original : false - }; - for(i in df) { - if(df.hasOwnProperty(i)) { - tmp.state[i] = df[i]; - } - } - if(d && d.data && d.data.jstree && d.data.jstree.icon) { - tmp.icon = d.data.jstree.icon; - } - if(tmp.icon === undefined || tmp.icon === null || tmp.icon === "") { - tmp.icon = true; - } - if(d && d.data) { - tmp.data = d.data; - if(d.data.jstree) { - for(i in d.data.jstree) { - if(d.data.jstree.hasOwnProperty(i)) { - tmp.state[i] = d.data.jstree[i]; - } - } - } - } - if(d && typeof d.state === 'object') { - for (i in d.state) { - if(d.state.hasOwnProperty(i)) { - tmp.state[i] = d.state[i]; - } - } - } - if(d && typeof d.li_attr === 'object') { - for (i in d.li_attr) { - if(d.li_attr.hasOwnProperty(i)) { - tmp.li_attr[i] = d.li_attr[i]; - } - } - } - if(!tmp.li_attr.id) { - tmp.li_attr.id = tid; - } - if(d && typeof d.a_attr === 'object') { - for (i in d.a_attr) { - if(d.a_attr.hasOwnProperty(i)) { - tmp.a_attr[i] = d.a_attr[i]; - } - } - } - if(d && d.children && d.children === true) { - tmp.state.loaded = false; - tmp.children = []; - tmp.children_d = []; - } - m[tmp.id] = tmp; - for(i = 0, j = tmp.children.length; i < j; i++) { - c = this._parse_model_from_flat_json(m[tmp.children[i]], tmp.id, ps); - e = m[c]; - tmp.children_d.push(c); - if(e.children_d.length) { - tmp.children_d = tmp.children_d.concat(e.children_d); - } - } - delete d.data; - delete d.children; - m[tmp.id].original = d; - if(tmp.state.selected) { - this._data.core.selected.push(tmp.id); - } - return tmp.id; - }, - /** - * parses a node from a JSON object and appends it to the in memory tree model. Used internally. - * @private - * @name _parse_model_from_json(d [, p, ps]) - * @param {Object} d the JSON object to parse - * @param {String} p the parent ID - * @param {Array} ps list of all parents - * @return {String} the ID of the object added to the model - */ - _parse_model_from_json : function (d, p, ps) { - if(!ps) { ps = []; } - else { ps = ps.concat(); } - if(p) { ps.unshift(p); } - var tid = false, i, j, c, e, m = this._model.data, df = this._model.default_state, tmp; - do { - tid = 'j' + this._id + '_' + (++this._cnt); - } while(m[tid]); - - tmp = { - id : false, - text : typeof d === 'string' ? d : '', - icon : typeof d === 'object' && d.icon !== undefined ? d.icon : true, - parent : p, - parents : ps, - children : [], - children_d : [], - data : null, - state : { }, - li_attr : { id : false }, - a_attr : { href : '#' }, - original : false - }; - for(i in df) { - if(df.hasOwnProperty(i)) { - tmp.state[i] = df[i]; - } - } - if(d && d.id) { tmp.id = d.id.toString(); } - if(d && d.text) { tmp.text = d.text; } - if(d && d.data && d.data.jstree && d.data.jstree.icon) { - tmp.icon = d.data.jstree.icon; - } - if(tmp.icon === undefined || tmp.icon === null || tmp.icon === "") { - tmp.icon = true; - } - if(d && d.data) { - tmp.data = d.data; - if(d.data.jstree) { - for(i in d.data.jstree) { - if(d.data.jstree.hasOwnProperty(i)) { - tmp.state[i] = d.data.jstree[i]; - } - } - } - } - if(d && typeof d.state === 'object') { - for (i in d.state) { - if(d.state.hasOwnProperty(i)) { - tmp.state[i] = d.state[i]; - } - } - } - if(d && typeof d.li_attr === 'object') { - for (i in d.li_attr) { - if(d.li_attr.hasOwnProperty(i)) { - tmp.li_attr[i] = d.li_attr[i]; - } - } - } - if(tmp.li_attr.id && !tmp.id) { - tmp.id = tmp.li_attr.id.toString(); - } - if(!tmp.id) { - tmp.id = tid; - } - if(!tmp.li_attr.id) { - tmp.li_attr.id = tmp.id; - } - if(d && typeof d.a_attr === 'object') { - for (i in d.a_attr) { - if(d.a_attr.hasOwnProperty(i)) { - tmp.a_attr[i] = d.a_attr[i]; - } - } - } - if(d && d.children && d.children.length) { - for(i = 0, j = d.children.length; i < j; i++) { - c = this._parse_model_from_json(d.children[i], tmp.id, ps); - e = m[c]; - tmp.children.push(c); - if(e.children_d.length) { - tmp.children_d = tmp.children_d.concat(e.children_d); - } - } - tmp.children_d = tmp.children_d.concat(tmp.children); - } - if(d && d.children && d.children === true) { - tmp.state.loaded = false; - tmp.children = []; - tmp.children_d = []; - } - delete d.data; - delete d.children; - tmp.original = d; - m[tmp.id] = tmp; - if(tmp.state.selected) { - this._data.core.selected.push(tmp.id); - } - return tmp.id; - }, - /** - * redraws all nodes that need to be redrawn. Used internally. - * @private - * @name _redraw() - * @trigger redraw.jstree - */ - _redraw : function () { - var nodes = this._model.force_full_redraw ? this._model.data[$.jstree.root].children.concat([]) : this._model.changed.concat([]), - f = document.createElement('UL'), tmp, i, j, fe = this._data.core.focused; - for(i = 0, j = nodes.length; i < j; i++) { - tmp = this.redraw_node(nodes[i], true, this._model.force_full_redraw); - if(tmp && this._model.force_full_redraw) { - f.appendChild(tmp); - } - } - if(this._model.force_full_redraw) { - f.className = this.get_container_ul()[0].className; - f.setAttribute('role','group'); - this.element.empty().append(f); - //this.get_container_ul()[0].appendChild(f); - } - if(fe !== null) { - tmp = this.get_node(fe, true); - if(tmp && tmp.length && tmp.children('.jstree-anchor')[0] !== document.activeElement) { - tmp.children('.jstree-anchor').focus(); - } - else { - this._data.core.focused = null; - } - } - this._model.force_full_redraw = false; - this._model.changed = []; - /** - * triggered after nodes are redrawn - * @event - * @name redraw.jstree - * @param {array} nodes the redrawn nodes - */ - this.trigger('redraw', { "nodes" : nodes }); - }, - /** - * redraws all nodes that need to be redrawn or optionally - the whole tree - * @name redraw([full]) - * @param {Boolean} full if set to `true` all nodes are redrawn. - */ - redraw : function (full) { - if(full) { - this._model.force_full_redraw = true; - } - //if(this._model.redraw_timeout) { - // clearTimeout(this._model.redraw_timeout); - //} - //this._model.redraw_timeout = setTimeout($.proxy(this._redraw, this),0); - this._redraw(); - }, - /** - * redraws a single node's children. Used internally. - * @private - * @name draw_children(node) - * @param {mixed} node the node whose children will be redrawn - */ - draw_children : function (node) { - var obj = this.get_node(node), - i = false, - j = false, - k = false, - d = document; - if(!obj) { return false; } - if(obj.id === $.jstree.root) { return this.redraw(true); } - node = this.get_node(node, true); - if(!node || !node.length) { return false; } // TODO: quick toggle - - node.children('.jstree-children').remove(); - node = node[0]; - if(obj.children.length && obj.state.loaded) { - k = d.createElement('UL'); - k.setAttribute('role', 'group'); - k.className = 'jstree-children'; - for(i = 0, j = obj.children.length; i < j; i++) { - k.appendChild(this.redraw_node(obj.children[i], true, true)); - } - node.appendChild(k); - } - }, - /** - * redraws a single node. Used internally. - * @private - * @name redraw_node(node, deep, is_callback, force_render) - * @param {mixed} node the node to redraw - * @param {Boolean} deep should child nodes be redrawn too - * @param {Boolean} is_callback is this a recursion call - * @param {Boolean} force_render should children of closed parents be drawn anyway - */ - redraw_node : function (node, deep, is_callback, force_render) { - var obj = this.get_node(node), - par = false, - ind = false, - old = false, - i = false, - j = false, - k = false, - c = '', - d = document, - m = this._model.data, - f = false, - s = false, - tmp = null, - t = 0, - l = 0, - has_children = false, - last_sibling = false; - if(!obj) { return false; } - if(obj.id === $.jstree.root) { return this.redraw(true); } - deep = deep || obj.children.length === 0; - node = !document.querySelector ? document.getElementById(obj.id) : this.element[0].querySelector('#' + ("0123456789".indexOf(obj.id[0]) !== -1 ? '\\3' + obj.id[0] + ' ' + obj.id.substr(1).replace($.jstree.idregex,'\\$&') : obj.id.replace($.jstree.idregex,'\\$&')) ); //, this.element); - if(!node) { - deep = true; - //node = d.createElement('LI'); - if(!is_callback) { - par = obj.parent !== $.jstree.root ? $('#' + obj.parent.replace($.jstree.idregex,'\\$&'), this.element)[0] : null; - if(par !== null && (!par || !m[obj.parent].state.opened)) { - return false; - } - ind = $.inArray(obj.id, par === null ? m[$.jstree.root].children : m[obj.parent].children); - } - } - else { - node = $(node); - if(!is_callback) { - par = node.parent().parent()[0]; - if(par === this.element[0]) { - par = null; - } - ind = node.index(); - } - // m[obj.id].data = node.data(); // use only node's data, no need to touch jquery storage - if(!deep && obj.children.length && !node.children('.jstree-children').length) { - deep = true; - } - if(!deep) { - old = node.children('.jstree-children')[0]; - } - f = node.children('.jstree-anchor')[0] === document.activeElement; - node.remove(); - //node = d.createElement('LI'); - //node = node[0]; - } - node = this._data.core.node.cloneNode(true); - // node is DOM, deep is boolean - - c = 'jstree-node '; - for(i in obj.li_attr) { - if(obj.li_attr.hasOwnProperty(i)) { - if(i === 'id') { continue; } - if(i !== 'class') { - node.setAttribute(i, obj.li_attr[i]); - } - else { - c += obj.li_attr[i]; - } - } - } - if(!obj.a_attr.id) { - obj.a_attr.id = obj.id + '_anchor'; - } - node.setAttribute('aria-selected', !!obj.state.selected); - node.setAttribute('aria-level', obj.parents.length); - node.setAttribute('aria-labelledby', obj.a_attr.id); - if(obj.state.disabled) { - node.setAttribute('aria-disabled', true); - } - - for(i = 0, j = obj.children.length; i < j; i++) { - if(!m[obj.children[i]].state.hidden) { - has_children = true; - break; - } - } - if(obj.parent !== null && m[obj.parent] && !obj.state.hidden) { - i = $.inArray(obj.id, m[obj.parent].children); - last_sibling = obj.id; - if(i !== -1) { - i++; - for(j = m[obj.parent].children.length; i < j; i++) { - if(!m[m[obj.parent].children[i]].state.hidden) { - last_sibling = m[obj.parent].children[i]; - } - if(last_sibling !== obj.id) { - break; - } - } - } - } - - if(obj.state.hidden) { - c += ' jstree-hidden'; - } - if(obj.state.loaded && !has_children) { - c += ' jstree-leaf'; - } - else { - c += obj.state.opened && obj.state.loaded ? ' jstree-open' : ' jstree-closed'; - node.setAttribute('aria-expanded', (obj.state.opened && obj.state.loaded) ); - } - if(last_sibling === obj.id) { - c += ' jstree-last'; - } - node.id = obj.id; - node.className = c; - c = ( obj.state.selected ? ' jstree-clicked' : '') + ( obj.state.disabled ? ' jstree-disabled' : ''); - for(j in obj.a_attr) { - if(obj.a_attr.hasOwnProperty(j)) { - if(j === 'href' && obj.a_attr[j] === '#') { continue; } - if(j !== 'class') { - node.childNodes[1].setAttribute(j, obj.a_attr[j]); - } - else { - c += ' ' + obj.a_attr[j]; - } - } - } - if(c.length) { - node.childNodes[1].className = 'jstree-anchor ' + c; - } - if((obj.icon && obj.icon !== true) || obj.icon === false) { - if(obj.icon === false) { - node.childNodes[1].childNodes[0].className += ' jstree-themeicon-hidden'; - } - else if(obj.icon.indexOf('/') === -1 && obj.icon.indexOf('.') === -1) { - node.childNodes[1].childNodes[0].className += ' ' + obj.icon + ' jstree-themeicon-custom'; - } - else { - node.childNodes[1].childNodes[0].style.backgroundImage = 'url("'+obj.icon+'")'; - node.childNodes[1].childNodes[0].style.backgroundPosition = 'center center'; - node.childNodes[1].childNodes[0].style.backgroundSize = 'auto'; - node.childNodes[1].childNodes[0].className += ' jstree-themeicon-custom'; - } - } - - if(this.settings.core.force_text) { - node.childNodes[1].appendChild(d.createTextNode(obj.text)); - } - else { - node.childNodes[1].innerHTML += obj.text; - } - - - if(deep && obj.children.length && (obj.state.opened || force_render) && obj.state.loaded) { - k = d.createElement('UL'); - k.setAttribute('role', 'group'); - k.className = 'jstree-children'; - for(i = 0, j = obj.children.length; i < j; i++) { - k.appendChild(this.redraw_node(obj.children[i], deep, true)); - } - node.appendChild(k); - } - if(old) { - node.appendChild(old); - } - if(!is_callback) { - // append back using par / ind - if(!par) { - par = this.element[0]; - } - for(i = 0, j = par.childNodes.length; i < j; i++) { - if(par.childNodes[i] && par.childNodes[i].className && par.childNodes[i].className.indexOf('jstree-children') !== -1) { - tmp = par.childNodes[i]; - break; - } - } - if(!tmp) { - tmp = d.createElement('UL'); - tmp.setAttribute('role', 'group'); - tmp.className = 'jstree-children'; - par.appendChild(tmp); - } - par = tmp; - - if(ind < par.childNodes.length) { - par.insertBefore(node, par.childNodes[ind]); - } - else { - par.appendChild(node); - } - if(f) { - t = this.element[0].scrollTop; - l = this.element[0].scrollLeft; - node.childNodes[1].focus(); - this.element[0].scrollTop = t; - this.element[0].scrollLeft = l; - } - } - if(obj.state.opened && !obj.state.loaded) { - obj.state.opened = false; - setTimeout($.proxy(function () { - this.open_node(obj.id, false, 0); - }, this), 0); - } - return node; - }, - /** - * opens a node, revaling its children. If the node is not loaded it will be loaded and opened once ready. - * @name open_node(obj [, callback, animation]) - * @param {mixed} obj the node to open - * @param {Function} callback a function to execute once the node is opened - * @param {Number} animation the animation duration in milliseconds when opening the node (overrides the `core.animation` setting). Use `false` for no animation. - * @trigger open_node.jstree, after_open.jstree, before_open.jstree - */ - open_node : function (obj, callback, animation) { - var t1, t2, d, t; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.open_node(obj[t1], callback, animation); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { - return false; - } - animation = animation === undefined ? this.settings.core.animation : animation; - if(!this.is_closed(obj)) { - if(callback) { - callback.call(this, obj, false); - } - return false; - } - if(!this.is_loaded(obj)) { - if(this.is_loading(obj)) { - return setTimeout($.proxy(function () { - this.open_node(obj, callback, animation); - }, this), 500); - } - this.load_node(obj, function (o, ok) { - return ok ? this.open_node(o, callback, animation) : (callback ? callback.call(this, o, false) : false); - }); - } - else { - d = this.get_node(obj, true); - t = this; - if(d.length) { - if(animation && d.children(".jstree-children").length) { - d.children(".jstree-children").stop(true, true); - } - if(obj.children.length && !this._firstChild(d.children('.jstree-children')[0])) { - this.draw_children(obj); - //d = this.get_node(obj, true); - } - if(!animation) { - this.trigger('before_open', { "node" : obj }); - d[0].className = d[0].className.replace('jstree-closed', 'jstree-open'); - d[0].setAttribute("aria-expanded", true); - } - else { - this.trigger('before_open', { "node" : obj }); - d - .children(".jstree-children").css("display","none").end() - .removeClass("jstree-closed").addClass("jstree-open").attr("aria-expanded", true) - .children(".jstree-children").stop(true, true) - .slideDown(animation, function () { - this.style.display = ""; - if (t.element) { - t.trigger("after_open", { "node" : obj }); - } - }); - } - } - obj.state.opened = true; - if(callback) { - callback.call(this, obj, true); - } - if(!d.length) { - /** - * triggered when a node is about to be opened (if the node is supposed to be in the DOM, it will be, but it won't be visible yet) - * @event - * @name before_open.jstree - * @param {Object} node the opened node - */ - this.trigger('before_open', { "node" : obj }); - } - /** - * triggered when a node is opened (if there is an animation it will not be completed yet) - * @event - * @name open_node.jstree - * @param {Object} node the opened node - */ - this.trigger('open_node', { "node" : obj }); - if(!animation || !d.length) { - /** - * triggered when a node is opened and the animation is complete - * @event - * @name after_open.jstree - * @param {Object} node the opened node - */ - this.trigger("after_open", { "node" : obj }); - } - return true; - } - }, - /** - * opens every parent of a node (node should be loaded) - * @name _open_to(obj) - * @param {mixed} obj the node to reveal - * @private - */ - _open_to : function (obj) { - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { - return false; - } - var i, j, p = obj.parents; - for(i = 0, j = p.length; i < j; i+=1) { - if(i !== $.jstree.root) { - this.open_node(p[i], false, 0); - } - } - return $('#' + obj.id.replace($.jstree.idregex,'\\$&'), this.element); - }, - /** - * closes a node, hiding its children - * @name close_node(obj [, animation]) - * @param {mixed} obj the node to close - * @param {Number} animation the animation duration in milliseconds when closing the node (overrides the `core.animation` setting). Use `false` for no animation. - * @trigger close_node.jstree, after_close.jstree - */ - close_node : function (obj, animation) { - var t1, t2, t, d; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.close_node(obj[t1], animation); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { - return false; - } - if(this.is_closed(obj)) { - return false; - } - animation = animation === undefined ? this.settings.core.animation : animation; - t = this; - d = this.get_node(obj, true); - - obj.state.opened = false; - /** - * triggered when a node is closed (if there is an animation it will not be complete yet) - * @event - * @name close_node.jstree - * @param {Object} node the closed node - */ - this.trigger('close_node',{ "node" : obj }); - if(!d.length) { - /** - * triggered when a node is closed and the animation is complete - * @event - * @name after_close.jstree - * @param {Object} node the closed node - */ - this.trigger("after_close", { "node" : obj }); - } - else { - if(!animation) { - d[0].className = d[0].className.replace('jstree-open', 'jstree-closed'); - d.attr("aria-expanded", false).children('.jstree-children').remove(); - this.trigger("after_close", { "node" : obj }); - } - else { - d - .children(".jstree-children").attr("style","display:block !important").end() - .removeClass("jstree-open").addClass("jstree-closed").attr("aria-expanded", false) - .children(".jstree-children").stop(true, true).slideUp(animation, function () { - this.style.display = ""; - d.children('.jstree-children').remove(); - if (t.element) { - t.trigger("after_close", { "node" : obj }); - } - }); - } - } - }, - /** - * toggles a node - closing it if it is open, opening it if it is closed - * @name toggle_node(obj) - * @param {mixed} obj the node to toggle - */ - toggle_node : function (obj) { - var t1, t2; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.toggle_node(obj[t1]); - } - return true; - } - if(this.is_closed(obj)) { - return this.open_node(obj); - } - if(this.is_open(obj)) { - return this.close_node(obj); - } - }, - /** - * opens all nodes within a node (or the tree), revaling their children. If the node is not loaded it will be loaded and opened once ready. - * @name open_all([obj, animation, original_obj]) - * @param {mixed} obj the node to open recursively, omit to open all nodes in the tree - * @param {Number} animation the animation duration in milliseconds when opening the nodes, the default is no animation - * @param {jQuery} reference to the node that started the process (internal use) - * @trigger open_all.jstree - */ - open_all : function (obj, animation, original_obj) { - if(!obj) { obj = $.jstree.root; } - obj = this.get_node(obj); - if(!obj) { return false; } - var dom = obj.id === $.jstree.root ? this.get_container_ul() : this.get_node(obj, true), i, j, _this; - if(!dom.length) { - for(i = 0, j = obj.children_d.length; i < j; i++) { - if(this.is_closed(this._model.data[obj.children_d[i]])) { - this._model.data[obj.children_d[i]].state.opened = true; - } - } - return this.trigger('open_all', { "node" : obj }); - } - original_obj = original_obj || dom; - _this = this; - dom = this.is_closed(obj) ? dom.find('.jstree-closed').addBack() : dom.find('.jstree-closed'); - dom.each(function () { - _this.open_node( - this, - function(node, status) { if(status && this.is_parent(node)) { this.open_all(node, animation, original_obj); } }, - animation || 0 - ); - }); - if(original_obj.find('.jstree-closed').length === 0) { - /** - * triggered when an `open_all` call completes - * @event - * @name open_all.jstree - * @param {Object} node the opened node - */ - this.trigger('open_all', { "node" : this.get_node(original_obj) }); - } - }, - /** - * closes all nodes within a node (or the tree), revaling their children - * @name close_all([obj, animation]) - * @param {mixed} obj the node to close recursively, omit to close all nodes in the tree - * @param {Number} animation the animation duration in milliseconds when closing the nodes, the default is no animation - * @trigger close_all.jstree - */ - close_all : function (obj, animation) { - if(!obj) { obj = $.jstree.root; } - obj = this.get_node(obj); - if(!obj) { return false; } - var dom = obj.id === $.jstree.root ? this.get_container_ul() : this.get_node(obj, true), - _this = this, i, j; - if(dom.length) { - dom = this.is_open(obj) ? dom.find('.jstree-open').addBack() : dom.find('.jstree-open'); - $(dom.get().reverse()).each(function () { _this.close_node(this, animation || 0); }); - } - for(i = 0, j = obj.children_d.length; i < j; i++) { - this._model.data[obj.children_d[i]].state.opened = false; - } - /** - * triggered when an `close_all` call completes - * @event - * @name close_all.jstree - * @param {Object} node the closed node - */ - this.trigger('close_all', { "node" : obj }); - }, - /** - * checks if a node is disabled (not selectable) - * @name is_disabled(obj) - * @param {mixed} obj - * @return {Boolean} - */ - is_disabled : function (obj) { - obj = this.get_node(obj); - return obj && obj.state && obj.state.disabled; - }, - /** - * enables a node - so that it can be selected - * @name enable_node(obj) - * @param {mixed} obj the node to enable - * @trigger enable_node.jstree - */ - enable_node : function (obj) { - var t1, t2; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.enable_node(obj[t1]); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { - return false; - } - obj.state.disabled = false; - this.get_node(obj,true).children('.jstree-anchor').removeClass('jstree-disabled').attr('aria-disabled', false); - /** - * triggered when an node is enabled - * @event - * @name enable_node.jstree - * @param {Object} node the enabled node - */ - this.trigger('enable_node', { 'node' : obj }); - }, - /** - * disables a node - so that it can not be selected - * @name disable_node(obj) - * @param {mixed} obj the node to disable - * @trigger disable_node.jstree - */ - disable_node : function (obj) { - var t1, t2; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.disable_node(obj[t1]); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { - return false; - } - obj.state.disabled = true; - this.get_node(obj,true).children('.jstree-anchor').addClass('jstree-disabled').attr('aria-disabled', true); - /** - * triggered when an node is disabled - * @event - * @name disable_node.jstree - * @param {Object} node the disabled node - */ - this.trigger('disable_node', { 'node' : obj }); - }, - /** - * determines if a node is hidden - * @name is_hidden(obj) - * @param {mixed} obj the node - */ - is_hidden : function (obj) { - obj = this.get_node(obj); - return obj.state.hidden === true; - }, - /** - * hides a node - it is still in the structure but will not be visible - * @name hide_node(obj) - * @param {mixed} obj the node to hide - * @param {Boolean} skip_redraw internal parameter controlling if redraw is called - * @trigger hide_node.jstree - */ - hide_node : function (obj, skip_redraw) { - var t1, t2; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.hide_node(obj[t1], true); - } - if (!skip_redraw) { - this.redraw(); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { - return false; - } - if(!obj.state.hidden) { - obj.state.hidden = true; - this._node_changed(obj.parent); - if(!skip_redraw) { - this.redraw(); - } - /** - * triggered when an node is hidden - * @event - * @name hide_node.jstree - * @param {Object} node the hidden node - */ - this.trigger('hide_node', { 'node' : obj }); - } - }, - /** - * shows a node - * @name show_node(obj) - * @param {mixed} obj the node to show - * @param {Boolean} skip_redraw internal parameter controlling if redraw is called - * @trigger show_node.jstree - */ - show_node : function (obj, skip_redraw) { - var t1, t2; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.show_node(obj[t1], true); - } - if (!skip_redraw) { - this.redraw(); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { - return false; - } - if(obj.state.hidden) { - obj.state.hidden = false; - this._node_changed(obj.parent); - if(!skip_redraw) { - this.redraw(); - } - /** - * triggered when an node is shown - * @event - * @name show_node.jstree - * @param {Object} node the shown node - */ - this.trigger('show_node', { 'node' : obj }); - } - }, - /** - * hides all nodes - * @name hide_all() - * @trigger hide_all.jstree - */ - hide_all : function (skip_redraw) { - var i, m = this._model.data, ids = []; - for(i in m) { - if(m.hasOwnProperty(i) && i !== $.jstree.root && !m[i].state.hidden) { - m[i].state.hidden = true; - ids.push(i); - } - } - this._model.force_full_redraw = true; - if(!skip_redraw) { - this.redraw(); - } - /** - * triggered when all nodes are hidden - * @event - * @name hide_all.jstree - * @param {Array} nodes the IDs of all hidden nodes - */ - this.trigger('hide_all', { 'nodes' : ids }); - return ids; - }, - /** - * shows all nodes - * @name show_all() - * @trigger show_all.jstree - */ - show_all : function (skip_redraw) { - var i, m = this._model.data, ids = []; - for(i in m) { - if(m.hasOwnProperty(i) && i !== $.jstree.root && m[i].state.hidden) { - m[i].state.hidden = false; - ids.push(i); - } - } - this._model.force_full_redraw = true; - if(!skip_redraw) { - this.redraw(); - } - /** - * triggered when all nodes are shown - * @event - * @name show_all.jstree - * @param {Array} nodes the IDs of all shown nodes - */ - this.trigger('show_all', { 'nodes' : ids }); - return ids; - }, - /** - * called when a node is selected by the user. Used internally. - * @private - * @name activate_node(obj, e) - * @param {mixed} obj the node - * @param {Object} e the related event - * @trigger activate_node.jstree, changed.jstree - */ - activate_node : function (obj, e) { - if(this.is_disabled(obj)) { - return false; - } - if(!e || typeof e !== 'object') { - e = {}; - } - - // ensure last_clicked is still in the DOM, make it fresh (maybe it was moved?) and make sure it is still selected, if not - make last_clicked the last selected node - this._data.core.last_clicked = this._data.core.last_clicked && this._data.core.last_clicked.id !== undefined ? this.get_node(this._data.core.last_clicked.id) : null; - if(this._data.core.last_clicked && !this._data.core.last_clicked.state.selected) { this._data.core.last_clicked = null; } - if(!this._data.core.last_clicked && this._data.core.selected.length) { this._data.core.last_clicked = this.get_node(this._data.core.selected[this._data.core.selected.length - 1]); } - - if(!this.settings.core.multiple || (!e.metaKey && !e.ctrlKey && !e.shiftKey) || (e.shiftKey && (!this._data.core.last_clicked || !this.get_parent(obj) || this.get_parent(obj) !== this._data.core.last_clicked.parent ) )) { - if(!this.settings.core.multiple && (e.metaKey || e.ctrlKey || e.shiftKey) && this.is_selected(obj)) { - this.deselect_node(obj, false, e); - } - else { - this.deselect_all(true); - this.select_node(obj, false, false, e); - this._data.core.last_clicked = this.get_node(obj); - } - } - else { - if(e.shiftKey) { - var o = this.get_node(obj).id, - l = this._data.core.last_clicked.id, - p = this.get_node(this._data.core.last_clicked.parent).children, - c = false, - i, j; - for(i = 0, j = p.length; i < j; i += 1) { - // separate IFs work whem o and l are the same - if(p[i] === o) { - c = !c; - } - if(p[i] === l) { - c = !c; - } - if(!this.is_disabled(p[i]) && (c || p[i] === o || p[i] === l)) { - if (!this.is_hidden(p[i])) { - this.select_node(p[i], true, false, e); - } - } - else { - this.deselect_node(p[i], true, e); - } - } - this.trigger('changed', { 'action' : 'select_node', 'node' : this.get_node(obj), 'selected' : this._data.core.selected, 'event' : e }); - } - else { - if(!this.is_selected(obj)) { - this.select_node(obj, false, false, e); - } - else { - this.deselect_node(obj, false, e); - } - } - } - /** - * triggered when an node is clicked or intercated with by the user - * @event - * @name activate_node.jstree - * @param {Object} node - * @param {Object} event the ooriginal event (if any) which triggered the call (may be an empty object) - */ - this.trigger('activate_node', { 'node' : this.get_node(obj), 'event' : e }); - }, - /** - * applies the hover state on a node, called when a node is hovered by the user. Used internally. - * @private - * @name hover_node(obj) - * @param {mixed} obj - * @trigger hover_node.jstree - */ - hover_node : function (obj) { - obj = this.get_node(obj, true); - if(!obj || !obj.length || obj.children('.jstree-hovered').length) { - return false; - } - var o = this.element.find('.jstree-hovered'), t = this.element; - if(o && o.length) { this.dehover_node(o); } - - obj.children('.jstree-anchor').addClass('jstree-hovered'); - /** - * triggered when an node is hovered - * @event - * @name hover_node.jstree - * @param {Object} node - */ - this.trigger('hover_node', { 'node' : this.get_node(obj) }); - setTimeout(function () { t.attr('aria-activedescendant', obj[0].id); }, 0); - }, - /** - * removes the hover state from a nodecalled when a node is no longer hovered by the user. Used internally. - * @private - * @name dehover_node(obj) - * @param {mixed} obj - * @trigger dehover_node.jstree - */ - dehover_node : function (obj) { - obj = this.get_node(obj, true); - if(!obj || !obj.length || !obj.children('.jstree-hovered').length) { - return false; - } - obj.children('.jstree-anchor').removeClass('jstree-hovered'); - /** - * triggered when an node is no longer hovered - * @event - * @name dehover_node.jstree - * @param {Object} node - */ - this.trigger('dehover_node', { 'node' : this.get_node(obj) }); - }, - /** - * select a node - * @name select_node(obj [, supress_event, prevent_open]) - * @param {mixed} obj an array can be used to select multiple nodes - * @param {Boolean} supress_event if set to `true` the `changed.jstree` event won't be triggered - * @param {Boolean} prevent_open if set to `true` parents of the selected node won't be opened - * @trigger select_node.jstree, changed.jstree - */ - select_node : function (obj, supress_event, prevent_open, e) { - var dom, t1, t2, th; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.select_node(obj[t1], supress_event, prevent_open, e); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { - return false; - } - dom = this.get_node(obj, true); - if(!obj.state.selected) { - obj.state.selected = true; - this._data.core.selected.push(obj.id); - if(!prevent_open) { - dom = this._open_to(obj); - } - if(dom && dom.length) { - dom.attr('aria-selected', true).children('.jstree-anchor').addClass('jstree-clicked'); - } - /** - * triggered when an node is selected - * @event - * @name select_node.jstree - * @param {Object} node - * @param {Array} selected the current selection - * @param {Object} event the event (if any) that triggered this select_node - */ - this.trigger('select_node', { 'node' : obj, 'selected' : this._data.core.selected, 'event' : e }); - if(!supress_event) { - /** - * triggered when selection changes - * @event - * @name changed.jstree - * @param {Object} node - * @param {Object} action the action that caused the selection to change - * @param {Array} selected the current selection - * @param {Object} event the event (if any) that triggered this changed event - */ - this.trigger('changed', { 'action' : 'select_node', 'node' : obj, 'selected' : this._data.core.selected, 'event' : e }); - } - } - }, - /** - * deselect a node - * @name deselect_node(obj [, supress_event]) - * @param {mixed} obj an array can be used to deselect multiple nodes - * @param {Boolean} supress_event if set to `true` the `changed.jstree` event won't be triggered - * @trigger deselect_node.jstree, changed.jstree - */ - deselect_node : function (obj, supress_event, e) { - var t1, t2, dom; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.deselect_node(obj[t1], supress_event, e); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { - return false; - } - dom = this.get_node(obj, true); - if(obj.state.selected) { - obj.state.selected = false; - this._data.core.selected = $.vakata.array_remove_item(this._data.core.selected, obj.id); - if(dom.length) { - dom.attr('aria-selected', false).children('.jstree-anchor').removeClass('jstree-clicked'); - } - /** - * triggered when an node is deselected - * @event - * @name deselect_node.jstree - * @param {Object} node - * @param {Array} selected the current selection - * @param {Object} event the event (if any) that triggered this deselect_node - */ - this.trigger('deselect_node', { 'node' : obj, 'selected' : this._data.core.selected, 'event' : e }); - if(!supress_event) { - this.trigger('changed', { 'action' : 'deselect_node', 'node' : obj, 'selected' : this._data.core.selected, 'event' : e }); - } - } - }, - /** - * select all nodes in the tree - * @name select_all([supress_event]) - * @param {Boolean} supress_event if set to `true` the `changed.jstree` event won't be triggered - * @trigger select_all.jstree, changed.jstree - */ - select_all : function (supress_event) { - var tmp = this._data.core.selected.concat([]), i, j; - this._data.core.selected = this._model.data[$.jstree.root].children_d.concat(); - for(i = 0, j = this._data.core.selected.length; i < j; i++) { - if(this._model.data[this._data.core.selected[i]]) { - this._model.data[this._data.core.selected[i]].state.selected = true; - } - } - this.redraw(true); - /** - * triggered when all nodes are selected - * @event - * @name select_all.jstree - * @param {Array} selected the current selection - */ - this.trigger('select_all', { 'selected' : this._data.core.selected }); - if(!supress_event) { - this.trigger('changed', { 'action' : 'select_all', 'selected' : this._data.core.selected, 'old_selection' : tmp }); - } - }, - /** - * deselect all selected nodes - * @name deselect_all([supress_event]) - * @param {Boolean} supress_event if set to `true` the `changed.jstree` event won't be triggered - * @trigger deselect_all.jstree, changed.jstree - */ - deselect_all : function (supress_event) { - var tmp = this._data.core.selected.concat([]), i, j; - for(i = 0, j = this._data.core.selected.length; i < j; i++) { - if(this._model.data[this._data.core.selected[i]]) { - this._model.data[this._data.core.selected[i]].state.selected = false; - } - } - this._data.core.selected = []; - this.element.find('.jstree-clicked').removeClass('jstree-clicked').parent().attr('aria-selected', false); - /** - * triggered when all nodes are deselected - * @event - * @name deselect_all.jstree - * @param {Object} node the previous selection - * @param {Array} selected the current selection - */ - this.trigger('deselect_all', { 'selected' : this._data.core.selected, 'node' : tmp }); - if(!supress_event) { - this.trigger('changed', { 'action' : 'deselect_all', 'selected' : this._data.core.selected, 'old_selection' : tmp }); - } - }, - /** - * checks if a node is selected - * @name is_selected(obj) - * @param {mixed} obj - * @return {Boolean} - */ - is_selected : function (obj) { - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { - return false; - } - return obj.state.selected; - }, - /** - * get an array of all selected nodes - * @name get_selected([full]) - * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned - * @return {Array} - */ - get_selected : function (full) { - return full ? $.map(this._data.core.selected, $.proxy(function (i) { return this.get_node(i); }, this)) : this._data.core.selected.slice(); - }, - /** - * get an array of all top level selected nodes (ignoring children of selected nodes) - * @name get_top_selected([full]) - * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned - * @return {Array} - */ - get_top_selected : function (full) { - var tmp = this.get_selected(true), - obj = {}, i, j, k, l; - for(i = 0, j = tmp.length; i < j; i++) { - obj[tmp[i].id] = tmp[i]; - } - for(i = 0, j = tmp.length; i < j; i++) { - for(k = 0, l = tmp[i].children_d.length; k < l; k++) { - if(obj[tmp[i].children_d[k]]) { - delete obj[tmp[i].children_d[k]]; - } - } - } - tmp = []; - for(i in obj) { - if(obj.hasOwnProperty(i)) { - tmp.push(i); - } - } - return full ? $.map(tmp, $.proxy(function (i) { return this.get_node(i); }, this)) : tmp; - }, - /** - * get an array of all bottom level selected nodes (ignoring selected parents) - * @name get_bottom_selected([full]) - * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned - * @return {Array} - */ - get_bottom_selected : function (full) { - var tmp = this.get_selected(true), - obj = [], i, j; - for(i = 0, j = tmp.length; i < j; i++) { - if(!tmp[i].children.length) { - obj.push(tmp[i].id); - } - } - return full ? $.map(obj, $.proxy(function (i) { return this.get_node(i); }, this)) : obj; - }, - /** - * gets the current state of the tree so that it can be restored later with `set_state(state)`. Used internally. - * @name get_state() - * @private - * @return {Object} - */ - get_state : function () { - var state = { - 'core' : { - 'open' : [], - 'scroll' : { - 'left' : this.element.scrollLeft(), - 'top' : this.element.scrollTop() - }, - /*! - 'themes' : { - 'name' : this.get_theme(), - 'icons' : this._data.core.themes.icons, - 'dots' : this._data.core.themes.dots - }, - */ - 'selected' : [] - } - }, i; - for(i in this._model.data) { - if(this._model.data.hasOwnProperty(i)) { - if(i !== $.jstree.root) { - if(this._model.data[i].state.opened) { - state.core.open.push(i); - } - if(this._model.data[i].state.selected) { - state.core.selected.push(i); - } - } - } - } - return state; - }, - /** - * sets the state of the tree. Used internally. - * @name set_state(state [, callback]) - * @private - * @param {Object} state the state to restore. Keep in mind this object is passed by reference and jstree will modify it. - * @param {Function} callback an optional function to execute once the state is restored. - * @trigger set_state.jstree - */ - set_state : function (state, callback) { - if(state) { - if(state.core) { - var res, n, t, _this, i; - if(state.core.open) { - if(!$.isArray(state.core.open) || !state.core.open.length) { - delete state.core.open; - this.set_state(state, callback); - } - else { - this._load_nodes(state.core.open, function (nodes) { - this.open_node(nodes, false, 0); - delete state.core.open; - this.set_state(state, callback); - }); - } - return false; - } - if(state.core.scroll) { - if(state.core.scroll && state.core.scroll.left !== undefined) { - this.element.scrollLeft(state.core.scroll.left); - } - if(state.core.scroll && state.core.scroll.top !== undefined) { - this.element.scrollTop(state.core.scroll.top); - } - delete state.core.scroll; - this.set_state(state, callback); - return false; - } - if(state.core.selected) { - _this = this; - this.deselect_all(); - $.each(state.core.selected, function (i, v) { - _this.select_node(v, false, true); - }); - delete state.core.selected; - this.set_state(state, callback); - return false; - } - for(i in state) { - if(state.hasOwnProperty(i) && i !== "core" && $.inArray(i, this.settings.plugins) === -1) { - delete state[i]; - } - } - if($.isEmptyObject(state.core)) { - delete state.core; - this.set_state(state, callback); - return false; - } - } - if($.isEmptyObject(state)) { - state = null; - if(callback) { callback.call(this); } - /** - * triggered when a `set_state` call completes - * @event - * @name set_state.jstree - */ - this.trigger('set_state'); - return false; - } - return true; - } - return false; - }, - /** - * refreshes the tree - all nodes are reloaded with calls to `load_node`. - * @name refresh() - * @param {Boolean} skip_loading an option to skip showing the loading indicator - * @param {Mixed} forget_state if set to `true` state will not be reapplied, if set to a function (receiving the current state as argument) the result of that function will be used as state - * @trigger refresh.jstree - */ - refresh : function (skip_loading, forget_state) { - this._data.core.state = forget_state === true ? {} : this.get_state(); - if(forget_state && $.isFunction(forget_state)) { this._data.core.state = forget_state.call(this, this._data.core.state); } - this._cnt = 0; - this._model.data = {}; - this._model.data[$.jstree.root] = { - id : $.jstree.root, - parent : null, - parents : [], - children : [], - children_d : [], - state : { loaded : false } - }; - this._data.core.selected = []; - this._data.core.last_clicked = null; - this._data.core.focused = null; - - var c = this.get_container_ul()[0].className; - if(!skip_loading) { - this.element.html("<"+"ul class='"+c+"' role='group'><"+"li class='jstree-initial-node jstree-loading jstree-leaf jstree-last' role='treeitem' id='j"+this._id+"_loading'><"+"a class='jstree-anchor' href='#'>" + this.get_string("Loading ...") + ""); - this.element.attr('aria-activedescendant','j'+this._id+'_loading'); - } - this.load_node($.jstree.root, function (o, s) { - if(s) { - this.get_container_ul()[0].className = c; - if(this._firstChild(this.get_container_ul()[0])) { - this.element.attr('aria-activedescendant',this._firstChild(this.get_container_ul()[0]).id); - } - this.set_state($.extend(true, {}, this._data.core.state), function () { - /** - * triggered when a `refresh` call completes - * @event - * @name refresh.jstree - */ - this.trigger('refresh'); - }); - } - this._data.core.state = null; - }); - }, - /** - * refreshes a node in the tree (reload its children) all opened nodes inside that node are reloaded with calls to `load_node`. - * @name refresh_node(obj) - * @param {mixed} obj the node - * @trigger refresh_node.jstree - */ - refresh_node : function (obj) { - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { return false; } - var opened = [], to_load = [], s = this._data.core.selected.concat([]); - to_load.push(obj.id); - if(obj.state.opened === true) { opened.push(obj.id); } - this.get_node(obj, true).find('.jstree-open').each(function() { to_load.push(this.id); opened.push(this.id); }); - this._load_nodes(to_load, $.proxy(function (nodes) { - this.open_node(opened, false, 0); - this.select_node(s); - /** - * triggered when a node is refreshed - * @event - * @name refresh_node.jstree - * @param {Object} node - the refreshed node - * @param {Array} nodes - an array of the IDs of the nodes that were reloaded - */ - this.trigger('refresh_node', { 'node' : obj, 'nodes' : nodes }); - }, this), false, true); - }, - /** - * set (change) the ID of a node - * @name set_id(obj, id) - * @param {mixed} obj the node - * @param {String} id the new ID - * @return {Boolean} - * @trigger set_id.jstree - */ - set_id : function (obj, id) { - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { return false; } - var i, j, m = this._model.data, old = obj.id; - id = id.toString(); - // update parents (replace current ID with new one in children and children_d) - m[obj.parent].children[$.inArray(obj.id, m[obj.parent].children)] = id; - for(i = 0, j = obj.parents.length; i < j; i++) { - m[obj.parents[i]].children_d[$.inArray(obj.id, m[obj.parents[i]].children_d)] = id; - } - // update children (replace current ID with new one in parent and parents) - for(i = 0, j = obj.children.length; i < j; i++) { - m[obj.children[i]].parent = id; - } - for(i = 0, j = obj.children_d.length; i < j; i++) { - m[obj.children_d[i]].parents[$.inArray(obj.id, m[obj.children_d[i]].parents)] = id; - } - i = $.inArray(obj.id, this._data.core.selected); - if(i !== -1) { this._data.core.selected[i] = id; } - // update model and obj itself (obj.id, this._model.data[KEY]) - i = this.get_node(obj.id, true); - if(i) { - i.attr('id', id); //.children('.jstree-anchor').attr('id', id + '_anchor').end().attr('aria-labelledby', id + '_anchor'); - if(this.element.attr('aria-activedescendant') === obj.id) { - this.element.attr('aria-activedescendant', id); - } - } - delete m[obj.id]; - obj.id = id; - obj.li_attr.id = id; - m[id] = obj; - /** - * triggered when a node id value is changed - * @event - * @name set_id.jstree - * @param {Object} node - * @param {String} old the old id - */ - this.trigger('set_id',{ "node" : obj, "new" : obj.id, "old" : old }); - return true; - }, - /** - * get the text value of a node - * @name get_text(obj) - * @param {mixed} obj the node - * @return {String} - */ - get_text : function (obj) { - obj = this.get_node(obj); - return (!obj || obj.id === $.jstree.root) ? false : obj.text; - }, - /** - * set the text value of a node. Used internally, please use `rename_node(obj, val)`. - * @private - * @name set_text(obj, val) - * @param {mixed} obj the node, you can pass an array to set the text on multiple nodes - * @param {String} val the new text value - * @return {Boolean} - * @trigger set_text.jstree - */ - set_text : function (obj, val) { - var t1, t2; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.set_text(obj[t1], val); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { return false; } - obj.text = val; - if(this.get_node(obj, true).length) { - this.redraw_node(obj.id); - } - /** - * triggered when a node text value is changed - * @event - * @name set_text.jstree - * @param {Object} obj - * @param {String} text the new value - */ - this.trigger('set_text',{ "obj" : obj, "text" : val }); - return true; - }, - /** - * gets a JSON representation of a node (or the whole tree) - * @name get_json([obj, options]) - * @param {mixed} obj - * @param {Object} options - * @param {Boolean} options.no_state do not return state information - * @param {Boolean} options.no_id do not return ID - * @param {Boolean} options.no_children do not include children - * @param {Boolean} options.no_data do not include node data - * @param {Boolean} options.no_li_attr do not include LI attributes - * @param {Boolean} options.no_a_attr do not include A attributes - * @param {Boolean} options.flat return flat JSON instead of nested - * @return {Object} - */ - get_json : function (obj, options, flat) { - obj = this.get_node(obj || $.jstree.root); - if(!obj) { return false; } - if(options && options.flat && !flat) { flat = []; } - var tmp = { - 'id' : obj.id, - 'text' : obj.text, - 'icon' : this.get_icon(obj), - 'li_attr' : $.extend(true, {}, obj.li_attr), - 'a_attr' : $.extend(true, {}, obj.a_attr), - 'state' : {}, - 'data' : options && options.no_data ? false : $.extend(true, {}, obj.data) - //( this.get_node(obj, true).length ? this.get_node(obj, true).data() : obj.data ), - }, i, j; - if(options && options.flat) { - tmp.parent = obj.parent; - } - else { - tmp.children = []; - } - if(!options || !options.no_state) { - for(i in obj.state) { - if(obj.state.hasOwnProperty(i)) { - tmp.state[i] = obj.state[i]; - } - } - } else { - delete tmp.state; - } - if(options && options.no_li_attr) { - delete tmp.li_attr; - } - if(options && options.no_a_attr) { - delete tmp.a_attr; - } - if(options && options.no_id) { - delete tmp.id; - if(tmp.li_attr && tmp.li_attr.id) { - delete tmp.li_attr.id; - } - if(tmp.a_attr && tmp.a_attr.id) { - delete tmp.a_attr.id; - } - } - if(options && options.flat && obj.id !== $.jstree.root) { - flat.push(tmp); - } - if(!options || !options.no_children) { - for(i = 0, j = obj.children.length; i < j; i++) { - if(options && options.flat) { - this.get_json(obj.children[i], options, flat); - } - else { - tmp.children.push(this.get_json(obj.children[i], options)); - } - } - } - return options && options.flat ? flat : (obj.id === $.jstree.root ? tmp.children : tmp); - }, - /** - * create a new node (do not confuse with load_node) - * @name create_node([par, node, pos, callback, is_loaded]) - * @param {mixed} par the parent node (to create a root node use either "#" (string) or `null`) - * @param {mixed} node the data for the new node (a valid JSON object, or a simple string with the name) - * @param {mixed} pos the index at which to insert the node, "first" and "last" are also supported, default is "last" - * @param {Function} callback a function to be called once the node is created - * @param {Boolean} is_loaded internal argument indicating if the parent node was succesfully loaded - * @return {String} the ID of the newly create node - * @trigger model.jstree, create_node.jstree - */ - create_node : function (par, node, pos, callback, is_loaded) { - if(par === null) { par = $.jstree.root; } - par = this.get_node(par); - if(!par) { return false; } - pos = pos === undefined ? "last" : pos; - if(!pos.toString().match(/^(before|after)$/) && !is_loaded && !this.is_loaded(par)) { - return this.load_node(par, function () { this.create_node(par, node, pos, callback, true); }); - } - if(!node) { node = { "text" : this.get_string('New node') }; } - if(typeof node === "string") { node = { "text" : node }; } - if(node.text === undefined) { node.text = this.get_string('New node'); } - var tmp, dpc, i, j; - - if(par.id === $.jstree.root) { - if(pos === "before") { pos = "first"; } - if(pos === "after") { pos = "last"; } - } - switch(pos) { - case "before": - tmp = this.get_node(par.parent); - pos = $.inArray(par.id, tmp.children); - par = tmp; - break; - case "after" : - tmp = this.get_node(par.parent); - pos = $.inArray(par.id, tmp.children) + 1; - par = tmp; - break; - case "inside": - case "first": - pos = 0; - break; - case "last": - pos = par.children.length; - break; - default: - if(!pos) { pos = 0; } - break; - } - if(pos > par.children.length) { pos = par.children.length; } - if(!node.id) { node.id = true; } - if(!this.check("create_node", node, par, pos)) { - this.settings.core.error.call(this, this._data.core.last_error); - return false; - } - if(node.id === true) { delete node.id; } - node = this._parse_model_from_json(node, par.id, par.parents.concat()); - if(!node) { return false; } - tmp = this.get_node(node); - dpc = []; - dpc.push(node); - dpc = dpc.concat(tmp.children_d); - this.trigger('model', { "nodes" : dpc, "parent" : par.id }); - - par.children_d = par.children_d.concat(dpc); - for(i = 0, j = par.parents.length; i < j; i++) { - this._model.data[par.parents[i]].children_d = this._model.data[par.parents[i]].children_d.concat(dpc); - } - node = tmp; - tmp = []; - for(i = 0, j = par.children.length; i < j; i++) { - tmp[i >= pos ? i+1 : i] = par.children[i]; - } - tmp[pos] = node.id; - par.children = tmp; - - this.redraw_node(par, true); - if(callback) { callback.call(this, this.get_node(node)); } - /** - * triggered when a node is created - * @event - * @name create_node.jstree - * @param {Object} node - * @param {String} parent the parent's ID - * @param {Number} position the position of the new node among the parent's children - */ - this.trigger('create_node', { "node" : this.get_node(node), "parent" : par.id, "position" : pos }); - return node.id; - }, - /** - * set the text value of a node - * @name rename_node(obj, val) - * @param {mixed} obj the node, you can pass an array to rename multiple nodes to the same name - * @param {String} val the new text value - * @return {Boolean} - * @trigger rename_node.jstree - */ - rename_node : function (obj, val) { - var t1, t2, old; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.rename_node(obj[t1], val); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { return false; } - old = obj.text; - if(!this.check("rename_node", obj, this.get_parent(obj), val)) { - this.settings.core.error.call(this, this._data.core.last_error); - return false; - } - this.set_text(obj, val); // .apply(this, Array.prototype.slice.call(arguments)) - /** - * triggered when a node is renamed - * @event - * @name rename_node.jstree - * @param {Object} node - * @param {String} text the new value - * @param {String} old the old value - */ - this.trigger('rename_node', { "node" : obj, "text" : val, "old" : old }); - return true; - }, - /** - * remove a node - * @name delete_node(obj) - * @param {mixed} obj the node, you can pass an array to delete multiple nodes - * @return {Boolean} - * @trigger delete_node.jstree, changed.jstree - */ - delete_node : function (obj) { - var t1, t2, par, pos, tmp, i, j, k, l, c, top, lft; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.delete_node(obj[t1]); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { return false; } - par = this.get_node(obj.parent); - pos = $.inArray(obj.id, par.children); - c = false; - if(!this.check("delete_node", obj, par, pos)) { - this.settings.core.error.call(this, this._data.core.last_error); - return false; - } - if(pos !== -1) { - par.children = $.vakata.array_remove(par.children, pos); - } - tmp = obj.children_d.concat([]); - tmp.push(obj.id); - for(i = 0, j = obj.parents.length; i < j; i++) { - this._model.data[obj.parents[i]].children_d = $.vakata.array_filter(this._model.data[obj.parents[i]].children_d, function (v) { - return $.inArray(v, tmp) === -1; - }); - } - for(k = 0, l = tmp.length; k < l; k++) { - if(this._model.data[tmp[k]].state.selected) { - c = true; - break; - } - } - if (c) { - this._data.core.selected = $.vakata.array_filter(this._data.core.selected, function (v) { - return $.inArray(v, tmp) === -1; - }); - } - /** - * triggered when a node is deleted - * @event - * @name delete_node.jstree - * @param {Object} node - * @param {String} parent the parent's ID - */ - this.trigger('delete_node', { "node" : obj, "parent" : par.id }); - if(c) { - this.trigger('changed', { 'action' : 'delete_node', 'node' : obj, 'selected' : this._data.core.selected, 'parent' : par.id }); - } - for(k = 0, l = tmp.length; k < l; k++) { - delete this._model.data[tmp[k]]; - } - if($.inArray(this._data.core.focused, tmp) !== -1) { - this._data.core.focused = null; - top = this.element[0].scrollTop; - lft = this.element[0].scrollLeft; - if(par.id === $.jstree.root) { - if (this._model.data[$.jstree.root].children[0]) { - this.get_node(this._model.data[$.jstree.root].children[0], true).children('.jstree-anchor').focus(); - } - } - else { - this.get_node(par, true).children('.jstree-anchor').focus(); - } - this.element[0].scrollTop = top; - this.element[0].scrollLeft = lft; - } - this.redraw_node(par, true); - return true; - }, - /** - * check if an operation is premitted on the tree. Used internally. - * @private - * @name check(chk, obj, par, pos) - * @param {String} chk the operation to check, can be "create_node", "rename_node", "delete_node", "copy_node" or "move_node" - * @param {mixed} obj the node - * @param {mixed} par the parent - * @param {mixed} pos the position to insert at, or if "rename_node" - the new name - * @param {mixed} more some various additional information, for example if a "move_node" operations is triggered by DND this will be the hovered node - * @return {Boolean} - */ - check : function (chk, obj, par, pos, more) { - obj = obj && obj.id ? obj : this.get_node(obj); - par = par && par.id ? par : this.get_node(par); - var tmp = chk.match(/^move_node|copy_node|create_node$/i) ? par : obj, - chc = this.settings.core.check_callback; - if(chk === "move_node" || chk === "copy_node") { - if((!more || !more.is_multi) && (obj.id === par.id || (chk === "move_node" && $.inArray(obj.id, par.children) === pos) || $.inArray(par.id, obj.children_d) !== -1)) { - this._data.core.last_error = { 'error' : 'check', 'plugin' : 'core', 'id' : 'core_01', 'reason' : 'Moving parent inside child', 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; - return false; - } - } - if(tmp && tmp.data) { tmp = tmp.data; } - if(tmp && tmp.functions && (tmp.functions[chk] === false || tmp.functions[chk] === true)) { - if(tmp.functions[chk] === false) { - this._data.core.last_error = { 'error' : 'check', 'plugin' : 'core', 'id' : 'core_02', 'reason' : 'Node data prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; - } - return tmp.functions[chk]; - } - if(chc === false || ($.isFunction(chc) && chc.call(this, chk, obj, par, pos, more) === false) || (chc && chc[chk] === false)) { - this._data.core.last_error = { 'error' : 'check', 'plugin' : 'core', 'id' : 'core_03', 'reason' : 'User config for core.check_callback prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; - return false; - } - return true; - }, - /** - * get the last error - * @name last_error() - * @return {Object} - */ - last_error : function () { - return this._data.core.last_error; - }, - /** - * move a node to a new parent - * @name move_node(obj, par [, pos, callback, is_loaded]) - * @param {mixed} obj the node to move, pass an array to move multiple nodes - * @param {mixed} par the new parent - * @param {mixed} pos the position to insert at (besides integer values, "first" and "last" are supported, as well as "before" and "after"), defaults to integer `0` - * @param {function} callback a function to call once the move is completed, receives 3 arguments - the node, the new parent and the position - * @param {Boolean} is_loaded internal parameter indicating if the parent node has been loaded - * @param {Boolean} skip_redraw internal parameter indicating if the tree should be redrawn - * @param {Boolean} instance internal parameter indicating if the node comes from another instance - * @trigger move_node.jstree - */ - move_node : function (obj, par, pos, callback, is_loaded, skip_redraw, origin) { - var t1, t2, old_par, old_pos, new_par, old_ins, is_multi, dpc, tmp, i, j, k, l, p; - - par = this.get_node(par); - pos = pos === undefined ? 0 : pos; - if(!par) { return false; } - if(!pos.toString().match(/^(before|after)$/) && !is_loaded && !this.is_loaded(par)) { - return this.load_node(par, function () { this.move_node(obj, par, pos, callback, true, false, origin); }); - } - - if($.isArray(obj)) { - if(obj.length === 1) { - obj = obj[0]; - } - else { - //obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - if((tmp = this.move_node(obj[t1], par, pos, callback, is_loaded, false, origin))) { - par = tmp; - pos = "after"; - } - } - this.redraw(); - return true; - } - } - obj = obj && obj.id ? obj : this.get_node(obj); - - if(!obj || obj.id === $.jstree.root) { return false; } - - old_par = (obj.parent || $.jstree.root).toString(); - new_par = (!pos.toString().match(/^(before|after)$/) || par.id === $.jstree.root) ? par : this.get_node(par.parent); - old_ins = origin ? origin : (this._model.data[obj.id] ? this : $.jstree.reference(obj.id)); - is_multi = !old_ins || !old_ins._id || (this._id !== old_ins._id); - old_pos = old_ins && old_ins._id && old_par && old_ins._model.data[old_par] && old_ins._model.data[old_par].children ? $.inArray(obj.id, old_ins._model.data[old_par].children) : -1; - if(old_ins && old_ins._id) { - obj = old_ins._model.data[obj.id]; - } - - if(is_multi) { - if((tmp = this.copy_node(obj, par, pos, callback, is_loaded, false, origin))) { - if(old_ins) { old_ins.delete_node(obj); } - return tmp; - } - return false; - } - //var m = this._model.data; - if(par.id === $.jstree.root) { - if(pos === "before") { pos = "first"; } - if(pos === "after") { pos = "last"; } - } - switch(pos) { - case "before": - pos = $.inArray(par.id, new_par.children); - break; - case "after" : - pos = $.inArray(par.id, new_par.children) + 1; - break; - case "inside": - case "first": - pos = 0; - break; - case "last": - pos = new_par.children.length; - break; - default: - if(!pos) { pos = 0; } - break; - } - if(pos > new_par.children.length) { pos = new_par.children.length; } - if(!this.check("move_node", obj, new_par, pos, { 'core' : true, 'origin' : origin, 'is_multi' : (old_ins && old_ins._id && old_ins._id !== this._id), 'is_foreign' : (!old_ins || !old_ins._id) })) { - this.settings.core.error.call(this, this._data.core.last_error); - return false; - } - if(obj.parent === new_par.id) { - dpc = new_par.children.concat(); - tmp = $.inArray(obj.id, dpc); - if(tmp !== -1) { - dpc = $.vakata.array_remove(dpc, tmp); - if(pos > tmp) { pos--; } - } - tmp = []; - for(i = 0, j = dpc.length; i < j; i++) { - tmp[i >= pos ? i+1 : i] = dpc[i]; - } - tmp[pos] = obj.id; - new_par.children = tmp; - this._node_changed(new_par.id); - this.redraw(new_par.id === $.jstree.root); - } - else { - // clean old parent and up - tmp = obj.children_d.concat(); - tmp.push(obj.id); - for(i = 0, j = obj.parents.length; i < j; i++) { - dpc = []; - p = old_ins._model.data[obj.parents[i]].children_d; - for(k = 0, l = p.length; k < l; k++) { - if($.inArray(p[k], tmp) === -1) { - dpc.push(p[k]); - } - } - old_ins._model.data[obj.parents[i]].children_d = dpc; - } - old_ins._model.data[old_par].children = $.vakata.array_remove_item(old_ins._model.data[old_par].children, obj.id); - - // insert into new parent and up - for(i = 0, j = new_par.parents.length; i < j; i++) { - this._model.data[new_par.parents[i]].children_d = this._model.data[new_par.parents[i]].children_d.concat(tmp); - } - dpc = []; - for(i = 0, j = new_par.children.length; i < j; i++) { - dpc[i >= pos ? i+1 : i] = new_par.children[i]; - } - dpc[pos] = obj.id; - new_par.children = dpc; - new_par.children_d.push(obj.id); - new_par.children_d = new_par.children_d.concat(obj.children_d); - - // update object - obj.parent = new_par.id; - tmp = new_par.parents.concat(); - tmp.unshift(new_par.id); - p = obj.parents.length; - obj.parents = tmp; - - // update object children - tmp = tmp.concat(); - for(i = 0, j = obj.children_d.length; i < j; i++) { - this._model.data[obj.children_d[i]].parents = this._model.data[obj.children_d[i]].parents.slice(0,p*-1); - Array.prototype.push.apply(this._model.data[obj.children_d[i]].parents, tmp); - } - - if(old_par === $.jstree.root || new_par.id === $.jstree.root) { - this._model.force_full_redraw = true; - } - if(!this._model.force_full_redraw) { - this._node_changed(old_par); - this._node_changed(new_par.id); - } - if(!skip_redraw) { - this.redraw(); - } - } - if(callback) { callback.call(this, obj, new_par, pos); } - /** - * triggered when a node is moved - * @event - * @name move_node.jstree - * @param {Object} node - * @param {String} parent the parent's ID - * @param {Number} position the position of the node among the parent's children - * @param {String} old_parent the old parent of the node - * @param {Number} old_position the old position of the node - * @param {Boolean} is_multi do the node and new parent belong to different instances - * @param {jsTree} old_instance the instance the node came from - * @param {jsTree} new_instance the instance of the new parent - */ - this.trigger('move_node', { "node" : obj, "parent" : new_par.id, "position" : pos, "old_parent" : old_par, "old_position" : old_pos, 'is_multi' : (old_ins && old_ins._id && old_ins._id !== this._id), 'is_foreign' : (!old_ins || !old_ins._id), 'old_instance' : old_ins, 'new_instance' : this }); - return obj.id; - }, - /** - * copy a node to a new parent - * @name copy_node(obj, par [, pos, callback, is_loaded]) - * @param {mixed} obj the node to copy, pass an array to copy multiple nodes - * @param {mixed} par the new parent - * @param {mixed} pos the position to insert at (besides integer values, "first" and "last" are supported, as well as "before" and "after"), defaults to integer `0` - * @param {function} callback a function to call once the move is completed, receives 3 arguments - the node, the new parent and the position - * @param {Boolean} is_loaded internal parameter indicating if the parent node has been loaded - * @param {Boolean} skip_redraw internal parameter indicating if the tree should be redrawn - * @param {Boolean} instance internal parameter indicating if the node comes from another instance - * @trigger model.jstree copy_node.jstree - */ - copy_node : function (obj, par, pos, callback, is_loaded, skip_redraw, origin) { - var t1, t2, dpc, tmp, i, j, node, old_par, new_par, old_ins, is_multi; - - par = this.get_node(par); - pos = pos === undefined ? 0 : pos; - if(!par) { return false; } - if(!pos.toString().match(/^(before|after)$/) && !is_loaded && !this.is_loaded(par)) { - return this.load_node(par, function () { this.copy_node(obj, par, pos, callback, true, false, origin); }); - } - - if($.isArray(obj)) { - if(obj.length === 1) { - obj = obj[0]; - } - else { - //obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - if((tmp = this.copy_node(obj[t1], par, pos, callback, is_loaded, true, origin))) { - par = tmp; - pos = "after"; - } - } - this.redraw(); - return true; - } - } - obj = obj && obj.id ? obj : this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { return false; } - - old_par = (obj.parent || $.jstree.root).toString(); - new_par = (!pos.toString().match(/^(before|after)$/) || par.id === $.jstree.root) ? par : this.get_node(par.parent); - old_ins = origin ? origin : (this._model.data[obj.id] ? this : $.jstree.reference(obj.id)); - is_multi = !old_ins || !old_ins._id || (this._id !== old_ins._id); - - if(old_ins && old_ins._id) { - obj = old_ins._model.data[obj.id]; - } - - if(par.id === $.jstree.root) { - if(pos === "before") { pos = "first"; } - if(pos === "after") { pos = "last"; } - } - switch(pos) { - case "before": - pos = $.inArray(par.id, new_par.children); - break; - case "after" : - pos = $.inArray(par.id, new_par.children) + 1; - break; - case "inside": - case "first": - pos = 0; - break; - case "last": - pos = new_par.children.length; - break; - default: - if(!pos) { pos = 0; } - break; - } - if(pos > new_par.children.length) { pos = new_par.children.length; } - if(!this.check("copy_node", obj, new_par, pos, { 'core' : true, 'origin' : origin, 'is_multi' : (old_ins && old_ins._id && old_ins._id !== this._id), 'is_foreign' : (!old_ins || !old_ins._id) })) { - this.settings.core.error.call(this, this._data.core.last_error); - return false; - } - node = old_ins ? old_ins.get_json(obj, { no_id : true, no_data : true, no_state : true }) : obj; - if(!node) { return false; } - if(node.id === true) { delete node.id; } - node = this._parse_model_from_json(node, new_par.id, new_par.parents.concat()); - if(!node) { return false; } - tmp = this.get_node(node); - if(obj && obj.state && obj.state.loaded === false) { tmp.state.loaded = false; } - dpc = []; - dpc.push(node); - dpc = dpc.concat(tmp.children_d); - this.trigger('model', { "nodes" : dpc, "parent" : new_par.id }); - - // insert into new parent and up - for(i = 0, j = new_par.parents.length; i < j; i++) { - this._model.data[new_par.parents[i]].children_d = this._model.data[new_par.parents[i]].children_d.concat(dpc); - } - dpc = []; - for(i = 0, j = new_par.children.length; i < j; i++) { - dpc[i >= pos ? i+1 : i] = new_par.children[i]; - } - dpc[pos] = tmp.id; - new_par.children = dpc; - new_par.children_d.push(tmp.id); - new_par.children_d = new_par.children_d.concat(tmp.children_d); - - if(new_par.id === $.jstree.root) { - this._model.force_full_redraw = true; - } - if(!this._model.force_full_redraw) { - this._node_changed(new_par.id); - } - if(!skip_redraw) { - this.redraw(new_par.id === $.jstree.root); - } - if(callback) { callback.call(this, tmp, new_par, pos); } - /** - * triggered when a node is copied - * @event - * @name copy_node.jstree - * @param {Object} node the copied node - * @param {Object} original the original node - * @param {String} parent the parent's ID - * @param {Number} position the position of the node among the parent's children - * @param {String} old_parent the old parent of the node - * @param {Number} old_position the position of the original node - * @param {Boolean} is_multi do the node and new parent belong to different instances - * @param {jsTree} old_instance the instance the node came from - * @param {jsTree} new_instance the instance of the new parent - */ - this.trigger('copy_node', { "node" : tmp, "original" : obj, "parent" : new_par.id, "position" : pos, "old_parent" : old_par, "old_position" : old_ins && old_ins._id && old_par && old_ins._model.data[old_par] && old_ins._model.data[old_par].children ? $.inArray(obj.id, old_ins._model.data[old_par].children) : -1,'is_multi' : (old_ins && old_ins._id && old_ins._id !== this._id), 'is_foreign' : (!old_ins || !old_ins._id), 'old_instance' : old_ins, 'new_instance' : this }); - return tmp.id; - }, - /** - * cut a node (a later call to `paste(obj)` would move the node) - * @name cut(obj) - * @param {mixed} obj multiple objects can be passed using an array - * @trigger cut.jstree - */ - cut : function (obj) { - if(!obj) { obj = this._data.core.selected.concat(); } - if(!$.isArray(obj)) { obj = [obj]; } - if(!obj.length) { return false; } - var tmp = [], o, t1, t2; - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - o = this.get_node(obj[t1]); - if(o && o.id && o.id !== $.jstree.root) { tmp.push(o); } - } - if(!tmp.length) { return false; } - ccp_node = tmp; - ccp_inst = this; - ccp_mode = 'move_node'; - /** - * triggered when nodes are added to the buffer for moving - * @event - * @name cut.jstree - * @param {Array} node - */ - this.trigger('cut', { "node" : obj }); - }, - /** - * copy a node (a later call to `paste(obj)` would copy the node) - * @name copy(obj) - * @param {mixed} obj multiple objects can be passed using an array - * @trigger copy.jstree - */ - copy : function (obj) { - if(!obj) { obj = this._data.core.selected.concat(); } - if(!$.isArray(obj)) { obj = [obj]; } - if(!obj.length) { return false; } - var tmp = [], o, t1, t2; - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - o = this.get_node(obj[t1]); - if(o && o.id && o.id !== $.jstree.root) { tmp.push(o); } - } - if(!tmp.length) { return false; } - ccp_node = tmp; - ccp_inst = this; - ccp_mode = 'copy_node'; - /** - * triggered when nodes are added to the buffer for copying - * @event - * @name copy.jstree - * @param {Array} node - */ - this.trigger('copy', { "node" : obj }); - }, - /** - * get the current buffer (any nodes that are waiting for a paste operation) - * @name get_buffer() - * @return {Object} an object consisting of `mode` ("copy_node" or "move_node"), `node` (an array of objects) and `inst` (the instance) - */ - get_buffer : function () { - return { 'mode' : ccp_mode, 'node' : ccp_node, 'inst' : ccp_inst }; - }, - /** - * check if there is something in the buffer to paste - * @name can_paste() - * @return {Boolean} - */ - can_paste : function () { - return ccp_mode !== false && ccp_node !== false; // && ccp_inst._model.data[ccp_node]; - }, - /** - * copy or move the previously cut or copied nodes to a new parent - * @name paste(obj [, pos]) - * @param {mixed} obj the new parent - * @param {mixed} pos the position to insert at (besides integer, "first" and "last" are supported), defaults to integer `0` - * @trigger paste.jstree - */ - paste : function (obj, pos) { - obj = this.get_node(obj); - if(!obj || !ccp_mode || !ccp_mode.match(/^(copy_node|move_node)$/) || !ccp_node) { return false; } - if(this[ccp_mode](ccp_node, obj, pos, false, false, false, ccp_inst)) { - /** - * triggered when paste is invoked - * @event - * @name paste.jstree - * @param {String} parent the ID of the receiving node - * @param {Array} node the nodes in the buffer - * @param {String} mode the performed operation - "copy_node" or "move_node" - */ - this.trigger('paste', { "parent" : obj.id, "node" : ccp_node, "mode" : ccp_mode }); - } - ccp_node = false; - ccp_mode = false; - ccp_inst = false; - }, - /** - * clear the buffer of previously copied or cut nodes - * @name clear_buffer() - * @trigger clear_buffer.jstree - */ - clear_buffer : function () { - ccp_node = false; - ccp_mode = false; - ccp_inst = false; - /** - * triggered when the copy / cut buffer is cleared - * @event - * @name clear_buffer.jstree - */ - this.trigger('clear_buffer'); - }, - /** - * put a node in edit mode (input field to rename the node) - * @name edit(obj [, default_text, callback]) - * @param {mixed} obj - * @param {String} default_text the text to populate the input with (if omitted or set to a non-string value the node's text value is used) - * @param {Function} callback a function to be called once the text box is blurred, it is called in the instance's scope and receives the node, a status parameter (true if the rename is successful, false otherwise) and a boolean indicating if the user cancelled the edit. You can access the node's title using .text - */ - edit : function (obj, default_text, callback) { - var rtl, w, a, s, t, h1, h2, fn, tmp, cancel = false; - obj = this.get_node(obj); - if(!obj) { return false; } - if(this.settings.core.check_callback === false) { - this._data.core.last_error = { 'error' : 'check', 'plugin' : 'core', 'id' : 'core_07', 'reason' : 'Could not edit node because of check_callback' }; - this.settings.core.error.call(this, this._data.core.last_error); - return false; - } - tmp = obj; - default_text = typeof default_text === 'string' ? default_text : obj.text; - this.set_text(obj, ""); - obj = this._open_to(obj); - tmp.text = default_text; - - rtl = this._data.core.rtl; - w = this.element.width(); - this._data.core.focused = tmp.id; - a = obj.children('.jstree-anchor').focus(); - s = $(''); - /*! - oi = obj.children("i:visible"), - ai = a.children("i:visible"), - w1 = oi.width() * oi.length, - w2 = ai.width() * ai.length, - */ - t = default_text; - h1 = $("<"+"div />", { css : { "position" : "absolute", "top" : "-200px", "left" : (rtl ? "0px" : "-1000px"), "visibility" : "hidden" } }).appendTo("body"); - h2 = $("<"+"input />", { - "value" : t, - "class" : "jstree-rename-input", - // "size" : t.length, - "css" : { - "padding" : "0", - "border" : "1px solid silver", - "box-sizing" : "border-box", - "display" : "inline-block", - "height" : (this._data.core.li_height) + "px", - "lineHeight" : (this._data.core.li_height) + "px", - "width" : "150px" // will be set a bit further down - }, - "blur" : $.proxy(function (e) { - e.stopImmediatePropagation(); - e.preventDefault(); - var i = s.children(".jstree-rename-input"), - v = i.val(), - f = this.settings.core.force_text, - nv; - if(v === "") { v = t; } - h1.remove(); - s.replaceWith(a); - s.remove(); - t = f ? t : $('
          ').append($.parseHTML(t)).html(); - this.set_text(obj, t); - nv = !!this.rename_node(obj, f ? $('
          ').text(v).text() : $('
          ').append($.parseHTML(v)).html()); - if(!nv) { - this.set_text(obj, t); // move this up? and fix #483 - } - this._data.core.focused = tmp.id; - setTimeout($.proxy(function () { - var node = this.get_node(tmp.id, true); - if(node.length) { - this._data.core.focused = tmp.id; - node.children('.jstree-anchor').focus(); - } - }, this), 0); - if(callback) { - callback.call(this, tmp, nv, cancel); - } - h2 = null; - }, this), - "keydown" : function (e) { - var key = e.which; - if(key === 27) { - cancel = true; - this.value = t; - } - if(key === 27 || key === 13 || key === 37 || key === 38 || key === 39 || key === 40 || key === 32) { - e.stopImmediatePropagation(); - } - if(key === 27 || key === 13) { - e.preventDefault(); - this.blur(); - } - }, - "click" : function (e) { e.stopImmediatePropagation(); }, - "mousedown" : function (e) { e.stopImmediatePropagation(); }, - "keyup" : function (e) { - h2.width(Math.min(h1.text("pW" + this.value).width(),w)); - }, - "keypress" : function(e) { - if(e.which === 13) { return false; } - } - }); - fn = { - fontFamily : a.css('fontFamily') || '', - fontSize : a.css('fontSize') || '', - fontWeight : a.css('fontWeight') || '', - fontStyle : a.css('fontStyle') || '', - fontStretch : a.css('fontStretch') || '', - fontVariant : a.css('fontVariant') || '', - letterSpacing : a.css('letterSpacing') || '', - wordSpacing : a.css('wordSpacing') || '' - }; - s.attr('class', a.attr('class')).append(a.contents().clone()).append(h2); - a.replaceWith(s); - h1.css(fn); - h2.css(fn).width(Math.min(h1.text("pW" + h2[0].value).width(),w))[0].select(); - $(document).one('mousedown.jstree touchstart.jstree dnd_start.vakata', function (e) { - if (h2 && e.target !== h2) { - $(h2).blur(); - } - }); - }, - - - /** - * changes the theme - * @name set_theme(theme_name [, theme_url]) - * @param {String} theme_name the name of the new theme to apply - * @param {mixed} theme_url the location of the CSS file for this theme. Omit or set to `false` if you manually included the file. Set to `true` to autoload from the `core.themes.dir` directory. - * @trigger set_theme.jstree - */ - set_theme : function (theme_name, theme_url) { - if(!theme_name) { return false; } - if(theme_url === true) { - var dir = this.settings.core.themes.dir; - if(!dir) { dir = $.jstree.path + '/themes'; } - theme_url = dir + '/' + theme_name + '/style.css'; - } - if(theme_url && $.inArray(theme_url, themes_loaded) === -1) { - $('head').append('<'+'link rel="stylesheet" href="' + theme_url + '" type="text/css" />'); - themes_loaded.push(theme_url); - } - if(this._data.core.themes.name) { - this.element.removeClass('jstree-' + this._data.core.themes.name); - } - this._data.core.themes.name = theme_name; - this.element.addClass('jstree-' + theme_name); - this.element[this.settings.core.themes.responsive ? 'addClass' : 'removeClass' ]('jstree-' + theme_name + '-responsive'); - /** - * triggered when a theme is set - * @event - * @name set_theme.jstree - * @param {String} theme the new theme - */ - this.trigger('set_theme', { 'theme' : theme_name }); - }, - /** - * gets the name of the currently applied theme name - * @name get_theme() - * @return {String} - */ - get_theme : function () { return this._data.core.themes.name; }, - /** - * changes the theme variant (if the theme has variants) - * @name set_theme_variant(variant_name) - * @param {String|Boolean} variant_name the variant to apply (if `false` is used the current variant is removed) - */ - set_theme_variant : function (variant_name) { - if(this._data.core.themes.variant) { - this.element.removeClass('jstree-' + this._data.core.themes.name + '-' + this._data.core.themes.variant); - } - this._data.core.themes.variant = variant_name; - if(variant_name) { - this.element.addClass('jstree-' + this._data.core.themes.name + '-' + this._data.core.themes.variant); - } - }, - /** - * gets the name of the currently applied theme variant - * @name get_theme() - * @return {String} - */ - get_theme_variant : function () { return this._data.core.themes.variant; }, - /** - * shows a striped background on the container (if the theme supports it) - * @name show_stripes() - */ - show_stripes : function () { - this._data.core.themes.stripes = true; - this.get_container_ul().addClass("jstree-striped"); - /** - * triggered when stripes are shown - * @event - * @name show_stripes.jstree - */ - this.trigger('show_stripes'); - }, - /** - * hides the striped background on the container - * @name hide_stripes() - */ - hide_stripes : function () { - this._data.core.themes.stripes = false; - this.get_container_ul().removeClass("jstree-striped"); - /** - * triggered when stripes are hidden - * @event - * @name hide_stripes.jstree - */ - this.trigger('hide_stripes'); - }, - /** - * toggles the striped background on the container - * @name toggle_stripes() - */ - toggle_stripes : function () { if(this._data.core.themes.stripes) { this.hide_stripes(); } else { this.show_stripes(); } }, - /** - * shows the connecting dots (if the theme supports it) - * @name show_dots() - */ - show_dots : function () { - this._data.core.themes.dots = true; - this.get_container_ul().removeClass("jstree-no-dots"); - /** - * triggered when dots are shown - * @event - * @name show_dots.jstree - */ - this.trigger('show_dots'); - }, - /** - * hides the connecting dots - * @name hide_dots() - */ - hide_dots : function () { - this._data.core.themes.dots = false; - this.get_container_ul().addClass("jstree-no-dots"); - /** - * triggered when dots are hidden - * @event - * @name hide_dots.jstree - */ - this.trigger('hide_dots'); - }, - /** - * toggles the connecting dots - * @name toggle_dots() - */ - toggle_dots : function () { if(this._data.core.themes.dots) { this.hide_dots(); } else { this.show_dots(); } }, - /** - * show the node icons - * @name show_icons() - */ - show_icons : function () { - this._data.core.themes.icons = true; - this.get_container_ul().removeClass("jstree-no-icons"); - /** - * triggered when icons are shown - * @event - * @name show_icons.jstree - */ - this.trigger('show_icons'); - }, - /** - * hide the node icons - * @name hide_icons() - */ - hide_icons : function () { - this._data.core.themes.icons = false; - this.get_container_ul().addClass("jstree-no-icons"); - /** - * triggered when icons are hidden - * @event - * @name hide_icons.jstree - */ - this.trigger('hide_icons'); - }, - /** - * toggle the node icons - * @name toggle_icons() - */ - toggle_icons : function () { if(this._data.core.themes.icons) { this.hide_icons(); } else { this.show_icons(); } }, - /** - * show the node ellipsis - * @name show_icons() - */ - show_ellipsis : function () { - this._data.core.themes.ellipsis = true; - this.get_container_ul().addClass("jstree-ellipsis"); - /** - * triggered when ellisis is shown - * @event - * @name show_ellipsis.jstree - */ - this.trigger('show_ellipsis'); - }, - /** - * hide the node ellipsis - * @name hide_ellipsis() - */ - hide_ellipsis : function () { - this._data.core.themes.ellipsis = false; - this.get_container_ul().removeClass("jstree-ellipsis"); - /** - * triggered when ellisis is hidden - * @event - * @name hide_ellipsis.jstree - */ - this.trigger('hide_ellipsis'); - }, - /** - * toggle the node ellipsis - * @name toggle_icons() - */ - toggle_ellipsis : function () { if(this._data.core.themes.ellipsis) { this.hide_ellipsis(); } else { this.show_ellipsis(); } }, - /** - * set the node icon for a node - * @name set_icon(obj, icon) - * @param {mixed} obj - * @param {String} icon the new icon - can be a path to an icon or a className, if using an image that is in the current directory use a `./` prefix, otherwise it will be detected as a class - */ - set_icon : function (obj, icon) { - var t1, t2, dom, old; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.set_icon(obj[t1], icon); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { return false; } - old = obj.icon; - obj.icon = icon === true || icon === null || icon === undefined || icon === '' ? true : icon; - dom = this.get_node(obj, true).children(".jstree-anchor").children(".jstree-themeicon"); - if(icon === false) { - this.hide_icon(obj); - } - else if(icon === true || icon === null || icon === undefined || icon === '') { - dom.removeClass('jstree-themeicon-custom ' + old).css("background","").removeAttr("rel"); - if(old === false) { this.show_icon(obj); } - } - else if(icon.indexOf("/") === -1 && icon.indexOf(".") === -1) { - dom.removeClass(old).css("background",""); - dom.addClass(icon + ' jstree-themeicon-custom').attr("rel",icon); - if(old === false) { this.show_icon(obj); } - } - else { - dom.removeClass(old).css("background",""); - dom.addClass('jstree-themeicon-custom').css("background", "url('" + icon + "') center center no-repeat").attr("rel",icon); - if(old === false) { this.show_icon(obj); } - } - return true; - }, - /** - * get the node icon for a node - * @name get_icon(obj) - * @param {mixed} obj - * @return {String} - */ - get_icon : function (obj) { - obj = this.get_node(obj); - return (!obj || obj.id === $.jstree.root) ? false : obj.icon; - }, - /** - * hide the icon on an individual node - * @name hide_icon(obj) - * @param {mixed} obj - */ - hide_icon : function (obj) { - var t1, t2; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.hide_icon(obj[t1]); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj === $.jstree.root) { return false; } - obj.icon = false; - this.get_node(obj, true).children(".jstree-anchor").children(".jstree-themeicon").addClass('jstree-themeicon-hidden'); - return true; - }, - /** - * show the icon on an individual node - * @name show_icon(obj) - * @param {mixed} obj - */ - show_icon : function (obj) { - var t1, t2, dom; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.show_icon(obj[t1]); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj === $.jstree.root) { return false; } - dom = this.get_node(obj, true); - obj.icon = dom.length ? dom.children(".jstree-anchor").children(".jstree-themeicon").attr('rel') : true; - if(!obj.icon) { obj.icon = true; } - dom.children(".jstree-anchor").children(".jstree-themeicon").removeClass('jstree-themeicon-hidden'); - return true; - } - }; - - // helpers - $.vakata = {}; - // collect attributes - $.vakata.attributes = function(node, with_values) { - node = $(node)[0]; - var attr = with_values ? {} : []; - if(node && node.attributes) { - $.each(node.attributes, function (i, v) { - if($.inArray(v.name.toLowerCase(),['style','contenteditable','hasfocus','tabindex']) !== -1) { return; } - if(v.value !== null && $.trim(v.value) !== '') { - if(with_values) { attr[v.name] = v.value; } - else { attr.push(v.name); } - } - }); - } - return attr; - }; - $.vakata.array_unique = function(array) { - var a = [], i, j, l, o = {}; - for(i = 0, l = array.length; i < l; i++) { - if(o[array[i]] === undefined) { - a.push(array[i]); - o[array[i]] = true; - } - } - return a; - }; - // remove item from array - $.vakata.array_remove = function(array, from) { - array.splice(from, 1); - return array; - //var rest = array.slice((to || from) + 1 || array.length); - //array.length = from < 0 ? array.length + from : from; - //array.push.apply(array, rest); - //return array; - }; - // remove item from array - $.vakata.array_remove_item = function(array, item) { - var tmp = $.inArray(item, array); - return tmp !== -1 ? $.vakata.array_remove(array, tmp) : array; - }; - $.vakata.array_filter = function(c,a,b,d,e) { - if (c.filter) { - return c.filter(a, b); - } - d=[]; - for (e in c) { - if (~~e+''===e+'' && e>=0 && a.call(b,c[e],+e,c)) { - d.push(c[e]); - } - } - return d; - }; -})); diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/jstree.massload.js b/mayan/apps/cabinets/static/cabinets/packages/jstree/src/jstree.massload.js deleted file mode 100644 index d202a3eca5..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/jstree.massload.js +++ /dev/null @@ -1,137 +0,0 @@ -/** - * ### Massload plugin - * - * Adds massload functionality to jsTree, so that multiple nodes can be loaded in a single request (only useful with lazy loading). - */ -/*globals jQuery, define, exports, require, document */ -(function (factory) { - "use strict"; - if (typeof define === 'function' && define.amd) { - define('jstree.massload', ['jquery','jstree'], factory); - } - else if(typeof exports === 'object') { - factory(require('jquery'), require('jstree')); - } - else { - factory(jQuery, jQuery.jstree); - } -}(function ($, jstree, undefined) { - "use strict"; - - if($.jstree.plugins.massload) { return; } - - /** - * massload configuration - * - * It is possible to set this to a standard jQuery-like AJAX config. - * In addition to the standard jQuery ajax options here you can supply functions for `data` and `url`, the functions will be run in the current instance's scope and a param will be passed indicating which node IDs need to be loaded, the return value of those functions will be used. - * - * You can also set this to a function, that function will receive the node IDs being loaded as argument and a second param which is a function (callback) which should be called with the result. - * - * Both the AJAX and the function approach rely on the same return value - an object where the keys are the node IDs, and the value is the children of that node as an array. - * - * { - * "id1" : [{ "text" : "Child of ID1", "id" : "c1" }, { "text" : "Another child of ID1", "id" : "c2" }], - * "id2" : [{ "text" : "Child of ID2", "id" : "c3" }] - * } - * - * @name $.jstree.defaults.massload - * @plugin massload - */ - $.jstree.defaults.massload = null; - $.jstree.plugins.massload = function (options, parent) { - this.init = function (el, options) { - this._data.massload = {}; - parent.init.call(this, el, options); - }; - this._load_nodes = function (nodes, callback, is_callback, force_reload) { - var s = this.settings.massload, - nodesString = JSON.stringify(nodes), - toLoad = [], - m = this._model.data, - i, j, dom; - if (!is_callback) { - for(i = 0, j = nodes.length; i < j; i++) { - if(!m[nodes[i]] || ( (!m[nodes[i]].state.loaded && !m[nodes[i]].state.failed) || force_reload) ) { - toLoad.push(nodes[i]); - dom = this.get_node(nodes[i], true); - if (dom && dom.length) { - dom.addClass("jstree-loading").attr('aria-busy',true); - } - } - } - this._data.massload = {}; - if (toLoad.length) { - if($.isFunction(s)) { - return s.call(this, toLoad, $.proxy(function (data) { - var i, j; - if(data) { - for(i in data) { - if(data.hasOwnProperty(i)) { - this._data.massload[i] = data[i]; - } - } - } - for(i = 0, j = nodes.length; i < j; i++) { - dom = this.get_node(nodes[i], true); - if (dom && dom.length) { - dom.removeClass("jstree-loading").attr('aria-busy',false); - } - } - parent._load_nodes.call(this, nodes, callback, is_callback, force_reload); - }, this)); - } - if(typeof s === 'object' && s && s.url) { - s = $.extend(true, {}, s); - if($.isFunction(s.url)) { - s.url = s.url.call(this, toLoad); - } - if($.isFunction(s.data)) { - s.data = s.data.call(this, toLoad); - } - return $.ajax(s) - .done($.proxy(function (data,t,x) { - var i, j; - if(data) { - for(i in data) { - if(data.hasOwnProperty(i)) { - this._data.massload[i] = data[i]; - } - } - } - for(i = 0, j = nodes.length; i < j; i++) { - dom = this.get_node(nodes[i], true); - if (dom && dom.length) { - dom.removeClass("jstree-loading").attr('aria-busy',false); - } - } - parent._load_nodes.call(this, nodes, callback, is_callback, force_reload); - }, this)) - .fail($.proxy(function (f) { - parent._load_nodes.call(this, nodes, callback, is_callback, force_reload); - }, this)); - } - } - } - return parent._load_nodes.call(this, nodes, callback, is_callback, force_reload); - }; - this._load_node = function (obj, callback) { - var data = this._data.massload[obj.id], - rslt = null, dom; - if(data) { - rslt = this[typeof data === 'string' ? '_append_html_data' : '_append_json_data']( - obj, - typeof data === 'string' ? $($.parseHTML(data)).filter(function () { return this.nodeType !== 3; }) : data, - function (status) { callback.call(this, status); } - ); - dom = this.get_node(obj.id, true); - if (dom && dom.length) { - dom.removeClass("jstree-loading").attr('aria-busy',false); - } - delete this._data.massload[obj.id]; - return rslt; - } - return parent._load_node.call(this, obj, callback); - }; - }; -})); \ No newline at end of file diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/jstree.search.js b/mayan/apps/cabinets/static/cabinets/packages/jstree/src/jstree.search.js deleted file mode 100644 index 21c3e7923a..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/jstree.search.js +++ /dev/null @@ -1,421 +0,0 @@ -/** - * ### Search plugin - * - * Adds search functionality to jsTree. - */ -/*globals jQuery, define, exports, require, document */ -(function (factory) { - "use strict"; - if (typeof define === 'function' && define.amd) { - define('jstree.search', ['jquery','jstree'], factory); - } - else if(typeof exports === 'object') { - factory(require('jquery'), require('jstree')); - } - else { - factory(jQuery, jQuery.jstree); - } -}(function ($, jstree, undefined) { - "use strict"; - - if($.jstree.plugins.search) { return; } - - /** - * stores all defaults for the search plugin - * @name $.jstree.defaults.search - * @plugin search - */ - $.jstree.defaults.search = { - /** - * a jQuery-like AJAX config, which jstree uses if a server should be queried for results. - * - * A `str` (which is the search string) parameter will be added with the request, an optional `inside` parameter will be added if the search is limited to a node id. The expected result is a JSON array with nodes that need to be opened so that matching nodes will be revealed. - * Leave this setting as `false` to not query the server. You can also set this to a function, which will be invoked in the instance's scope and receive 3 parameters - the search string, the callback to call with the array of nodes to load, and the optional node ID to limit the search to - * @name $.jstree.defaults.search.ajax - * @plugin search - */ - ajax : false, - /** - * Indicates if the search should be fuzzy or not (should `chnd3` match `child node 3`). Default is `false`. - * @name $.jstree.defaults.search.fuzzy - * @plugin search - */ - fuzzy : false, - /** - * Indicates if the search should be case sensitive. Default is `false`. - * @name $.jstree.defaults.search.case_sensitive - * @plugin search - */ - case_sensitive : false, - /** - * Indicates if the tree should be filtered (by default) to show only matching nodes (keep in mind this can be a heavy on large trees in old browsers). - * This setting can be changed at runtime when calling the search method. Default is `false`. - * @name $.jstree.defaults.search.show_only_matches - * @plugin search - */ - show_only_matches : false, - /** - * Indicates if the children of matched element are shown (when show_only_matches is true) - * This setting can be changed at runtime when calling the search method. Default is `false`. - * @name $.jstree.defaults.search.show_only_matches_children - * @plugin search - */ - show_only_matches_children : false, - /** - * Indicates if all nodes opened to reveal the search result, should be closed when the search is cleared or a new search is performed. Default is `true`. - * @name $.jstree.defaults.search.close_opened_onclear - * @plugin search - */ - close_opened_onclear : true, - /** - * Indicates if only leaf nodes should be included in search results. Default is `false`. - * @name $.jstree.defaults.search.search_leaves_only - * @plugin search - */ - search_leaves_only : false, - /** - * If set to a function it wil be called in the instance's scope with two arguments - search string and node (where node will be every node in the structure, so use with caution). - * If the function returns a truthy value the node will be considered a match (it might not be displayed if search_only_leaves is set to true and the node is not a leaf). Default is `false`. - * @name $.jstree.defaults.search.search_callback - * @plugin search - */ - search_callback : false - }; - - $.jstree.plugins.search = function (options, parent) { - this.bind = function () { - parent.bind.call(this); - - this._data.search.str = ""; - this._data.search.dom = $(); - this._data.search.res = []; - this._data.search.opn = []; - this._data.search.som = false; - this._data.search.smc = false; - this._data.search.hdn = []; - - this.element - .on("search.jstree", $.proxy(function (e, data) { - if(this._data.search.som && data.res.length) { - var m = this._model.data, i, j, p = [], k, l; - for(i = 0, j = data.res.length; i < j; i++) { - if(m[data.res[i]] && !m[data.res[i]].state.hidden) { - p.push(data.res[i]); - p = p.concat(m[data.res[i]].parents); - if(this._data.search.smc) { - for (k = 0, l = m[data.res[i]].children_d.length; k < l; k++) { - if (m[m[data.res[i]].children_d[k]] && !m[m[data.res[i]].children_d[k]].state.hidden) { - p.push(m[data.res[i]].children_d[k]); - } - } - } - } - } - p = $.vakata.array_remove_item($.vakata.array_unique(p), $.jstree.root); - this._data.search.hdn = this.hide_all(true); - this.show_node(p, true); - this.redraw(true); - } - }, this)) - .on("clear_search.jstree", $.proxy(function (e, data) { - if(this._data.search.som && data.res.length) { - this.show_node(this._data.search.hdn, true); - this.redraw(true); - } - }, this)); - }; - /** - * used to search the tree nodes for a given string - * @name search(str [, skip_async]) - * @param {String} str the search string - * @param {Boolean} skip_async if set to true server will not be queried even if configured - * @param {Boolean} show_only_matches if set to true only matching nodes will be shown (keep in mind this can be very slow on large trees or old browsers) - * @param {mixed} inside an optional node to whose children to limit the search - * @param {Boolean} append if set to true the results of this search are appended to the previous search - * @plugin search - * @trigger search.jstree - */ - this.search = function (str, skip_async, show_only_matches, inside, append, show_only_matches_children) { - if(str === false || $.trim(str.toString()) === "") { - return this.clear_search(); - } - inside = this.get_node(inside); - inside = inside && inside.id ? inside.id : null; - str = str.toString(); - var s = this.settings.search, - a = s.ajax ? s.ajax : false, - m = this._model.data, - f = null, - r = [], - p = [], i, j; - if(this._data.search.res.length && !append) { - this.clear_search(); - } - if(show_only_matches === undefined) { - show_only_matches = s.show_only_matches; - } - if(show_only_matches_children === undefined) { - show_only_matches_children = s.show_only_matches_children; - } - if(!skip_async && a !== false) { - if($.isFunction(a)) { - return a.call(this, str, $.proxy(function (d) { - if(d && d.d) { d = d.d; } - this._load_nodes(!$.isArray(d) ? [] : $.vakata.array_unique(d), function () { - this.search(str, true, show_only_matches, inside, append, show_only_matches_children); - }); - }, this), inside); - } - else { - a = $.extend({}, a); - if(!a.data) { a.data = {}; } - a.data.str = str; - if(inside) { - a.data.inside = inside; - } - if (this._data.search.lastRequest) { - this._data.search.lastRequest.abort(); - } - this._data.search.lastRequest = $.ajax(a) - .fail($.proxy(function () { - this._data.core.last_error = { 'error' : 'ajax', 'plugin' : 'search', 'id' : 'search_01', 'reason' : 'Could not load search parents', 'data' : JSON.stringify(a) }; - this.settings.core.error.call(this, this._data.core.last_error); - }, this)) - .done($.proxy(function (d) { - if(d && d.d) { d = d.d; } - this._load_nodes(!$.isArray(d) ? [] : $.vakata.array_unique(d), function () { - this.search(str, true, show_only_matches, inside, append, show_only_matches_children); - }); - }, this)); - return this._data.search.lastRequest; - } - } - if(!append) { - this._data.search.str = str; - this._data.search.dom = $(); - this._data.search.res = []; - this._data.search.opn = []; - this._data.search.som = show_only_matches; - this._data.search.smc = show_only_matches_children; - } - - f = new $.vakata.search(str, true, { caseSensitive : s.case_sensitive, fuzzy : s.fuzzy }); - $.each(m[inside ? inside : $.jstree.root].children_d, function (ii, i) { - var v = m[i]; - if(v.text && !v.state.hidden && (!s.search_leaves_only || (v.state.loaded && v.children.length === 0)) && ( (s.search_callback && s.search_callback.call(this, str, v)) || (!s.search_callback && f.search(v.text).isMatch) ) ) { - r.push(i); - p = p.concat(v.parents); - } - }); - if(r.length) { - p = $.vakata.array_unique(p); - for(i = 0, j = p.length; i < j; i++) { - if(p[i] !== $.jstree.root && m[p[i]] && this.open_node(p[i], null, 0) === true) { - this._data.search.opn.push(p[i]); - } - } - if(!append) { - this._data.search.dom = $(this.element[0].querySelectorAll('#' + $.map(r, function (v) { return "0123456789".indexOf(v[0]) !== -1 ? '\\3' + v[0] + ' ' + v.substr(1).replace($.jstree.idregex,'\\$&') : v.replace($.jstree.idregex,'\\$&'); }).join(', #'))); - this._data.search.res = r; - } - else { - this._data.search.dom = this._data.search.dom.add($(this.element[0].querySelectorAll('#' + $.map(r, function (v) { return "0123456789".indexOf(v[0]) !== -1 ? '\\3' + v[0] + ' ' + v.substr(1).replace($.jstree.idregex,'\\$&') : v.replace($.jstree.idregex,'\\$&'); }).join(', #')))); - this._data.search.res = $.vakata.array_unique(this._data.search.res.concat(r)); - } - this._data.search.dom.children(".jstree-anchor").addClass('jstree-search'); - } - /** - * triggered after search is complete - * @event - * @name search.jstree - * @param {jQuery} nodes a jQuery collection of matching nodes - * @param {String} str the search string - * @param {Array} res a collection of objects represeing the matching nodes - * @plugin search - */ - this.trigger('search', { nodes : this._data.search.dom, str : str, res : this._data.search.res, show_only_matches : show_only_matches }); - }; - /** - * used to clear the last search (removes classes and shows all nodes if filtering is on) - * @name clear_search() - * @plugin search - * @trigger clear_search.jstree - */ - this.clear_search = function () { - if(this.settings.search.close_opened_onclear) { - this.close_node(this._data.search.opn, 0); - } - /** - * triggered after search is complete - * @event - * @name clear_search.jstree - * @param {jQuery} nodes a jQuery collection of matching nodes (the result from the last search) - * @param {String} str the search string (the last search string) - * @param {Array} res a collection of objects represeing the matching nodes (the result from the last search) - * @plugin search - */ - this.trigger('clear_search', { 'nodes' : this._data.search.dom, str : this._data.search.str, res : this._data.search.res }); - if(this._data.search.res.length) { - this._data.search.dom = $(this.element[0].querySelectorAll('#' + $.map(this._data.search.res, function (v) { - return "0123456789".indexOf(v[0]) !== -1 ? '\\3' + v[0] + ' ' + v.substr(1).replace($.jstree.idregex,'\\$&') : v.replace($.jstree.idregex,'\\$&'); - }).join(', #'))); - this._data.search.dom.children(".jstree-anchor").removeClass("jstree-search"); - } - this._data.search.str = ""; - this._data.search.res = []; - this._data.search.opn = []; - this._data.search.dom = $(); - }; - - this.redraw_node = function(obj, deep, callback, force_render) { - obj = parent.redraw_node.apply(this, arguments); - if(obj) { - if($.inArray(obj.id, this._data.search.res) !== -1) { - var i, j, tmp = null; - for(i = 0, j = obj.childNodes.length; i < j; i++) { - if(obj.childNodes[i] && obj.childNodes[i].className && obj.childNodes[i].className.indexOf("jstree-anchor") !== -1) { - tmp = obj.childNodes[i]; - break; - } - } - if(tmp) { - tmp.className += ' jstree-search'; - } - } - } - return obj; - }; - }; - - // helpers - (function ($) { - // from http://kiro.me/projects/fuse.html - $.vakata.search = function(pattern, txt, options) { - options = options || {}; - options = $.extend({}, $.vakata.search.defaults, options); - if(options.fuzzy !== false) { - options.fuzzy = true; - } - pattern = options.caseSensitive ? pattern : pattern.toLowerCase(); - var MATCH_LOCATION = options.location, - MATCH_DISTANCE = options.distance, - MATCH_THRESHOLD = options.threshold, - patternLen = pattern.length, - matchmask, pattern_alphabet, match_bitapScore, search; - if(patternLen > 32) { - options.fuzzy = false; - } - if(options.fuzzy) { - matchmask = 1 << (patternLen - 1); - pattern_alphabet = (function () { - var mask = {}, - i = 0; - for (i = 0; i < patternLen; i++) { - mask[pattern.charAt(i)] = 0; - } - for (i = 0; i < patternLen; i++) { - mask[pattern.charAt(i)] |= 1 << (patternLen - i - 1); - } - return mask; - }()); - match_bitapScore = function (e, x) { - var accuracy = e / patternLen, - proximity = Math.abs(MATCH_LOCATION - x); - if(!MATCH_DISTANCE) { - return proximity ? 1.0 : accuracy; - } - return accuracy + (proximity / MATCH_DISTANCE); - }; - } - search = function (text) { - text = options.caseSensitive ? text : text.toLowerCase(); - if(pattern === text || text.indexOf(pattern) !== -1) { - return { - isMatch: true, - score: 0 - }; - } - if(!options.fuzzy) { - return { - isMatch: false, - score: 1 - }; - } - var i, j, - textLen = text.length, - scoreThreshold = MATCH_THRESHOLD, - bestLoc = text.indexOf(pattern, MATCH_LOCATION), - binMin, binMid, - binMax = patternLen + textLen, - lastRd, start, finish, rd, charMatch, - score = 1, - locations = []; - if (bestLoc !== -1) { - scoreThreshold = Math.min(match_bitapScore(0, bestLoc), scoreThreshold); - bestLoc = text.lastIndexOf(pattern, MATCH_LOCATION + patternLen); - if (bestLoc !== -1) { - scoreThreshold = Math.min(match_bitapScore(0, bestLoc), scoreThreshold); - } - } - bestLoc = -1; - for (i = 0; i < patternLen; i++) { - binMin = 0; - binMid = binMax; - while (binMin < binMid) { - if (match_bitapScore(i, MATCH_LOCATION + binMid) <= scoreThreshold) { - binMin = binMid; - } else { - binMax = binMid; - } - binMid = Math.floor((binMax - binMin) / 2 + binMin); - } - binMax = binMid; - start = Math.max(1, MATCH_LOCATION - binMid + 1); - finish = Math.min(MATCH_LOCATION + binMid, textLen) + patternLen; - rd = new Array(finish + 2); - rd[finish + 1] = (1 << i) - 1; - for (j = finish; j >= start; j--) { - charMatch = pattern_alphabet[text.charAt(j - 1)]; - if (i === 0) { - rd[j] = ((rd[j + 1] << 1) | 1) & charMatch; - } else { - rd[j] = ((rd[j + 1] << 1) | 1) & charMatch | (((lastRd[j + 1] | lastRd[j]) << 1) | 1) | lastRd[j + 1]; - } - if (rd[j] & matchmask) { - score = match_bitapScore(i, j - 1); - if (score <= scoreThreshold) { - scoreThreshold = score; - bestLoc = j - 1; - locations.push(bestLoc); - if (bestLoc > MATCH_LOCATION) { - start = Math.max(1, 2 * MATCH_LOCATION - bestLoc); - } else { - break; - } - } - } - } - if (match_bitapScore(i + 1, MATCH_LOCATION) > scoreThreshold) { - break; - } - lastRd = rd; - } - return { - isMatch: bestLoc >= 0, - score: score - }; - }; - return txt === true ? { 'search' : search } : search(txt); - }; - $.vakata.search.defaults = { - location : 0, - distance : 100, - threshold : 0.6, - fuzzy : false, - caseSensitive : false - }; - }($)); - - // include the search plugin by default - // $.jstree.defaults.plugins.push("search"); -})); diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/jstree.sort.js b/mayan/apps/cabinets/static/cabinets/packages/jstree/src/jstree.sort.js deleted file mode 100644 index 94f8b39014..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/jstree.sort.js +++ /dev/null @@ -1,74 +0,0 @@ -/** - * ### Sort plugin - * - * Automatically sorts all siblings in the tree according to a sorting function. - */ -/*globals jQuery, define, exports, require */ -(function (factory) { - "use strict"; - if (typeof define === 'function' && define.amd) { - define('jstree.sort', ['jquery','jstree'], factory); - } - else if(typeof exports === 'object') { - factory(require('jquery'), require('jstree')); - } - else { - factory(jQuery, jQuery.jstree); - } -}(function ($, jstree, undefined) { - "use strict"; - - if($.jstree.plugins.sort) { return; } - - /** - * the settings function used to sort the nodes. - * It is executed in the tree's context, accepts two nodes as arguments and should return `1` or `-1`. - * @name $.jstree.defaults.sort - * @plugin sort - */ - $.jstree.defaults.sort = function (a, b) { - //return this.get_type(a) === this.get_type(b) ? (this.get_text(a) > this.get_text(b) ? 1 : -1) : this.get_type(a) >= this.get_type(b); - return this.get_text(a) > this.get_text(b) ? 1 : -1; - }; - $.jstree.plugins.sort = function (options, parent) { - this.bind = function () { - parent.bind.call(this); - this.element - .on("model.jstree", $.proxy(function (e, data) { - this.sort(data.parent, true); - }, this)) - .on("rename_node.jstree create_node.jstree", $.proxy(function (e, data) { - this.sort(data.parent || data.node.parent, false); - this.redraw_node(data.parent || data.node.parent, true); - }, this)) - .on("move_node.jstree copy_node.jstree", $.proxy(function (e, data) { - this.sort(data.parent, false); - this.redraw_node(data.parent, true); - }, this)); - }; - /** - * used to sort a node's children - * @private - * @name sort(obj [, deep]) - * @param {mixed} obj the node - * @param {Boolean} deep if set to `true` nodes are sorted recursively. - * @plugin sort - * @trigger search.jstree - */ - this.sort = function (obj, deep) { - var i, j; - obj = this.get_node(obj); - if(obj && obj.children && obj.children.length) { - obj.children.sort($.proxy(this.settings.sort, this)); - if(deep) { - for(i = 0, j = obj.children_d.length; i < j; i++) { - this.sort(obj.children_d[i], false); - } - } - } - }; - }; - - // include the sort plugin by default - // $.jstree.defaults.plugins.push("sort"); -})); \ No newline at end of file diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/jstree.state.js b/mayan/apps/cabinets/static/cabinets/packages/jstree/src/jstree.state.js deleted file mode 100644 index f87cf4fb64..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/jstree.state.js +++ /dev/null @@ -1,125 +0,0 @@ -/** - * ### State plugin - * - * Saves the state of the tree (selected nodes, opened nodes) on the user's computer using available options (localStorage, cookies, etc) - */ -/*globals jQuery, define, exports, require */ -(function (factory) { - "use strict"; - if (typeof define === 'function' && define.amd) { - define('jstree.state', ['jquery','jstree'], factory); - } - else if(typeof exports === 'object') { - factory(require('jquery'), require('jstree')); - } - else { - factory(jQuery, jQuery.jstree); - } -}(function ($, jstree, undefined) { - "use strict"; - - if($.jstree.plugins.state) { return; } - - var to = false; - /** - * stores all defaults for the state plugin - * @name $.jstree.defaults.state - * @plugin state - */ - $.jstree.defaults.state = { - /** - * A string for the key to use when saving the current tree (change if using multiple trees in your project). Defaults to `jstree`. - * @name $.jstree.defaults.state.key - * @plugin state - */ - key : 'jstree', - /** - * A space separated list of events that trigger a state save. Defaults to `changed.jstree open_node.jstree close_node.jstree`. - * @name $.jstree.defaults.state.events - * @plugin state - */ - events : 'changed.jstree open_node.jstree close_node.jstree check_node.jstree uncheck_node.jstree', - /** - * Time in milliseconds after which the state will expire. Defaults to 'false' meaning - no expire. - * @name $.jstree.defaults.state.ttl - * @plugin state - */ - ttl : false, - /** - * A function that will be executed prior to restoring state with one argument - the state object. Can be used to clear unwanted parts of the state. - * @name $.jstree.defaults.state.filter - * @plugin state - */ - filter : false - }; - $.jstree.plugins.state = function (options, parent) { - this.bind = function () { - parent.bind.call(this); - var bind = $.proxy(function () { - this.element.on(this.settings.state.events, $.proxy(function () { - if(to) { clearTimeout(to); } - to = setTimeout($.proxy(function () { this.save_state(); }, this), 100); - }, this)); - /** - * triggered when the state plugin is finished restoring the state (and immediately after ready if there is no state to restore). - * @event - * @name state_ready.jstree - * @plugin state - */ - this.trigger('state_ready'); - }, this); - this.element - .on("ready.jstree", $.proxy(function (e, data) { - this.element.one("restore_state.jstree", bind); - if(!this.restore_state()) { bind(); } - }, this)); - }; - /** - * save the state - * @name save_state() - * @plugin state - */ - this.save_state = function () { - var st = { 'state' : this.get_state(), 'ttl' : this.settings.state.ttl, 'sec' : +(new Date()) }; - $.vakata.storage.set(this.settings.state.key, JSON.stringify(st)); - }; - /** - * restore the state from the user's computer - * @name restore_state() - * @plugin state - */ - this.restore_state = function () { - var k = $.vakata.storage.get(this.settings.state.key); - if(!!k) { try { k = JSON.parse(k); } catch(ex) { return false; } } - if(!!k && k.ttl && k.sec && +(new Date()) - k.sec > k.ttl) { return false; } - if(!!k && k.state) { k = k.state; } - if(!!k && $.isFunction(this.settings.state.filter)) { k = this.settings.state.filter.call(this, k); } - if(!!k) { - this.element.one("set_state.jstree", function (e, data) { data.instance.trigger('restore_state', { 'state' : $.extend(true, {}, k) }); }); - this.set_state(k); - return true; - } - return false; - }; - /** - * clear the state on the user's computer - * @name clear_state() - * @plugin state - */ - this.clear_state = function () { - return $.vakata.storage.del(this.settings.state.key); - }; - }; - - (function ($, undefined) { - $.vakata.storage = { - // simply specifying the functions in FF throws an error - set : function (key, val) { return window.localStorage.setItem(key, val); }, - get : function (key) { return window.localStorage.getItem(key); }, - del : function (key) { return window.localStorage.removeItem(key); } - }; - }($)); - - // include the state plugin by default - // $.jstree.defaults.plugins.push("state"); -})); \ No newline at end of file diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/jstree.types.js b/mayan/apps/cabinets/static/cabinets/packages/jstree/src/jstree.types.js deleted file mode 100644 index 706829a9d0..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/jstree.types.js +++ /dev/null @@ -1,372 +0,0 @@ -/** - * ### Types plugin - * - * Makes it possible to add predefined types for groups of nodes, which make it possible to easily control nesting rules and icon for each group. - */ -/*globals jQuery, define, exports, require */ -(function (factory) { - "use strict"; - if (typeof define === 'function' && define.amd) { - define('jstree.types', ['jquery','jstree'], factory); - } - else if(typeof exports === 'object') { - factory(require('jquery'), require('jstree')); - } - else { - factory(jQuery, jQuery.jstree); - } -}(function ($, jstree, undefined) { - "use strict"; - - if($.jstree.plugins.types) { return; } - - /** - * An object storing all types as key value pairs, where the key is the type name and the value is an object that could contain following keys (all optional). - * - * * `max_children` the maximum number of immediate children this node type can have. Do not specify or set to `-1` for unlimited. - * * `max_depth` the maximum number of nesting this node type can have. A value of `1` would mean that the node can have children, but no grandchildren. Do not specify or set to `-1` for unlimited. - * * `valid_children` an array of node type strings, that nodes of this type can have as children. Do not specify or set to `-1` for no limits. - * * `icon` a string - can be a path to an icon or a className, if using an image that is in the current directory use a `./` prefix, otherwise it will be detected as a class. Omit to use the default icon from your theme. - * * `li_attr` an object of values which will be used to add HTML attributes on the resulting LI DOM node (merged with the node's own data) - * * `a_attr` an object of values which will be used to add HTML attributes on the resulting A DOM node (merged with the node's own data) - * - * There are two predefined types: - * - * * `#` represents the root of the tree, for example `max_children` would control the maximum number of root nodes. - * * `default` represents the default node - any settings here will be applied to all nodes that do not have a type specified. - * - * @name $.jstree.defaults.types - * @plugin types - */ - $.jstree.defaults.types = { - 'default' : {} - }; - $.jstree.defaults.types[$.jstree.root] = {}; - - $.jstree.plugins.types = function (options, parent) { - this.init = function (el, options) { - var i, j; - if(options && options.types && options.types['default']) { - for(i in options.types) { - if(i !== "default" && i !== $.jstree.root && options.types.hasOwnProperty(i)) { - for(j in options.types['default']) { - if(options.types['default'].hasOwnProperty(j) && options.types[i][j] === undefined) { - options.types[i][j] = options.types['default'][j]; - } - } - } - } - } - parent.init.call(this, el, options); - this._model.data[$.jstree.root].type = $.jstree.root; - }; - this.refresh = function (skip_loading, forget_state) { - parent.refresh.call(this, skip_loading, forget_state); - this._model.data[$.jstree.root].type = $.jstree.root; - }; - this.bind = function () { - this.element - .on('model.jstree', $.proxy(function (e, data) { - var m = this._model.data, - dpc = data.nodes, - t = this.settings.types, - i, j, c = 'default', k; - for(i = 0, j = dpc.length; i < j; i++) { - c = 'default'; - if(m[dpc[i]].original && m[dpc[i]].original.type && t[m[dpc[i]].original.type]) { - c = m[dpc[i]].original.type; - } - if(m[dpc[i]].data && m[dpc[i]].data.jstree && m[dpc[i]].data.jstree.type && t[m[dpc[i]].data.jstree.type]) { - c = m[dpc[i]].data.jstree.type; - } - m[dpc[i]].type = c; - if(m[dpc[i]].icon === true && t[c].icon !== undefined) { - m[dpc[i]].icon = t[c].icon; - } - if(t[c].li_attr !== undefined && typeof t[c].li_attr === 'object') { - for (k in t[c].li_attr) { - if (t[c].li_attr.hasOwnProperty(k)) { - if (k === 'id') { - continue; - } - else if (m[dpc[i]].li_attr[k] === undefined) { - m[dpc[i]].li_attr[k] = t[c].li_attr[k]; - } - else if (k === 'class') { - m[dpc[i]].li_attr['class'] = t[c].li_attr['class'] + ' ' + m[dpc[i]].li_attr['class']; - } - } - } - } - if(t[c].a_attr !== undefined && typeof t[c].a_attr === 'object') { - for (k in t[c].a_attr) { - if (t[c].a_attr.hasOwnProperty(k)) { - if (k === 'id') { - continue; - } - else if (m[dpc[i]].a_attr[k] === undefined) { - m[dpc[i]].a_attr[k] = t[c].a_attr[k]; - } - else if (k === 'href' && m[dpc[i]].a_attr[k] === '#') { - m[dpc[i]].a_attr['href'] = t[c].a_attr['href']; - } - else if (k === 'class') { - m[dpc[i]].a_attr['class'] = t[c].a_attr['class'] + ' ' + m[dpc[i]].a_attr['class']; - } - } - } - } - } - m[$.jstree.root].type = $.jstree.root; - }, this)); - parent.bind.call(this); - }; - this.get_json = function (obj, options, flat) { - var i, j, - m = this._model.data, - opt = options ? $.extend(true, {}, options, {no_id:false}) : {}, - tmp = parent.get_json.call(this, obj, opt, flat); - if(tmp === false) { return false; } - if($.isArray(tmp)) { - for(i = 0, j = tmp.length; i < j; i++) { - tmp[i].type = tmp[i].id && m[tmp[i].id] && m[tmp[i].id].type ? m[tmp[i].id].type : "default"; - if(options && options.no_id) { - delete tmp[i].id; - if(tmp[i].li_attr && tmp[i].li_attr.id) { - delete tmp[i].li_attr.id; - } - if(tmp[i].a_attr && tmp[i].a_attr.id) { - delete tmp[i].a_attr.id; - } - } - } - } - else { - tmp.type = tmp.id && m[tmp.id] && m[tmp.id].type ? m[tmp.id].type : "default"; - if(options && options.no_id) { - tmp = this._delete_ids(tmp); - } - } - return tmp; - }; - this._delete_ids = function (tmp) { - if($.isArray(tmp)) { - for(var i = 0, j = tmp.length; i < j; i++) { - tmp[i] = this._delete_ids(tmp[i]); - } - return tmp; - } - delete tmp.id; - if(tmp.li_attr && tmp.li_attr.id) { - delete tmp.li_attr.id; - } - if(tmp.a_attr && tmp.a_attr.id) { - delete tmp.a_attr.id; - } - if(tmp.children && $.isArray(tmp.children)) { - tmp.children = this._delete_ids(tmp.children); - } - return tmp; - }; - this.check = function (chk, obj, par, pos, more) { - if(parent.check.call(this, chk, obj, par, pos, more) === false) { return false; } - obj = obj && obj.id ? obj : this.get_node(obj); - par = par && par.id ? par : this.get_node(par); - var m = obj && obj.id ? (more && more.origin ? more.origin : $.jstree.reference(obj.id)) : null, tmp, d, i, j; - m = m && m._model && m._model.data ? m._model.data : null; - switch(chk) { - case "create_node": - case "move_node": - case "copy_node": - if(chk !== 'move_node' || $.inArray(obj.id, par.children) === -1) { - tmp = this.get_rules(par); - if(tmp.max_children !== undefined && tmp.max_children !== -1 && tmp.max_children === par.children.length) { - this._data.core.last_error = { 'error' : 'check', 'plugin' : 'types', 'id' : 'types_01', 'reason' : 'max_children prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; - return false; - } - if(tmp.valid_children !== undefined && tmp.valid_children !== -1 && $.inArray((obj.type || 'default'), tmp.valid_children) === -1) { - this._data.core.last_error = { 'error' : 'check', 'plugin' : 'types', 'id' : 'types_02', 'reason' : 'valid_children prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; - return false; - } - if(m && obj.children_d && obj.parents) { - d = 0; - for(i = 0, j = obj.children_d.length; i < j; i++) { - d = Math.max(d, m[obj.children_d[i]].parents.length); - } - d = d - obj.parents.length + 1; - } - if(d <= 0 || d === undefined) { d = 1; } - do { - if(tmp.max_depth !== undefined && tmp.max_depth !== -1 && tmp.max_depth < d) { - this._data.core.last_error = { 'error' : 'check', 'plugin' : 'types', 'id' : 'types_03', 'reason' : 'max_depth prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; - return false; - } - par = this.get_node(par.parent); - tmp = this.get_rules(par); - d++; - } while(par); - } - break; - } - return true; - }; - /** - * used to retrieve the type settings object for a node - * @name get_rules(obj) - * @param {mixed} obj the node to find the rules for - * @return {Object} - * @plugin types - */ - this.get_rules = function (obj) { - obj = this.get_node(obj); - if(!obj) { return false; } - var tmp = this.get_type(obj, true); - if(tmp.max_depth === undefined) { tmp.max_depth = -1; } - if(tmp.max_children === undefined) { tmp.max_children = -1; } - if(tmp.valid_children === undefined) { tmp.valid_children = -1; } - return tmp; - }; - /** - * used to retrieve the type string or settings object for a node - * @name get_type(obj [, rules]) - * @param {mixed} obj the node to find the rules for - * @param {Boolean} rules if set to `true` instead of a string the settings object will be returned - * @return {String|Object} - * @plugin types - */ - this.get_type = function (obj, rules) { - obj = this.get_node(obj); - return (!obj) ? false : ( rules ? $.extend({ 'type' : obj.type }, this.settings.types[obj.type]) : obj.type); - }; - /** - * used to change a node's type - * @name set_type(obj, type) - * @param {mixed} obj the node to change - * @param {String} type the new type - * @plugin types - */ - this.set_type = function (obj, type) { - var m = this._model.data, t, t1, t2, old_type, old_icon, k, d, a; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.set_type(obj[t1], type); - } - return true; - } - t = this.settings.types; - obj = this.get_node(obj); - if(!t[type] || !obj) { return false; } - d = this.get_node(obj, true); - if (d && d.length) { - a = d.children('.jstree-anchor'); - } - old_type = obj.type; - old_icon = this.get_icon(obj); - obj.type = type; - if(old_icon === true || !t[old_type] || (t[old_type].icon !== undefined && old_icon === t[old_type].icon)) { - this.set_icon(obj, t[type].icon !== undefined ? t[type].icon : true); - } - - // remove old type props - if(t[old_type] && t[old_type].li_attr !== undefined && typeof t[old_type].li_attr === 'object') { - for (k in t[old_type].li_attr) { - if (t[old_type].li_attr.hasOwnProperty(k)) { - if (k === 'id') { - continue; - } - else if (k === 'class') { - m[obj.id].li_attr['class'] = (m[obj.id].li_attr['class'] || '').replace(t[old_type].li_attr[k], ''); - if (d) { d.removeClass(t[old_type].li_attr[k]); } - } - else if (m[obj.id].li_attr[k] === t[old_type].li_attr[k]) { - m[obj.id].li_attr[k] = null; - if (d) { d.removeAttr(k); } - } - } - } - } - if(t[old_type] && t[old_type].a_attr !== undefined && typeof t[old_type].a_attr === 'object') { - for (k in t[old_type].a_attr) { - if (t[old_type].a_attr.hasOwnProperty(k)) { - if (k === 'id') { - continue; - } - else if (k === 'class') { - m[obj.id].a_attr['class'] = (m[obj.id].a_attr['class'] || '').replace(t[old_type].a_attr[k], ''); - if (a) { a.removeClass(t[old_type].a_attr[k]); } - } - else if (m[obj.id].a_attr[k] === t[old_type].a_attr[k]) { - if (k === 'href') { - m[obj.id].a_attr[k] = '#'; - if (a) { a.attr('href', '#'); } - } - else { - delete m[obj.id].a_attr[k]; - if (a) { a.removeAttr(k); } - } - } - } - } - } - - // add new props - if(t[type].li_attr !== undefined && typeof t[type].li_attr === 'object') { - for (k in t[type].li_attr) { - if (t[type].li_attr.hasOwnProperty(k)) { - if (k === 'id') { - continue; - } - else if (m[obj.id].li_attr[k] === undefined) { - m[obj.id].li_attr[k] = t[type].li_attr[k]; - if (d) { - if (k === 'class') { - d.addClass(t[type].li_attr[k]); - } - else { - d.attr(k, t[type].li_attr[k]); - } - } - } - else if (k === 'class') { - m[obj.id].li_attr['class'] = t[type].li_attr[k] + ' ' + m[obj.id].li_attr['class']; - if (d) { d.addClass(t[type].li_attr[k]); } - } - } - } - } - if(t[type].a_attr !== undefined && typeof t[type].a_attr === 'object') { - for (k in t[type].a_attr) { - if (t[type].a_attr.hasOwnProperty(k)) { - if (k === 'id') { - continue; - } - else if (m[obj.id].a_attr[k] === undefined) { - m[obj.id].a_attr[k] = t[type].a_attr[k]; - if (a) { - if (k === 'class') { - a.addClass(t[type].a_attr[k]); - } - else { - a.attr(k, t[type].a_attr[k]); - } - } - } - else if (k === 'href' && m[obj.id].a_attr[k] === '#') { - m[obj.id].a_attr['href'] = t[type].a_attr['href']; - if (a) { a.attr('href', t[type].a_attr['href']); } - } - else if (k === 'class') { - m[obj.id].a_attr['class'] = t[type].a_attr['class'] + ' ' + m[obj.id].a_attr['class']; - if (a) { a.addClass(t[type].a_attr[k]); } - } - } - } - } - - return true; - }; - }; - // include the types plugin by default - // $.jstree.defaults.plugins.push("types"); -})); diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/jstree.unique.js b/mayan/apps/cabinets/static/cabinets/packages/jstree/src/jstree.unique.js deleted file mode 100644 index bfe2f1b8f8..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/jstree.unique.js +++ /dev/null @@ -1,121 +0,0 @@ -/** - * ### Unique plugin - * - * Enforces that no nodes with the same name can coexist as siblings. - */ -/*globals jQuery, define, exports, require */ -(function (factory) { - "use strict"; - if (typeof define === 'function' && define.amd) { - define('jstree.unique', ['jquery','jstree'], factory); - } - else if(typeof exports === 'object') { - factory(require('jquery'), require('jstree')); - } - else { - factory(jQuery, jQuery.jstree); - } -}(function ($, jstree, undefined) { - "use strict"; - - if($.jstree.plugins.unique) { return; } - - /** - * stores all defaults for the unique plugin - * @name $.jstree.defaults.unique - * @plugin unique - */ - $.jstree.defaults.unique = { - /** - * Indicates if the comparison should be case sensitive. Default is `false`. - * @name $.jstree.defaults.unique.case_sensitive - * @plugin unique - */ - case_sensitive : false, - /** - * A callback executed in the instance's scope when a new node is created and the name is already taken, the two arguments are the conflicting name and the counter. The default will produce results like `New node (2)`. - * @name $.jstree.defaults.unique.duplicate - * @plugin unique - */ - duplicate : function (name, counter) { - return name + ' (' + counter + ')'; - } - }; - - $.jstree.plugins.unique = function (options, parent) { - this.check = function (chk, obj, par, pos, more) { - if(parent.check.call(this, chk, obj, par, pos, more) === false) { return false; } - obj = obj && obj.id ? obj : this.get_node(obj); - par = par && par.id ? par : this.get_node(par); - if(!par || !par.children) { return true; } - var n = chk === "rename_node" ? pos : obj.text, - c = [], - s = this.settings.unique.case_sensitive, - m = this._model.data, i, j; - for(i = 0, j = par.children.length; i < j; i++) { - c.push(s ? m[par.children[i]].text : m[par.children[i]].text.toLowerCase()); - } - if(!s) { n = n.toLowerCase(); } - switch(chk) { - case "delete_node": - return true; - case "rename_node": - i = ($.inArray(n, c) === -1 || (obj.text && obj.text[ s ? 'toString' : 'toLowerCase']() === n)); - if(!i) { - this._data.core.last_error = { 'error' : 'check', 'plugin' : 'unique', 'id' : 'unique_01', 'reason' : 'Child with name ' + n + ' already exists. Preventing: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; - } - return i; - case "create_node": - i = ($.inArray(n, c) === -1); - if(!i) { - this._data.core.last_error = { 'error' : 'check', 'plugin' : 'unique', 'id' : 'unique_04', 'reason' : 'Child with name ' + n + ' already exists. Preventing: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; - } - return i; - case "copy_node": - i = ($.inArray(n, c) === -1); - if(!i) { - this._data.core.last_error = { 'error' : 'check', 'plugin' : 'unique', 'id' : 'unique_02', 'reason' : 'Child with name ' + n + ' already exists. Preventing: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; - } - return i; - case "move_node": - i = ( (obj.parent === par.id && (!more || !more.is_multi)) || $.inArray(n, c) === -1); - if(!i) { - this._data.core.last_error = { 'error' : 'check', 'plugin' : 'unique', 'id' : 'unique_03', 'reason' : 'Child with name ' + n + ' already exists. Preventing: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; - } - return i; - } - return true; - }; - this.create_node = function (par, node, pos, callback, is_loaded) { - if(!node || node.text === undefined) { - if(par === null) { - par = $.jstree.root; - } - par = this.get_node(par); - if(!par) { - return parent.create_node.call(this, par, node, pos, callback, is_loaded); - } - pos = pos === undefined ? "last" : pos; - if(!pos.toString().match(/^(before|after)$/) && !is_loaded && !this.is_loaded(par)) { - return parent.create_node.call(this, par, node, pos, callback, is_loaded); - } - if(!node) { node = {}; } - var tmp, n, dpc, i, j, m = this._model.data, s = this.settings.unique.case_sensitive, cb = this.settings.unique.duplicate; - n = tmp = this.get_string('New node'); - dpc = []; - for(i = 0, j = par.children.length; i < j; i++) { - dpc.push(s ? m[par.children[i]].text : m[par.children[i]].text.toLowerCase()); - } - i = 1; - while($.inArray(s ? n : n.toLowerCase(), dpc) !== -1) { - n = cb.call(this, tmp, (++i)).toString(); - } - node.text = n; - } - return parent.create_node.call(this, par, node, pos, callback, is_loaded); - }; - }; - - // include the unique plugin by default - // $.jstree.defaults.plugins.push("unique"); -})); diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/jstree.wholerow.js b/mayan/apps/cabinets/static/cabinets/packages/jstree/src/jstree.wholerow.js deleted file mode 100644 index e8fe3e6d54..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/jstree.wholerow.js +++ /dev/null @@ -1,122 +0,0 @@ -/** - * ### Wholerow plugin - * - * Makes each node appear block level. Making selection easier. May cause slow down for large trees in old browsers. - */ -/*globals jQuery, define, exports, require */ -(function (factory) { - "use strict"; - if (typeof define === 'function' && define.amd) { - define('jstree.wholerow', ['jquery','jstree'], factory); - } - else if(typeof exports === 'object') { - factory(require('jquery'), require('jstree')); - } - else { - factory(jQuery, jQuery.jstree); - } -}(function ($, jstree, undefined) { - "use strict"; - - if($.jstree.plugins.wholerow) { return; } - - var div = document.createElement('DIV'); - div.setAttribute('unselectable','on'); - div.setAttribute('role','presentation'); - div.className = 'jstree-wholerow'; - div.innerHTML = ' '; - $.jstree.plugins.wholerow = function (options, parent) { - this.bind = function () { - parent.bind.call(this); - - this.element - .on('ready.jstree set_state.jstree', $.proxy(function () { - this.hide_dots(); - }, this)) - .on("init.jstree loading.jstree ready.jstree", $.proxy(function () { - //div.style.height = this._data.core.li_height + 'px'; - this.get_container_ul().addClass('jstree-wholerow-ul'); - }, this)) - .on("deselect_all.jstree", $.proxy(function (e, data) { - this.element.find('.jstree-wholerow-clicked').removeClass('jstree-wholerow-clicked'); - }, this)) - .on("changed.jstree", $.proxy(function (e, data) { - this.element.find('.jstree-wholerow-clicked').removeClass('jstree-wholerow-clicked'); - var tmp = false, i, j; - for(i = 0, j = data.selected.length; i < j; i++) { - tmp = this.get_node(data.selected[i], true); - if(tmp && tmp.length) { - tmp.children('.jstree-wholerow').addClass('jstree-wholerow-clicked'); - } - } - }, this)) - .on("open_node.jstree", $.proxy(function (e, data) { - this.get_node(data.node, true).find('.jstree-clicked').parent().children('.jstree-wholerow').addClass('jstree-wholerow-clicked'); - }, this)) - .on("hover_node.jstree dehover_node.jstree", $.proxy(function (e, data) { - if(e.type === "hover_node" && this.is_disabled(data.node)) { return; } - this.get_node(data.node, true).children('.jstree-wholerow')[e.type === "hover_node"?"addClass":"removeClass"]('jstree-wholerow-hovered'); - }, this)) - .on("contextmenu.jstree", ".jstree-wholerow", $.proxy(function (e) { - if (this._data.contextmenu) { - e.preventDefault(); - var tmp = $.Event('contextmenu', { metaKey : e.metaKey, ctrlKey : e.ctrlKey, altKey : e.altKey, shiftKey : e.shiftKey, pageX : e.pageX, pageY : e.pageY }); - $(e.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(tmp); - } - }, this)) - /*! - .on("mousedown.jstree touchstart.jstree", ".jstree-wholerow", function (e) { - if(e.target === e.currentTarget) { - var a = $(e.currentTarget).closest(".jstree-node").children(".jstree-anchor"); - e.target = a[0]; - a.trigger(e); - } - }) - */ - .on("click.jstree", ".jstree-wholerow", function (e) { - e.stopImmediatePropagation(); - var tmp = $.Event('click', { metaKey : e.metaKey, ctrlKey : e.ctrlKey, altKey : e.altKey, shiftKey : e.shiftKey }); - $(e.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(tmp).focus(); - }) - .on("dblclick.jstree", ".jstree-wholerow", function (e) { - e.stopImmediatePropagation(); - var tmp = $.Event('dblclick', { metaKey : e.metaKey, ctrlKey : e.ctrlKey, altKey : e.altKey, shiftKey : e.shiftKey }); - $(e.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(tmp).focus(); - }) - .on("click.jstree", ".jstree-leaf > .jstree-ocl", $.proxy(function (e) { - e.stopImmediatePropagation(); - var tmp = $.Event('click', { metaKey : e.metaKey, ctrlKey : e.ctrlKey, altKey : e.altKey, shiftKey : e.shiftKey }); - $(e.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(tmp).focus(); - }, this)) - .on("mouseover.jstree", ".jstree-wholerow, .jstree-icon", $.proxy(function (e) { - e.stopImmediatePropagation(); - if(!this.is_disabled(e.currentTarget)) { - this.hover_node(e.currentTarget); - } - return false; - }, this)) - .on("mouseleave.jstree", ".jstree-node", $.proxy(function (e) { - this.dehover_node(e.currentTarget); - }, this)); - }; - this.teardown = function () { - if(this.settings.wholerow) { - this.element.find(".jstree-wholerow").remove(); - } - parent.teardown.call(this); - }; - this.redraw_node = function(obj, deep, callback, force_render) { - obj = parent.redraw_node.apply(this, arguments); - if(obj) { - var tmp = div.cloneNode(true); - //tmp.style.height = this._data.core.li_height + 'px'; - if($.inArray(obj.id, this._data.core.selected) !== -1) { tmp.className += ' jstree-wholerow-clicked'; } - if(this._data.core.focused && this._data.core.focused === obj.id) { tmp.className += ' jstree-wholerow-hovered'; } - obj.insertBefore(tmp, obj.childNodes[0]); - } - return obj; - }; - }; - // include the wholerow plugin by default - // $.jstree.defaults.plugins.push("wholerow"); -})); diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/misc.js b/mayan/apps/cabinets/static/cabinets/packages/jstree/src/misc.js deleted file mode 100644 index d2d789b1f3..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/misc.js +++ /dev/null @@ -1,601 +0,0 @@ -/* global jQuery */ - -// disable all events -(function ($, undefined) { - "use strict"; - $.jstree.plugins.trigger = function (options, parent) { - this.init = function (el, options) { - // do not forget parent - parent.init.call(this, el, options); - this._data.trigger.disabled = false; - }; - this.trigger = function (ev, data) { - if(!this._data.trigger.disabled) { - parent.trigger.call(this, ev, data); - } - }; - this.disable_events = function () { this._data.trigger.disabled = true; }; - this.enable_events = function () { this._data.trigger.disabled = false; }; - }; -})(jQuery); - -// mapping -(function ($, undefined) { - "use strict"; - // use this if you need any options - $.jstree.defaults.mapper = { - option_key : "option_value" - }; - $.jstree.plugins.mapper = function () { - this._parse_model_from_json = function (d, p, ps) { - // d is the node from the server, it will be called recursively for children, - // so you do not need to process at once - /* // for example - for(var i in d) { - if(d.hasOwnProperty(i)) { - d[i.toLowerCase()] = d[i]; - } - } - */ - return parent._parse_model_from_json.call(this, d, p, ps); - }; - }; -})(jQuery); - -// no hover -(function ($, undefined) { - "use strict"; - $.jstree.plugins.nohover = function () { - this.hover_node = $.noop; - }; -})(jQuery); - -// force multiple select -(function ($, undefined) { - "use strict"; - $.jstree.defaults.multiselect = {}; - $.jstree.plugins.multiselect = function (options, parent) { - this.activate_node = function (obj, e) { - e.ctrlKey = true; - parent.activate_node.call(this, obj, e); - }; - }; -})(jQuery); - -// real checkboxes -(function ($, undefined) { - "use strict"; - - var inp = document.createElement("INPUT"); - inp.type = "checkbox"; - inp.className = "jstree-checkbox jstree-realcheckbox"; - - $.jstree.defaults.realcheckboxes = {}; - - $.jstree.plugins.realcheckboxes = function (options, parent) { - this.bind = function () { - parent.bind.call(this); - this._data.realcheckboxes.uto = false; - this.element - .on('changed.jstree uncheck_node.jstree check_node.jstree uncheck_all.jstree check_all.jstree move_node.jstree copy_node.jstree redraw.jstree open_node.jstree ready.jstree loaded.jstree', $.proxy(function () { - // only if undetermined is in setting - if(this._data.realcheckboxes.uto) { clearTimeout(this._data.realcheckboxes.uto); } - this._data.realcheckboxes.uto = setTimeout($.proxy(this._realcheckboxes, this), 50); - }, this)); - }; - this.redraw_node = function(obj, deep, callback, force_draw) { - obj = parent.redraw_node.call(this, obj, deep, callback, force_draw); - if(obj) { - var i, j, tmp = null, chk = inp.cloneNode(true); - for(i = 0, j = obj.childNodes.length; i < j; i++) { - if(obj.childNodes[i] && obj.childNodes[i].className && obj.childNodes[i].className.indexOf("jstree-anchor") !== -1) { - tmp = obj.childNodes[i]; - break; - } - } - if(tmp) { - for(i = 0, j = tmp.childNodes.length; i < j; i++) { - if(tmp.childNodes[i] && tmp.childNodes[i].className && tmp.childNodes[i].className.indexOf("jstree-checkbox") !== -1) { - tmp = tmp.childNodes[i]; - break; - } - } - } - if(tmp && tmp.tagName === "I") { - tmp.style.backgroundColor = "transparent"; - tmp.style.backgroundImage = "none"; - tmp.appendChild(chk); - } - } - return obj; - }; - this._realcheckboxes = function () { - var ts = this.settings.checkbox.tie_selection; - console.log(ts); - $('.jstree-realcheckbox').each(function () { - this.checked = (!ts && this.parentNode.parentNode.className.indexOf("jstree-checked") !== -1) || (ts && this.parentNode.parentNode.className.indexOf('jstree-clicked') !== -1); - this.indeterminate = this.parentNode.className.indexOf("jstree-undetermined") !== -1; - this.disabled = this.parentNode.parentNode.className.indexOf("disabled") !== -1; - }); - }; - }; -})(jQuery); - -// no state -(function ($, undefined) { - "use strict"; - $.jstree.plugins.nostate = function () { - this.set_state = function (state, callback) { - if(callback) { callback.call(this); } - this.trigger('set_state'); - }; - }; -})(jQuery); - -// no selected in state -(function ($, undefined) { - "use strict"; - $.jstree.plugins.noselectedstate = function (options, parent) { - this.get_state = function () { - var state = parent.get_state.call(this); - delete state.core.selected; - return state; - }; - }; -})(jQuery); - -// additional icon on node (outside of anchor) -(function ($, undefined) { - "use strict"; - var img = document.createElement('IMG'); - //img.src = "http://www.dpcd.vic.gov.au/__data/assets/image/0004/30667/help.gif"; - img.className = "jstree-questionmark"; - - $.jstree.defaults.questionmark = $.noop; - $.jstree.plugins.questionmark = function (options, parent) { - this.bind = function () { - parent.bind.call(this); - this.element - .on("click.jstree", ".jstree-questionmark", $.proxy(function (e) { - e.stopImmediatePropagation(); - this.settings.questionmark.call(this, this.get_node(e.target)); - }, this)); - }; - this.teardown = function () { - if(this.settings.questionmark) { - this.element.find(".jstree-questionmark").remove(); - } - parent.teardown.call(this); - }; - this.redraw_node = function(obj, deep, callback, force_draw) { - obj = parent.redraw_node.call(this, obj, deep, callback, force_draw); - if(obj) { - var tmp = img.cloneNode(true); - obj.insertBefore(tmp, obj.childNodes[2]); - } - return obj; - }; - }; -})(jQuery); - -// auto numbering -(function ($, undefined) { - "use strict"; - var span = document.createElement('SPAN'); - span.className = "jstree-numbering"; - - $.jstree.defaults.numbering = {}; - $.jstree.plugins.numbering = function (options, parent) { - this.teardown = function () { - if(this.settings.questionmark) { - this.element.find(".jstree-numbering").remove(); - } - parent.teardown.call(this); - }; - this.get_number = function (obj) { - obj = this.get_node(obj); - var ind = $.inArray(obj.id, this.get_node(obj.parent).children) + 1; - return obj.parent === '#' ? ind : this.get_number(obj.parent) + '.' + ind; - }; - this.redraw_node = function(obj, deep, callback, force_draw) { - var i, j, tmp = null, elm = null, org = this.get_number(obj); - obj = parent.redraw_node.call(this, obj, deep, callback, force_draw); - if(obj) { - for(i = 0, j = obj.childNodes.length; i < j; i++) { - if(obj.childNodes[i] && obj.childNodes[i].className && obj.childNodes[i].className.indexOf("jstree-anchor") !== -1) { - tmp = obj.childNodes[i]; - break; - } - } - if(tmp) { - elm = span.cloneNode(true); - elm.innerHTML = org + '. '; - tmp.insertBefore(elm, tmp.childNodes[tmp.childNodes.length - 1]); - } - } - return obj; - }; - }; -})(jQuery); - -// additional icon on node (inside anchor) -(function ($, undefined) { - "use strict"; - var _s = document.createElement('SPAN'); - _s.className = 'fa-stack jstree-stackedicon'; - var _i = document.createElement('I'); - _i.className = 'jstree-icon'; - _i.setAttribute('role', 'presentation'); - - $.jstree.plugins.stackedicon = function (options, parent) { - this.teardown = function () { - this.element.find(".jstree-stackedicon").remove(); - parent.teardown.call(this); - }; - this.redraw_node = function(obj, deep, is_callback, force_render) { - obj = parent.redraw_node.apply(this, arguments); - if(obj) { - var i, j, tmp = null, icon = null, temp = null; - for(i = 0, j = obj.childNodes.length; i < j; i++) { - if(obj.childNodes[i] && obj.childNodes[i].className && obj.childNodes[i].className.indexOf("jstree-anchor") !== -1) { - tmp = obj.childNodes[i]; - break; - } - } - if(tmp) { - if(this._model.data[obj.id].state.icons && this._model.data[obj.id].state.icons.length) { - icon = _s.cloneNode(false); - for(i = 0, j = this._model.data[obj.id].state.icons.length; i < j; i++) { - temp = _i.cloneNode(false); - temp.className += ' ' + this._model.data[obj.id].state.icons[i]; - icon.appendChild(temp); - } - tmp.insertBefore(icon, tmp.childNodes[0]); - } - } - } - return obj; - }; - }; -})(jQuery); - -// selecting a node opens it -(function ($, undefined) { - "use strict"; - $.jstree.plugins.selectopens = function (options, parent) { - this.bind = function () { - parent.bind.call(this); - this.element.on('select_node.jstree', function (e, data) { data.instance.open_node(data.node); }); - }; - }; -})(jQuery); - -// object as data -(function ($, undefined) { - "use strict"; - $.jstree.defaults.datamodel = {}; - $.jstree.plugins.datamodel = function (options, parent) { - this.init = function (el, options) { - this._data.datamodel = {}; - parent.init.call(this, el, options); - }; - this._datamodel = function (id, nodes, callback) { - var i = 0, j = nodes.length, tmp = [], obj = null; - for(; i < j; i++) { - this._data.datamodel[nodes[i].getID()] = nodes[i]; - obj = { - id : nodes[i].getID(), - text : nodes[i].getText(), - children : nodes[i].hasChildren() - }; - if(nodes[i].getExtra) { - obj = nodes[i].getExtra(obj); // icon, type - } - tmp.push(obj); - } - return this._append_json_data(id, tmp, $.proxy(function (status) { - callback.call(this, status); - }, this)); - }; - this._load_node = function (obj, callback) { - var id = obj.id; - var nd = obj.id === "#" ? this.settings.core.data : this._data.datamodel[obj.id].getChildren($.proxy(function (nodes) { - this._datamodel(id, nodes, callback); - }, this)); - if($.isArray(nd)) { - this._datamodel(id, nd, callback); - } - }; - }; -})(jQuery); -/* - demo of the above - function treeNode(val) { - var id = ++treeNode.counter; - this.getID = function () { - return id; - }; - this.getText = function () { - return val.toString(); - }; - this.getExtra = function (obj) { - obj.icon = false; - return obj; - }; - this.hasChildren = function () { - return true; - }; - this.getChildren = function () { - return [ - new treeNode(Math.pow(val, 2)), - new treeNode(Math.sqrt(val)), - ]; - }; - } - treeNode.counter = 0; - - $('#jstree').jstree({ - 'core': { - 'data': [ - new treeNode(2), - new treeNode(3), - new treeNode(4), - new treeNode(5) - ] - }, - plugins : ['datamodel'] - }); -*/ - -// untested sample plugin to keep all nodes in the DOM -(function ($, undefined) { - "use strict"; - $.jstree.plugins.dom = function (options, parent) { - this.redraw_node = function (node, deep, is_callback, force_render) { - return parent.redraw_node.call(this, node, deep, is_callback, true); - }; - this.close_node = function (obj, animation) { - var t1, t2, t, d; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.close_node(obj[t1], animation); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { - return false; - } - if(this.is_closed(obj)) { - return false; - } - animation = animation === undefined ? this.settings.core.animation : animation; - t = this; - d = this.get_node(obj, true); - if(d.length) { - if(!animation) { - d[0].className = d[0].className.replace('jstree-open', 'jstree-closed'); - d.attr("aria-expanded", false); - } - else { - d - .children(".jstree-children").attr("style","display:block !important").end() - .removeClass("jstree-open").addClass("jstree-closed").attr("aria-expanded", false) - .children(".jstree-children").stop(true, true).slideUp(animation, function () { - this.style.display = ""; - t.trigger("after_close", { "node" : obj }); - }); - } - } - obj.state.opened = false; - this.trigger('close_node',{ "node" : obj }); - if(!animation || !d.length) { - this.trigger("after_close", { "node" : obj }); - } - }; - }; -})(jQuery); - -// customize plugin by @Lusito -// https://github.com/Lusito/jstree/blob/node-customize/src/jstree-node-customize.js -/** - * ### Node Customize plugin - * - * Allows to customize nodes when they are drawn. - */ -(function (factory) { - "use strict"; - if (typeof define === 'function' && define.amd) { - define('jstree.node_customize', ['jquery','jstree'], factory); - } - else if(typeof exports === 'object') { - factory(require('jquery'), require('jstree')); - } - else { - factory(jQuery, jQuery.jstree); - } -}(function ($, jstree, undefined) { - "use strict"; - - if($.jstree.plugins.node_customize) { return; } - - /** - * the settings object. - * key is the attribute name to select the customizer function from switch. - * switch is a key => function(el, node) map. - * default: function(el, node) will be called if the type could not be mapped - * @name $.jstree.defaults.node_customize - * @plugin node_customize - */ - $.jstree.defaults.node_customize = { - "key": "type", - "switch": {}, - "default": null - }; - - $.jstree.plugins.node_customize = function (options, parent) { - this.redraw_node = function (obj, deep, callback, force_draw) { - var node_id = obj; - var el = parent.redraw_node.apply(this, arguments); - if (el) { - var node = this._model.data[node_id]; - var cfg = this.settings.node_customize; - var key = cfg.key; - var type = (node && node.original && node.original[key]); - var customizer = (type && cfg.switch[type]) || cfg.default; - if(customizer) - customizer(el, node); - } - return el; - }; - } -})); - - -// parentsload plugin by @ashl1 -/** - * ### Parentsload plugin - * - * Change load_node() functionality in jsTree, to possible load not yes downloaded node with all it parent in a single request (only useful with lazy loading). - * - * version 1.0.0 (Alexey Shildyakov - ashl1future@gmail.com) - * 2015: Compatible with jsTree-3.2.1 - */ -/*globals jQuery, define, exports, require, document */ -(function (factory) { - "use strict"; - if (typeof define === 'function' && define.amd) { - define('jstree.parentsload', ['jquery','jstree'], factory); - } - else if(typeof exports === 'object') { - factory(require('jquery'), require('jstree')); - } - else { - factory(jQuery, jQuery.jstree); - } -}(function ($, jstree, undefined) { - "use strict"; - - if($.jstree.plugins.parentsload) { return; } - - /** - * parentsload configuration - * - * The configuration syntax is almost the same as for core.data option. You must set parenstload.data the following: - * - * parentsload: { - * data: function(){} // this function overwrites core data.data options - * } - * - * OR - * - * parentsload: { - * data: { - * url: function(node){} OR string, - * data: function(node){} OR associative array as json{data} jQuery parameter - * } - * } - * - * In last case at least on of 'url' or 'data' must be presented. - * - * At first, the plugin load_node() detects if the node already downloaded. If is - uses the core.data settings, if not - uses parentsload.data settings - * to fetch in one query the specified node and all its parent. The data must be in the first mentioned JSON format with set nested children[]. - * Each node level should consist of all nodes on the level to properly work with the tree in the future. Otherwise, you must manually call load_node - * on every parent node to fetch all children nodes on that level. - * - * @name $.jstree.defaults.parentsload - * @plugin parentsload - */ - $.jstree.defaults.parentsload = null; - $.jstree.plugins.parentsload = function (options, parent) { - this.init = function (el, options) { - parent.init.call(this, el, options); - this.patch_data() - }; - this.patch_data = function(){ - var parentsloadSettings = this.settings.parentsload; - var jsTreeDataSettings = this.settings.core.data; - var self = this; - - var callError = function(number, message) { - self._data.core.last_error = { 'error' : 'configuration', 'plugin' : 'parentsload', 'id' : 'parentsload_' + number, 'reason' : message, 'data' : JSON.stringify({config: parentsloadSettings}) }; - self.settings.core.error.call(self, self._data.core.last_error); - } - - if(!parentsloadSettings) { - callError('01', 'The configuration must be presented') - return - } - parentsloadSettings = parentsloadSettings.data; - - var patchSettingsProperty = function (propertyName) { - var property = parentsloadSettings[propertyName], - coreProperty = jsTreeDataSettings[propertyName]; - if (property) { - jsTreeDataSettings[propertyName] = function(node) { - if (this.get_node(node).parentsload_required) { - if ($.isFunction(property)) { - return property.call(this, node) - } else {// (typeof property === 'string') - return property - } - } else { - if ($.isFunction(coreProperty)) { - return coreProperty.call(this, node) - } else { // (typeof coreProperty === 'string') - return coreProperty - } - } - } - } /* else { - use jstree the same data[propertyName] settings - }*/ - } - - if($.isFunction(parentsloadSettings)) { - this.settings.data = parentsloadSettings - } else if (typeof parentsloadSettings === 'object') { - if (! (parentsloadSettings.url || parentsloadSettings.data)) { - callError('02', 'The "data.url" or "data.data" must be presented in configuration') - return - } - patchSettingsProperty('url') - patchSettingsProperty('data') - - } else { - callError('03', 'The appropriate "data.url" or "data.data" must be presented in configuration') - } - } - - this.load_node = function (obj, callback) { - if($.isArray(obj)) { - // FIXME: _load_nodes will not load nodes not presented in the tree - this._load_nodes(obj.slice(), callback); - return true; - } - var foundObj = this.get_node(obj); - if (foundObj) { - return parent.load_node.apply(this, arguments) - } else { - // node hasn't been loaded - var id = obj.id? obj.id: obj; - this._model.data[id] = { - id : id, - parent : '#', - parents : [], - children : [], - children_d : [], - state : { loaded : false }, - li_attr : {}, - a_attr : {}, - parentsload_required : true, - }; - return parent.load_node.call(this, obj, function(obj, status){ - obj.parentsload_required = !status - callback.call(this, obj, status) - }) - } - } - }; -})); diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/outro.js b/mayan/apps/cabinets/static/cabinets/packages/jstree/src/outro.js deleted file mode 100644 index 57d3e4820a..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/outro.js +++ /dev/null @@ -1 +0,0 @@ -})); \ No newline at end of file diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/sample.js b/mayan/apps/cabinets/static/cabinets/packages/jstree/src/sample.js deleted file mode 100644 index 2811e75ca0..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/sample.js +++ /dev/null @@ -1,93 +0,0 @@ -/*global jQuery */ -// wrap in IIFE and pass jQuery as $ -(function ($, undefined) { - "use strict"; - - // some private plugin stuff if needed - var private_var = null; - - // extending the defaults - $.jstree.defaults.sample = { - sample_option : 'sample_val' - }; - - // the actual plugin code - $.jstree.plugins.sample = function (options, parent) { - // own function - this.sample_function = function (arg) { - // you can chain this method if needed and available - if(parent.sample_function) { parent.sample_function.call(this, arg); } - }; - - // *SPECIAL* FUNCTIONS - this.init = function (el, options) { - // do not forget parent - parent.init.call(this, el, options); - }; - // bind events if needed - this.bind = function () { - // call parent function first - parent.bind.call(this); - // do(stuff); - }; - // unbind events if needed (all in jquery namespace are taken care of by the core) - this.unbind = function () { - // do(stuff); - // call parent function last - parent.unbind.call(this); - }; - this.teardown = function () { - // do not forget parent - parent.teardown.call(this); - }; - // state management - get and restore - this.get_state = function () { - // always get state from parent first - var state = parent.get_state.call(this); - // add own stuff to state - state.sample = { 'var' : 'val' }; - return state; - }; - this.set_state = function (state, callback) { - // only process your part if parent returns true - // there will be multiple times with false - if(parent.set_state.call(this, state, callback)) { - // check the key you set above - if(state.sample) { - // do(stuff); // like calling this.sample_function(state.sample.var); - // remove your part of the state, call again and RETURN FALSE, the next cycle will be TRUE - delete state.sample; - this.set_state(state, callback); - return false; - } - // return true if your state is gone (cleared in the previous step) - return true; - } - // parent was false - return false too - return false; - }; - // node transportation - this.get_json = function (obj, options, flat) { - // get the node from the parent - var tmp = parent.get_json.call(this, obj, options, flat), i, j; - if($.isArray(tmp)) { - for(i = 0, j = tmp.length; i < j; i++) { - tmp[i].sample = 'value'; - } - } - else { - tmp.sample = 'value'; - } - // return the original / modified node - return tmp; - }; - }; - - // attach to document ready if needed - $(function () { - // do(stuff); - }); - - // you can include the sample plugin in all instances by default - $.jstree.defaults.plugins.push("sample"); -})(jQuery); \ No newline at end of file diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/themes/base.less b/mayan/apps/cabinets/static/cabinets/packages/jstree/src/themes/base.less deleted file mode 100644 index 097e9997a8..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/themes/base.less +++ /dev/null @@ -1,88 +0,0 @@ -// base jstree -.jstree-node, .jstree-children, .jstree-container-ul { display:block; margin:0; padding:0; list-style-type:none; list-style-image:none; } -.jstree-node { white-space:nowrap; } -.jstree-anchor { display:inline-block; color:black; white-space:nowrap; padding:0 4px 0 1px; margin:0; vertical-align:top; } -.jstree-anchor:focus { outline:0; } -.jstree-anchor, .jstree-anchor:link, .jstree-anchor:visited, .jstree-anchor:hover, .jstree-anchor:active { text-decoration:none; color:inherit; } -.jstree-icon { display:inline-block; text-decoration:none; margin:0; padding:0; vertical-align:top; text-align:center; } -.jstree-icon:empty { display:inline-block; text-decoration:none; margin:0; padding:0; vertical-align:top; text-align:center; } -.jstree-ocl { cursor:pointer; } -.jstree-leaf > .jstree-ocl { cursor:default; } -.jstree .jstree-open > .jstree-children { display:block; } -.jstree .jstree-closed > .jstree-children, -.jstree .jstree-leaf > .jstree-children { display:none; } -.jstree-anchor > .jstree-themeicon { margin-right:2px; } -.jstree-no-icons .jstree-themeicon, -.jstree-anchor > .jstree-themeicon-hidden { display:none; } -.jstree-hidden, .jstree-node.jstree-hidden { display:none; } - -// base jstree rtl -.jstree-rtl { - .jstree-anchor { padding:0 1px 0 4px; } - .jstree-anchor > .jstree-themeicon { margin-left:2px; margin-right:0; } - .jstree-node { margin-left:0; } - .jstree-container-ul > .jstree-node { margin-right:0; } -} - -// base jstree wholerow -.jstree-wholerow-ul { - position:relative; - display:inline-block; - min-width:100%; - .jstree-leaf > .jstree-ocl { cursor:pointer; } - .jstree-anchor, .jstree-icon { position:relative; } - .jstree-wholerow { width:100%; cursor:pointer; position:absolute; left:0; -webkit-user-select:none; -moz-user-select:none; -ms-user-select:none; user-select:none; } -} - -// base contextmenu -.vakata-context { - display:none; - &, ul { margin:0; padding:2px; position:absolute; background:#f5f5f5; border:1px solid #979797; box-shadow:2px 2px 2px #999999; } - ul { list-style:none; left:100%; margin-top:-2.7em; margin-left:-4px; } - .vakata-context-right ul { left:auto; right:100%; margin-left:auto; margin-right:-4px; } - li { - list-style:none; - > a { - display:block; padding:0 2em 0 2em; text-decoration:none; width:auto; color:black; white-space:nowrap; line-height:2.4em; text-shadow:1px 1px 0 white; border-radius:1px; - &:hover { position:relative; background-color:#e8eff7; box-shadow:0 0 2px #0a6aa1; } - &.vakata-context-parent { background-image:url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAIORI4JlrqN1oMSnmmZDQUAOw=="); background-position:right center; background-repeat:no-repeat; } - } - > a:focus { outline:0; } - } - .vakata-context-hover > a { position:relative; background-color:#e8eff7; box-shadow:0 0 2px #0a6aa1; } - .vakata-context-separator { - > a, > a:hover { background:white; border:0; border-top:1px solid #e2e3e3; height:1px; min-height:1px; max-height:1px; padding:0; margin:0 0 0 2.4em; border-left:1px solid #e0e0e0; text-shadow:0 0 0 transparent; box-shadow:0 0 0 transparent; border-radius:0; } - } - .vakata-contextmenu-disabled { - a, a:hover { color:silver; background-color:transparent; border:0; box-shadow:0 0 0; } - } - li > a { - > i { text-decoration:none; display:inline-block; width:2.4em; height:2.4em; background:transparent; margin:0 0 0 -2em; vertical-align:top; text-align:center; line-height:2.4em; } - > i:empty { width:2.4em; line-height:2.4em; } - .vakata-contextmenu-sep { display:inline-block; width:1px; height:2.4em; background:white; margin:0 0.5em 0 0; border-left:1px solid #e2e3e3; } - } - .vakata-contextmenu-shortcut { font-size:0.8em; color:silver; opacity:0.5; display:none; } -} -.vakata-context-rtl { - ul { left:auto; right:100%; margin-left:auto; margin-right:-4px; } - li > a.vakata-context-parent { background-image:url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAINjI+AC7rWHIsPtmoxLAA7"); background-position:left center; background-repeat:no-repeat; } - .vakata-context-separator > a { margin:0 2.4em 0 0; border-left:0; border-right:1px solid #e2e3e3;} - .vakata-context-left ul { right:auto; left:100%; margin-left:-4px; margin-right:auto; } - li > a { - > i { margin:0 -2em 0 0; } - .vakata-contextmenu-sep { margin:0 0 0 0.5em; border-left-color:white; background:#e2e3e3; } - } -} - -// base drag'n'drop -#jstree-marker { position: absolute; top:0; left:0; margin:-5px 0 0 0; padding:0; border-right:0; border-top:5px solid transparent; border-bottom:5px solid transparent; border-left:5px solid; width:0; height:0; font-size:0; line-height:0; } -#jstree-dnd { - line-height:16px; - margin:0; - padding:4px; - .jstree-icon, - .jstree-copy { display:inline-block; text-decoration:none; margin:0 2px 0 0; padding:0; width:16px; height:16px; } - .jstree-ok { background:green; } - .jstree-er { background:red; } - .jstree-copy { margin:0 2px 0 2px; } -} diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/themes/default-dark/32px.png b/mayan/apps/cabinets/static/cabinets/packages/jstree/src/themes/default-dark/32px.png deleted file mode 100644 index 60395729ef..0000000000 Binary files a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/themes/default-dark/32px.png and /dev/null differ diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/themes/default-dark/40px.png b/mayan/apps/cabinets/static/cabinets/packages/jstree/src/themes/default-dark/40px.png deleted file mode 100644 index 002af360d0..0000000000 Binary files a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/themes/default-dark/40px.png and /dev/null differ diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/themes/default-dark/style.css b/mayan/apps/cabinets/static/cabinets/packages/jstree/src/themes/default-dark/style.css deleted file mode 100644 index 3af003f2d5..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/themes/default-dark/style.css +++ /dev/null @@ -1,1146 +0,0 @@ -/* jsTree default dark theme */ -.jstree-node, -.jstree-children, -.jstree-container-ul { - display: block; - margin: 0; - padding: 0; - list-style-type: none; - list-style-image: none; -} -.jstree-node { - white-space: nowrap; -} -.jstree-anchor { - display: inline-block; - color: black; - white-space: nowrap; - padding: 0 4px 0 1px; - margin: 0; - vertical-align: top; -} -.jstree-anchor:focus { - outline: 0; -} -.jstree-anchor, -.jstree-anchor:link, -.jstree-anchor:visited, -.jstree-anchor:hover, -.jstree-anchor:active { - text-decoration: none; - color: inherit; -} -.jstree-icon { - display: inline-block; - text-decoration: none; - margin: 0; - padding: 0; - vertical-align: top; - text-align: center; -} -.jstree-icon:empty { - display: inline-block; - text-decoration: none; - margin: 0; - padding: 0; - vertical-align: top; - text-align: center; -} -.jstree-ocl { - cursor: pointer; -} -.jstree-leaf > .jstree-ocl { - cursor: default; -} -.jstree .jstree-open > .jstree-children { - display: block; -} -.jstree .jstree-closed > .jstree-children, -.jstree .jstree-leaf > .jstree-children { - display: none; -} -.jstree-anchor > .jstree-themeicon { - margin-right: 2px; -} -.jstree-no-icons .jstree-themeicon, -.jstree-anchor > .jstree-themeicon-hidden { - display: none; -} -.jstree-hidden, -.jstree-node.jstree-hidden { - display: none; -} -.jstree-rtl .jstree-anchor { - padding: 0 1px 0 4px; -} -.jstree-rtl .jstree-anchor > .jstree-themeicon { - margin-left: 2px; - margin-right: 0; -} -.jstree-rtl .jstree-node { - margin-left: 0; -} -.jstree-rtl .jstree-container-ul > .jstree-node { - margin-right: 0; -} -.jstree-wholerow-ul { - position: relative; - display: inline-block; - min-width: 100%; -} -.jstree-wholerow-ul .jstree-leaf > .jstree-ocl { - cursor: pointer; -} -.jstree-wholerow-ul .jstree-anchor, -.jstree-wholerow-ul .jstree-icon { - position: relative; -} -.jstree-wholerow-ul .jstree-wholerow { - width: 100%; - cursor: pointer; - position: absolute; - left: 0; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} -.vakata-context { - display: none; -} -.vakata-context, -.vakata-context ul { - margin: 0; - padding: 2px; - position: absolute; - background: #f5f5f5; - border: 1px solid #979797; - box-shadow: 2px 2px 2px #999999; -} -.vakata-context ul { - list-style: none; - left: 100%; - margin-top: -2.7em; - margin-left: -4px; -} -.vakata-context .vakata-context-right ul { - left: auto; - right: 100%; - margin-left: auto; - margin-right: -4px; -} -.vakata-context li { - list-style: none; -} -.vakata-context li > a { - display: block; - padding: 0 2em 0 2em; - text-decoration: none; - width: auto; - color: black; - white-space: nowrap; - line-height: 2.4em; - text-shadow: 1px 1px 0 white; - border-radius: 1px; -} -.vakata-context li > a:hover { - position: relative; - background-color: #e8eff7; - box-shadow: 0 0 2px #0a6aa1; -} -.vakata-context li > a.vakata-context-parent { - background-image: url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAIORI4JlrqN1oMSnmmZDQUAOw=="); - background-position: right center; - background-repeat: no-repeat; -} -.vakata-context li > a:focus { - outline: 0; -} -.vakata-context .vakata-context-hover > a { - position: relative; - background-color: #e8eff7; - box-shadow: 0 0 2px #0a6aa1; -} -.vakata-context .vakata-context-separator > a, -.vakata-context .vakata-context-separator > a:hover { - background: white; - border: 0; - border-top: 1px solid #e2e3e3; - height: 1px; - min-height: 1px; - max-height: 1px; - padding: 0; - margin: 0 0 0 2.4em; - border-left: 1px solid #e0e0e0; - text-shadow: 0 0 0 transparent; - box-shadow: 0 0 0 transparent; - border-radius: 0; -} -.vakata-context .vakata-contextmenu-disabled a, -.vakata-context .vakata-contextmenu-disabled a:hover { - color: silver; - background-color: transparent; - border: 0; - box-shadow: 0 0 0; -} -.vakata-context li > a > i { - text-decoration: none; - display: inline-block; - width: 2.4em; - height: 2.4em; - background: transparent; - margin: 0 0 0 -2em; - vertical-align: top; - text-align: center; - line-height: 2.4em; -} -.vakata-context li > a > i:empty { - width: 2.4em; - line-height: 2.4em; -} -.vakata-context li > a .vakata-contextmenu-sep { - display: inline-block; - width: 1px; - height: 2.4em; - background: white; - margin: 0 0.5em 0 0; - border-left: 1px solid #e2e3e3; -} -.vakata-context .vakata-contextmenu-shortcut { - font-size: 0.8em; - color: silver; - opacity: 0.5; - display: none; -} -.vakata-context-rtl ul { - left: auto; - right: 100%; - margin-left: auto; - margin-right: -4px; -} -.vakata-context-rtl li > a.vakata-context-parent { - background-image: url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAINjI+AC7rWHIsPtmoxLAA7"); - background-position: left center; - background-repeat: no-repeat; -} -.vakata-context-rtl .vakata-context-separator > a { - margin: 0 2.4em 0 0; - border-left: 0; - border-right: 1px solid #e2e3e3; -} -.vakata-context-rtl .vakata-context-left ul { - right: auto; - left: 100%; - margin-left: -4px; - margin-right: auto; -} -.vakata-context-rtl li > a > i { - margin: 0 -2em 0 0; -} -.vakata-context-rtl li > a .vakata-contextmenu-sep { - margin: 0 0 0 0.5em; - border-left-color: white; - background: #e2e3e3; -} -#jstree-marker { - position: absolute; - top: 0; - left: 0; - margin: -5px 0 0 0; - padding: 0; - border-right: 0; - border-top: 5px solid transparent; - border-bottom: 5px solid transparent; - border-left: 5px solid; - width: 0; - height: 0; - font-size: 0; - line-height: 0; -} -#jstree-dnd { - line-height: 16px; - margin: 0; - padding: 4px; -} -#jstree-dnd .jstree-icon, -#jstree-dnd .jstree-copy { - display: inline-block; - text-decoration: none; - margin: 0 2px 0 0; - padding: 0; - width: 16px; - height: 16px; -} -#jstree-dnd .jstree-ok { - background: green; -} -#jstree-dnd .jstree-er { - background: red; -} -#jstree-dnd .jstree-copy { - margin: 0 2px 0 2px; -} -.jstree-default-dark .jstree-node, -.jstree-default-dark .jstree-icon { - background-repeat: no-repeat; - background-color: transparent; -} -.jstree-default-dark .jstree-anchor, -.jstree-default-dark .jstree-animated, -.jstree-default-dark .jstree-wholerow { - transition: background-color 0.15s, box-shadow 0.15s; -} -.jstree-default-dark .jstree-hovered { - background: #555555; - border-radius: 2px; - box-shadow: inset 0 0 1px #555555; -} -.jstree-default-dark .jstree-context { - background: #555555; - border-radius: 2px; - box-shadow: inset 0 0 1px #555555; -} -.jstree-default-dark .jstree-clicked { - background: #5fa2db; - border-radius: 2px; - box-shadow: inset 0 0 1px #666666; -} -.jstree-default-dark .jstree-no-icons .jstree-anchor > .jstree-themeicon { - display: none; -} -.jstree-default-dark .jstree-disabled { - background: transparent; - color: #666666; -} -.jstree-default-dark .jstree-disabled.jstree-hovered { - background: transparent; - box-shadow: none; -} -.jstree-default-dark .jstree-disabled.jstree-clicked { - background: #333333; -} -.jstree-default-dark .jstree-disabled > .jstree-icon { - opacity: 0.8; - filter: url("data:image/svg+xml;utf8,#jstree-grayscale"); - /* Firefox 10+ */ - filter: gray; - /* IE6-9 */ - -webkit-filter: grayscale(100%); - /* Chrome 19+ & Safari 6+ */ -} -.jstree-default-dark .jstree-search { - font-style: italic; - color: #ffffff; - font-weight: bold; -} -.jstree-default-dark .jstree-no-checkboxes .jstree-checkbox { - display: none !important; -} -.jstree-default-dark.jstree-checkbox-no-clicked .jstree-clicked { - background: transparent; - box-shadow: none; -} -.jstree-default-dark.jstree-checkbox-no-clicked .jstree-clicked.jstree-hovered { - background: #555555; -} -.jstree-default-dark.jstree-checkbox-no-clicked > .jstree-wholerow-ul .jstree-wholerow-clicked { - background: transparent; -} -.jstree-default-dark.jstree-checkbox-no-clicked > .jstree-wholerow-ul .jstree-wholerow-clicked.jstree-wholerow-hovered { - background: #555555; -} -.jstree-default-dark > .jstree-striped { - min-width: 100%; - display: inline-block; - background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAkCAMAAAB/qqA+AAAABlBMVEUAAAAAAAClZ7nPAAAAAnRSTlMNAMM9s3UAAAAXSURBVHjajcEBAQAAAIKg/H/aCQZ70AUBjAATb6YPDgAAAABJRU5ErkJggg==") left top repeat; -} -.jstree-default-dark > .jstree-wholerow-ul .jstree-hovered, -.jstree-default-dark > .jstree-wholerow-ul .jstree-clicked { - background: transparent; - box-shadow: none; - border-radius: 0; -} -.jstree-default-dark .jstree-wholerow { - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - box-sizing: border-box; -} -.jstree-default-dark .jstree-wholerow-hovered { - background: #555555; -} -.jstree-default-dark .jstree-wholerow-clicked { - background: #5fa2db; - background: -webkit-linear-gradient(top, #5fa2db 0%, #5fa2db 100%); - background: linear-gradient(to bottom, #5fa2db 0%, #5fa2db 100%); -} -.jstree-default-dark .jstree-node { - min-height: 24px; - line-height: 24px; - margin-left: 24px; - min-width: 24px; -} -.jstree-default-dark .jstree-anchor { - line-height: 24px; - height: 24px; -} -.jstree-default-dark .jstree-icon { - width: 24px; - height: 24px; - line-height: 24px; -} -.jstree-default-dark .jstree-icon:empty { - width: 24px; - height: 24px; - line-height: 24px; -} -.jstree-default-dark.jstree-rtl .jstree-node { - margin-right: 24px; -} -.jstree-default-dark .jstree-wholerow { - height: 24px; -} -.jstree-default-dark .jstree-node, -.jstree-default-dark .jstree-icon { - background-image: url("32px.png"); -} -.jstree-default-dark .jstree-node { - background-position: -292px -4px; - background-repeat: repeat-y; -} -.jstree-default-dark .jstree-last { - background: transparent; -} -.jstree-default-dark .jstree-open > .jstree-ocl { - background-position: -132px -4px; -} -.jstree-default-dark .jstree-closed > .jstree-ocl { - background-position: -100px -4px; -} -.jstree-default-dark .jstree-leaf > .jstree-ocl { - background-position: -68px -4px; -} -.jstree-default-dark .jstree-themeicon { - background-position: -260px -4px; -} -.jstree-default-dark > .jstree-no-dots .jstree-node, -.jstree-default-dark > .jstree-no-dots .jstree-leaf > .jstree-ocl { - background: transparent; -} -.jstree-default-dark > .jstree-no-dots .jstree-open > .jstree-ocl { - background-position: -36px -4px; -} -.jstree-default-dark > .jstree-no-dots .jstree-closed > .jstree-ocl { - background-position: -4px -4px; -} -.jstree-default-dark .jstree-disabled { - background: transparent; -} -.jstree-default-dark .jstree-disabled.jstree-hovered { - background: transparent; -} -.jstree-default-dark .jstree-disabled.jstree-clicked { - background: #efefef; -} -.jstree-default-dark .jstree-checkbox { - background-position: -164px -4px; -} -.jstree-default-dark .jstree-checkbox:hover { - background-position: -164px -36px; -} -.jstree-default-dark.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox, -.jstree-default-dark .jstree-checked > .jstree-checkbox { - background-position: -228px -4px; -} -.jstree-default-dark.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover, -.jstree-default-dark .jstree-checked > .jstree-checkbox:hover { - background-position: -228px -36px; -} -.jstree-default-dark .jstree-anchor > .jstree-undetermined { - background-position: -196px -4px; -} -.jstree-default-dark .jstree-anchor > .jstree-undetermined:hover { - background-position: -196px -36px; -} -.jstree-default-dark .jstree-checkbox-disabled { - opacity: 0.8; - filter: url("data:image/svg+xml;utf8,#jstree-grayscale"); - /* Firefox 10+ */ - filter: gray; - /* IE6-9 */ - -webkit-filter: grayscale(100%); - /* Chrome 19+ & Safari 6+ */ -} -.jstree-default-dark > .jstree-striped { - background-size: auto 48px; -} -.jstree-default-dark.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg=="); - background-position: 100% 1px; - background-repeat: repeat-y; -} -.jstree-default-dark.jstree-rtl .jstree-last { - background: transparent; -} -.jstree-default-dark.jstree-rtl .jstree-open > .jstree-ocl { - background-position: -132px -36px; -} -.jstree-default-dark.jstree-rtl .jstree-closed > .jstree-ocl { - background-position: -100px -36px; -} -.jstree-default-dark.jstree-rtl .jstree-leaf > .jstree-ocl { - background-position: -68px -36px; -} -.jstree-default-dark.jstree-rtl > .jstree-no-dots .jstree-node, -.jstree-default-dark.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl { - background: transparent; -} -.jstree-default-dark.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl { - background-position: -36px -36px; -} -.jstree-default-dark.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl { - background-position: -4px -36px; -} -.jstree-default-dark .jstree-themeicon-custom { - background-color: transparent; - background-image: none; - background-position: 0 0; -} -.jstree-default-dark > .jstree-container-ul .jstree-loading > .jstree-ocl { - background: url("throbber.gif") center center no-repeat; -} -.jstree-default-dark .jstree-file { - background: url("32px.png") -100px -68px no-repeat; -} -.jstree-default-dark .jstree-folder { - background: url("32px.png") -260px -4px no-repeat; -} -.jstree-default-dark > .jstree-container-ul > .jstree-node { - margin-left: 0; - margin-right: 0; -} -#jstree-dnd.jstree-default-dark { - line-height: 24px; - padding: 0 4px; -} -#jstree-dnd.jstree-default-dark .jstree-ok, -#jstree-dnd.jstree-default-dark .jstree-er { - background-image: url("32px.png"); - background-repeat: no-repeat; - background-color: transparent; -} -#jstree-dnd.jstree-default-dark i { - background: transparent; - width: 24px; - height: 24px; - line-height: 24px; -} -#jstree-dnd.jstree-default-dark .jstree-ok { - background-position: -4px -68px; -} -#jstree-dnd.jstree-default-dark .jstree-er { - background-position: -36px -68px; -} -.jstree-default-dark .jstree-ellipsis { - overflow: hidden; -} -.jstree-default-dark .jstree-ellipsis .jstree-anchor { - width: calc(100% - 29px); - text-overflow: ellipsis; - overflow: hidden; -} -.jstree-default-dark .jstree-ellipsis.jstree-no-icons .jstree-anchor { - width: calc(100% - 5px); -} -.jstree-default-dark.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg=="); -} -.jstree-default-dark.jstree-rtl .jstree-last { - background: transparent; -} -.jstree-default-dark-small .jstree-node { - min-height: 18px; - line-height: 18px; - margin-left: 18px; - min-width: 18px; -} -.jstree-default-dark-small .jstree-anchor { - line-height: 18px; - height: 18px; -} -.jstree-default-dark-small .jstree-icon { - width: 18px; - height: 18px; - line-height: 18px; -} -.jstree-default-dark-small .jstree-icon:empty { - width: 18px; - height: 18px; - line-height: 18px; -} -.jstree-default-dark-small.jstree-rtl .jstree-node { - margin-right: 18px; -} -.jstree-default-dark-small .jstree-wholerow { - height: 18px; -} -.jstree-default-dark-small .jstree-node, -.jstree-default-dark-small .jstree-icon { - background-image: url("32px.png"); -} -.jstree-default-dark-small .jstree-node { - background-position: -295px -7px; - background-repeat: repeat-y; -} -.jstree-default-dark-small .jstree-last { - background: transparent; -} -.jstree-default-dark-small .jstree-open > .jstree-ocl { - background-position: -135px -7px; -} -.jstree-default-dark-small .jstree-closed > .jstree-ocl { - background-position: -103px -7px; -} -.jstree-default-dark-small .jstree-leaf > .jstree-ocl { - background-position: -71px -7px; -} -.jstree-default-dark-small .jstree-themeicon { - background-position: -263px -7px; -} -.jstree-default-dark-small > .jstree-no-dots .jstree-node, -.jstree-default-dark-small > .jstree-no-dots .jstree-leaf > .jstree-ocl { - background: transparent; -} -.jstree-default-dark-small > .jstree-no-dots .jstree-open > .jstree-ocl { - background-position: -39px -7px; -} -.jstree-default-dark-small > .jstree-no-dots .jstree-closed > .jstree-ocl { - background-position: -7px -7px; -} -.jstree-default-dark-small .jstree-disabled { - background: transparent; -} -.jstree-default-dark-small .jstree-disabled.jstree-hovered { - background: transparent; -} -.jstree-default-dark-small .jstree-disabled.jstree-clicked { - background: #efefef; -} -.jstree-default-dark-small .jstree-checkbox { - background-position: -167px -7px; -} -.jstree-default-dark-small .jstree-checkbox:hover { - background-position: -167px -39px; -} -.jstree-default-dark-small.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox, -.jstree-default-dark-small .jstree-checked > .jstree-checkbox { - background-position: -231px -7px; -} -.jstree-default-dark-small.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover, -.jstree-default-dark-small .jstree-checked > .jstree-checkbox:hover { - background-position: -231px -39px; -} -.jstree-default-dark-small .jstree-anchor > .jstree-undetermined { - background-position: -199px -7px; -} -.jstree-default-dark-small .jstree-anchor > .jstree-undetermined:hover { - background-position: -199px -39px; -} -.jstree-default-dark-small .jstree-checkbox-disabled { - opacity: 0.8; - filter: url("data:image/svg+xml;utf8,#jstree-grayscale"); - /* Firefox 10+ */ - filter: gray; - /* IE6-9 */ - -webkit-filter: grayscale(100%); - /* Chrome 19+ & Safari 6+ */ -} -.jstree-default-dark-small > .jstree-striped { - background-size: auto 36px; -} -.jstree-default-dark-small.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg=="); - background-position: 100% 1px; - background-repeat: repeat-y; -} -.jstree-default-dark-small.jstree-rtl .jstree-last { - background: transparent; -} -.jstree-default-dark-small.jstree-rtl .jstree-open > .jstree-ocl { - background-position: -135px -39px; -} -.jstree-default-dark-small.jstree-rtl .jstree-closed > .jstree-ocl { - background-position: -103px -39px; -} -.jstree-default-dark-small.jstree-rtl .jstree-leaf > .jstree-ocl { - background-position: -71px -39px; -} -.jstree-default-dark-small.jstree-rtl > .jstree-no-dots .jstree-node, -.jstree-default-dark-small.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl { - background: transparent; -} -.jstree-default-dark-small.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl { - background-position: -39px -39px; -} -.jstree-default-dark-small.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl { - background-position: -7px -39px; -} -.jstree-default-dark-small .jstree-themeicon-custom { - background-color: transparent; - background-image: none; - background-position: 0 0; -} -.jstree-default-dark-small > .jstree-container-ul .jstree-loading > .jstree-ocl { - background: url("throbber.gif") center center no-repeat; -} -.jstree-default-dark-small .jstree-file { - background: url("32px.png") -103px -71px no-repeat; -} -.jstree-default-dark-small .jstree-folder { - background: url("32px.png") -263px -7px no-repeat; -} -.jstree-default-dark-small > .jstree-container-ul > .jstree-node { - margin-left: 0; - margin-right: 0; -} -#jstree-dnd.jstree-default-dark-small { - line-height: 18px; - padding: 0 4px; -} -#jstree-dnd.jstree-default-dark-small .jstree-ok, -#jstree-dnd.jstree-default-dark-small .jstree-er { - background-image: url("32px.png"); - background-repeat: no-repeat; - background-color: transparent; -} -#jstree-dnd.jstree-default-dark-small i { - background: transparent; - width: 18px; - height: 18px; - line-height: 18px; -} -#jstree-dnd.jstree-default-dark-small .jstree-ok { - background-position: -7px -71px; -} -#jstree-dnd.jstree-default-dark-small .jstree-er { - background-position: -39px -71px; -} -.jstree-default-dark-small .jstree-ellipsis { - overflow: hidden; -} -.jstree-default-dark-small .jstree-ellipsis .jstree-anchor { - width: calc(100% - 23px); - text-overflow: ellipsis; - overflow: hidden; -} -.jstree-default-dark-small .jstree-ellipsis.jstree-no-icons .jstree-anchor { - width: calc(100% - 5px); -} -.jstree-default-dark-small.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAACAQMAAABv1h6PAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMHBgAAiABBI4gz9AAAAABJRU5ErkJggg=="); -} -.jstree-default-dark-small.jstree-rtl .jstree-last { - background: transparent; -} -.jstree-default-dark-large .jstree-node { - min-height: 32px; - line-height: 32px; - margin-left: 32px; - min-width: 32px; -} -.jstree-default-dark-large .jstree-anchor { - line-height: 32px; - height: 32px; -} -.jstree-default-dark-large .jstree-icon { - width: 32px; - height: 32px; - line-height: 32px; -} -.jstree-default-dark-large .jstree-icon:empty { - width: 32px; - height: 32px; - line-height: 32px; -} -.jstree-default-dark-large.jstree-rtl .jstree-node { - margin-right: 32px; -} -.jstree-default-dark-large .jstree-wholerow { - height: 32px; -} -.jstree-default-dark-large .jstree-node, -.jstree-default-dark-large .jstree-icon { - background-image: url("32px.png"); -} -.jstree-default-dark-large .jstree-node { - background-position: -288px 0px; - background-repeat: repeat-y; -} -.jstree-default-dark-large .jstree-last { - background: transparent; -} -.jstree-default-dark-large .jstree-open > .jstree-ocl { - background-position: -128px 0px; -} -.jstree-default-dark-large .jstree-closed > .jstree-ocl { - background-position: -96px 0px; -} -.jstree-default-dark-large .jstree-leaf > .jstree-ocl { - background-position: -64px 0px; -} -.jstree-default-dark-large .jstree-themeicon { - background-position: -256px 0px; -} -.jstree-default-dark-large > .jstree-no-dots .jstree-node, -.jstree-default-dark-large > .jstree-no-dots .jstree-leaf > .jstree-ocl { - background: transparent; -} -.jstree-default-dark-large > .jstree-no-dots .jstree-open > .jstree-ocl { - background-position: -32px 0px; -} -.jstree-default-dark-large > .jstree-no-dots .jstree-closed > .jstree-ocl { - background-position: 0px 0px; -} -.jstree-default-dark-large .jstree-disabled { - background: transparent; -} -.jstree-default-dark-large .jstree-disabled.jstree-hovered { - background: transparent; -} -.jstree-default-dark-large .jstree-disabled.jstree-clicked { - background: #efefef; -} -.jstree-default-dark-large .jstree-checkbox { - background-position: -160px 0px; -} -.jstree-default-dark-large .jstree-checkbox:hover { - background-position: -160px -32px; -} -.jstree-default-dark-large.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox, -.jstree-default-dark-large .jstree-checked > .jstree-checkbox { - background-position: -224px 0px; -} -.jstree-default-dark-large.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover, -.jstree-default-dark-large .jstree-checked > .jstree-checkbox:hover { - background-position: -224px -32px; -} -.jstree-default-dark-large .jstree-anchor > .jstree-undetermined { - background-position: -192px 0px; -} -.jstree-default-dark-large .jstree-anchor > .jstree-undetermined:hover { - background-position: -192px -32px; -} -.jstree-default-dark-large .jstree-checkbox-disabled { - opacity: 0.8; - filter: url("data:image/svg+xml;utf8,#jstree-grayscale"); - /* Firefox 10+ */ - filter: gray; - /* IE6-9 */ - -webkit-filter: grayscale(100%); - /* Chrome 19+ & Safari 6+ */ -} -.jstree-default-dark-large > .jstree-striped { - background-size: auto 64px; -} -.jstree-default-dark-large.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg=="); - background-position: 100% 1px; - background-repeat: repeat-y; -} -.jstree-default-dark-large.jstree-rtl .jstree-last { - background: transparent; -} -.jstree-default-dark-large.jstree-rtl .jstree-open > .jstree-ocl { - background-position: -128px -32px; -} -.jstree-default-dark-large.jstree-rtl .jstree-closed > .jstree-ocl { - background-position: -96px -32px; -} -.jstree-default-dark-large.jstree-rtl .jstree-leaf > .jstree-ocl { - background-position: -64px -32px; -} -.jstree-default-dark-large.jstree-rtl > .jstree-no-dots .jstree-node, -.jstree-default-dark-large.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl { - background: transparent; -} -.jstree-default-dark-large.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl { - background-position: -32px -32px; -} -.jstree-default-dark-large.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl { - background-position: 0px -32px; -} -.jstree-default-dark-large .jstree-themeicon-custom { - background-color: transparent; - background-image: none; - background-position: 0 0; -} -.jstree-default-dark-large > .jstree-container-ul .jstree-loading > .jstree-ocl { - background: url("throbber.gif") center center no-repeat; -} -.jstree-default-dark-large .jstree-file { - background: url("32px.png") -96px -64px no-repeat; -} -.jstree-default-dark-large .jstree-folder { - background: url("32px.png") -256px 0px no-repeat; -} -.jstree-default-dark-large > .jstree-container-ul > .jstree-node { - margin-left: 0; - margin-right: 0; -} -#jstree-dnd.jstree-default-dark-large { - line-height: 32px; - padding: 0 4px; -} -#jstree-dnd.jstree-default-dark-large .jstree-ok, -#jstree-dnd.jstree-default-dark-large .jstree-er { - background-image: url("32px.png"); - background-repeat: no-repeat; - background-color: transparent; -} -#jstree-dnd.jstree-default-dark-large i { - background: transparent; - width: 32px; - height: 32px; - line-height: 32px; -} -#jstree-dnd.jstree-default-dark-large .jstree-ok { - background-position: 0px -64px; -} -#jstree-dnd.jstree-default-dark-large .jstree-er { - background-position: -32px -64px; -} -.jstree-default-dark-large .jstree-ellipsis { - overflow: hidden; -} -.jstree-default-dark-large .jstree-ellipsis .jstree-anchor { - width: calc(100% - 37px); - text-overflow: ellipsis; - overflow: hidden; -} -.jstree-default-dark-large .jstree-ellipsis.jstree-no-icons .jstree-anchor { - width: calc(100% - 5px); -} -.jstree-default-dark-large.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAACAQMAAAAD0EyKAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjgIIGBgABCgCBvVLXcAAAAABJRU5ErkJggg=="); -} -.jstree-default-dark-large.jstree-rtl .jstree-last { - background: transparent; -} -@media (max-width: 768px) { - #jstree-dnd.jstree-dnd-responsive { - line-height: 40px; - font-weight: bold; - font-size: 1.1em; - text-shadow: 1px 1px white; - } - #jstree-dnd.jstree-dnd-responsive > i { - background: transparent; - width: 40px; - height: 40px; - } - #jstree-dnd.jstree-dnd-responsive > .jstree-ok { - background-image: url("40px.png"); - background-position: 0 -200px; - background-size: 120px 240px; - } - #jstree-dnd.jstree-dnd-responsive > .jstree-er { - background-image: url("40px.png"); - background-position: -40px -200px; - background-size: 120px 240px; - } - #jstree-marker.jstree-dnd-responsive { - border-left-width: 10px; - border-top-width: 10px; - border-bottom-width: 10px; - margin-top: -10px; - } -} -@media (max-width: 768px) { - .jstree-default-dark-responsive { - /* - .jstree-open > .jstree-ocl, - .jstree-closed > .jstree-ocl { border-radius:20px; background-color:white; } - */ - } - .jstree-default-dark-responsive .jstree-icon { - background-image: url("40px.png"); - } - .jstree-default-dark-responsive .jstree-node, - .jstree-default-dark-responsive .jstree-leaf > .jstree-ocl { - background: transparent; - } - .jstree-default-dark-responsive .jstree-node { - min-height: 40px; - line-height: 40px; - margin-left: 40px; - min-width: 40px; - white-space: nowrap; - } - .jstree-default-dark-responsive .jstree-anchor { - line-height: 40px; - height: 40px; - } - .jstree-default-dark-responsive .jstree-icon, - .jstree-default-dark-responsive .jstree-icon:empty { - width: 40px; - height: 40px; - line-height: 40px; - } - .jstree-default-dark-responsive > .jstree-container-ul > .jstree-node { - margin-left: 0; - } - .jstree-default-dark-responsive.jstree-rtl .jstree-node { - margin-left: 0; - margin-right: 40px; - background: transparent; - } - .jstree-default-dark-responsive.jstree-rtl .jstree-container-ul > .jstree-node { - margin-right: 0; - } - .jstree-default-dark-responsive .jstree-ocl, - .jstree-default-dark-responsive .jstree-themeicon, - .jstree-default-dark-responsive .jstree-checkbox { - background-size: 120px 240px; - } - .jstree-default-dark-responsive .jstree-leaf > .jstree-ocl, - .jstree-default-dark-responsive.jstree-rtl .jstree-leaf > .jstree-ocl { - background: transparent; - } - .jstree-default-dark-responsive .jstree-open > .jstree-ocl { - background-position: 0 0px !important; - } - .jstree-default-dark-responsive .jstree-closed > .jstree-ocl { - background-position: 0 -40px !important; - } - .jstree-default-dark-responsive.jstree-rtl .jstree-closed > .jstree-ocl { - background-position: -40px 0px !important; - } - .jstree-default-dark-responsive .jstree-themeicon { - background-position: -40px -40px; - } - .jstree-default-dark-responsive .jstree-checkbox, - .jstree-default-dark-responsive .jstree-checkbox:hover { - background-position: -40px -80px; - } - .jstree-default-dark-responsive.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox, - .jstree-default-dark-responsive.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover, - .jstree-default-dark-responsive .jstree-checked > .jstree-checkbox, - .jstree-default-dark-responsive .jstree-checked > .jstree-checkbox:hover { - background-position: 0 -80px; - } - .jstree-default-dark-responsive .jstree-anchor > .jstree-undetermined, - .jstree-default-dark-responsive .jstree-anchor > .jstree-undetermined:hover { - background-position: 0 -120px; - } - .jstree-default-dark-responsive .jstree-anchor { - font-weight: bold; - font-size: 1.1em; - text-shadow: 1px 1px white; - } - .jstree-default-dark-responsive > .jstree-striped { - background: transparent; - } - .jstree-default-dark-responsive .jstree-wholerow { - border-top: 1px solid #666666; - border-bottom: 1px solid #000000; - background: #333333; - height: 40px; - } - .jstree-default-dark-responsive .jstree-wholerow-hovered { - background: #555555; - } - .jstree-default-dark-responsive .jstree-wholerow-clicked { - background: #5fa2db; - } - .jstree-default-dark-responsive .jstree-children .jstree-last > .jstree-wholerow { - box-shadow: inset 0 -6px 3px -5px #111111; - } - .jstree-default-dark-responsive .jstree-children .jstree-open > .jstree-wholerow { - box-shadow: inset 0 6px 3px -5px #111111; - border-top: 0; - } - .jstree-default-dark-responsive .jstree-children .jstree-open + .jstree-open { - box-shadow: none; - } - .jstree-default-dark-responsive .jstree-node, - .jstree-default-dark-responsive .jstree-icon, - .jstree-default-dark-responsive .jstree-node > .jstree-ocl, - .jstree-default-dark-responsive .jstree-themeicon, - .jstree-default-dark-responsive .jstree-checkbox { - background-image: url("40px.png"); - background-size: 120px 240px; - } - .jstree-default-dark-responsive .jstree-node { - background-position: -80px 0; - background-repeat: repeat-y; - } - .jstree-default-dark-responsive .jstree-last { - background: transparent; - } - .jstree-default-dark-responsive .jstree-leaf > .jstree-ocl { - background-position: -40px -120px; - } - .jstree-default-dark-responsive .jstree-last > .jstree-ocl { - background-position: -40px -160px; - } - .jstree-default-dark-responsive .jstree-themeicon-custom { - background-color: transparent; - background-image: none; - background-position: 0 0; - } - .jstree-default-dark-responsive .jstree-file { - background: url("40px.png") 0 -160px no-repeat; - background-size: 120px 240px; - } - .jstree-default-dark-responsive .jstree-folder { - background: url("40px.png") -40px -40px no-repeat; - background-size: 120px 240px; - } - .jstree-default-dark-responsive > .jstree-container-ul > .jstree-node { - margin-left: 0; - margin-right: 0; - } -} -.jstree-default-dark { - background: #333; -} -.jstree-default-dark .jstree-anchor { - color: #999; - text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5); -} -.jstree-default-dark .jstree-clicked, -.jstree-default-dark .jstree-checked { - color: white; -} -.jstree-default-dark .jstree-hovered { - color: white; -} -#jstree-marker.jstree-default-dark { - border-left-color: #999; - background: transparent; -} -.jstree-default-dark .jstree-anchor > .jstree-icon { - opacity: 0.75; -} -.jstree-default-dark .jstree-clicked > .jstree-icon, -.jstree-default-dark .jstree-hovered > .jstree-icon, -.jstree-default-dark .jstree-checked > .jstree-icon { - opacity: 1; -} -.jstree-default-dark.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAACZmZl+9SADAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg=="); -} -.jstree-default-dark.jstree-rtl .jstree-last { - background: transparent; -} -.jstree-default-dark-small.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAACAQMAAABv1h6PAAAABlBMVEUAAACZmZl+9SADAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMHBgAAiABBI4gz9AAAAABJRU5ErkJggg=="); -} -.jstree-default-dark-small.jstree-rtl .jstree-last { - background: transparent; -} -.jstree-default-dark-large.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAACAQMAAAAD0EyKAAAABlBMVEUAAACZmZl+9SADAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjgIIGBgABCgCBvVLXcAAAAABJRU5ErkJggg=="); -} -.jstree-default-dark-large.jstree-rtl .jstree-last { - background: transparent; -} diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/themes/default-dark/style.less b/mayan/apps/cabinets/static/cabinets/packages/jstree/src/themes/default-dark/style.less deleted file mode 100644 index 0f9a3963d1..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/themes/default-dark/style.less +++ /dev/null @@ -1,50 +0,0 @@ -/* jsTree default dark theme */ -@theme-name: default-dark; -@hovered-bg-color: #555; -@hovered-shadow-color: #555; -@disabled-color: #666666; -@disabled-bg-color: #333333; -@clicked-bg-color: #5fa2db; -@clicked-shadow-color: #666666; -@clicked-gradient-color-1: #5fa2db; -@clicked-gradient-color-2: #5fa2db; -@search-result-color: #ffffff; -@mobile-wholerow-bg-color: #333333; -@mobile-wholerow-shadow: #111111; -@mobile-wholerow-bordert: #666; -@mobile-wholerow-borderb: #000; -@responsive: true; -@image-path: ""; -@base-height: 40px; - -@import "../mixins.less"; -@import "../base.less"; -@import "../main.less"; - -.jstree-@{theme-name} { - background:#333; - .jstree-anchor { color:#999; text-shadow:1px 1px 0 rgba(0,0,0,0.5); } - .jstree-clicked, .jstree-checked { color:white; } - .jstree-hovered { color:white; } - #jstree-marker& { - border-left-color:#999; - background:transparent; - } - .jstree-anchor > .jstree-icon { opacity:0.75; } - .jstree-clicked > .jstree-icon, - .jstree-hovered > .jstree-icon, - .jstree-checked > .jstree-icon { opacity:1; } -} -// theme variants -.jstree-@{theme-name} { - &.jstree-rtl .jstree-node { background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAACZmZl+9SADAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg=="); } - &.jstree-rtl .jstree-last { background:transparent; } -} -.jstree-@{theme-name}-small { - &.jstree-rtl .jstree-node { background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAACAQMAAABv1h6PAAAABlBMVEUAAACZmZl+9SADAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMHBgAAiABBI4gz9AAAAABJRU5ErkJggg=="); } - &.jstree-rtl .jstree-last { background:transparent; } -} -.jstree-@{theme-name}-large { - &.jstree-rtl .jstree-node { background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAACAQMAAAAD0EyKAAAABlBMVEUAAACZmZl+9SADAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjgIIGBgABCgCBvVLXcAAAAABJRU5ErkJggg=="); } - &.jstree-rtl .jstree-last { background:transparent; } -} \ No newline at end of file diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/themes/default-dark/throbber.gif b/mayan/apps/cabinets/static/cabinets/packages/jstree/src/themes/default-dark/throbber.gif deleted file mode 100644 index 2e310e8be2..0000000000 Binary files a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/themes/default-dark/throbber.gif and /dev/null differ diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/themes/default/32px.png b/mayan/apps/cabinets/static/cabinets/packages/jstree/src/themes/default/32px.png deleted file mode 100644 index ac74418d28..0000000000 Binary files a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/themes/default/32px.png and /dev/null differ diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/themes/default/40px.png b/mayan/apps/cabinets/static/cabinets/packages/jstree/src/themes/default/40px.png deleted file mode 100644 index 2927326007..0000000000 Binary files a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/themes/default/40px.png and /dev/null differ diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/themes/default/style.css b/mayan/apps/cabinets/static/cabinets/packages/jstree/src/themes/default/style.css deleted file mode 100644 index 616be241be..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/themes/default/style.css +++ /dev/null @@ -1,1102 +0,0 @@ -/* jsTree default theme */ -.jstree-node, -.jstree-children, -.jstree-container-ul { - display: block; - margin: 0; - padding: 0; - list-style-type: none; - list-style-image: none; -} -.jstree-node { - white-space: nowrap; -} -.jstree-anchor { - display: inline-block; - color: black; - white-space: nowrap; - padding: 0 4px 0 1px; - margin: 0; - vertical-align: top; -} -.jstree-anchor:focus { - outline: 0; -} -.jstree-anchor, -.jstree-anchor:link, -.jstree-anchor:visited, -.jstree-anchor:hover, -.jstree-anchor:active { - text-decoration: none; - color: inherit; -} -.jstree-icon { - display: inline-block; - text-decoration: none; - margin: 0; - padding: 0; - vertical-align: top; - text-align: center; -} -.jstree-icon:empty { - display: inline-block; - text-decoration: none; - margin: 0; - padding: 0; - vertical-align: top; - text-align: center; -} -.jstree-ocl { - cursor: pointer; -} -.jstree-leaf > .jstree-ocl { - cursor: default; -} -.jstree .jstree-open > .jstree-children { - display: block; -} -.jstree .jstree-closed > .jstree-children, -.jstree .jstree-leaf > .jstree-children { - display: none; -} -.jstree-anchor > .jstree-themeicon { - margin-right: 2px; -} -.jstree-no-icons .jstree-themeicon, -.jstree-anchor > .jstree-themeicon-hidden { - display: none; -} -.jstree-hidden, -.jstree-node.jstree-hidden { - display: none; -} -.jstree-rtl .jstree-anchor { - padding: 0 1px 0 4px; -} -.jstree-rtl .jstree-anchor > .jstree-themeicon { - margin-left: 2px; - margin-right: 0; -} -.jstree-rtl .jstree-node { - margin-left: 0; -} -.jstree-rtl .jstree-container-ul > .jstree-node { - margin-right: 0; -} -.jstree-wholerow-ul { - position: relative; - display: inline-block; - min-width: 100%; -} -.jstree-wholerow-ul .jstree-leaf > .jstree-ocl { - cursor: pointer; -} -.jstree-wholerow-ul .jstree-anchor, -.jstree-wholerow-ul .jstree-icon { - position: relative; -} -.jstree-wholerow-ul .jstree-wholerow { - width: 100%; - cursor: pointer; - position: absolute; - left: 0; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} -.vakata-context { - display: none; -} -.vakata-context, -.vakata-context ul { - margin: 0; - padding: 2px; - position: absolute; - background: #f5f5f5; - border: 1px solid #979797; - box-shadow: 2px 2px 2px #999999; -} -.vakata-context ul { - list-style: none; - left: 100%; - margin-top: -2.7em; - margin-left: -4px; -} -.vakata-context .vakata-context-right ul { - left: auto; - right: 100%; - margin-left: auto; - margin-right: -4px; -} -.vakata-context li { - list-style: none; -} -.vakata-context li > a { - display: block; - padding: 0 2em 0 2em; - text-decoration: none; - width: auto; - color: black; - white-space: nowrap; - line-height: 2.4em; - text-shadow: 1px 1px 0 white; - border-radius: 1px; -} -.vakata-context li > a:hover { - position: relative; - background-color: #e8eff7; - box-shadow: 0 0 2px #0a6aa1; -} -.vakata-context li > a.vakata-context-parent { - background-image: url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAIORI4JlrqN1oMSnmmZDQUAOw=="); - background-position: right center; - background-repeat: no-repeat; -} -.vakata-context li > a:focus { - outline: 0; -} -.vakata-context .vakata-context-hover > a { - position: relative; - background-color: #e8eff7; - box-shadow: 0 0 2px #0a6aa1; -} -.vakata-context .vakata-context-separator > a, -.vakata-context .vakata-context-separator > a:hover { - background: white; - border: 0; - border-top: 1px solid #e2e3e3; - height: 1px; - min-height: 1px; - max-height: 1px; - padding: 0; - margin: 0 0 0 2.4em; - border-left: 1px solid #e0e0e0; - text-shadow: 0 0 0 transparent; - box-shadow: 0 0 0 transparent; - border-radius: 0; -} -.vakata-context .vakata-contextmenu-disabled a, -.vakata-context .vakata-contextmenu-disabled a:hover { - color: silver; - background-color: transparent; - border: 0; - box-shadow: 0 0 0; -} -.vakata-context li > a > i { - text-decoration: none; - display: inline-block; - width: 2.4em; - height: 2.4em; - background: transparent; - margin: 0 0 0 -2em; - vertical-align: top; - text-align: center; - line-height: 2.4em; -} -.vakata-context li > a > i:empty { - width: 2.4em; - line-height: 2.4em; -} -.vakata-context li > a .vakata-contextmenu-sep { - display: inline-block; - width: 1px; - height: 2.4em; - background: white; - margin: 0 0.5em 0 0; - border-left: 1px solid #e2e3e3; -} -.vakata-context .vakata-contextmenu-shortcut { - font-size: 0.8em; - color: silver; - opacity: 0.5; - display: none; -} -.vakata-context-rtl ul { - left: auto; - right: 100%; - margin-left: auto; - margin-right: -4px; -} -.vakata-context-rtl li > a.vakata-context-parent { - background-image: url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAINjI+AC7rWHIsPtmoxLAA7"); - background-position: left center; - background-repeat: no-repeat; -} -.vakata-context-rtl .vakata-context-separator > a { - margin: 0 2.4em 0 0; - border-left: 0; - border-right: 1px solid #e2e3e3; -} -.vakata-context-rtl .vakata-context-left ul { - right: auto; - left: 100%; - margin-left: -4px; - margin-right: auto; -} -.vakata-context-rtl li > a > i { - margin: 0 -2em 0 0; -} -.vakata-context-rtl li > a .vakata-contextmenu-sep { - margin: 0 0 0 0.5em; - border-left-color: white; - background: #e2e3e3; -} -#jstree-marker { - position: absolute; - top: 0; - left: 0; - margin: -5px 0 0 0; - padding: 0; - border-right: 0; - border-top: 5px solid transparent; - border-bottom: 5px solid transparent; - border-left: 5px solid; - width: 0; - height: 0; - font-size: 0; - line-height: 0; -} -#jstree-dnd { - line-height: 16px; - margin: 0; - padding: 4px; -} -#jstree-dnd .jstree-icon, -#jstree-dnd .jstree-copy { - display: inline-block; - text-decoration: none; - margin: 0 2px 0 0; - padding: 0; - width: 16px; - height: 16px; -} -#jstree-dnd .jstree-ok { - background: green; -} -#jstree-dnd .jstree-er { - background: red; -} -#jstree-dnd .jstree-copy { - margin: 0 2px 0 2px; -} -.jstree-default .jstree-node, -.jstree-default .jstree-icon { - background-repeat: no-repeat; - background-color: transparent; -} -.jstree-default .jstree-anchor, -.jstree-default .jstree-animated, -.jstree-default .jstree-wholerow { - transition: background-color 0.15s, box-shadow 0.15s; -} -.jstree-default .jstree-hovered { - background: #e7f4f9; - border-radius: 2px; - box-shadow: inset 0 0 1px #cccccc; -} -.jstree-default .jstree-context { - background: #e7f4f9; - border-radius: 2px; - box-shadow: inset 0 0 1px #cccccc; -} -.jstree-default .jstree-clicked { - background: #beebff; - border-radius: 2px; - box-shadow: inset 0 0 1px #999999; -} -.jstree-default .jstree-no-icons .jstree-anchor > .jstree-themeicon { - display: none; -} -.jstree-default .jstree-disabled { - background: transparent; - color: #666666; -} -.jstree-default .jstree-disabled.jstree-hovered { - background: transparent; - box-shadow: none; -} -.jstree-default .jstree-disabled.jstree-clicked { - background: #efefef; -} -.jstree-default .jstree-disabled > .jstree-icon { - opacity: 0.8; - filter: url("data:image/svg+xml;utf8,#jstree-grayscale"); - /* Firefox 10+ */ - filter: gray; - /* IE6-9 */ - -webkit-filter: grayscale(100%); - /* Chrome 19+ & Safari 6+ */ -} -.jstree-default .jstree-search { - font-style: italic; - color: #8b0000; - font-weight: bold; -} -.jstree-default .jstree-no-checkboxes .jstree-checkbox { - display: none !important; -} -.jstree-default.jstree-checkbox-no-clicked .jstree-clicked { - background: transparent; - box-shadow: none; -} -.jstree-default.jstree-checkbox-no-clicked .jstree-clicked.jstree-hovered { - background: #e7f4f9; -} -.jstree-default.jstree-checkbox-no-clicked > .jstree-wholerow-ul .jstree-wholerow-clicked { - background: transparent; -} -.jstree-default.jstree-checkbox-no-clicked > .jstree-wholerow-ul .jstree-wholerow-clicked.jstree-wholerow-hovered { - background: #e7f4f9; -} -.jstree-default > .jstree-striped { - min-width: 100%; - display: inline-block; - background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAkCAMAAAB/qqA+AAAABlBMVEUAAAAAAAClZ7nPAAAAAnRSTlMNAMM9s3UAAAAXSURBVHjajcEBAQAAAIKg/H/aCQZ70AUBjAATb6YPDgAAAABJRU5ErkJggg==") left top repeat; -} -.jstree-default > .jstree-wholerow-ul .jstree-hovered, -.jstree-default > .jstree-wholerow-ul .jstree-clicked { - background: transparent; - box-shadow: none; - border-radius: 0; -} -.jstree-default .jstree-wholerow { - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - box-sizing: border-box; -} -.jstree-default .jstree-wholerow-hovered { - background: #e7f4f9; -} -.jstree-default .jstree-wholerow-clicked { - background: #beebff; - background: -webkit-linear-gradient(top, #beebff 0%, #a8e4ff 100%); - background: linear-gradient(to bottom, #beebff 0%, #a8e4ff 100%); -} -.jstree-default .jstree-node { - min-height: 24px; - line-height: 24px; - margin-left: 24px; - min-width: 24px; -} -.jstree-default .jstree-anchor { - line-height: 24px; - height: 24px; -} -.jstree-default .jstree-icon { - width: 24px; - height: 24px; - line-height: 24px; -} -.jstree-default .jstree-icon:empty { - width: 24px; - height: 24px; - line-height: 24px; -} -.jstree-default.jstree-rtl .jstree-node { - margin-right: 24px; -} -.jstree-default .jstree-wholerow { - height: 24px; -} -.jstree-default .jstree-node, -.jstree-default .jstree-icon { - background-image: url("32px.png"); -} -.jstree-default .jstree-node { - background-position: -292px -4px; - background-repeat: repeat-y; -} -.jstree-default .jstree-last { - background: transparent; -} -.jstree-default .jstree-open > .jstree-ocl { - background-position: -132px -4px; -} -.jstree-default .jstree-closed > .jstree-ocl { - background-position: -100px -4px; -} -.jstree-default .jstree-leaf > .jstree-ocl { - background-position: -68px -4px; -} -.jstree-default .jstree-themeicon { - background-position: -260px -4px; -} -.jstree-default > .jstree-no-dots .jstree-node, -.jstree-default > .jstree-no-dots .jstree-leaf > .jstree-ocl { - background: transparent; -} -.jstree-default > .jstree-no-dots .jstree-open > .jstree-ocl { - background-position: -36px -4px; -} -.jstree-default > .jstree-no-dots .jstree-closed > .jstree-ocl { - background-position: -4px -4px; -} -.jstree-default .jstree-disabled { - background: transparent; -} -.jstree-default .jstree-disabled.jstree-hovered { - background: transparent; -} -.jstree-default .jstree-disabled.jstree-clicked { - background: #efefef; -} -.jstree-default .jstree-checkbox { - background-position: -164px -4px; -} -.jstree-default .jstree-checkbox:hover { - background-position: -164px -36px; -} -.jstree-default.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox, -.jstree-default .jstree-checked > .jstree-checkbox { - background-position: -228px -4px; -} -.jstree-default.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover, -.jstree-default .jstree-checked > .jstree-checkbox:hover { - background-position: -228px -36px; -} -.jstree-default .jstree-anchor > .jstree-undetermined { - background-position: -196px -4px; -} -.jstree-default .jstree-anchor > .jstree-undetermined:hover { - background-position: -196px -36px; -} -.jstree-default .jstree-checkbox-disabled { - opacity: 0.8; - filter: url("data:image/svg+xml;utf8,#jstree-grayscale"); - /* Firefox 10+ */ - filter: gray; - /* IE6-9 */ - -webkit-filter: grayscale(100%); - /* Chrome 19+ & Safari 6+ */ -} -.jstree-default > .jstree-striped { - background-size: auto 48px; -} -.jstree-default.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg=="); - background-position: 100% 1px; - background-repeat: repeat-y; -} -.jstree-default.jstree-rtl .jstree-last { - background: transparent; -} -.jstree-default.jstree-rtl .jstree-open > .jstree-ocl { - background-position: -132px -36px; -} -.jstree-default.jstree-rtl .jstree-closed > .jstree-ocl { - background-position: -100px -36px; -} -.jstree-default.jstree-rtl .jstree-leaf > .jstree-ocl { - background-position: -68px -36px; -} -.jstree-default.jstree-rtl > .jstree-no-dots .jstree-node, -.jstree-default.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl { - background: transparent; -} -.jstree-default.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl { - background-position: -36px -36px; -} -.jstree-default.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl { - background-position: -4px -36px; -} -.jstree-default .jstree-themeicon-custom { - background-color: transparent; - background-image: none; - background-position: 0 0; -} -.jstree-default > .jstree-container-ul .jstree-loading > .jstree-ocl { - background: url("throbber.gif") center center no-repeat; -} -.jstree-default .jstree-file { - background: url("32px.png") -100px -68px no-repeat; -} -.jstree-default .jstree-folder { - background: url("32px.png") -260px -4px no-repeat; -} -.jstree-default > .jstree-container-ul > .jstree-node { - margin-left: 0; - margin-right: 0; -} -#jstree-dnd.jstree-default { - line-height: 24px; - padding: 0 4px; -} -#jstree-dnd.jstree-default .jstree-ok, -#jstree-dnd.jstree-default .jstree-er { - background-image: url("32px.png"); - background-repeat: no-repeat; - background-color: transparent; -} -#jstree-dnd.jstree-default i { - background: transparent; - width: 24px; - height: 24px; - line-height: 24px; -} -#jstree-dnd.jstree-default .jstree-ok { - background-position: -4px -68px; -} -#jstree-dnd.jstree-default .jstree-er { - background-position: -36px -68px; -} -.jstree-default .jstree-ellipsis { - overflow: hidden; -} -.jstree-default .jstree-ellipsis .jstree-anchor { - width: calc(100% - 29px); - text-overflow: ellipsis; - overflow: hidden; -} -.jstree-default .jstree-ellipsis.jstree-no-icons .jstree-anchor { - width: calc(100% - 5px); -} -.jstree-default.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg=="); -} -.jstree-default.jstree-rtl .jstree-last { - background: transparent; -} -.jstree-default-small .jstree-node { - min-height: 18px; - line-height: 18px; - margin-left: 18px; - min-width: 18px; -} -.jstree-default-small .jstree-anchor { - line-height: 18px; - height: 18px; -} -.jstree-default-small .jstree-icon { - width: 18px; - height: 18px; - line-height: 18px; -} -.jstree-default-small .jstree-icon:empty { - width: 18px; - height: 18px; - line-height: 18px; -} -.jstree-default-small.jstree-rtl .jstree-node { - margin-right: 18px; -} -.jstree-default-small .jstree-wholerow { - height: 18px; -} -.jstree-default-small .jstree-node, -.jstree-default-small .jstree-icon { - background-image: url("32px.png"); -} -.jstree-default-small .jstree-node { - background-position: -295px -7px; - background-repeat: repeat-y; -} -.jstree-default-small .jstree-last { - background: transparent; -} -.jstree-default-small .jstree-open > .jstree-ocl { - background-position: -135px -7px; -} -.jstree-default-small .jstree-closed > .jstree-ocl { - background-position: -103px -7px; -} -.jstree-default-small .jstree-leaf > .jstree-ocl { - background-position: -71px -7px; -} -.jstree-default-small .jstree-themeicon { - background-position: -263px -7px; -} -.jstree-default-small > .jstree-no-dots .jstree-node, -.jstree-default-small > .jstree-no-dots .jstree-leaf > .jstree-ocl { - background: transparent; -} -.jstree-default-small > .jstree-no-dots .jstree-open > .jstree-ocl { - background-position: -39px -7px; -} -.jstree-default-small > .jstree-no-dots .jstree-closed > .jstree-ocl { - background-position: -7px -7px; -} -.jstree-default-small .jstree-disabled { - background: transparent; -} -.jstree-default-small .jstree-disabled.jstree-hovered { - background: transparent; -} -.jstree-default-small .jstree-disabled.jstree-clicked { - background: #efefef; -} -.jstree-default-small .jstree-checkbox { - background-position: -167px -7px; -} -.jstree-default-small .jstree-checkbox:hover { - background-position: -167px -39px; -} -.jstree-default-small.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox, -.jstree-default-small .jstree-checked > .jstree-checkbox { - background-position: -231px -7px; -} -.jstree-default-small.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover, -.jstree-default-small .jstree-checked > .jstree-checkbox:hover { - background-position: -231px -39px; -} -.jstree-default-small .jstree-anchor > .jstree-undetermined { - background-position: -199px -7px; -} -.jstree-default-small .jstree-anchor > .jstree-undetermined:hover { - background-position: -199px -39px; -} -.jstree-default-small .jstree-checkbox-disabled { - opacity: 0.8; - filter: url("data:image/svg+xml;utf8,#jstree-grayscale"); - /* Firefox 10+ */ - filter: gray; - /* IE6-9 */ - -webkit-filter: grayscale(100%); - /* Chrome 19+ & Safari 6+ */ -} -.jstree-default-small > .jstree-striped { - background-size: auto 36px; -} -.jstree-default-small.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg=="); - background-position: 100% 1px; - background-repeat: repeat-y; -} -.jstree-default-small.jstree-rtl .jstree-last { - background: transparent; -} -.jstree-default-small.jstree-rtl .jstree-open > .jstree-ocl { - background-position: -135px -39px; -} -.jstree-default-small.jstree-rtl .jstree-closed > .jstree-ocl { - background-position: -103px -39px; -} -.jstree-default-small.jstree-rtl .jstree-leaf > .jstree-ocl { - background-position: -71px -39px; -} -.jstree-default-small.jstree-rtl > .jstree-no-dots .jstree-node, -.jstree-default-small.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl { - background: transparent; -} -.jstree-default-small.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl { - background-position: -39px -39px; -} -.jstree-default-small.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl { - background-position: -7px -39px; -} -.jstree-default-small .jstree-themeicon-custom { - background-color: transparent; - background-image: none; - background-position: 0 0; -} -.jstree-default-small > .jstree-container-ul .jstree-loading > .jstree-ocl { - background: url("throbber.gif") center center no-repeat; -} -.jstree-default-small .jstree-file { - background: url("32px.png") -103px -71px no-repeat; -} -.jstree-default-small .jstree-folder { - background: url("32px.png") -263px -7px no-repeat; -} -.jstree-default-small > .jstree-container-ul > .jstree-node { - margin-left: 0; - margin-right: 0; -} -#jstree-dnd.jstree-default-small { - line-height: 18px; - padding: 0 4px; -} -#jstree-dnd.jstree-default-small .jstree-ok, -#jstree-dnd.jstree-default-small .jstree-er { - background-image: url("32px.png"); - background-repeat: no-repeat; - background-color: transparent; -} -#jstree-dnd.jstree-default-small i { - background: transparent; - width: 18px; - height: 18px; - line-height: 18px; -} -#jstree-dnd.jstree-default-small .jstree-ok { - background-position: -7px -71px; -} -#jstree-dnd.jstree-default-small .jstree-er { - background-position: -39px -71px; -} -.jstree-default-small .jstree-ellipsis { - overflow: hidden; -} -.jstree-default-small .jstree-ellipsis .jstree-anchor { - width: calc(100% - 23px); - text-overflow: ellipsis; - overflow: hidden; -} -.jstree-default-small .jstree-ellipsis.jstree-no-icons .jstree-anchor { - width: calc(100% - 5px); -} -.jstree-default-small.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAACAQMAAABv1h6PAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMHBgAAiABBI4gz9AAAAABJRU5ErkJggg=="); -} -.jstree-default-small.jstree-rtl .jstree-last { - background: transparent; -} -.jstree-default-large .jstree-node { - min-height: 32px; - line-height: 32px; - margin-left: 32px; - min-width: 32px; -} -.jstree-default-large .jstree-anchor { - line-height: 32px; - height: 32px; -} -.jstree-default-large .jstree-icon { - width: 32px; - height: 32px; - line-height: 32px; -} -.jstree-default-large .jstree-icon:empty { - width: 32px; - height: 32px; - line-height: 32px; -} -.jstree-default-large.jstree-rtl .jstree-node { - margin-right: 32px; -} -.jstree-default-large .jstree-wholerow { - height: 32px; -} -.jstree-default-large .jstree-node, -.jstree-default-large .jstree-icon { - background-image: url("32px.png"); -} -.jstree-default-large .jstree-node { - background-position: -288px 0px; - background-repeat: repeat-y; -} -.jstree-default-large .jstree-last { - background: transparent; -} -.jstree-default-large .jstree-open > .jstree-ocl { - background-position: -128px 0px; -} -.jstree-default-large .jstree-closed > .jstree-ocl { - background-position: -96px 0px; -} -.jstree-default-large .jstree-leaf > .jstree-ocl { - background-position: -64px 0px; -} -.jstree-default-large .jstree-themeicon { - background-position: -256px 0px; -} -.jstree-default-large > .jstree-no-dots .jstree-node, -.jstree-default-large > .jstree-no-dots .jstree-leaf > .jstree-ocl { - background: transparent; -} -.jstree-default-large > .jstree-no-dots .jstree-open > .jstree-ocl { - background-position: -32px 0px; -} -.jstree-default-large > .jstree-no-dots .jstree-closed > .jstree-ocl { - background-position: 0px 0px; -} -.jstree-default-large .jstree-disabled { - background: transparent; -} -.jstree-default-large .jstree-disabled.jstree-hovered { - background: transparent; -} -.jstree-default-large .jstree-disabled.jstree-clicked { - background: #efefef; -} -.jstree-default-large .jstree-checkbox { - background-position: -160px 0px; -} -.jstree-default-large .jstree-checkbox:hover { - background-position: -160px -32px; -} -.jstree-default-large.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox, -.jstree-default-large .jstree-checked > .jstree-checkbox { - background-position: -224px 0px; -} -.jstree-default-large.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover, -.jstree-default-large .jstree-checked > .jstree-checkbox:hover { - background-position: -224px -32px; -} -.jstree-default-large .jstree-anchor > .jstree-undetermined { - background-position: -192px 0px; -} -.jstree-default-large .jstree-anchor > .jstree-undetermined:hover { - background-position: -192px -32px; -} -.jstree-default-large .jstree-checkbox-disabled { - opacity: 0.8; - filter: url("data:image/svg+xml;utf8,#jstree-grayscale"); - /* Firefox 10+ */ - filter: gray; - /* IE6-9 */ - -webkit-filter: grayscale(100%); - /* Chrome 19+ & Safari 6+ */ -} -.jstree-default-large > .jstree-striped { - background-size: auto 64px; -} -.jstree-default-large.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg=="); - background-position: 100% 1px; - background-repeat: repeat-y; -} -.jstree-default-large.jstree-rtl .jstree-last { - background: transparent; -} -.jstree-default-large.jstree-rtl .jstree-open > .jstree-ocl { - background-position: -128px -32px; -} -.jstree-default-large.jstree-rtl .jstree-closed > .jstree-ocl { - background-position: -96px -32px; -} -.jstree-default-large.jstree-rtl .jstree-leaf > .jstree-ocl { - background-position: -64px -32px; -} -.jstree-default-large.jstree-rtl > .jstree-no-dots .jstree-node, -.jstree-default-large.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl { - background: transparent; -} -.jstree-default-large.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl { - background-position: -32px -32px; -} -.jstree-default-large.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl { - background-position: 0px -32px; -} -.jstree-default-large .jstree-themeicon-custom { - background-color: transparent; - background-image: none; - background-position: 0 0; -} -.jstree-default-large > .jstree-container-ul .jstree-loading > .jstree-ocl { - background: url("throbber.gif") center center no-repeat; -} -.jstree-default-large .jstree-file { - background: url("32px.png") -96px -64px no-repeat; -} -.jstree-default-large .jstree-folder { - background: url("32px.png") -256px 0px no-repeat; -} -.jstree-default-large > .jstree-container-ul > .jstree-node { - margin-left: 0; - margin-right: 0; -} -#jstree-dnd.jstree-default-large { - line-height: 32px; - padding: 0 4px; -} -#jstree-dnd.jstree-default-large .jstree-ok, -#jstree-dnd.jstree-default-large .jstree-er { - background-image: url("32px.png"); - background-repeat: no-repeat; - background-color: transparent; -} -#jstree-dnd.jstree-default-large i { - background: transparent; - width: 32px; - height: 32px; - line-height: 32px; -} -#jstree-dnd.jstree-default-large .jstree-ok { - background-position: 0px -64px; -} -#jstree-dnd.jstree-default-large .jstree-er { - background-position: -32px -64px; -} -.jstree-default-large .jstree-ellipsis { - overflow: hidden; -} -.jstree-default-large .jstree-ellipsis .jstree-anchor { - width: calc(100% - 37px); - text-overflow: ellipsis; - overflow: hidden; -} -.jstree-default-large .jstree-ellipsis.jstree-no-icons .jstree-anchor { - width: calc(100% - 5px); -} -.jstree-default-large.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAACAQMAAAAD0EyKAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjgIIGBgABCgCBvVLXcAAAAABJRU5ErkJggg=="); -} -.jstree-default-large.jstree-rtl .jstree-last { - background: transparent; -} -@media (max-width: 768px) { - #jstree-dnd.jstree-dnd-responsive { - line-height: 40px; - font-weight: bold; - font-size: 1.1em; - text-shadow: 1px 1px white; - } - #jstree-dnd.jstree-dnd-responsive > i { - background: transparent; - width: 40px; - height: 40px; - } - #jstree-dnd.jstree-dnd-responsive > .jstree-ok { - background-image: url("40px.png"); - background-position: 0 -200px; - background-size: 120px 240px; - } - #jstree-dnd.jstree-dnd-responsive > .jstree-er { - background-image: url("40px.png"); - background-position: -40px -200px; - background-size: 120px 240px; - } - #jstree-marker.jstree-dnd-responsive { - border-left-width: 10px; - border-top-width: 10px; - border-bottom-width: 10px; - margin-top: -10px; - } -} -@media (max-width: 768px) { - .jstree-default-responsive { - /* - .jstree-open > .jstree-ocl, - .jstree-closed > .jstree-ocl { border-radius:20px; background-color:white; } - */ - } - .jstree-default-responsive .jstree-icon { - background-image: url("40px.png"); - } - .jstree-default-responsive .jstree-node, - .jstree-default-responsive .jstree-leaf > .jstree-ocl { - background: transparent; - } - .jstree-default-responsive .jstree-node { - min-height: 40px; - line-height: 40px; - margin-left: 40px; - min-width: 40px; - white-space: nowrap; - } - .jstree-default-responsive .jstree-anchor { - line-height: 40px; - height: 40px; - } - .jstree-default-responsive .jstree-icon, - .jstree-default-responsive .jstree-icon:empty { - width: 40px; - height: 40px; - line-height: 40px; - } - .jstree-default-responsive > .jstree-container-ul > .jstree-node { - margin-left: 0; - } - .jstree-default-responsive.jstree-rtl .jstree-node { - margin-left: 0; - margin-right: 40px; - background: transparent; - } - .jstree-default-responsive.jstree-rtl .jstree-container-ul > .jstree-node { - margin-right: 0; - } - .jstree-default-responsive .jstree-ocl, - .jstree-default-responsive .jstree-themeicon, - .jstree-default-responsive .jstree-checkbox { - background-size: 120px 240px; - } - .jstree-default-responsive .jstree-leaf > .jstree-ocl, - .jstree-default-responsive.jstree-rtl .jstree-leaf > .jstree-ocl { - background: transparent; - } - .jstree-default-responsive .jstree-open > .jstree-ocl { - background-position: 0 0px !important; - } - .jstree-default-responsive .jstree-closed > .jstree-ocl { - background-position: 0 -40px !important; - } - .jstree-default-responsive.jstree-rtl .jstree-closed > .jstree-ocl { - background-position: -40px 0px !important; - } - .jstree-default-responsive .jstree-themeicon { - background-position: -40px -40px; - } - .jstree-default-responsive .jstree-checkbox, - .jstree-default-responsive .jstree-checkbox:hover { - background-position: -40px -80px; - } - .jstree-default-responsive.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox, - .jstree-default-responsive.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover, - .jstree-default-responsive .jstree-checked > .jstree-checkbox, - .jstree-default-responsive .jstree-checked > .jstree-checkbox:hover { - background-position: 0 -80px; - } - .jstree-default-responsive .jstree-anchor > .jstree-undetermined, - .jstree-default-responsive .jstree-anchor > .jstree-undetermined:hover { - background-position: 0 -120px; - } - .jstree-default-responsive .jstree-anchor { - font-weight: bold; - font-size: 1.1em; - text-shadow: 1px 1px white; - } - .jstree-default-responsive > .jstree-striped { - background: transparent; - } - .jstree-default-responsive .jstree-wholerow { - border-top: 1px solid rgba(255, 255, 255, 0.7); - border-bottom: 1px solid rgba(64, 64, 64, 0.2); - background: #ebebeb; - height: 40px; - } - .jstree-default-responsive .jstree-wholerow-hovered { - background: #e7f4f9; - } - .jstree-default-responsive .jstree-wholerow-clicked { - background: #beebff; - } - .jstree-default-responsive .jstree-children .jstree-last > .jstree-wholerow { - box-shadow: inset 0 -6px 3px -5px #666666; - } - .jstree-default-responsive .jstree-children .jstree-open > .jstree-wholerow { - box-shadow: inset 0 6px 3px -5px #666666; - border-top: 0; - } - .jstree-default-responsive .jstree-children .jstree-open + .jstree-open { - box-shadow: none; - } - .jstree-default-responsive .jstree-node, - .jstree-default-responsive .jstree-icon, - .jstree-default-responsive .jstree-node > .jstree-ocl, - .jstree-default-responsive .jstree-themeicon, - .jstree-default-responsive .jstree-checkbox { - background-image: url("40px.png"); - background-size: 120px 240px; - } - .jstree-default-responsive .jstree-node { - background-position: -80px 0; - background-repeat: repeat-y; - } - .jstree-default-responsive .jstree-last { - background: transparent; - } - .jstree-default-responsive .jstree-leaf > .jstree-ocl { - background-position: -40px -120px; - } - .jstree-default-responsive .jstree-last > .jstree-ocl { - background-position: -40px -160px; - } - .jstree-default-responsive .jstree-themeicon-custom { - background-color: transparent; - background-image: none; - background-position: 0 0; - } - .jstree-default-responsive .jstree-file { - background: url("40px.png") 0 -160px no-repeat; - background-size: 120px 240px; - } - .jstree-default-responsive .jstree-folder { - background: url("40px.png") -40px -40px no-repeat; - background-size: 120px 240px; - } - .jstree-default-responsive > .jstree-container-ul > .jstree-node { - margin-left: 0; - margin-right: 0; - } -} diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/themes/default/style.less b/mayan/apps/cabinets/static/cabinets/packages/jstree/src/themes/default/style.less deleted file mode 100644 index 53f786fa7e..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/themes/default/style.less +++ /dev/null @@ -1,22 +0,0 @@ -/* jsTree default theme */ -@theme-name: default; -@hovered-bg-color: #e7f4f9; -@hovered-shadow-color: #cccccc; -@disabled-color: #666666; -@disabled-bg-color: #efefef; -@clicked-bg-color: #beebff; -@clicked-shadow-color: #999999; -@clicked-gradient-color-1: #beebff; -@clicked-gradient-color-2: #a8e4ff; -@search-result-color: #8b0000; -@mobile-wholerow-bg-color: #ebebeb; -@mobile-wholerow-shadow: #666666; -@mobile-wholerow-bordert: rgba(255,255,255,0.7); -@mobile-wholerow-borderb: rgba(64,64,64,0.2); -@responsive: true; -@image-path: ""; -@base-height: 40px; - -@import "../mixins.less"; -@import "../base.less"; -@import "../main.less"; \ No newline at end of file diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/themes/default/throbber.gif b/mayan/apps/cabinets/static/cabinets/packages/jstree/src/themes/default/throbber.gif deleted file mode 100644 index 5b33f7e54f..0000000000 Binary files a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/themes/default/throbber.gif and /dev/null differ diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/themes/main.less b/mayan/apps/cabinets/static/cabinets/packages/jstree/src/themes/main.less deleted file mode 100644 index 8616cc039f..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/themes/main.less +++ /dev/null @@ -1,77 +0,0 @@ -.jstree-@{theme-name} { - .jstree-node, - .jstree-icon { background-repeat:no-repeat; background-color:transparent; } - .jstree-anchor, - .jstree-animated, - .jstree-wholerow { transition:background-color 0.15s, box-shadow 0.15s; } - .jstree-hovered { background:@hovered-bg-color; border-radius:2px; box-shadow:inset 0 0 1px @hovered-shadow-color; } - .jstree-context { background:@hovered-bg-color; border-radius:2px; box-shadow:inset 0 0 1px @hovered-shadow-color; } - .jstree-clicked { background:@clicked-bg-color; border-radius:2px; box-shadow:inset 0 0 1px @clicked-shadow-color; } - .jstree-no-icons .jstree-anchor > .jstree-themeicon { display:none; } - .jstree-disabled { - background:transparent; color:@disabled-color; - &.jstree-hovered { background:transparent; box-shadow:none; } - &.jstree-clicked { background:@disabled-bg-color; } - > .jstree-icon { opacity:0.8; filter: url("data:image/svg+xml;utf8,#jstree-grayscale"); /* Firefox 10+ */ filter: gray; /* IE6-9 */ -webkit-filter: grayscale(100%); /* Chrome 19+ & Safari 6+ */ } - } - // search - .jstree-search { font-style:italic; color:@search-result-color; font-weight:bold; } - // checkboxes - .jstree-no-checkboxes .jstree-checkbox { display:none !important; } - &.jstree-checkbox-no-clicked { - .jstree-clicked { - background:transparent; - box-shadow:none; - &.jstree-hovered { background:@hovered-bg-color; } - } - > .jstree-wholerow-ul .jstree-wholerow-clicked { - background:transparent; - &.jstree-wholerow-hovered { background:@hovered-bg-color; } - } - } - // stripes - > .jstree-striped { min-width:100%; display:inline-block; background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAkCAMAAAB/qqA+AAAABlBMVEUAAAAAAAClZ7nPAAAAAnRSTlMNAMM9s3UAAAAXSURBVHjajcEBAQAAAIKg/H/aCQZ70AUBjAATb6YPDgAAAABJRU5ErkJggg==") left top repeat; } - // wholerow - > .jstree-wholerow-ul .jstree-hovered, - > .jstree-wholerow-ul .jstree-clicked { background:transparent; box-shadow:none; border-radius:0; } - .jstree-wholerow { -moz-box-sizing:border-box; -webkit-box-sizing:border-box; box-sizing:border-box; } - .jstree-wholerow-hovered { background:@hovered-bg-color; } - .jstree-wholerow-clicked { .gradient(@clicked-gradient-color-1, @clicked-gradient-color-2); } -} - -// theme variants -.jstree-@{theme-name} { - .jstree-theme(24px, "@{image-path}32px.png", 32px); - &.jstree-rtl .jstree-node { background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg=="); } - &.jstree-rtl .jstree-last { background:transparent; } -} -.jstree-@{theme-name}-small { - .jstree-theme(18px, "@{image-path}32px.png", 32px); - &.jstree-rtl .jstree-node { background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAACAQMAAABv1h6PAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMHBgAAiABBI4gz9AAAAABJRU5ErkJggg=="); } - &.jstree-rtl .jstree-last { background:transparent; } -} -.jstree-@{theme-name}-large { - .jstree-theme(32px, "@{image-path}32px.png", 32px); - &.jstree-rtl .jstree-node { background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAACAQMAAAAD0EyKAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjgIIGBgABCgCBvVLXcAAAAABJRU5ErkJggg=="); } - &.jstree-rtl .jstree-last { background:transparent; } -} - -// mobile theme attempt -@media (max-width: 768px) { - #jstree-dnd.jstree-dnd-responsive when (@responsive = true) { - line-height:@base-height; font-weight:bold; font-size:1.1em; text-shadow:1px 1px white; - > i { background:transparent; width:@base-height; height:@base-height; } - > .jstree-ok { background-image:url("@{image-path}@{base-height}.png"); background-position:0 -(@base-height * 5); background-size:(@base-height * 3) (@base-height * 6); } - > .jstree-er { background-image:url("@{image-path}@{base-height}.png"); background-position:-(@base-height * 1) -(@base-height * 5); background-size:(@base-height * 3) (@base-height * 6); } - } - #jstree-marker.jstree-dnd-responsive when (@responsive = true) { - border-left-width:10px; - border-top-width:10px; - border-bottom-width:10px; - margin-top:-10px; - } -} - -.jstree-@{theme-name}-responsive when (@responsive = true) { - @import "responsive.less"; -} diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/themes/mixins.less b/mayan/apps/cabinets/static/cabinets/packages/jstree/src/themes/mixins.less deleted file mode 100644 index 3018623b26..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/themes/mixins.less +++ /dev/null @@ -1,105 +0,0 @@ -.gradient (@color1; @color2) { - background:@color1; - background: -webkit-linear-gradient(top, @color1 0%,@color2 100%); - background: linear-gradient(to bottom, @color1 0%,@color2 100%); -} - -.jstree-theme (@base-height, @image, @image-height) { - @correction: (@image-height - @base-height) / 2; - - .jstree-node { min-height:@base-height; line-height:@base-height; margin-left:@base-height; min-width:@base-height; } - .jstree-anchor { line-height:@base-height; height:@base-height; } - .jstree-icon { width:@base-height; height:@base-height; line-height:@base-height; } - .jstree-icon:empty { width:@base-height; height:@base-height; line-height:@base-height; } - &.jstree-rtl .jstree-node { margin-right:@base-height; } - .jstree-wholerow { height:@base-height; } - - .jstree-node, - .jstree-icon { background-image:url("@{image}"); } - .jstree-node { background-position:-(@image-height * 9 + @correction) -@correction; background-repeat:repeat-y; } - .jstree-last { background:transparent; } - - .jstree-open > .jstree-ocl { background-position:-(@image-height * 4 + @correction) -@correction; } - .jstree-closed > .jstree-ocl { background-position:-(@image-height * 3 + @correction) -@correction; } - .jstree-leaf > .jstree-ocl { background-position:-(@image-height * 2 + @correction) -@correction; } - - .jstree-themeicon { background-position:-(@image-height * 8 + @correction) -@correction; } - - > .jstree-no-dots { - .jstree-node, - .jstree-leaf > .jstree-ocl { background:transparent; } - .jstree-open > .jstree-ocl { background-position:-(@image-height * 1 + @correction) -@correction; } - .jstree-closed > .jstree-ocl { background-position:-@correction -@correction; } - } - - .jstree-disabled { - background:transparent; - &.jstree-hovered { - background:transparent; - } - &.jstree-clicked { - background:#efefef; - } - } - - .jstree-checkbox { - background-position:-(@image-height * 5 + @correction) -@correction; - &:hover { background-position:-(@image-height * 5 + @correction) -(@image-height * 1 + @correction); } - } - - &.jstree-checkbox-selection .jstree-clicked, .jstree-checked { - > .jstree-checkbox { - background-position:-(@image-height * 7 + @correction) -@correction; - &:hover { background-position:-(@image-height * 7 + @correction) -(@image-height * 1 + @correction); } - } - } - .jstree-anchor { - > .jstree-undetermined { - background-position:-(@image-height * 6 + @correction) -@correction; - &:hover { - background-position:-(@image-height * 6 + @correction) -(@image-height * 1 + @correction); - } - } - } - .jstree-checkbox-disabled { opacity:0.8; filter: url("data:image/svg+xml;utf8,#jstree-grayscale"); /* Firefox 10+ */ filter: gray; /* IE6-9 */ -webkit-filter: grayscale(100%); /* Chrome 19+ & Safari 6+ */ } - - > .jstree-striped { background-size:auto (@base-height * 2); } - - &.jstree-rtl { - .jstree-node { background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg=="); background-position: 100% 1px; background-repeat:repeat-y; } - .jstree-last { background:transparent; } - .jstree-open > .jstree-ocl { background-position:-(@image-height * 4 + @correction) -(@image-height * 1 + @correction); } - .jstree-closed > .jstree-ocl { background-position:-(@image-height * 3 + @correction) -(@image-height * 1 + @correction); } - .jstree-leaf > .jstree-ocl { background-position:-(@image-height * 2 + @correction) -(@image-height * 1 + @correction); } - > .jstree-no-dots { - .jstree-node, - .jstree-leaf > .jstree-ocl { background:transparent; } - .jstree-open > .jstree-ocl { background-position:-(@image-height * 1 + @correction) -(@image-height * 1 + @correction); } - .jstree-closed > .jstree-ocl { background-position:-@correction -(@image-height * 1 + @correction); } - } - } - .jstree-themeicon-custom { background-color:transparent; background-image:none; background-position:0 0; } - - > .jstree-container-ul .jstree-loading > .jstree-ocl { background:url("@{image-path}throbber.gif") center center no-repeat; } - - .jstree-file { background:url("@{image}") -(@image-height * 3 + @correction) -(@image-height * 2 + @correction) no-repeat; } - .jstree-folder { background:url("@{image}") -(@image-height * 8 + @correction) -(@correction) no-repeat; } - - > .jstree-container-ul > .jstree-node { margin-left:0; margin-right:0; } - - // drag'n'drop - #jstree-dnd& { - line-height:@base-height; padding:0 4px; - .jstree-ok, - .jstree-er { background-image:url("@{image-path}32px.png"); background-repeat:no-repeat; background-color:transparent; } - i { background:transparent; width:@base-height; height:@base-height; line-height:@base-height; } - .jstree-ok { background-position: -(@correction) -(@image-height * 2 + @correction); } - .jstree-er { background-position: -(@image-height * 1 + @correction) -(@image-height * 2 + @correction); } - } - - // ellipsis - .jstree-ellipsis { overflow: hidden; } - // base height + PADDINGS! - .jstree-ellipsis .jstree-anchor { width: calc(100% ~"-" (@base-height + 5px)); text-overflow: ellipsis; overflow: hidden; } - .jstree-ellipsis.jstree-no-icons .jstree-anchor { width: calc(100% ~"-" 5px); } -} diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/themes/responsive.less b/mayan/apps/cabinets/static/cabinets/packages/jstree/src/themes/responsive.less deleted file mode 100644 index 364e007518..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/themes/responsive.less +++ /dev/null @@ -1,67 +0,0 @@ -@media (max-width: 768px) { - // background image - .jstree-icon { background-image:url("@{image-path}@{base-height}.png"); } - - .jstree-node, - .jstree-leaf > .jstree-ocl { background:transparent; } - - .jstree-node { min-height:@base-height; line-height:@base-height; margin-left:@base-height; min-width:@base-height; white-space:nowrap; } - .jstree-anchor { line-height:@base-height; height:@base-height; } - .jstree-icon, .jstree-icon:empty { width:@base-height; height:@base-height; line-height:@base-height; } - - > .jstree-container-ul > .jstree-node { margin-left:0; } - &.jstree-rtl .jstree-node { margin-left:0; margin-right:@base-height; background:transparent; } - &.jstree-rtl .jstree-container-ul > .jstree-node { margin-right:0; } - - .jstree-ocl, - .jstree-themeicon, - .jstree-checkbox { background-size:(@base-height * 3) (@base-height * 6); } - .jstree-leaf > .jstree-ocl, - &.jstree-rtl .jstree-leaf > .jstree-ocl { background:transparent; } - .jstree-open > .jstree-ocl { background-position:0 0px !important; } - .jstree-closed > .jstree-ocl { background-position:0 -(@base-height * 1) !important; } - &.jstree-rtl .jstree-closed > .jstree-ocl { background-position:-(@base-height * 1) 0px !important; } - - .jstree-themeicon { background-position:-(@base-height * 1) -(@base-height * 1); } - - .jstree-checkbox, .jstree-checkbox:hover { background-position:-(@base-height * 1) -(@base-height * 2); } - &.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox, - &.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover, - .jstree-checked > .jstree-checkbox, - .jstree-checked > .jstree-checkbox:hover { background-position:0 -(@base-height * 2); } - .jstree-anchor > .jstree-undetermined, .jstree-anchor > .jstree-undetermined:hover { background-position:0 -(@base-height * 3); } - - .jstree-anchor { font-weight:bold; font-size:1.1em; text-shadow:1px 1px white; } - - > .jstree-striped { background:transparent; } - .jstree-wholerow { border-top:1px solid @mobile-wholerow-bordert; border-bottom:1px solid @mobile-wholerow-borderb; background:@mobile-wholerow-bg-color; height:@base-height; } - .jstree-wholerow-hovered { background:@hovered-bg-color; } - .jstree-wholerow-clicked { background:@clicked-bg-color; } - - // thanks to PHOTONUI - .jstree-children .jstree-last > .jstree-wholerow { box-shadow: inset 0 -6px 3px -5px @mobile-wholerow-shadow; } - .jstree-children .jstree-open > .jstree-wholerow { box-shadow: inset 0 6px 3px -5px @mobile-wholerow-shadow; border-top:0; } - .jstree-children .jstree-open + .jstree-open { box-shadow:none; } - - // experiment - .jstree-node, - .jstree-icon, - .jstree-node > .jstree-ocl, - .jstree-themeicon, - .jstree-checkbox { background-image:url("@{image-path}@{base-height}.png"); background-size:(@base-height * 3) (@base-height * 6); } - - .jstree-node { background-position:-(@base-height * 2) 0; background-repeat:repeat-y; } - .jstree-last { background:transparent; } - .jstree-leaf > .jstree-ocl { background-position:-(@base-height * 1) -(@base-height * 3); } - .jstree-last > .jstree-ocl { background-position:-(@base-height * 1) -(@base-height * 4); } - /* - .jstree-open > .jstree-ocl, - .jstree-closed > .jstree-ocl { border-radius:20px; background-color:white; } - */ - - .jstree-themeicon-custom { background-color:transparent; background-image:none; background-position:0 0; } - .jstree-file { background:url("@{image-path}@{base-height}.png") 0 -(@base-height * 4) no-repeat; background-size:(@base-height * 3) (@base-height * 6); } - .jstree-folder { background:url("@{image-path}@{base-height}.png") -(@base-height * 1) -(@base-height * 1) no-repeat; background-size:(@base-height * 3) (@base-height * 6); } - - > .jstree-container-ul > .jstree-node { margin-left:0; margin-right:0; } -} \ No newline at end of file diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/vakata-jstree.js b/mayan/apps/cabinets/static/cabinets/packages/jstree/src/vakata-jstree.js deleted file mode 100644 index 9838885177..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/src/vakata-jstree.js +++ /dev/null @@ -1,38 +0,0 @@ -(function (factory) { - "use strict"; - if (typeof define === 'function' && define.amd) { - define('jstree.checkbox', ['jquery','jstree'], factory); - } - else if(typeof exports === 'object') { - factory(require('jquery'), require('jstree')); - } - else { - factory(jQuery); - } -}(function ($, undefined) { - "use strict"; - if(document.registerElement && Object && Object.create) { - var proto = Object.create(HTMLElement.prototype); - proto.createdCallback = function () { - var c = { core : {}, plugins : [] }, i; - for(i in $.jstree.plugins) { - if($.jstree.plugins.hasOwnProperty(i) && this.attributes[i]) { - c.plugins.push(i); - if(this.getAttribute(i) && JSON.parse(this.getAttribute(i))) { - c[i] = JSON.parse(this.getAttribute(i)); - } - } - } - for(i in $.jstree.defaults.core) { - if($.jstree.defaults.core.hasOwnProperty(i) && this.attributes[i]) { - c.core[i] = JSON.parse(this.getAttribute(i)) || this.getAttribute(i); - } - } - $(this).jstree(c); - }; - // proto.attributeChangedCallback = function (name, previous, value) { }; - try { - document.registerElement("vakata-jstree", { prototype: proto }); - } catch(ignore) { } - } -})); diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/test/unit/index.html b/mayan/apps/cabinets/static/cabinets/packages/jstree/test/unit/index.html deleted file mode 100644 index 0d64e77d67..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/test/unit/index.html +++ /dev/null @@ -1,16 +0,0 @@ - - - - - Basic Test Suite - - - - - -
          -
          this had better work.
          - - - - \ No newline at end of file diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/test/unit/libs/qunit.css b/mayan/apps/cabinets/static/cabinets/packages/jstree/test/unit/libs/qunit.css deleted file mode 100644 index 2a6a02bf50..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/test/unit/libs/qunit.css +++ /dev/null @@ -1,244 +0,0 @@ -/** - * QUnit v1.12.0 - A JavaScript Unit Testing Framework - * - * http://qunitjs.com - * - * Copyright 2012 jQuery Foundation and other contributors - * Released under the MIT license. - * http://jquery.org/license - */ - -/** Font Family and Sizes */ - -#qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult { - font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif; -} - -#qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; } -#qunit-tests { font-size: smaller; } - - -/** Resets */ - -#qunit-tests, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult, #qunit-modulefilter { - margin: 0; - padding: 0; -} - - -/** Header */ - -#qunit-header { - padding: 0.5em 0 0.5em 1em; - - color: #8699a4; - background-color: #0d3349; - - font-size: 1.5em; - line-height: 1em; - font-weight: normal; - - border-radius: 5px 5px 0 0; - -moz-border-radius: 5px 5px 0 0; - -webkit-border-top-right-radius: 5px; - -webkit-border-top-left-radius: 5px; -} - -#qunit-header a { - text-decoration: none; - color: #c2ccd1; -} - -#qunit-header a:hover, -#qunit-header a:focus { - color: #fff; -} - -#qunit-testrunner-toolbar label { - display: inline-block; - padding: 0 .5em 0 .1em; -} - -#qunit-banner { - height: 5px; -} - -#qunit-testrunner-toolbar { - padding: 0.5em 0 0.5em 2em; - color: #5E740B; - background-color: #eee; - overflow: hidden; -} - -#qunit-userAgent { - padding: 0.5em 0 0.5em 2.5em; - background-color: #2b81af; - color: #fff; - text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px; -} - -#qunit-modulefilter-container { - float: right; -} - -/** Tests: Pass/Fail */ - -#qunit-tests { - list-style-position: inside; -} - -#qunit-tests li { - padding: 0.4em 0.5em 0.4em 2.5em; - border-bottom: 1px solid #fff; - list-style-position: inside; -} - -#qunit-tests.hidepass li.pass, #qunit-tests.hidepass li.running { - display: none; -} - -#qunit-tests li strong { - cursor: pointer; -} - -#qunit-tests li a { - padding: 0.5em; - color: #c2ccd1; - text-decoration: none; -} -#qunit-tests li a:hover, -#qunit-tests li a:focus { - color: #000; -} - -#qunit-tests li .runtime { - float: right; - font-size: smaller; -} - -.qunit-assert-list { - margin-top: 0.5em; - padding: 0.5em; - - background-color: #fff; - - border-radius: 5px; - -moz-border-radius: 5px; - -webkit-border-radius: 5px; -} - -.qunit-collapsed { - display: none; -} - -#qunit-tests table { - border-collapse: collapse; - margin-top: .2em; -} - -#qunit-tests th { - text-align: right; - vertical-align: top; - padding: 0 .5em 0 0; -} - -#qunit-tests td { - vertical-align: top; -} - -#qunit-tests pre { - margin: 0; - white-space: pre-wrap; - word-wrap: break-word; -} - -#qunit-tests del { - background-color: #e0f2be; - color: #374e0c; - text-decoration: none; -} - -#qunit-tests ins { - background-color: #ffcaca; - color: #500; - text-decoration: none; -} - -/*** Test Counts */ - -#qunit-tests b.counts { color: black; } -#qunit-tests b.passed { color: #5E740B; } -#qunit-tests b.failed { color: #710909; } - -#qunit-tests li li { - padding: 5px; - background-color: #fff; - border-bottom: none; - list-style-position: inside; -} - -/*** Passing Styles */ - -#qunit-tests li li.pass { - color: #3c510c; - background-color: #fff; - border-left: 10px solid #C6E746; -} - -#qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; } -#qunit-tests .pass .test-name { color: #366097; } - -#qunit-tests .pass .test-actual, -#qunit-tests .pass .test-expected { color: #999999; } - -#qunit-banner.qunit-pass { background-color: #C6E746; } - -/*** Failing Styles */ - -#qunit-tests li li.fail { - color: #710909; - background-color: #fff; - border-left: 10px solid #EE5757; - white-space: pre; -} - -#qunit-tests > li:last-child { - border-radius: 0 0 5px 5px; - -moz-border-radius: 0 0 5px 5px; - -webkit-border-bottom-right-radius: 5px; - -webkit-border-bottom-left-radius: 5px; -} - -#qunit-tests .fail { color: #000000; background-color: #EE5757; } -#qunit-tests .fail .test-name, -#qunit-tests .fail .module-name { color: #000000; } - -#qunit-tests .fail .test-actual { color: #EE5757; } -#qunit-tests .fail .test-expected { color: green; } - -#qunit-banner.qunit-fail { background-color: #EE5757; } - - -/** Result */ - -#qunit-testresult { - padding: 0.5em 0.5em 0.5em 2.5em; - - color: #2b81af; - background-color: #D2E0E6; - - border-bottom: 1px solid white; -} -#qunit-testresult .module-name { - font-weight: bold; -} - -/** Fixture */ - -#qunit-fixture { - position: absolute; - top: -10000px; - left: -10000px; - width: 1000px; - height: 1000px; -} \ No newline at end of file diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/test/unit/libs/qunit.js b/mayan/apps/cabinets/static/cabinets/packages/jstree/test/unit/libs/qunit.js deleted file mode 100644 index 7567d5fc51..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/test/unit/libs/qunit.js +++ /dev/null @@ -1,2212 +0,0 @@ -/** - * QUnit v1.12.0 - A JavaScript Unit Testing Framework - * - * http://qunitjs.com - * - * Copyright 2013 jQuery Foundation and other contributors - * Released under the MIT license. - * https://jquery.org/license/ - */ - -(function( window ) { - -var QUnit, - assert, - config, - onErrorFnPrev, - testId = 0, - fileName = (sourceFromStacktrace( 0 ) || "" ).replace(/(:\d+)+\)?/, "").replace(/.+\//, ""), - toString = Object.prototype.toString, - hasOwn = Object.prototype.hasOwnProperty, - // Keep a local reference to Date (GH-283) - Date = window.Date, - setTimeout = window.setTimeout, - defined = { - setTimeout: typeof window.setTimeout !== "undefined", - sessionStorage: (function() { - var x = "qunit-test-string"; - try { - sessionStorage.setItem( x, x ); - sessionStorage.removeItem( x ); - return true; - } catch( e ) { - return false; - } - }()) - }, - /** - * Provides a normalized error string, correcting an issue - * with IE 7 (and prior) where Error.prototype.toString is - * not properly implemented - * - * Based on http://es5.github.com/#x15.11.4.4 - * - * @param {String|Error} error - * @return {String} error message - */ - errorString = function( error ) { - var name, message, - errorString = error.toString(); - if ( errorString.substring( 0, 7 ) === "[object" ) { - name = error.name ? error.name.toString() : "Error"; - message = error.message ? error.message.toString() : ""; - if ( name && message ) { - return name + ": " + message; - } else if ( name ) { - return name; - } else if ( message ) { - return message; - } else { - return "Error"; - } - } else { - return errorString; - } - }, - /** - * Makes a clone of an object using only Array or Object as base, - * and copies over the own enumerable properties. - * - * @param {Object} obj - * @return {Object} New object with only the own properties (recursively). - */ - objectValues = function( obj ) { - // Grunt 0.3.x uses an older version of jshint that still has jshint/jshint#392. - /*jshint newcap: false */ - var key, val, - vals = QUnit.is( "array", obj ) ? [] : {}; - for ( key in obj ) { - if ( hasOwn.call( obj, key ) ) { - val = obj[key]; - vals[key] = val === Object(val) ? objectValues(val) : val; - } - } - return vals; - }; - -function Test( settings ) { - extend( this, settings ); - this.assertions = []; - this.testNumber = ++Test.count; -} - -Test.count = 0; - -Test.prototype = { - init: function() { - var a, b, li, - tests = id( "qunit-tests" ); - - if ( tests ) { - b = document.createElement( "strong" ); - b.innerHTML = this.nameHtml; - - // `a` initialized at top of scope - a = document.createElement( "a" ); - a.innerHTML = "Rerun"; - a.href = QUnit.url({ testNumber: this.testNumber }); - - li = document.createElement( "li" ); - li.appendChild( b ); - li.appendChild( a ); - li.className = "running"; - li.id = this.id = "qunit-test-output" + testId++; - - tests.appendChild( li ); - } - }, - setup: function() { - if ( - // Emit moduleStart when we're switching from one module to another - this.module !== config.previousModule || - // They could be equal (both undefined) but if the previousModule property doesn't - // yet exist it means this is the first test in a suite that isn't wrapped in a - // module, in which case we'll just emit a moduleStart event for 'undefined'. - // Without this, reporters can get testStart before moduleStart which is a problem. - !hasOwn.call( config, "previousModule" ) - ) { - if ( hasOwn.call( config, "previousModule" ) ) { - runLoggingCallbacks( "moduleDone", QUnit, { - name: config.previousModule, - failed: config.moduleStats.bad, - passed: config.moduleStats.all - config.moduleStats.bad, - total: config.moduleStats.all - }); - } - config.previousModule = this.module; - config.moduleStats = { all: 0, bad: 0 }; - runLoggingCallbacks( "moduleStart", QUnit, { - name: this.module - }); - } - - config.current = this; - - this.testEnvironment = extend({ - setup: function() {}, - teardown: function() {} - }, this.moduleTestEnvironment ); - - this.started = +new Date(); - runLoggingCallbacks( "testStart", QUnit, { - name: this.testName, - module: this.module - }); - - /*jshint camelcase:false */ - - - /** - * Expose the current test environment. - * - * @deprecated since 1.12.0: Use QUnit.config.current.testEnvironment instead. - */ - QUnit.current_testEnvironment = this.testEnvironment; - - /*jshint camelcase:true */ - - if ( !config.pollution ) { - saveGlobal(); - } - if ( config.notrycatch ) { - this.testEnvironment.setup.call( this.testEnvironment, QUnit.assert ); - return; - } - try { - this.testEnvironment.setup.call( this.testEnvironment, QUnit.assert ); - } catch( e ) { - QUnit.pushFailure( "Setup failed on " + this.testName + ": " + ( e.message || e ), extractStacktrace( e, 1 ) ); - } - }, - run: function() { - config.current = this; - - var running = id( "qunit-testresult" ); - - if ( running ) { - running.innerHTML = "Running:
          " + this.nameHtml; - } - - if ( this.async ) { - QUnit.stop(); - } - - this.callbackStarted = +new Date(); - - if ( config.notrycatch ) { - this.callback.call( this.testEnvironment, QUnit.assert ); - this.callbackRuntime = +new Date() - this.callbackStarted; - return; - } - - try { - this.callback.call( this.testEnvironment, QUnit.assert ); - this.callbackRuntime = +new Date() - this.callbackStarted; - } catch( e ) { - this.callbackRuntime = +new Date() - this.callbackStarted; - - QUnit.pushFailure( "Died on test #" + (this.assertions.length + 1) + " " + this.stack + ": " + ( e.message || e ), extractStacktrace( e, 0 ) ); - // else next test will carry the responsibility - saveGlobal(); - - // Restart the tests if they're blocking - if ( config.blocking ) { - QUnit.start(); - } - } - }, - teardown: function() { - config.current = this; - if ( config.notrycatch ) { - if ( typeof this.callbackRuntime === "undefined" ) { - this.callbackRuntime = +new Date() - this.callbackStarted; - } - this.testEnvironment.teardown.call( this.testEnvironment, QUnit.assert ); - return; - } else { - try { - this.testEnvironment.teardown.call( this.testEnvironment, QUnit.assert ); - } catch( e ) { - QUnit.pushFailure( "Teardown failed on " + this.testName + ": " + ( e.message || e ), extractStacktrace( e, 1 ) ); - } - } - checkPollution(); - }, - finish: function() { - config.current = this; - if ( config.requireExpects && this.expected === null ) { - QUnit.pushFailure( "Expected number of assertions to be defined, but expect() was not called.", this.stack ); - } else if ( this.expected !== null && this.expected !== this.assertions.length ) { - QUnit.pushFailure( "Expected " + this.expected + " assertions, but " + this.assertions.length + " were run", this.stack ); - } else if ( this.expected === null && !this.assertions.length ) { - QUnit.pushFailure( "Expected at least one assertion, but none were run - call expect(0) to accept zero assertions.", this.stack ); - } - - var i, assertion, a, b, time, li, ol, - test = this, - good = 0, - bad = 0, - tests = id( "qunit-tests" ); - - this.runtime = +new Date() - this.started; - config.stats.all += this.assertions.length; - config.moduleStats.all += this.assertions.length; - - if ( tests ) { - ol = document.createElement( "ol" ); - ol.className = "qunit-assert-list"; - - for ( i = 0; i < this.assertions.length; i++ ) { - assertion = this.assertions[i]; - - li = document.createElement( "li" ); - li.className = assertion.result ? "pass" : "fail"; - li.innerHTML = assertion.message || ( assertion.result ? "okay" : "failed" ); - ol.appendChild( li ); - - if ( assertion.result ) { - good++; - } else { - bad++; - config.stats.bad++; - config.moduleStats.bad++; - } - } - - // store result when possible - if ( QUnit.config.reorder && defined.sessionStorage ) { - if ( bad ) { - sessionStorage.setItem( "qunit-test-" + this.module + "-" + this.testName, bad ); - } else { - sessionStorage.removeItem( "qunit-test-" + this.module + "-" + this.testName ); - } - } - - if ( bad === 0 ) { - addClass( ol, "qunit-collapsed" ); - } - - // `b` initialized at top of scope - b = document.createElement( "strong" ); - b.innerHTML = this.nameHtml + " (" + bad + ", " + good + ", " + this.assertions.length + ")"; - - addEvent(b, "click", function() { - var next = b.parentNode.lastChild, - collapsed = hasClass( next, "qunit-collapsed" ); - ( collapsed ? removeClass : addClass )( next, "qunit-collapsed" ); - }); - - addEvent(b, "dblclick", function( e ) { - var target = e && e.target ? e.target : window.event.srcElement; - if ( target.nodeName.toLowerCase() === "span" || target.nodeName.toLowerCase() === "b" ) { - target = target.parentNode; - } - if ( window.location && target.nodeName.toLowerCase() === "strong" ) { - window.location = QUnit.url({ testNumber: test.testNumber }); - } - }); - - // `time` initialized at top of scope - time = document.createElement( "span" ); - time.className = "runtime"; - time.innerHTML = this.runtime + " ms"; - - // `li` initialized at top of scope - li = id( this.id ); - li.className = bad ? "fail" : "pass"; - li.removeChild( li.firstChild ); - a = li.firstChild; - li.appendChild( b ); - li.appendChild( a ); - li.appendChild( time ); - li.appendChild( ol ); - - } else { - for ( i = 0; i < this.assertions.length; i++ ) { - if ( !this.assertions[i].result ) { - bad++; - config.stats.bad++; - config.moduleStats.bad++; - } - } - } - - runLoggingCallbacks( "testDone", QUnit, { - name: this.testName, - module: this.module, - failed: bad, - passed: this.assertions.length - bad, - total: this.assertions.length, - duration: this.runtime - }); - - QUnit.reset(); - - config.current = undefined; - }, - - queue: function() { - var bad, - test = this; - - synchronize(function() { - test.init(); - }); - function run() { - // each of these can by async - synchronize(function() { - test.setup(); - }); - synchronize(function() { - test.run(); - }); - synchronize(function() { - test.teardown(); - }); - synchronize(function() { - test.finish(); - }); - } - - // `bad` initialized at top of scope - // defer when previous test run passed, if storage is available - bad = QUnit.config.reorder && defined.sessionStorage && - +sessionStorage.getItem( "qunit-test-" + this.module + "-" + this.testName ); - - if ( bad ) { - run(); - } else { - synchronize( run, true ); - } - } -}; - -// Root QUnit object. -// `QUnit` initialized at top of scope -QUnit = { - - // call on start of module test to prepend name to all tests - module: function( name, testEnvironment ) { - config.currentModule = name; - config.currentModuleTestEnvironment = testEnvironment; - config.modules[name] = true; - }, - - asyncTest: function( testName, expected, callback ) { - if ( arguments.length === 2 ) { - callback = expected; - expected = null; - } - - QUnit.test( testName, expected, callback, true ); - }, - - test: function( testName, expected, callback, async ) { - var test, - nameHtml = "" + escapeText( testName ) + ""; - - if ( arguments.length === 2 ) { - callback = expected; - expected = null; - } - - if ( config.currentModule ) { - nameHtml = "" + escapeText( config.currentModule ) + ": " + nameHtml; - } - - test = new Test({ - nameHtml: nameHtml, - testName: testName, - expected: expected, - async: async, - callback: callback, - module: config.currentModule, - moduleTestEnvironment: config.currentModuleTestEnvironment, - stack: sourceFromStacktrace( 2 ) - }); - - if ( !validTest( test ) ) { - return; - } - - test.queue(); - }, - - // Specify the number of expected assertions to guarantee that failed test (no assertions are run at all) don't slip through. - expect: function( asserts ) { - if (arguments.length === 1) { - config.current.expected = asserts; - } else { - return config.current.expected; - } - }, - - start: function( count ) { - // QUnit hasn't been initialized yet. - // Note: RequireJS (et al) may delay onLoad - if ( config.semaphore === undefined ) { - QUnit.begin(function() { - // This is triggered at the top of QUnit.load, push start() to the event loop, to allow QUnit.load to finish first - setTimeout(function() { - QUnit.start( count ); - }); - }); - return; - } - - config.semaphore -= count || 1; - // don't start until equal number of stop-calls - if ( config.semaphore > 0 ) { - return; - } - // ignore if start is called more often then stop - if ( config.semaphore < 0 ) { - config.semaphore = 0; - QUnit.pushFailure( "Called start() while already started (QUnit.config.semaphore was 0 already)", null, sourceFromStacktrace(2) ); - return; - } - // A slight delay, to avoid any current callbacks - if ( defined.setTimeout ) { - setTimeout(function() { - if ( config.semaphore > 0 ) { - return; - } - if ( config.timeout ) { - clearTimeout( config.timeout ); - } - - config.blocking = false; - process( true ); - }, 13); - } else { - config.blocking = false; - process( true ); - } - }, - - stop: function( count ) { - config.semaphore += count || 1; - config.blocking = true; - - if ( config.testTimeout && defined.setTimeout ) { - clearTimeout( config.timeout ); - config.timeout = setTimeout(function() { - QUnit.ok( false, "Test timed out" ); - config.semaphore = 1; - QUnit.start(); - }, config.testTimeout ); - } - } -}; - -// `assert` initialized at top of scope -// Assert helpers -// All of these must either call QUnit.push() or manually do: -// - runLoggingCallbacks( "log", .. ); -// - config.current.assertions.push({ .. }); -// We attach it to the QUnit object *after* we expose the public API, -// otherwise `assert` will become a global variable in browsers (#341). -assert = { - /** - * Asserts rough true-ish result. - * @name ok - * @function - * @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" ); - */ - ok: function( result, msg ) { - if ( !config.current ) { - throw new Error( "ok() assertion outside test context, was " + sourceFromStacktrace(2) ); - } - result = !!result; - msg = msg || (result ? "okay" : "failed" ); - - var source, - details = { - module: config.current.module, - name: config.current.testName, - result: result, - message: msg - }; - - msg = "" + escapeText( msg ) + ""; - - if ( !result ) { - source = sourceFromStacktrace( 2 ); - if ( source ) { - details.source = source; - msg += "
          Source:
          " + escapeText( source ) + "
          "; - } - } - runLoggingCallbacks( "log", QUnit, details ); - config.current.assertions.push({ - result: result, - message: msg - }); - }, - - /** - * Assert that the first two arguments are equal, with an optional message. - * Prints out both actual and expected values. - * @name equal - * @function - * @example equal( format( "Received {0} bytes.", 2), "Received 2 bytes.", "format() replaces {0} with next argument" ); - */ - equal: function( actual, expected, message ) { - /*jshint eqeqeq:false */ - QUnit.push( expected == actual, actual, expected, message ); - }, - - /** - * @name notEqual - * @function - */ - notEqual: function( actual, expected, message ) { - /*jshint eqeqeq:false */ - QUnit.push( expected != actual, actual, expected, message ); - }, - - /** - * @name propEqual - * @function - */ - propEqual: function( actual, expected, message ) { - actual = objectValues(actual); - expected = objectValues(expected); - QUnit.push( QUnit.equiv(actual, expected), actual, expected, message ); - }, - - /** - * @name notPropEqual - * @function - */ - notPropEqual: function( actual, expected, message ) { - actual = objectValues(actual); - expected = objectValues(expected); - QUnit.push( !QUnit.equiv(actual, expected), actual, expected, message ); - }, - - /** - * @name deepEqual - * @function - */ - deepEqual: function( actual, expected, message ) { - QUnit.push( QUnit.equiv(actual, expected), actual, expected, message ); - }, - - /** - * @name notDeepEqual - * @function - */ - notDeepEqual: function( actual, expected, message ) { - QUnit.push( !QUnit.equiv(actual, expected), actual, expected, message ); - }, - - /** - * @name strictEqual - * @function - */ - strictEqual: function( actual, expected, message ) { - QUnit.push( expected === actual, actual, expected, message ); - }, - - /** - * @name notStrictEqual - * @function - */ - notStrictEqual: function( actual, expected, message ) { - QUnit.push( expected !== actual, actual, expected, message ); - }, - - "throws": function( block, expected, message ) { - var actual, - expectedOutput = expected, - ok = false; - - // 'expected' is optional - if ( typeof expected === "string" ) { - message = expected; - expected = null; - } - - config.current.ignoreGlobalErrors = true; - try { - block.call( config.current.testEnvironment ); - } catch (e) { - actual = e; - } - config.current.ignoreGlobalErrors = false; - - if ( actual ) { - // we don't want to validate thrown error - if ( !expected ) { - ok = true; - expectedOutput = null; - // expected is a regexp - } else if ( QUnit.objectType( expected ) === "regexp" ) { - ok = expected.test( errorString( actual ) ); - // expected is a constructor - } else if ( actual instanceof expected ) { - ok = true; - // expected is a validation function which returns true is validation passed - } else if ( expected.call( {}, actual ) === true ) { - expectedOutput = null; - ok = true; - } - - QUnit.push( ok, actual, expectedOutput, message ); - } else { - QUnit.pushFailure( message, null, "No exception was thrown." ); - } - } -}; - -/** - * @deprecated since 1.8.0 - * Kept assertion helpers in root for backwards compatibility. - */ -extend( QUnit, assert ); - -/** - * @deprecated since 1.9.0 - * Kept root "raises()" for backwards compatibility. - * (Note that we don't introduce assert.raises). - */ -QUnit.raises = assert[ "throws" ]; - -/** - * @deprecated since 1.0.0, replaced with error pushes since 1.3.0 - * Kept to avoid TypeErrors for undefined methods. - */ -QUnit.equals = function() { - QUnit.push( false, false, false, "QUnit.equals has been deprecated since 2009 (e88049a0), use QUnit.equal instead" ); -}; -QUnit.same = function() { - QUnit.push( false, false, false, "QUnit.same has been deprecated since 2009 (e88049a0), use QUnit.deepEqual instead" ); -}; - -// We want access to the constructor's prototype -(function() { - function F() {} - F.prototype = QUnit; - QUnit = new F(); - // Make F QUnit's constructor so that we can add to the prototype later - QUnit.constructor = F; -}()); - -/** - * Config object: Maintain internal state - * Later exposed as QUnit.config - * `config` initialized at top of scope - */ -config = { - // The queue of tests to run - queue: [], - - // block until document ready - blocking: true, - - // when enabled, show only failing tests - // gets persisted through sessionStorage and can be changed in UI via checkbox - hidepassed: false, - - // by default, run previously failed tests first - // very useful in combination with "Hide passed tests" checked - reorder: true, - - // by default, modify document.title when suite is done - altertitle: true, - - // when enabled, all tests must call expect() - requireExpects: false, - - // add checkboxes that are persisted in the query-string - // when enabled, the id is set to `true` as a `QUnit.config` property - urlConfig: [ - { - id: "noglobals", - label: "Check for Globals", - tooltip: "Enabling this will test if any test introduces new properties on the `window` object. Stored as query-strings." - }, - { - id: "notrycatch", - label: "No try-catch", - tooltip: "Enabling this will run tests outside of a try-catch block. Makes debugging exceptions in IE reasonable. Stored as query-strings." - } - ], - - // Set of all modules. - modules: {}, - - // logging callback queues - begin: [], - done: [], - log: [], - testStart: [], - testDone: [], - moduleStart: [], - moduleDone: [] -}; - -// Export global variables, unless an 'exports' object exists, -// in that case we assume we're in CommonJS (dealt with on the bottom of the script) -if ( typeof exports === "undefined" ) { - extend( window, QUnit.constructor.prototype ); - - // Expose QUnit object - window.QUnit = QUnit; -} - -// Initialize more QUnit.config and QUnit.urlParams -(function() { - var i, - location = window.location || { search: "", protocol: "file:" }, - params = location.search.slice( 1 ).split( "&" ), - length = params.length, - urlParams = {}, - current; - - if ( params[ 0 ] ) { - for ( i = 0; i < length; i++ ) { - current = params[ i ].split( "=" ); - current[ 0 ] = decodeURIComponent( current[ 0 ] ); - // allow just a key to turn on a flag, e.g., test.html?noglobals - current[ 1 ] = current[ 1 ] ? decodeURIComponent( current[ 1 ] ) : true; - urlParams[ current[ 0 ] ] = current[ 1 ]; - } - } - - QUnit.urlParams = urlParams; - - // String search anywhere in moduleName+testName - config.filter = urlParams.filter; - - // Exact match of the module name - config.module = urlParams.module; - - config.testNumber = parseInt( urlParams.testNumber, 10 ) || null; - - // Figure out if we're running the tests from a server or not - QUnit.isLocal = location.protocol === "file:"; -}()); - -// Extend QUnit object, -// these after set here because they should not be exposed as global functions -extend( QUnit, { - assert: assert, - - config: config, - - // Initialize the configuration options - init: function() { - extend( config, { - stats: { all: 0, bad: 0 }, - moduleStats: { all: 0, bad: 0 }, - started: +new Date(), - updateRate: 1000, - blocking: false, - autostart: true, - autorun: false, - filter: "", - queue: [], - semaphore: 1 - }); - - var tests, banner, result, - qunit = id( "qunit" ); - - if ( qunit ) { - qunit.innerHTML = - "

          " + escapeText( document.title ) + "

          " + - "

          " + - "
          " + - "

          " + - "
            "; - } - - tests = id( "qunit-tests" ); - banner = id( "qunit-banner" ); - result = id( "qunit-testresult" ); - - if ( tests ) { - tests.innerHTML = ""; - } - - if ( banner ) { - banner.className = ""; - } - - if ( result ) { - result.parentNode.removeChild( result ); - } - - if ( tests ) { - result = document.createElement( "p" ); - result.id = "qunit-testresult"; - result.className = "result"; - tests.parentNode.insertBefore( result, tests ); - result.innerHTML = "Running...
             "; - } - }, - - // Resets the test setup. Useful for tests that modify the DOM. - /* - DEPRECATED: Use multiple tests instead of resetting inside a test. - Use testStart or testDone for custom cleanup. - This method will throw an error in 2.0, and will be removed in 2.1 - */ - reset: function() { - var fixture = id( "qunit-fixture" ); - if ( fixture ) { - fixture.innerHTML = config.fixture; - } - }, - - // Trigger an event on an element. - // @example triggerEvent( document.body, "click" ); - triggerEvent: function( elem, type, event ) { - if ( document.createEvent ) { - event = document.createEvent( "MouseEvents" ); - event.initMouseEvent(type, true, true, elem.ownerDocument.defaultView, - 0, 0, 0, 0, 0, false, false, false, false, 0, null); - - elem.dispatchEvent( event ); - } else if ( elem.fireEvent ) { - elem.fireEvent( "on" + type ); - } - }, - - // Safe object type checking - is: function( type, obj ) { - return QUnit.objectType( obj ) === type; - }, - - objectType: function( obj ) { - if ( typeof obj === "undefined" ) { - return "undefined"; - // consider: typeof null === object - } - if ( obj === null ) { - return "null"; - } - - var match = toString.call( obj ).match(/^\[object\s(.*)\]$/), - type = match && match[1] || ""; - - switch ( type ) { - case "Number": - if ( isNaN(obj) ) { - return "nan"; - } - return "number"; - case "String": - case "Boolean": - case "Array": - case "Date": - case "RegExp": - case "Function": - return type.toLowerCase(); - } - if ( typeof obj === "object" ) { - return "object"; - } - return undefined; - }, - - push: function( result, actual, expected, message ) { - if ( !config.current ) { - throw new Error( "assertion outside test context, was " + sourceFromStacktrace() ); - } - - var output, source, - details = { - module: config.current.module, - name: config.current.testName, - result: result, - message: message, - actual: actual, - expected: expected - }; - - message = escapeText( message ) || ( result ? "okay" : "failed" ); - message = "" + message + ""; - output = message; - - if ( !result ) { - expected = escapeText( QUnit.jsDump.parse(expected) ); - actual = escapeText( QUnit.jsDump.parse(actual) ); - output += ""; - - if ( actual !== expected ) { - output += ""; - output += ""; - } - - source = sourceFromStacktrace(); - - if ( source ) { - details.source = source; - output += ""; - } - - output += "
            Expected:
            " + expected + "
            Result:
            " + actual + "
            Diff:
            " + QUnit.diff( expected, actual ) + "
            Source:
            " + escapeText( source ) + "
            "; - } - - runLoggingCallbacks( "log", QUnit, details ); - - config.current.assertions.push({ - result: !!result, - message: output - }); - }, - - pushFailure: function( message, source, actual ) { - if ( !config.current ) { - throw new Error( "pushFailure() assertion outside test context, was " + sourceFromStacktrace(2) ); - } - - var output, - details = { - module: config.current.module, - name: config.current.testName, - result: false, - message: message - }; - - message = escapeText( message ) || "error"; - message = "" + message + ""; - output = message; - - output += ""; - - if ( actual ) { - output += ""; - } - - if ( source ) { - details.source = source; - output += ""; - } - - output += "
            Result:
            " + escapeText( actual ) + "
            Source:
            " + escapeText( source ) + "
            "; - - runLoggingCallbacks( "log", QUnit, details ); - - config.current.assertions.push({ - result: false, - message: output - }); - }, - - url: function( params ) { - params = extend( extend( {}, QUnit.urlParams ), params ); - var key, - querystring = "?"; - - for ( key in params ) { - if ( hasOwn.call( params, key ) ) { - querystring += encodeURIComponent( key ) + "=" + - encodeURIComponent( params[ key ] ) + "&"; - } - } - return window.location.protocol + "//" + window.location.host + - window.location.pathname + querystring.slice( 0, -1 ); - }, - - extend: extend, - id: id, - addEvent: addEvent, - addClass: addClass, - hasClass: hasClass, - removeClass: removeClass - // load, equiv, jsDump, diff: Attached later -}); - -/** - * @deprecated: Created for backwards compatibility with test runner that set the hook function - * into QUnit.{hook}, instead of invoking it and passing the hook function. - * QUnit.constructor is set to the empty F() above so that we can add to it's prototype here. - * Doing this allows us to tell if the following methods have been overwritten on the actual - * QUnit object. - */ -extend( QUnit.constructor.prototype, { - - // Logging callbacks; all receive a single argument with the listed properties - // run test/logs.html for any related changes - begin: registerLoggingCallback( "begin" ), - - // done: { failed, passed, total, runtime } - done: registerLoggingCallback( "done" ), - - // log: { result, actual, expected, message } - log: registerLoggingCallback( "log" ), - - // testStart: { name } - testStart: registerLoggingCallback( "testStart" ), - - // testDone: { name, failed, passed, total, duration } - testDone: registerLoggingCallback( "testDone" ), - - // moduleStart: { name } - moduleStart: registerLoggingCallback( "moduleStart" ), - - // moduleDone: { name, failed, passed, total } - moduleDone: registerLoggingCallback( "moduleDone" ) -}); - -if ( typeof document === "undefined" || document.readyState === "complete" ) { - config.autorun = true; -} - -QUnit.load = function() { - runLoggingCallbacks( "begin", QUnit, {} ); - - // Initialize the config, saving the execution queue - var banner, filter, i, label, len, main, ol, toolbar, userAgent, val, - urlConfigCheckboxesContainer, urlConfigCheckboxes, moduleFilter, - numModules = 0, - moduleNames = [], - moduleFilterHtml = "", - urlConfigHtml = "", - oldconfig = extend( {}, config ); - - QUnit.init(); - extend(config, oldconfig); - - config.blocking = false; - - len = config.urlConfig.length; - - for ( i = 0; i < len; i++ ) { - val = config.urlConfig[i]; - if ( typeof val === "string" ) { - val = { - id: val, - label: val, - tooltip: "[no tooltip available]" - }; - } - config[ val.id ] = QUnit.urlParams[ val.id ]; - urlConfigHtml += ""; - } - for ( i in config.modules ) { - if ( config.modules.hasOwnProperty( i ) ) { - moduleNames.push(i); - } - } - numModules = moduleNames.length; - moduleNames.sort( function( a, b ) { - return a.localeCompare( b ); - }); - moduleFilterHtml += ""; - - // `userAgent` initialized at top of scope - userAgent = id( "qunit-userAgent" ); - if ( userAgent ) { - userAgent.innerHTML = navigator.userAgent; - } - - // `banner` initialized at top of scope - banner = id( "qunit-header" ); - if ( banner ) { - banner.innerHTML = "" + banner.innerHTML + " "; - } - - // `toolbar` initialized at top of scope - toolbar = id( "qunit-testrunner-toolbar" ); - if ( toolbar ) { - // `filter` initialized at top of scope - filter = document.createElement( "input" ); - filter.type = "checkbox"; - filter.id = "qunit-filter-pass"; - - addEvent( filter, "click", function() { - var tmp, - ol = document.getElementById( "qunit-tests" ); - - if ( filter.checked ) { - ol.className = ol.className + " hidepass"; - } else { - tmp = " " + ol.className.replace( /[\n\t\r]/g, " " ) + " "; - ol.className = tmp.replace( / hidepass /, " " ); - } - if ( defined.sessionStorage ) { - if (filter.checked) { - sessionStorage.setItem( "qunit-filter-passed-tests", "true" ); - } else { - sessionStorage.removeItem( "qunit-filter-passed-tests" ); - } - } - }); - - if ( config.hidepassed || defined.sessionStorage && sessionStorage.getItem( "qunit-filter-passed-tests" ) ) { - filter.checked = true; - // `ol` initialized at top of scope - ol = document.getElementById( "qunit-tests" ); - ol.className = ol.className + " hidepass"; - } - toolbar.appendChild( filter ); - - // `label` initialized at top of scope - label = document.createElement( "label" ); - label.setAttribute( "for", "qunit-filter-pass" ); - label.setAttribute( "title", "Only show tests and assertions that fail. Stored in sessionStorage." ); - label.innerHTML = "Hide passed tests"; - toolbar.appendChild( label ); - - urlConfigCheckboxesContainer = document.createElement("span"); - urlConfigCheckboxesContainer.innerHTML = urlConfigHtml; - urlConfigCheckboxes = urlConfigCheckboxesContainer.getElementsByTagName("input"); - // For oldIE support: - // * Add handlers to the individual elements instead of the container - // * Use "click" instead of "change" - // * Fallback from event.target to event.srcElement - addEvents( urlConfigCheckboxes, "click", function( event ) { - var params = {}, - target = event.target || event.srcElement; - params[ target.name ] = target.checked ? true : undefined; - window.location = QUnit.url( params ); - }); - toolbar.appendChild( urlConfigCheckboxesContainer ); - - if (numModules > 1) { - moduleFilter = document.createElement( "span" ); - moduleFilter.setAttribute( "id", "qunit-modulefilter-container" ); - moduleFilter.innerHTML = moduleFilterHtml; - addEvent( moduleFilter.lastChild, "change", function() { - var selectBox = moduleFilter.getElementsByTagName("select")[0], - selectedModule = decodeURIComponent(selectBox.options[selectBox.selectedIndex].value); - - window.location = QUnit.url({ - module: ( selectedModule === "" ) ? undefined : selectedModule, - // Remove any existing filters - filter: undefined, - testNumber: undefined - }); - }); - toolbar.appendChild(moduleFilter); - } - } - - // `main` initialized at top of scope - main = id( "qunit-fixture" ); - if ( main ) { - config.fixture = main.innerHTML; - } - - if ( config.autostart ) { - QUnit.start(); - } -}; - -addEvent( window, "load", QUnit.load ); - -// `onErrorFnPrev` initialized at top of scope -// Preserve other handlers -onErrorFnPrev = window.onerror; - -// Cover uncaught exceptions -// Returning true will suppress the default browser handler, -// returning false will let it run. -window.onerror = function ( error, filePath, linerNr ) { - var ret = false; - if ( onErrorFnPrev ) { - ret = onErrorFnPrev( error, filePath, linerNr ); - } - - // Treat return value as window.onerror itself does, - // Only do our handling if not suppressed. - if ( ret !== true ) { - if ( QUnit.config.current ) { - if ( QUnit.config.current.ignoreGlobalErrors ) { - return true; - } - QUnit.pushFailure( error, filePath + ":" + linerNr ); - } else { - QUnit.test( "global failure", extend( function() { - QUnit.pushFailure( error, filePath + ":" + linerNr ); - }, { validTest: validTest } ) ); - } - return false; - } - - return ret; -}; - -function done() { - config.autorun = true; - - // Log the last module results - if ( config.currentModule ) { - runLoggingCallbacks( "moduleDone", QUnit, { - name: config.currentModule, - failed: config.moduleStats.bad, - passed: config.moduleStats.all - config.moduleStats.bad, - total: config.moduleStats.all - }); - } - delete config.previousModule; - - var i, key, - banner = id( "qunit-banner" ), - tests = id( "qunit-tests" ), - runtime = +new Date() - config.started, - passed = config.stats.all - config.stats.bad, - html = [ - "Tests completed in ", - runtime, - " milliseconds.
            ", - "", - passed, - " assertions of ", - config.stats.all, - " passed, ", - config.stats.bad, - " failed." - ].join( "" ); - - if ( banner ) { - banner.className = ( config.stats.bad ? "qunit-fail" : "qunit-pass" ); - } - - if ( tests ) { - id( "qunit-testresult" ).innerHTML = html; - } - - if ( config.altertitle && typeof document !== "undefined" && document.title ) { - // show ✖ for good, ✔ for bad suite result in title - // use escape sequences in case file gets loaded with non-utf-8-charset - document.title = [ - ( config.stats.bad ? "\u2716" : "\u2714" ), - document.title.replace( /^[\u2714\u2716] /i, "" ) - ].join( " " ); - } - - // clear own sessionStorage items if all tests passed - if ( config.reorder && defined.sessionStorage && config.stats.bad === 0 ) { - // `key` & `i` initialized at top of scope - for ( i = 0; i < sessionStorage.length; i++ ) { - key = sessionStorage.key( i++ ); - if ( key.indexOf( "qunit-test-" ) === 0 ) { - sessionStorage.removeItem( key ); - } - } - } - - // scroll back to top to show results - if ( window.scrollTo ) { - window.scrollTo(0, 0); - } - - runLoggingCallbacks( "done", QUnit, { - failed: config.stats.bad, - passed: passed, - total: config.stats.all, - runtime: runtime - }); -} - -/** @return Boolean: true if this test should be ran */ -function validTest( test ) { - var include, - filter = config.filter && config.filter.toLowerCase(), - module = config.module && config.module.toLowerCase(), - fullName = (test.module + ": " + test.testName).toLowerCase(); - - // Internally-generated tests are always valid - if ( test.callback && test.callback.validTest === validTest ) { - delete test.callback.validTest; - return true; - } - - if ( config.testNumber ) { - return test.testNumber === config.testNumber; - } - - if ( module && ( !test.module || test.module.toLowerCase() !== module ) ) { - return false; - } - - if ( !filter ) { - return true; - } - - include = filter.charAt( 0 ) !== "!"; - if ( !include ) { - filter = filter.slice( 1 ); - } - - // If the filter matches, we need to honour include - if ( fullName.indexOf( filter ) !== -1 ) { - return include; - } - - // Otherwise, do the opposite - return !include; -} - -// so far supports only Firefox, Chrome and Opera (buggy), Safari (for real exceptions) -// Later Safari and IE10 are supposed to support error.stack as well -// See also https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error/Stack -function extractStacktrace( e, offset ) { - offset = offset === undefined ? 3 : offset; - - var stack, include, i; - - if ( e.stacktrace ) { - // Opera - return e.stacktrace.split( "\n" )[ offset + 3 ]; - } else if ( e.stack ) { - // Firefox, Chrome - stack = e.stack.split( "\n" ); - if (/^error$/i.test( stack[0] ) ) { - stack.shift(); - } - if ( fileName ) { - include = []; - for ( i = offset; i < stack.length; i++ ) { - if ( stack[ i ].indexOf( fileName ) !== -1 ) { - break; - } - include.push( stack[ i ] ); - } - if ( include.length ) { - return include.join( "\n" ); - } - } - return stack[ offset ]; - } else if ( e.sourceURL ) { - // Safari, PhantomJS - // hopefully one day Safari provides actual stacktraces - // exclude useless self-reference for generated Error objects - if ( /qunit.js$/.test( e.sourceURL ) ) { - return; - } - // for actual exceptions, this is useful - return e.sourceURL + ":" + e.line; - } -} -function sourceFromStacktrace( offset ) { - try { - throw new Error(); - } catch ( e ) { - return extractStacktrace( e, offset ); - } -} - -/** - * Escape text for attribute or text content. - */ -function escapeText( s ) { - if ( !s ) { - return ""; - } - s = s + ""; - // Both single quotes and double quotes (for attributes) - return s.replace( /['"<>&]/g, function( s ) { - switch( s ) { - case "'": - return "'"; - case "\"": - return """; - case "<": - return "<"; - case ">": - return ">"; - case "&": - return "&"; - } - }); -} - -function synchronize( callback, last ) { - config.queue.push( callback ); - - if ( config.autorun && !config.blocking ) { - process( last ); - } -} - -function process( last ) { - function next() { - process( last ); - } - var start = new Date().getTime(); - config.depth = config.depth ? config.depth + 1 : 1; - - while ( config.queue.length && !config.blocking ) { - if ( !defined.setTimeout || config.updateRate <= 0 || ( ( new Date().getTime() - start ) < config.updateRate ) ) { - config.queue.shift()(); - } else { - setTimeout( next, 13 ); - break; - } - } - config.depth--; - if ( last && !config.blocking && !config.queue.length && config.depth === 0 ) { - done(); - } -} - -function saveGlobal() { - config.pollution = []; - - if ( config.noglobals ) { - for ( var key in window ) { - if ( hasOwn.call( window, key ) ) { - // in Opera sometimes DOM element ids show up here, ignore them - if ( /^qunit-test-output/.test( key ) ) { - continue; - } - config.pollution.push( key ); - } - } - } -} - -function checkPollution() { - var newGlobals, - deletedGlobals, - old = config.pollution; - - saveGlobal(); - - newGlobals = diff( config.pollution, old ); - if ( newGlobals.length > 0 ) { - QUnit.pushFailure( "Introduced global variable(s): " + newGlobals.join(", ") ); - } - - deletedGlobals = diff( old, config.pollution ); - if ( deletedGlobals.length > 0 ) { - QUnit.pushFailure( "Deleted global variable(s): " + deletedGlobals.join(", ") ); - } -} - -// returns a new Array with the elements that are in a but not in b -function diff( a, b ) { - var i, j, - result = a.slice(); - - for ( i = 0; i < result.length; i++ ) { - for ( j = 0; j < b.length; j++ ) { - if ( result[i] === b[j] ) { - result.splice( i, 1 ); - i--; - break; - } - } - } - return result; -} - -function extend( a, b ) { - for ( var prop in b ) { - if ( hasOwn.call( b, prop ) ) { - // Avoid "Member not found" error in IE8 caused by messing with window.constructor - if ( !( prop === "constructor" && a === window ) ) { - if ( b[ prop ] === undefined ) { - delete a[ prop ]; - } else { - a[ prop ] = b[ prop ]; - } - } - } - } - - return a; -} - -/** - * @param {HTMLElement} elem - * @param {string} type - * @param {Function} fn - */ -function addEvent( elem, type, fn ) { - // Standards-based browsers - if ( elem.addEventListener ) { - elem.addEventListener( type, fn, false ); - // IE - } else { - elem.attachEvent( "on" + type, fn ); - } -} - -/** - * @param {Array|NodeList} elems - * @param {string} type - * @param {Function} fn - */ -function addEvents( elems, type, fn ) { - var i = elems.length; - while ( i-- ) { - addEvent( elems[i], type, fn ); - } -} - -function hasClass( elem, name ) { - return (" " + elem.className + " ").indexOf(" " + name + " ") > -1; -} - -function addClass( elem, name ) { - if ( !hasClass( elem, name ) ) { - elem.className += (elem.className ? " " : "") + name; - } -} - -function removeClass( elem, name ) { - var set = " " + elem.className + " "; - // Class name may appear multiple times - while ( set.indexOf(" " + name + " ") > -1 ) { - set = set.replace(" " + name + " " , " "); - } - // If possible, trim it for prettiness, but not necessarily - elem.className = typeof set.trim === "function" ? set.trim() : set.replace(/^\s+|\s+$/g, ""); -} - -function id( name ) { - return !!( typeof document !== "undefined" && document && document.getElementById ) && - document.getElementById( name ); -} - -function registerLoggingCallback( key ) { - return function( callback ) { - config[key].push( callback ); - }; -} - -// Supports deprecated method of completely overwriting logging callbacks -function runLoggingCallbacks( key, scope, args ) { - var i, callbacks; - if ( QUnit.hasOwnProperty( key ) ) { - QUnit[ key ].call(scope, args ); - } else { - callbacks = config[ key ]; - for ( i = 0; i < callbacks.length; i++ ) { - callbacks[ i ].call( scope, args ); - } - } -} - -// Test for equality any JavaScript type. -// Author: Philippe Rathé -QUnit.equiv = (function() { - - // Call the o related callback with the given arguments. - function bindCallbacks( o, callbacks, args ) { - var prop = QUnit.objectType( o ); - if ( prop ) { - if ( QUnit.objectType( callbacks[ prop ] ) === "function" ) { - return callbacks[ prop ].apply( callbacks, args ); - } else { - return callbacks[ prop ]; // or undefined - } - } - } - - // the real equiv function - var innerEquiv, - // stack to decide between skip/abort functions - callers = [], - // stack to avoiding loops from circular referencing - parents = [], - parentsB = [], - - getProto = Object.getPrototypeOf || function ( obj ) { - /*jshint camelcase:false */ - return obj.__proto__; - }, - callbacks = (function () { - - // for string, boolean, number and null - function useStrictEquality( b, a ) { - /*jshint eqeqeq:false */ - if ( b instanceof a.constructor || a instanceof b.constructor ) { - // to catch short annotation VS 'new' annotation of a - // declaration - // e.g. var i = 1; - // var j = new Number(1); - return a == b; - } else { - return a === b; - } - } - - return { - "string": useStrictEquality, - "boolean": useStrictEquality, - "number": useStrictEquality, - "null": useStrictEquality, - "undefined": useStrictEquality, - - "nan": function( b ) { - return isNaN( b ); - }, - - "date": function( b, a ) { - return QUnit.objectType( b ) === "date" && a.valueOf() === b.valueOf(); - }, - - "regexp": function( b, a ) { - return QUnit.objectType( b ) === "regexp" && - // the regex itself - a.source === b.source && - // and its modifiers - a.global === b.global && - // (gmi) ... - a.ignoreCase === b.ignoreCase && - a.multiline === b.multiline && - a.sticky === b.sticky; - }, - - // - skip when the property is a method of an instance (OOP) - // - abort otherwise, - // initial === would have catch identical references anyway - "function": function() { - var caller = callers[callers.length - 1]; - return caller !== Object && typeof caller !== "undefined"; - }, - - "array": function( b, a ) { - var i, j, len, loop, aCircular, bCircular; - - // b could be an object literal here - if ( QUnit.objectType( b ) !== "array" ) { - return false; - } - - len = a.length; - if ( len !== b.length ) { - // safe and faster - return false; - } - - // track reference to avoid circular references - parents.push( a ); - parentsB.push( b ); - for ( i = 0; i < len; i++ ) { - loop = false; - for ( j = 0; j < parents.length; j++ ) { - aCircular = parents[j] === a[i]; - bCircular = parentsB[j] === b[i]; - if ( aCircular || bCircular ) { - if ( a[i] === b[i] || aCircular && bCircular ) { - loop = true; - } else { - parents.pop(); - parentsB.pop(); - return false; - } - } - } - if ( !loop && !innerEquiv(a[i], b[i]) ) { - parents.pop(); - parentsB.pop(); - return false; - } - } - parents.pop(); - parentsB.pop(); - return true; - }, - - "object": function( b, a ) { - /*jshint forin:false */ - var i, j, loop, aCircular, bCircular, - // Default to true - eq = true, - aProperties = [], - bProperties = []; - - // comparing constructors is more strict than using - // instanceof - if ( a.constructor !== b.constructor ) { - // Allow objects with no prototype to be equivalent to - // objects with Object as their constructor. - if ( !(( getProto(a) === null && getProto(b) === Object.prototype ) || - ( getProto(b) === null && getProto(a) === Object.prototype ) ) ) { - return false; - } - } - - // stack constructor before traversing properties - callers.push( a.constructor ); - - // track reference to avoid circular references - parents.push( a ); - parentsB.push( b ); - - // be strict: don't ensure hasOwnProperty and go deep - for ( i in a ) { - loop = false; - for ( j = 0; j < parents.length; j++ ) { - aCircular = parents[j] === a[i]; - bCircular = parentsB[j] === b[i]; - if ( aCircular || bCircular ) { - if ( a[i] === b[i] || aCircular && bCircular ) { - loop = true; - } else { - eq = false; - break; - } - } - } - aProperties.push(i); - if ( !loop && !innerEquiv(a[i], b[i]) ) { - eq = false; - break; - } - } - - parents.pop(); - parentsB.pop(); - callers.pop(); // unstack, we are done - - for ( i in b ) { - bProperties.push( i ); // collect b's properties - } - - // Ensures identical properties name - return eq && innerEquiv( aProperties.sort(), bProperties.sort() ); - } - }; - }()); - - innerEquiv = function() { // can take multiple arguments - var args = [].slice.apply( arguments ); - if ( args.length < 2 ) { - return true; // end transition - } - - return (function( a, b ) { - if ( a === b ) { - return true; // catch the most you can - } else if ( a === null || b === null || typeof a === "undefined" || - typeof b === "undefined" || - QUnit.objectType(a) !== QUnit.objectType(b) ) { - return false; // don't lose time with error prone cases - } else { - return bindCallbacks(a, callbacks, [ b, a ]); - } - - // apply transition with (1..n) arguments - }( args[0], args[1] ) && innerEquiv.apply( this, args.splice(1, args.length - 1 )) ); - }; - - return innerEquiv; -}()); - -/** - * jsDump Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com | - * http://flesler.blogspot.com Licensed under BSD - * (http://www.opensource.org/licenses/bsd-license.php) Date: 5/15/2008 - * - * @projectDescription Advanced and extensible data dumping for Javascript. - * @version 1.0.0 - * @author Ariel Flesler - * @link {http://flesler.blogspot.com/2008/05/jsdump-pretty-dump-of-any-javascript.html} - */ -QUnit.jsDump = (function() { - function quote( str ) { - return "\"" + str.toString().replace( /"/g, "\\\"" ) + "\""; - } - function literal( o ) { - return o + ""; - } - function join( pre, arr, post ) { - var s = jsDump.separator(), - base = jsDump.indent(), - inner = jsDump.indent(1); - if ( arr.join ) { - arr = arr.join( "," + s + inner ); - } - if ( !arr ) { - return pre + post; - } - return [ pre, inner + arr, base + post ].join(s); - } - function array( arr, stack ) { - var i = arr.length, ret = new Array(i); - this.up(); - while ( i-- ) { - ret[i] = this.parse( arr[i] , undefined , stack); - } - this.down(); - return join( "[", ret, "]" ); - } - - var reName = /^function (\w+)/, - jsDump = { - // type is used mostly internally, you can fix a (custom)type in advance - parse: function( obj, type, stack ) { - stack = stack || [ ]; - var inStack, res, - parser = this.parsers[ type || this.typeOf(obj) ]; - - type = typeof parser; - inStack = inArray( obj, stack ); - - if ( inStack !== -1 ) { - return "recursion(" + (inStack - stack.length) + ")"; - } - if ( type === "function" ) { - stack.push( obj ); - res = parser.call( this, obj, stack ); - stack.pop(); - return res; - } - return ( type === "string" ) ? parser : this.parsers.error; - }, - typeOf: function( obj ) { - var type; - if ( obj === null ) { - type = "null"; - } else if ( typeof obj === "undefined" ) { - type = "undefined"; - } else if ( QUnit.is( "regexp", obj) ) { - type = "regexp"; - } else if ( QUnit.is( "date", obj) ) { - type = "date"; - } else if ( QUnit.is( "function", obj) ) { - type = "function"; - } else if ( typeof obj.setInterval !== undefined && typeof obj.document !== "undefined" && typeof obj.nodeType === "undefined" ) { - type = "window"; - } else if ( obj.nodeType === 9 ) { - type = "document"; - } else if ( obj.nodeType ) { - type = "node"; - } else if ( - // native arrays - toString.call( obj ) === "[object Array]" || - // NodeList objects - ( typeof obj.length === "number" && typeof obj.item !== "undefined" && ( obj.length ? obj.item(0) === obj[0] : ( obj.item( 0 ) === null && typeof obj[0] === "undefined" ) ) ) - ) { - type = "array"; - } else if ( obj.constructor === Error.prototype.constructor ) { - type = "error"; - } else { - type = typeof obj; - } - return type; - }, - separator: function() { - return this.multiline ? this.HTML ? "
            " : "\n" : this.HTML ? " " : " "; - }, - // extra can be a number, shortcut for increasing-calling-decreasing - indent: function( extra ) { - if ( !this.multiline ) { - return ""; - } - var chr = this.indentChar; - if ( this.HTML ) { - chr = chr.replace( /\t/g, " " ).replace( / /g, " " ); - } - return new Array( this.depth + ( extra || 0 ) ).join(chr); - }, - up: function( a ) { - this.depth += a || 1; - }, - down: function( a ) { - this.depth -= a || 1; - }, - setParser: function( name, parser ) { - this.parsers[name] = parser; - }, - // The next 3 are exposed so you can use them - quote: quote, - literal: literal, - join: join, - // - depth: 1, - // This is the list of parsers, to modify them, use jsDump.setParser - parsers: { - window: "[Window]", - document: "[Document]", - error: function(error) { - return "Error(\"" + error.message + "\")"; - }, - unknown: "[Unknown]", - "null": "null", - "undefined": "undefined", - "function": function( fn ) { - var ret = "function", - // functions never have name in IE - name = "name" in fn ? fn.name : (reName.exec(fn) || [])[1]; - - if ( name ) { - ret += " " + name; - } - ret += "( "; - - ret = [ ret, QUnit.jsDump.parse( fn, "functionArgs" ), "){" ].join( "" ); - return join( ret, QUnit.jsDump.parse(fn,"functionCode" ), "}" ); - }, - array: array, - nodelist: array, - "arguments": array, - object: function( map, stack ) { - /*jshint forin:false */ - var ret = [ ], keys, key, val, i; - QUnit.jsDump.up(); - keys = []; - for ( key in map ) { - keys.push( key ); - } - keys.sort(); - for ( i = 0; i < keys.length; i++ ) { - key = keys[ i ]; - val = map[ key ]; - ret.push( QUnit.jsDump.parse( key, "key" ) + ": " + QUnit.jsDump.parse( val, undefined, stack ) ); - } - QUnit.jsDump.down(); - return join( "{", ret, "}" ); - }, - node: function( node ) { - var len, i, val, - open = QUnit.jsDump.HTML ? "<" : "<", - close = QUnit.jsDump.HTML ? ">" : ">", - tag = node.nodeName.toLowerCase(), - ret = open + tag, - attrs = node.attributes; - - if ( attrs ) { - for ( i = 0, len = attrs.length; i < len; i++ ) { - val = attrs[i].nodeValue; - // IE6 includes all attributes in .attributes, even ones not explicitly set. - // Those have values like undefined, null, 0, false, "" or "inherit". - if ( val && val !== "inherit" ) { - ret += " " + attrs[i].nodeName + "=" + QUnit.jsDump.parse( val, "attribute" ); - } - } - } - ret += close; - - // Show content of TextNode or CDATASection - if ( node.nodeType === 3 || node.nodeType === 4 ) { - ret += node.nodeValue; - } - - return ret + open + "/" + tag + close; - }, - // function calls it internally, it's the arguments part of the function - functionArgs: function( fn ) { - var args, - l = fn.length; - - if ( !l ) { - return ""; - } - - args = new Array(l); - while ( l-- ) { - // 97 is 'a' - args[l] = String.fromCharCode(97+l); - } - return " " + args.join( ", " ) + " "; - }, - // object calls it internally, the key part of an item in a map - key: quote, - // function calls it internally, it's the content of the function - functionCode: "[code]", - // node calls it internally, it's an html attribute value - attribute: quote, - string: quote, - date: quote, - regexp: literal, - number: literal, - "boolean": literal - }, - // if true, entities are escaped ( <, >, \t, space and \n ) - HTML: false, - // indentation unit - indentChar: " ", - // if true, items in a collection, are separated by a \n, else just a space. - multiline: true - }; - - return jsDump; -}()); - -// from jquery.js -function inArray( elem, array ) { - if ( array.indexOf ) { - return array.indexOf( elem ); - } - - for ( var i = 0, length = array.length; i < length; i++ ) { - if ( array[ i ] === elem ) { - return i; - } - } - - return -1; -} - -/* - * Javascript Diff Algorithm - * By John Resig (http://ejohn.org/) - * Modified by Chu Alan "sprite" - * - * Released under the MIT license. - * - * More Info: - * http://ejohn.org/projects/javascript-diff-algorithm/ - * - * Usage: QUnit.diff(expected, actual) - * - * QUnit.diff( "the quick brown fox jumped over", "the quick fox jumps over" ) == "the quick brown fox jumped jumps over" - */ -QUnit.diff = (function() { - /*jshint eqeqeq:false, eqnull:true */ - function diff( o, n ) { - var i, - ns = {}, - os = {}; - - for ( i = 0; i < n.length; i++ ) { - if ( !hasOwn.call( ns, n[i] ) ) { - ns[ n[i] ] = { - rows: [], - o: null - }; - } - ns[ n[i] ].rows.push( i ); - } - - for ( i = 0; i < o.length; i++ ) { - if ( !hasOwn.call( os, o[i] ) ) { - os[ o[i] ] = { - rows: [], - n: null - }; - } - os[ o[i] ].rows.push( i ); - } - - for ( i in ns ) { - if ( hasOwn.call( ns, i ) ) { - if ( ns[i].rows.length === 1 && hasOwn.call( os, i ) && os[i].rows.length === 1 ) { - n[ ns[i].rows[0] ] = { - text: n[ ns[i].rows[0] ], - row: os[i].rows[0] - }; - o[ os[i].rows[0] ] = { - text: o[ os[i].rows[0] ], - row: ns[i].rows[0] - }; - } - } - } - - for ( i = 0; i < n.length - 1; i++ ) { - if ( n[i].text != null && n[ i + 1 ].text == null && n[i].row + 1 < o.length && o[ n[i].row + 1 ].text == null && - n[ i + 1 ] == o[ n[i].row + 1 ] ) { - - n[ i + 1 ] = { - text: n[ i + 1 ], - row: n[i].row + 1 - }; - o[ n[i].row + 1 ] = { - text: o[ n[i].row + 1 ], - row: i + 1 - }; - } - } - - for ( i = n.length - 1; i > 0; i-- ) { - if ( n[i].text != null && n[ i - 1 ].text == null && n[i].row > 0 && o[ n[i].row - 1 ].text == null && - n[ i - 1 ] == o[ n[i].row - 1 ]) { - - n[ i - 1 ] = { - text: n[ i - 1 ], - row: n[i].row - 1 - }; - o[ n[i].row - 1 ] = { - text: o[ n[i].row - 1 ], - row: i - 1 - }; - } - } - - return { - o: o, - n: n - }; - } - - return function( o, n ) { - o = o.replace( /\s+$/, "" ); - n = n.replace( /\s+$/, "" ); - - var i, pre, - str = "", - out = diff( o === "" ? [] : o.split(/\s+/), n === "" ? [] : n.split(/\s+/) ), - oSpace = o.match(/\s+/g), - nSpace = n.match(/\s+/g); - - if ( oSpace == null ) { - oSpace = [ " " ]; - } - else { - oSpace.push( " " ); - } - - if ( nSpace == null ) { - nSpace = [ " " ]; - } - else { - nSpace.push( " " ); - } - - if ( out.n.length === 0 ) { - for ( i = 0; i < out.o.length; i++ ) { - str += "" + out.o[i] + oSpace[i] + ""; - } - } - else { - if ( out.n[0].text == null ) { - for ( n = 0; n < out.o.length && out.o[n].text == null; n++ ) { - str += "" + out.o[n] + oSpace[n] + ""; - } - } - - for ( i = 0; i < out.n.length; i++ ) { - if (out.n[i].text == null) { - str += "" + out.n[i] + nSpace[i] + ""; - } - else { - // `pre` initialized at top of scope - pre = ""; - - for ( n = out.n[i].row + 1; n < out.o.length && out.o[n].text == null; n++ ) { - pre += "" + out.o[n] + oSpace[n] + ""; - } - str += " " + out.n[i].text + nSpace[i] + pre; - } - } - } - - return str; - }; -}()); - -// for CommonJS environments, export everything -if ( typeof exports !== "undefined" ) { - extend( exports, QUnit.constructor.prototype ); -} - -// get at whatever the global object is, like window in browsers -}( (function() {return this;}.call()) )); \ No newline at end of file diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/test/unit/test.js b/mayan/apps/cabinets/static/cabinets/packages/jstree/test/unit/test.js deleted file mode 100644 index 331e9c67d1..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/test/unit/test.js +++ /dev/null @@ -1,11 +0,0 @@ -test('basic test', function() { - expect(1); - ok(true, 'this had better work.'); -}); - - -test('can access the DOM', function() { - expect(1); - var fixture = document.getElementById('qunit-fixture'); - equal(fixture.innerText || fixture.textContent, 'this had better work.', 'should be able to access the DOM.'); -}); \ No newline at end of file diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/test/visual/desktop/index.html b/mayan/apps/cabinets/static/cabinets/packages/jstree/test/visual/desktop/index.html deleted file mode 100644 index 1c3cf0a8aa..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/test/visual/desktop/index.html +++ /dev/null @@ -1,44 +0,0 @@ - - - - - Light theme visual tests - - - - - -
            -
            • asdf
            -
            -
              -
            • Node 01 -
                -
              • Node
              • -
              • Node
              • -
              -
            • -
            • Node 02
            • -
            • Node 03 -
                -
              • Node
              • -
              • Node
              • -
              -
            • -
            • Node 04
            • -
            • Node 05
            • -
            -
            -
            • full
            • asdf
            -
            • full
            • asdf
            - - - - - - \ No newline at end of file diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/test/visual/mobile/index.html b/mayan/apps/cabinets/static/cabinets/packages/jstree/test/visual/mobile/index.html deleted file mode 100644 index 12ba4b85d0..0000000000 --- a/mayan/apps/cabinets/static/cabinets/packages/jstree/test/visual/mobile/index.html +++ /dev/null @@ -1,42 +0,0 @@ - - - - - Mobile theme visual tests - - - - - -
            -
              -
            • Node 01 -
                -
              • Node
              • -
              • Node
              • -
              -
            • -
            • Node 02
            • -
            • Node 03 -
                -
              • Node
              • -
              • Node
              • -
              -
            • -
            • Node 04
            • -
            • Node 05
            • -
            -
            -
            • full
            • asdf
            -
            • full
            • asdf
            - - - - - - \ No newline at end of file diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/test/visual/screenshots/desktop/.png b/mayan/apps/cabinets/static/cabinets/packages/jstree/test/visual/screenshots/desktop/.png deleted file mode 100644 index 55ccf189b5..0000000000 Binary files a/mayan/apps/cabinets/static/cabinets/packages/jstree/test/visual/screenshots/desktop/.png and /dev/null differ diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/test/visual/screenshots/desktop/desktop.png b/mayan/apps/cabinets/static/cabinets/packages/jstree/test/visual/screenshots/desktop/desktop.png deleted file mode 100644 index d6ececdbd9..0000000000 Binary files a/mayan/apps/cabinets/static/cabinets/packages/jstree/test/visual/screenshots/desktop/desktop.png and /dev/null differ diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/test/visual/screenshots/desktop/home.png b/mayan/apps/cabinets/static/cabinets/packages/jstree/test/visual/screenshots/desktop/home.png deleted file mode 100644 index 55ccf189b5..0000000000 Binary files a/mayan/apps/cabinets/static/cabinets/packages/jstree/test/visual/screenshots/desktop/home.png and /dev/null differ diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/test/visual/screenshots/mobile/.png b/mayan/apps/cabinets/static/cabinets/packages/jstree/test/visual/screenshots/mobile/.png deleted file mode 100644 index c8cd05ad1d..0000000000 Binary files a/mayan/apps/cabinets/static/cabinets/packages/jstree/test/visual/screenshots/mobile/.png and /dev/null differ diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/test/visual/screenshots/mobile/home.png b/mayan/apps/cabinets/static/cabinets/packages/jstree/test/visual/screenshots/mobile/home.png deleted file mode 100644 index c8cd05ad1d..0000000000 Binary files a/mayan/apps/cabinets/static/cabinets/packages/jstree/test/visual/screenshots/mobile/home.png and /dev/null differ diff --git a/mayan/apps/cabinets/static/cabinets/packages/jstree/test/visual/screenshots/mobile/mobile.png b/mayan/apps/cabinets/static/cabinets/packages/jstree/test/visual/screenshots/mobile/mobile.png deleted file mode 100644 index dcc76a0064..0000000000 Binary files a/mayan/apps/cabinets/static/cabinets/packages/jstree/test/visual/screenshots/mobile/mobile.png and /dev/null differ diff --git a/mayan/apps/cabinets/templates/cabinets/cabinet_details.html b/mayan/apps/cabinets/templates/cabinets/cabinet_details.html index 7a19093116..0e689c109b 100644 --- a/mayan/apps/cabinets/templates/cabinets/cabinet_details.html +++ b/mayan/apps/cabinets/templates/cabinets/cabinet_details.html @@ -8,7 +8,7 @@ {% block title %}{% include 'appearance/calculate_form_title.html' with non_html_title=True %}{% endblock %} {% block stylesheets %} - + {% endblock %} {% block content %} @@ -30,7 +30,7 @@ {% block javascript %}