diff options
author | ArthurHoaro <arthur@hoa.ro> | 2018-02-24 18:18:33 +0100 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2018-03-28 19:01:17 +0200 |
commit | b3375c7f86f35fce723185bb76d3b5f9c4ff7a07 (patch) | |
tree | 9add15148b2efbfa6dc25a883769f33da60f70a5 /tpl/vintage/js/shaarli.js | |
parent | 9b2bd66fb60ffd5a833480bf329062c7d57bc8c4 (diff) | |
download | Shaarli-b3375c7f86f35fce723185bb76d3b5f9c4ff7a07.tar.gz Shaarli-b3375c7f86f35fce723185bb76d3b5f9c4ff7a07.tar.zst Shaarli-b3375c7f86f35fce723185bb76d3b5f9c4ff7a07.zip |
Webpack / Remove frontend dependencies from tpl/ & inc/ and move them to assets/
Diffstat (limited to 'tpl/vintage/js/shaarli.js')
-rw-r--r-- | tpl/vintage/js/shaarli.js | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/tpl/vintage/js/shaarli.js b/tpl/vintage/js/shaarli.js deleted file mode 100644 index 9bcc96fb..00000000 --- a/tpl/vintage/js/shaarli.js +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | window.onload = function () { | ||
2 | var continent = document.getElementById('continent'); | ||
3 | var city = document.getElementById('city'); | ||
4 | if (continent != null && city != null) { | ||
5 | continent.addEventListener('change', function(event) { | ||
6 | hideTimezoneCities(city, continent.options[continent.selectedIndex].value, true); | ||
7 | }); | ||
8 | hideTimezoneCities(city, continent.options[continent.selectedIndex].value, false); | ||
9 | } | ||
10 | }; | ||
11 | |||
12 | /** | ||
13 | * Add the class 'hidden' to city options not attached to the current selected continent. | ||
14 | * | ||
15 | * @param cities List of <option> elements | ||
16 | * @param currentContinent Current selected continent | ||
17 | * @param reset Set to true to reset the selected value | ||
18 | */ | ||
19 | function hideTimezoneCities(cities, currentContinent, reset = false) { | ||
20 | var first = true; | ||
21 | [].forEach.call(cities, function(option) { | ||
22 | if (option.getAttribute('data-continent') != currentContinent) { | ||
23 | option.className = 'hidden'; | ||
24 | } else { | ||
25 | option.className = ''; | ||
26 | if (reset === true && first === true) { | ||
27 | option.setAttribute('selected', 'selected'); | ||
28 | first = false; | ||
29 | } | ||
30 | } | ||
31 | }); | ||
32 | } | ||