diff options
author | Andreas Gohr <andi@splitbrain.org> | 2013-02-03 22:57:45 +0100 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2013-02-03 22:57:45 +0100 |
commit | 3da7921f08ecdda929466921ecc50698f1adf99e (patch) | |
tree | 0e179e504399e874bfd785d0a95eec44b76d5952 /lib/scripts/qsearch.js | |
parent | 6cf2bbfa12b776cf47cb69ae40fb8862f715ad01 (diff) | |
parent | cc4bb766fdac23358d7b586aa3830b9650eed7a8 (diff) | |
download | dokuwiki-3da7921f08ecdda929466921ecc50698f1adf99e.tar.gz dokuwiki-3da7921f08ecdda929466921ecc50698f1adf99e.zip |
Merge branch 'master' into future
* master: (162 commits)
fixed revision JS for images
upgraded SimplePie to 1.3.1 FS#2708
removed obsolete browser plugin (migrate does it)
adjust spacing to match standard 1.4em grid
added comment on use of whitelist vs blacklist
Updated idfilter() function for IIS
use var and remove suggestions when needed Use variable for maximum number of suggestions for quicksearch. And hide suggestions when search field is emptied, or when no suggestion are found.
added 'home' class to first link in hierarchical breadcrumbs
reduced required max width to go into tablet mode
re-added linear gradients for firefox
added missing styling for disabled form elements (FS#2705)
fixed acronyms in italics (FS#2684)
improved print styles (includes fixes for FS#2645 and FS#2707)
basic styles improvements
Greek language update
Use list in acl help text, for more structure
Galician language update
touch the config on save, even if no changes were made
unwind the width narrowing commit
put some whitespace between form submit button and fieldset bottom border
...
Conflicts:
lib/plugins/config/admin.php
lib/plugins/config/settings/config.class.php
Diffstat (limited to 'lib/scripts/qsearch.js')
-rw-r--r-- | lib/scripts/qsearch.js | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/lib/scripts/qsearch.js b/lib/scripts/qsearch.js index a309f9e29..0c3609ada 100644 --- a/lib/scripts/qsearch.js +++ b/lib/scripts/qsearch.js @@ -35,9 +35,9 @@ var dw_qsearch = { // attach eventhandler to search field do_qsearch = function () { - dw_qsearch.clear_results(); var value = dw_qsearch.$inObj.val(); if (value === '') { + dw_qsearch.clear_results(); return; } jQuery.post( @@ -57,7 +57,6 @@ var dw_qsearch = { window.clearTimeout(dw_qsearch.timer); dw_qsearch.timer = null; } - dw_qsearch.clear_results(); dw_qsearch.timer = window.setTimeout(do_qsearch, 500); } ); @@ -85,19 +84,28 @@ var dw_qsearch = { onCompletion: function(data) { var max, $links, too_big; - if (data === '') { return; } + if (data === '') { + dw_qsearch.clear_results(); + return; + } dw_qsearch.$outObj .html(data) .show() .css('white-space', 'nowrap'); - // shorten namespaces if too long - max = dw_qsearch.$outObj[0].clientWidth; + // disable overflow during shortening + dw_qsearch.$outObj.find('li').css('overflow', 'visible'); + $links = dw_qsearch.$outObj.find('a'); - too_big = (document.documentElement.dir === 'rtl') - ? function (l) { return l.offsetLeft < 0; } - : function (l) { return l.offsetWidth + l.offsetLeft > max; }; + max = dw_qsearch.$outObj[0].clientWidth; // maximum width allowed (but take away paddings below) + if(document.documentElement.dir === 'rtl'){ + max -= parseInt(dw_qsearch.$outObj.css('padding-left')); + too_big = function (l) { return l.offsetLeft < 0; }; + }else{ + max -= parseInt(dw_qsearch.$outObj.css('padding-right')); + too_big = function (l) { return l.offsetWidth + l.offsetLeft > max; }; + } $links.each(function () { var start, length, replace, nsL, nsR, eli, runaway; @@ -106,6 +114,12 @@ var dw_qsearch = { return; } + // make IE's innerText available to W3C conform browsers + if(this.textContent){ + this.__defineGetter__('innerText', function(){ return this.textContent }); + this.__defineSetter__('innerText', function(val){ this.textContent = val }); + } + nsL = this.innerText.indexOf('('); nsR = this.innerText.indexOf(')'); eli = 0; @@ -138,6 +152,9 @@ var dw_qsearch = { nsR = this.innerText.indexOf(')'); } }); + + // reenable overflow + dw_qsearch.$outObj.find('li').css('overflow', 'hidden').css('text-overflow','ellipsis'); } }; |