diff --git a/CHANGELOG.md b/CHANGELOG.md index 302c7531860ae91249e619694371c8eb777d4326..7a43f60167028f8a85f70202ebef86e6cc042442 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ All notable changes to this project will be documented in this file. - sspmod_perun_RpcConnector to SimpleSAML\Module\perun\RpcConnector - Added disco-tpl template file - Method getUsersGroupsOnFacility in AdapterRpc was optimized + - Searching of institutions on WAYF is accent-insensitive [Fixed] - Fixed the bug generating Array to string conversion Exception in PerunAttributes, diff --git a/themes/perun/perun/disco-tpl.php b/themes/perun/perun/disco-tpl.php index 9d254eb311798984929139530ab9006188d1f9bc..ccd1ba9feb574783217c394d41d620e768b432cb 100644 --- a/themes/perun/perun/disco-tpl.php +++ b/themes/perun/perun/disco-tpl.php @@ -23,7 +23,7 @@ $this->data['head'] .= '<link rel="stylesheet" media="screen" type="text/css" hr Module::getModuleUrl('perun/res/css/disco.css') . '" />'; $this->data['head'] .= '<script type="text/javascript" src="' . - Module::getModuleUrl('discopower/assets/js/jquery.livesearch.js') . '"></script>'; + Module::getModuleUrl('perun/res/js/jquery.livesearch.js') . '"></script>'; $this->data['head'] .= '<script type="text/javascript" src="' . Module::getModuleUrl('discopower/assets/js/suggest.js') . '"></script>'; diff --git a/www/res/js/jquery.livesearch.js b/www/res/js/jquery.livesearch.js new file mode 100644 index 0000000000000000000000000000000000000000..558284ee24d71d52362948f4dec67cf89d997741 --- /dev/null +++ b/www/res/js/jquery.livesearch.js @@ -0,0 +1,43 @@ +jQuery.fn.liveUpdate = function (list) { + list = jQuery(list); + + if (list.length) { + var rows = list.children('a'), + cache = rows.map(function () { + return jQuery(this).text().toLowerCase().normalize('NFD').replace(/[\u0300-\u036f]/g, ""); + }); + + this.keyup(filter).keyup().parents('form').submit(function () { + return false; + }); + } + + return this; + + function filter() + { + var term = jQuery.trim(jQuery(this).val().toLowerCase()), scores = []; + + if (!term) { + rows.show(); + } else { + rows.hide(); + + cache.each(function (i) { + var score = this.score(term); + if (score > 0) { + scores.push([score, i]); + } + }); + + jQuery.each( + scores.sort(function (a, b) { + return b[0] - a[0]; + }), + function () { + jQuery(rows[ this[1] ]).show(); + } + ); + } + } +};