aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2012-06-18 10:53:47 +0200
committerJoas Schilling <nickvergessen@gmx.de>2012-06-18 15:10:14 +0200
commitc21275fa951bd4d8608cc335a5c39d9a05bc4904 (patch)
treeab4622f594c49f3c14a1b473c19decfb4e18d893 /phpBB
parent8d65f1f7d263d9f6e76cbac2765da02a0877c87f (diff)
downloadforums-c21275fa951bd4d8608cc335a5c39d9a05bc4904.tar
forums-c21275fa951bd4d8608cc335a5c39d9a05bc4904.tar.gz
forums-c21275fa951bd4d8608cc335a5c39d9a05bc4904.tar.bz2
forums-c21275fa951bd4d8608cc335a5c39d9a05bc4904.tar.xz
forums-c21275fa951bd4d8608cc335a5c39d9a05bc4904.zip
[feature/new-tz-handling] Use js and data attributes to create the events
PHPBB3-9558
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/styles/prosilver/template/timezone.js13
-rw-r--r--phpBB/styles/prosilver/template/timezone_option.html6
-rw-r--r--phpBB/styles/subsilver2/template/timezone.js13
-rw-r--r--phpBB/styles/subsilver2/template/timezone_option.html2
4 files changed, 18 insertions, 16 deletions
diff --git a/phpBB/styles/prosilver/template/timezone.js b/phpBB/styles/prosilver/template/timezone.js
index b91aae6244..b8d3c2f152 100644
--- a/phpBB/styles/prosilver/template/timezone.js
+++ b/phpBB/styles/prosilver/template/timezone.js
@@ -36,9 +36,8 @@ function phpbb_enable_tz_dates()
* Preselect a date/time or suggest one, if it is not picked.
*
* @param bool force_selector Shall we select the suggestion?
-* @param string l_suggestion The language string which we use, to display the selection
*/
-function phpbb_preselect_tz_select(force_selector, l_suggestion)
+function phpbb_preselect_tz_select(force_selector)
{
// The offset returned here is in minutes and negated.
@@ -86,8 +85,8 @@ function phpbb_preselect_tz_select(force_selector, l_suggestion)
// We do not select the option for the user, but notify him,
// that we would suggest a different setting.
$('#tz_select_date_suggest').css("display", "inline");
- $('#tz_select_date_suggest').attr("title", l_suggestion.replace("%s", option.innerHTML));
- $('#tz_select_date_suggest').html(l_suggestion.replace("%s", option.innerHTML.substring(0, 9)));
+ $('#tz_select_date_suggest').attr("title", $('#tz_select_date_suggest').attr('data-l-suggestion').replace("%s", option.innerHTML));
+ $('#tz_select_date_suggest').attr("value", $('#tz_select_date_suggest').attr('data-l-suggestion').replace("%s", option.innerHTML.substring(0, 9)));
phpbb_switch_tz_date(true);
}
else
@@ -101,5 +100,9 @@ function phpbb_preselect_tz_select(force_selector, l_suggestion)
}
}
+$('#tz_select_date_suggest').click(function(){
+ phpbb_preselect_tz_select(true, '');
+});
+
phpbb_enable_tz_dates();
-phpbb_preselect_tz_select(is_registration, l_timezone_date_suggestion);
+phpbb_preselect_tz_select($('#tz_select_date_suggest').attr('data-is-registration') == "true");
diff --git a/phpBB/styles/prosilver/template/timezone_option.html b/phpBB/styles/prosilver/template/timezone_option.html
index 3a08de1a46..8840e9e5e8 100644
--- a/phpBB/styles/prosilver/template/timezone_option.html
+++ b/phpBB/styles/prosilver/template/timezone_option.html
@@ -6,7 +6,7 @@
<option value="">{L_SELECT_CURRENT_TIME}</option>
{S_TZ_DATE_OPTIONS}
</select>
- <a id="tz_select_date_suggest" style="display: none;" href="javascript: phpbb_preselect_tz_select(true, '');">{L_TIMEZONE_DATE_SUGGESTION}</a>
+ <input id="tz_select_date_suggest" class="button2" style="display: none;" data-is-registration="<!-- IF S_REGISTRATION -->true<!-- ELSE -->false<!-- ENDIF -->" data-l-suggestion="{L_TIMEZONE_DATE_SUGGESTION}" value="{L_TIMEZONE_DATE_SUGGESTION}" />
</dd>
<!-- ENDIF -->
<dd>
@@ -15,10 +15,6 @@
{S_TZ_OPTIONS}
</select>
- <script type="text/javascript">
- var is_registration = <!-- IF S_REGISTRATION -->true<!-- ELSE -->false<!-- ENDIF -->;
- var l_timezone_date_suggestion = "{L_TIMEZONE_DATE_SUGGESTION}";
- </script>
<!-- INCLUDEJS template/timezone.js -->
</dd>
</dl>
diff --git a/phpBB/styles/subsilver2/template/timezone.js b/phpBB/styles/subsilver2/template/timezone.js
index b91aae6244..b8d3c2f152 100644
--- a/phpBB/styles/subsilver2/template/timezone.js
+++ b/phpBB/styles/subsilver2/template/timezone.js
@@ -36,9 +36,8 @@ function phpbb_enable_tz_dates()
* Preselect a date/time or suggest one, if it is not picked.
*
* @param bool force_selector Shall we select the suggestion?
-* @param string l_suggestion The language string which we use, to display the selection
*/
-function phpbb_preselect_tz_select(force_selector, l_suggestion)
+function phpbb_preselect_tz_select(force_selector)
{
// The offset returned here is in minutes and negated.
@@ -86,8 +85,8 @@ function phpbb_preselect_tz_select(force_selector, l_suggestion)
// We do not select the option for the user, but notify him,
// that we would suggest a different setting.
$('#tz_select_date_suggest').css("display", "inline");
- $('#tz_select_date_suggest').attr("title", l_suggestion.replace("%s", option.innerHTML));
- $('#tz_select_date_suggest').html(l_suggestion.replace("%s", option.innerHTML.substring(0, 9)));
+ $('#tz_select_date_suggest').attr("title", $('#tz_select_date_suggest').attr('data-l-suggestion').replace("%s", option.innerHTML));
+ $('#tz_select_date_suggest').attr("value", $('#tz_select_date_suggest').attr('data-l-suggestion').replace("%s", option.innerHTML.substring(0, 9)));
phpbb_switch_tz_date(true);
}
else
@@ -101,5 +100,9 @@ function phpbb_preselect_tz_select(force_selector, l_suggestion)
}
}
+$('#tz_select_date_suggest').click(function(){
+ phpbb_preselect_tz_select(true, '');
+});
+
phpbb_enable_tz_dates();
-phpbb_preselect_tz_select(is_registration, l_timezone_date_suggestion);
+phpbb_preselect_tz_select($('#tz_select_date_suggest').attr('data-is-registration') == "true");
diff --git a/phpBB/styles/subsilver2/template/timezone_option.html b/phpBB/styles/subsilver2/template/timezone_option.html
index 0806186c9c..affeee91ac 100644
--- a/phpBB/styles/subsilver2/template/timezone_option.html
+++ b/phpBB/styles/subsilver2/template/timezone_option.html
@@ -7,7 +7,7 @@
<option value="">{L_SELECT_CURRENT_TIME}</option>
{S_TZ_DATE_OPTIONS}
</select><br />
- <a id="tz_select_date_suggest" style="display: none;" href="javascript: phpbb_preselect_tz_select(true, '');">{L_TIMEZONE_DATE_SUGGESTION}</a><br />
+ <input id="tz_select_date_suggest" class="btnlite" style="display: none;" data-is-registration="<!-- IF S_REGISTRATION -->true<!-- ELSE -->false<!-- ENDIF -->" data-l-suggestion="{L_TIMEZONE_DATE_SUGGESTION}" value="{L_TIMEZONE_DATE_SUGGESTION}" />
</div>
<!-- ENDIF -->
<select name="tz" id="timezone" class="autowidth tz_select">