Skip to content
This repository was archived by the owner on Sep 19, 2022. It is now read-only.

Commit aa894ee

Browse files
Merge pull request #56 from BaranekD/accentInsensitive
Searching of institutions on WAYF is accent-insensitive
2 parents 8c15ca0 + f55b76a commit aa894ee

3 files changed

Lines changed: 45 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ All notable changes to this project will be documented in this file.
4444
- sspmod_perun_RpcConnector to SimpleSAML\Module\perun\RpcConnector
4545
- Added disco-tpl template file
4646
- Method getUsersGroupsOnFacility in AdapterRpc was optimized
47+
- Searching of institutions on WAYF is accent-insensitive
4748

4849
[Fixed]
4950
- Fixed the bug generating Array to string conversion Exception in PerunAttributes,

themes/perun/perun/disco-tpl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
Module::getModuleUrl('perun/res/css/disco.css') . '" />';
2424

2525
$this->data['head'] .= '<script type="text/javascript" src="' .
26-
Module::getModuleUrl('discopower/assets/js/jquery.livesearch.js') . '"></script>';
26+
Module::getModuleUrl('perun/res/js/jquery.livesearch.js') . '"></script>';
2727

2828
$this->data['head'] .= '<script type="text/javascript" src="' .
2929
Module::getModuleUrl('discopower/assets/js/suggest.js') . '"></script>';

www/res/js/jquery.livesearch.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
jQuery.fn.liveUpdate = function (list) {
2+
list = jQuery(list);
3+
4+
if (list.length) {
5+
var rows = list.children('a'),
6+
cache = rows.map(function () {
7+
return jQuery(this).text().toLowerCase().normalize('NFD').replace(/[\u0300-\u036f]/g, "");
8+
});
9+
10+
this.keyup(filter).keyup().parents('form').submit(function () {
11+
return false;
12+
});
13+
}
14+
15+
return this;
16+
17+
function filter()
18+
{
19+
var term = jQuery.trim(jQuery(this).val().toLowerCase()), scores = [];
20+
21+
if (!term) {
22+
rows.show();
23+
} else {
24+
rows.hide();
25+
26+
cache.each(function (i) {
27+
var score = this.score(term);
28+
if (score > 0) {
29+
scores.push([score, i]);
30+
}
31+
});
32+
33+
jQuery.each(
34+
scores.sort(function (a, b) {
35+
return b[0] - a[0];
36+
}),
37+
function () {
38+
jQuery(rows[ this[1] ]).show();
39+
}
40+
);
41+
}
42+
}
43+
};

0 commit comments

Comments
 (0)