aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/assets/javascript
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/assets/javascript')
-rw-r--r--phpBB/assets/javascript/core.js37
-rw-r--r--phpBB/assets/javascript/jquery.min.js (renamed from phpBB/assets/javascript/jquery.js)0
2 files changed, 32 insertions, 5 deletions
diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js
index ae8583ddbf..296c5b0ef9 100644
--- a/phpBB/assets/javascript/core.js
+++ b/phpBB/assets/javascript/core.js
@@ -15,7 +15,7 @@ var dark = $('#darkenwrapper');
var loadingIndicator = $('#loading_indicator');
var phpbbAlertTimer = null;
-var isTouch = (window && typeof window.ontouchstart !== 'undefined');
+phpbb.isTouch = (window && typeof window.ontouchstart !== 'undefined');
/**
* Display a loading screen
@@ -84,8 +84,8 @@ phpbb.alert = function(title, msg, fadedark) {
e.stopPropagation();
});
- $(document).bind('keydown', function(e) {
- if (e.keyCode === keymap.ENTER || e.keyCode === keymap.ESC) {
+ $(document).keydown(function(e) {
+ if ((e.keyCode === keymap.ENTER || e.keyCode === keymap.ESC) && dark.is(':visible')) {
dark.trigger('click');
e.preventDefault();
@@ -333,7 +333,9 @@ phpbb.ajaxify = function(options) {
// Hide the alert even if we refresh the page, in case the user
// presses the back button.
dark.fadeOut(phpbb.alertTime, function() {
- alert.hide();
+ if (typeof alert !== 'undefined') {
+ alert.hide();
+ }
});
}, res.REFRESH_DATA.time * 1000); // Server specifies time in seconds
}
@@ -1009,7 +1011,7 @@ phpbb.resizeTextArea = function(items, options) {
resetCallback: function(item) { }
};
- if (isTouch) return;
+ if (phpbb.isTouch) return;
if (arguments.length > 1) {
configuration = $.extend(configuration, options);
@@ -1476,6 +1478,21 @@ phpbb.toggleDisplay = function(id, action, type) {
}
/**
+* Toggle additional settings based on the selected
+* option of select element.
+*
+* @param jQuery el jQuery select element object.
+* @return undefined
+*/
+phpbb.toggleSelectSettings = function(el) {
+ el.children().each(function() {
+ var option = $(this),
+ setting = $(option.data('toggle-setting'));
+ setting.toggle(option.is(':selected'));
+ });
+};
+
+/**
* Get function from name.
* Based on http://stackoverflow.com/a/359910
*
@@ -1516,6 +1533,16 @@ $(document).ready(function() {
// Update browser history URL to point to specific post in viewtopic.php
// when using view=unread#unread link.
phpbb.history.replaceUrl($('#unread[data-url]').data('url'));
+
+ // Hide settings that are not selected via select element.
+ $('select[data-togglable-settings]').each(function() {
+ var select = $(this);
+
+ select.change(function() {
+ phpbb.toggleSelectSettings(select);
+ });
+ phpbb.toggleSelectSettings(select);
+ });
});
})(jQuery); // Avoid conflicts with other libraries
diff --git a/phpBB/assets/javascript/jquery.js b/phpBB/assets/javascript/jquery.min.js
index 73f33fb3aa..73f33fb3aa 100644
--- a/phpBB/assets/javascript/jquery.js
+++ b/phpBB/assets/javascript/jquery.min.js