diff --git a/trunk/www/js/jquery/incsearch/raw.js b/trunk/www/js/jquery/incsearch/raw.js new file mode 100644 index 0000000000..51bf3d8270 --- /dev/null +++ b/trunk/www/js/jquery/incsearch/raw.js @@ -0,0 +1,442 @@ +/* ************************************************************************** +Title: Incremental Search for Select Boxes +Copyright: Tobi Oetiker , OETIKER+PARTNER AG + +$Id: jquery.AddIncSearch.js 299 2009-11-16 16:22:10Z oetiker $ + +This jquery 1.3.x plugin adds incremental search to selectboxes of +your choics. + +If you want to 'modify' selectboxes in your document, do the +following. + +The behaviour of the widget can be tuned with the following options: + + maxListSize if the total number of entries in the selectbox are + less than maxListSize, show them all + + maxMultiMatch if multiple entries match, how many should be displayed. + + warnMultiMatch string to append to a list of entries cut short + by maxMultiMatch + + warnNoMatch string to show in the list when no entries match + + zIndex zIndex for the additional page elements + it should be higher than the index of the select boxes. + + + + + + + + +
+ +
+ + + +License: + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +* *******************************************************************/ +(function($) { + // setup a namespace for us + var nsp = 'AddIncSearch'; + + $[nsp] = { + // let the user override the default + // $.pluginPattern.defaultOptions.optA = false + defaultOptions: { + maxListSize : 200, + maxMultiMatch : 100, + warnMultiMatch : 'top matches ...', + warnNoMatch : 'no matches ...', + zIndex : 'auto' + } + }; + + // Private Variables and Functions + var _ = { + moveInputFocus: function (jq,dist) { + var fields = jq.parents('form,body').eq(0) + .find('button,input[type!=hidden],textarea,select'); + var index = fields.index( jq ); + if ( index > -1 + && index + dist < fields.length + && index + dist >= 0 ) { + fields.eq( index + dist ).focus(); + return true; + } + else { + return false; + } + }, + + action: function(options){ + if (this.nodeName != 'SELECT'){ // only select objects + return this; + } + if (this.size > 1){ // no select boxes + return this; + } + var $this = $(this); + var $parent = $this.parent(); + var meta_opts = options; + // lets you override the options + // inside the dom objects class property + // requires the jQuery metadata plugin + //
ddd
+ if ($.meta){ + meta_opts = $.extend({}, options, $this.data()); + } + + var text_arr = []; + var opt_arr = []; + var opt_cnt = this.length; + for (var i =0; i'+meta_opts.warnMultiMatch+'').get(0); + var no_match = $('').get(0); + top_match.disabled=true; + no_match.disabled=true; + + var blocker = $('
'); + blocker.css({ + position: 'absolute', + width: button.outerWidth(), + height: button.outerHeight(), + backgroundColor: '#ffffff', + opacity: 0.01 + }); + blocker.appendTo($parent); + + var input = $(''); + input.hide(); + input.appendTo($parent); + + input.width(button.outerWidth()); + input.height(button.outerHeight()); + input.css({ + position: 'absolute', + borderLeftWidth: button.css('border-left-width'), + paddingLeft: button.css('padding-left'), + borderTopWidth: button.css('border-top-width'), + paddingTop: button.css('padding-top'), + borderRightWidth: button.css('border-right-width'), + paddingRight: button.css('padding-right'), + borderBottomWidth: button.css('border-bottom-width'), + paddingBottom: button.css('padding-bottom'), + padding: 0, + margin: 0, + borderStyle: 'solid', + borderColor: 'transparent', + backgroundColor: 'transparent', + outlineStyle: 'none', + }); + var chooser = $('