Skip to content

TagSpaces is an offline, open source, document manager with tagging support

jquery.dropdown library added to the project

uggrock6620a0e317c9
diff --git a/data/about.html b/data/about.html
index b5e8c9c5b..9c67c6706 100644
--- a/data/about.html
+++ b/data/about.html
@@ -24,6 +24,7 @@ TagSpaces thankfully relays on the followings javascript libraries:
<li>jQuery - <a href="http://jquery.com" target="_new">Homepage</a>&nbsp;<a href="libs/jquery/MIT-LICENSE.txt">License[MIT]</a></li>
<li>jQueryUI - <a href="http://jqueryui.com" target="_new">Homepage</a>&nbsp;<a href="libs/jqueryui/MIT-LICENSE.txt">License[MIT]</a></li>
<li>jQuery Layout - <a href="http://layout.jquery-dev.net" target="_new">Homepage</a>&nbsp;<a href="libs/jquerylayout/MIT-LICENSE.txt">License[MIT]</a></li>
+<li>jQuery Dropdown - <a href="http://labs.abeautifulsite.net/jquery-dropdown" target="_new">Homepage</a>&nbsp;<a href="libs/jquerydropdown/MIT-LICENSE.txt">License[MIT]</a></li>
<li>DataTables - <a href="http://datatables.net/" target="_new">Homepage</a>&nbsp;<a href="libs/datatables/license-bsd.txt">License[BSD]</a></li>
<li>Dynatree - <a href="http://code.google.com/p/dynatree/" target="_new">Homepage</a>&nbsp;<a href="libs/dynatree/MIT-License.txt">License[MIT]</a></li>
<li>JSONEditor - <a href="http://jsoneditoronline.org/" target="_new">Homepage</a>&nbsp;<a href="libs/jsoneditor/LICENSE[Apache 2.0]">License[Apache2]</a></li>
diff --git a/data/libs/jquerydropdown/MIT-LICENSE.txt b/data/libs/jquerydropdown/MIT-LICENSE.txt
new file mode 100644
index 000000000..741585591
--- /dev/null
+++ b/data/libs/jquerydropdown/MIT-LICENSE.txt
@@ -0,0 +1,26 @@
+Copyright 2012 jQuery Foundation and other contributors,
+http://jqueryui.com/
+
+This software consists of voluntary contributions made by many
+individuals (AUTHORS.txt, http://jqueryui.com/about) For exact
+contribution history, see the revision history and logs, available
+at http://jquery-ui.googlecode.com/svn/
+
+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/data/libs/jquerydropdown/jquery.dropdown.css b/data/libs/jquerydropdown/jquery.dropdown.css
new file mode 100644
index 000000000..122ee7d9e
--- /dev/null
+++ b/data/libs/jquerydropdown/jquery.dropdown.css
@@ -0,0 +1,101 @@
+.dropdown-menu {
+ font: 14px sans-serif;
+ position: absolute;
+ z-index: 9999999;
+ display: none;
+}
+
+.dropdown-menu UL {
+ min-width: 160px;
+ list-style: none;
+ background: #FFF;
+ border: solid 1px #DDD;
+ border: solid 1px rgba(0, 0, 0, .2);
+ border-radius: 6px;
+ box-shadow: 0 5px 10px rgba(0, 0, 0, .2);
+ overflow: visible;
+ padding: 4px 0;
+ margin: 0;
+}
+
+.dropdown-menu.has-tip {
+ margin-top: 8px;
+}
+
+.dropdown-menu.has-tip:before {
+ position: absolute;
+ top: -6px;
+ left: 9px;
+ content: '';
+ border-left: 7px solid transparent;
+ border-right: 7px solid transparent;
+ border-bottom: 7px solid #CCC;
+ border-bottom-color: rgba(0, 0, 0, 0.2);
+ display: inline-block;
+}
+
+.dropdown-menu.has-tip.anchor-right:before {
+ left: auto;
+ right: 9px;
+}
+
+.dropdown-menu.has-tip:after {
+ position: absolute;
+ top: -5px;
+ left: 10px;
+ content: '';
+ border-left: 6px solid transparent;
+ border-right: 6px solid transparent;
+ border-bottom: 6px solid #FFF;
+ display: inline-block;
+}
+
+.dropdown-menu.has-tip.anchor-right:after {
+ left: auto;
+ right: 10px;
+}
+
+
+.dropdown-menu.has-scroll UL {
+ max-height: 358px;
+ overflow: auto;
+}
+
+.dropdown-menu LI {
+ list-style: none;
+ padding: 0;
+ margin: 0;
+ line-height: 18px;
+}
+
+.dropdown-menu LI > A,
+.dropdown-menu LABEL {
+ display: block;
+ color: #555;
+ text-decoration: none;
+ line-height: 18px;
+ padding: 3px 15px;
+ white-space: nowrap;
+}
+
+.dropdown-menu LI > A:hover,
+.dropdown-menu LABEL:hover {
+ background-color: #08C;
+ color: #FFF;
+ cursor: pointer;
+}
+
+.dropdown-menu .divider {
+ height: 1px;
+ background: #E5E5E5;
+ margin: 5px 1px;
+ overflow: hidden;
+}
+
+.dropdown-menu.has-icons LI > A {
+ padding-left: 30px;
+ background-position: 8px center;
+ background-repeat: no-repeat;
+}
+
+/* .dropdown-menu .undo A { background-image: url(icons/arrow-curve-180-left.png); } */
\ No newline at end of file
diff --git a/data/libs/jquerydropdown/jquery.dropdown.js b/data/libs/jquerydropdown/jquery.dropdown.js
new file mode 100644
index 000000000..4e1ad8edc
--- /dev/null
+++ b/data/libs/jquerydropdown/jquery.dropdown.js
@@ -0,0 +1,83 @@
+/*
+ * jQuery dropdown: A simple dropdown plugin
+ *
+ * Inspired by Bootstrap: http://twitter.github.com/bootstrap/javascript.html#dropdowns
+ *
+ * Copyright 2011 Cory LaViska for A Beautiful Site, LLC. (http://abeautifulsite.net/)
+ *
+ * Dual licensed under the MIT or GPL Version 2 licenses
+ *
+*/
+if(jQuery) (function($) {
+
+ $.extend($.fn, {
+ dropdown: function(method, data) {
+
+ switch( method ) {
+ case 'hide':
+ hideDropdowns();
+ return $(this);
+ case 'attach':
+ return $(this).attr('data-dropdown', data);
+ case 'detach':
+ hideDropdowns();
+ return $(this).removeAttr('data-dropdown');
+ case 'disable':
+ return $(this).addClass('dropdown-disabled');
+ case 'enable':
+ hideDropdowns();
+ return $(this).removeClass('dropdown-disabled');
+ }
+
+ }
+ });
+
+ function showMenu(event) {
+
+ var trigger = $(this),
+ dropdown = $( $(this).attr('data-dropdown') ),
+ isOpen = trigger.hasClass('dropdown-open'),
+ hOffset = parseInt($(this).attr('data-horizontal-offset') || 0),
+ vOffset = parseInt($(this).attr('data-vertical-offset') || 0);
+
+ if( trigger !== event.target && $(event.target).hasClass('dropdown-ignore') ) return;
+
+ event.preventDefault();
+ event.stopPropagation();
+
+ hideDropdowns();
+
+ if( isOpen || trigger.hasClass('dropdown-disabled') ) return;
+
+ dropdown
+ .css({
+ left: dropdown.hasClass('anchor-right') ?
+ trigger.offset().left - (dropdown.outerWidth() - trigger.outerWidth()) + hOffset : trigger.offset().left + hOffset,
+ top: trigger.offset().top + trigger.outerHeight() + vOffset
+ })
+ .show();
+
+ trigger.addClass('dropdown-open');
+
+ };
+
+ function hideDropdowns(event) {
+
+ var targetGroup = event ? $(event.target).parents().andSelf() : null;
+ if( targetGroup && targetGroup.is('.dropdown-menu') && !targetGroup.is('A') ) return;
+
+ $('BODY')
+ .find('.dropdown-menu').hide().end()
+ .find('[data-dropdown]').removeClass('dropdown-open');
+ };
+
+ $(function () {
+ $('BODY').on('click.dropdown', '[data-dropdown]', showMenu);
+ $('HTML').on('click.dropdown', hideDropdowns);
+ // Hide on resize (IE7/8 trigger this when any element is resized...)
+ if( !$.browser.msie || ($.browser.msie && $.browser.version >= 9) ) {
+ $(window).on('resize.dropdown', hideDropdowns);
+ }
+ });
+
+})(jQuery);
\ No newline at end of file