aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/adm
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2012-06-17 16:54:12 +0200
committerJoas Schilling <nickvergessen@gmx.de>2012-06-18 15:09:55 +0200
commit5441ee1ee489ef9ad1727f110c440dde5417cc1f (patch)
tree06a33d78b0e9dec0d37e6d4053d85c415de75cb8 /phpBB/adm
parent5f96e5d374d1702d3d81591b7c69ede1cafebfa7 (diff)
downloadforums-5441ee1ee489ef9ad1727f110c440dde5417cc1f.tar
forums-5441ee1ee489ef9ad1727f110c440dde5417cc1f.tar.gz
forums-5441ee1ee489ef9ad1727f110c440dde5417cc1f.tar.bz2
forums-5441ee1ee489ef9ad1727f110c440dde5417cc1f.tar.xz
forums-5441ee1ee489ef9ad1727f110c440dde5417cc1f.zip
[feature/new-tz-handling] Use jQuery and INCLUDEJS for javascript
PHPBB3-9558
Diffstat (limited to 'phpBB/adm')
-rw-r--r--phpBB/adm/style/timezone.js28
-rw-r--r--phpBB/adm/style/timezone_option.html3
2 files changed, 14 insertions, 17 deletions
diff --git a/phpBB/adm/style/timezone.js b/phpBB/adm/style/timezone.js
index d02c965ab5..a1ffeb17c5 100644
--- a/phpBB/adm/style/timezone.js
+++ b/phpBB/adm/style/timezone.js
@@ -1,29 +1,27 @@
function phpbb_switch_tz_date(keep_selection)
{
- var timezone_groups = document.getElementById("timezone");
- for (var i = 0; i < timezone_groups.childElementCount; i++) {
- if (timezone_groups.children[i].tagName == "OPTGROUP" &&
- timezone_groups.children[i].label != document.getElementById("tz_date").value)
- {
- timezone_groups.children[i].style.display = "none";
- }
- else if (timezone_groups.children[i].tagName == "OPTGROUP")
- {
- // Display other options
- timezone_groups.children[i].style.display = "block";
- }
+ $('#timezone > optgroup').css("display", "none");
+ $("#timezone > optgroup[label='" + $('#tz_date').val() + "']").css("display", "block");
+
+ if ($("#timezone > optgroup[label='" + $('#tz_date').val() + "'] > option").size() == 1)
+ {
+ // If there is only one timezone for the selected date, we just select that automatically.
+ $("#timezone > optgroup[label='" + $('#tz_date').val() + "'] > option:first").attr("selected", true);
+ keep_selection = true;
}
+
if (typeof keep_selection !== 'undefined')
{
if (!keep_selection)
{
- timezone_groups.children[0].selected = true;
+ $('#timezone > option:first').attr("selected", true);
}
}
}
function phpbb_enable_tz_dates()
{
- var tz_select_date = document.getElementById("tz_select_date");
- tz_select_date.style.display = "block";
+ $('#tz_select_date').css("display", "block");
}
+
+phpbb_enable_tz_dates();
diff --git a/phpBB/adm/style/timezone_option.html b/phpBB/adm/style/timezone_option.html
index 12e6e3700a..e12219b1c0 100644
--- a/phpBB/adm/style/timezone_option.html
+++ b/phpBB/adm/style/timezone_option.html
@@ -14,7 +14,6 @@
{S_TZ_OPTIONS}
</select>
- <script type="text/javascript" src="{T_TEMPLATE_PATH}/timezone.js"></script>
- <script type="text/javascript">phpbb_enable_tz_dates();</script>
+ <!-- INCLUDEJS timezone.js -->
</dd>
</dl>