Skip to content
Snippets Groups Projects
Commit 7647d877 authored by Gerrit Uitslag's avatar Gerrit Uitslag
Browse files

Made a jquery function of dw_qsearch

parent 4a5ab1c7
No related branches found
No related tags found
No related merge requests found
......@@ -6,10 +6,13 @@
* @author Adrian Lang <lang@cosmocode.de>
* @author Michal Rezler <m.rezler@centrum.cz>
*/
jQuery.fn.dw_qsearch = function(overrides) {
var dw_qsearch = {
var dw_qsearch = {
$inObj: null,
output_id: '#qsearch__out',
$inObj: this,
$outObj: null,
timer: null,
curRequest: null,
......@@ -19,14 +22,11 @@ var dw_qsearch = {
*
* Attaches the event handlers
*
* @param input element (jQuery selector/DOM obj)
* @param output element (jQuery selector/DOM obj)
*/
init: function (input, output) {
init: function () {
var do_qsearch;
dw_qsearch.$inObj = jQuery(input);
dw_qsearch.$outObj = jQuery(output);
dw_qsearch.$outObj = jQuery(dw_qsearch.output_id);
// objects found?
if (dw_qsearch.$inObj.length === 0 ||
......@@ -163,8 +163,21 @@ var dw_qsearch = {
// reenable overflow
dw_qsearch.$outObj.find('li').css('overflow', 'hidden').css('text-overflow','ellipsis');
}
};
jQuery.extend(dw_qsearch, overrides);
if (!overrides.deferInit) {
dw_qsearch.init();
}
return dw_qsearch;
};
jQuery(function () {
dw_qsearch.init('#qsearch__in','#qsearch__out');
jQuery('#qsearch__in').dw_qsearch({
output_id: '#qsearch__out'
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment