From: ArthurHoaro Date: Wed, 22 Mar 2017 18:29:02 +0000 (+0100) Subject: Apply the new timezone template variables to the default theme X-Git-Tag: v0.9.0~13^2~1 X-Git-Url: https://git.immae.eu/?p=github%2Fshaarli%2FShaarli.git;a=commitdiff_plain;h=a07373135e08d182314847bb7dfc5a0246610d06 Apply the new timezone template variables to the default theme --- diff --git a/tpl/default/configure.html b/tpl/default/configure.html index d6536d47..fd8ee9c2 100644 --- a/tpl/default/configure.html +++ b/tpl/default/configure.html @@ -73,15 +73,35 @@
- {ignore}FIXME! too hackish, needs to be fixed upstream{/ignore} -
{$timezone_form}
-
+
+ + +
diff --git a/tpl/default/install.html b/tpl/default/install.html index 33f8a453..c5052a26 100644 --- a/tpl/default/install.html +++ b/tpl/default/install.html @@ -49,18 +49,16 @@
-
+
-
-
+
- {ignore}FIXME! too hackish, needs to be fixed upstream{/ignore} -
{$timezone_html}
-
+
@@ -68,14 +66,36 @@
-
- +
+ + +
diff --git a/tpl/default/js/shaarli.js b/tpl/default/js/shaarli.js index 30d8ed6f..714420b7 100644 --- a/tpl/default/js/shaarli.js +++ b/tpl/default/js/shaarli.js @@ -76,9 +76,12 @@ window.onload = function () { } } - document.getElementById('menu-toggle').addEventListener('click', function (e) { - toggleMenu(); - }); + var menuToggle = document.getElementById('menu-toggle'); + if (menuToggle != null) { + menuToggle.addEventListener('click', function (e) { + toggleMenu(); + }); + } window.addEventListener(WINDOW_CHANGE_EVENT, closeMenu); })(this, this.document); @@ -299,21 +302,6 @@ window.onload = function () { }); } - /** - * TimeZome select - * FIXME! way too hackish - */ - var toRemove = document.getElementById('timezone-remove'); - if (toRemove != null) { - var firstSelect = toRemove.getElementsByTagName('select')[0]; - var secondSelect = toRemove.getElementsByTagName('select')[1]; - toRemove.parentNode.removeChild(toRemove); - var toAdd = document.getElementById('timezone-add'); - var newTimezone = 'Continent ' + firstSelect.outerHTML + ''; - newTimezone += ' Country ' + secondSelect.outerHTML + ''; - toAdd.innerHTML = newTimezone; - } - /** * Awesomplete trigger. */ @@ -366,6 +354,15 @@ window.onload = function () { } }); }); + + var continent = document.getElementById('continent'); + var city = document.getElementById('city'); + if (continent != null && city != null) { + continent.addEventListener('change', function(event) { + hideTimezoneCities(city, continent.options[continent.selectedIndex].value, true); + }); + hideTimezoneCities(city, continent.options[continent.selectedIndex].value, false); + } }; function activateFirefoxSocial(node) { @@ -391,3 +388,25 @@ function activateFirefoxSocial(node) { var activate = new CustomEvent("ActivateSocialFeature"); node.dispatchEvent(activate); } + +/** + * Add the class 'hidden' to city options not attached to the current selected continent. + * + * @param cities List of