From 966a2b4892762f3a1f032089d0b01c97a1d1c2e1 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 7 Apr 2014 21:27:48 +0200 Subject: [ticket/12372] Move dE() function core.js PHPBB3-12372 --- phpBB/assets/javascript/core.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'phpBB/assets/javascript') diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js index aa9dc9af82..ccb031de24 100644 --- a/phpBB/assets/javascript/core.js +++ b/phpBB/assets/javascript/core.js @@ -1061,6 +1061,27 @@ phpbb.registerPalette = function(el) { }); } +/** +* Set display of page element +* +* @param string id The ID of the element to change +* @param int action Set to 0 if element display should be toggled, -1 for +* hiding the element, and 1 for showing it. +* @param string type Display type that should be used, e.g. inline, block or +* other CSS "display" types +*/ +function dE(id, action, type) { + if (!type) { + type = 'block'; + } + + var display = jQuery('#' + id).css('display'); + if (!action) { + action = (display === '' || display === type) ? -1 : 1; + } + jQuery('#' + id).css('display', ((action === 1) ? type : 'none')); +} + /** * Apply code editor to all textarea elements with data-bbcode attribute */ -- cgit v1.2.1 From 91a1c3af901f51d79751b733e48e8bcddc81d263 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 7 Apr 2014 21:42:30 +0200 Subject: [ticket/12372] Rename JS function dE() to phpbb.toggleDisplay() PHPBB3-12372 --- phpBB/assets/javascript/core.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/assets/javascript') diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js index ccb031de24..9f89125a18 100644 --- a/phpBB/assets/javascript/core.js +++ b/phpBB/assets/javascript/core.js @@ -1070,7 +1070,7 @@ phpbb.registerPalette = function(el) { * @param string type Display type that should be used, e.g. inline, block or * other CSS "display" types */ -function dE(id, action, type) { +phpbb.toggleDisplay = function(id, action, type) { if (!type) { type = 'block'; } -- cgit v1.2.1 From fbeed2d975b4c080d3f391226b9b69b61f55aa23 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Fri, 11 Apr 2014 11:31:22 +0200 Subject: [ticket/12372] Use $() instead of jQuery() in core.js for toggleDisplay PHPBB3-12372 --- phpBB/assets/javascript/core.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/assets/javascript') diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js index 9f89125a18..7452d59d7c 100644 --- a/phpBB/assets/javascript/core.js +++ b/phpBB/assets/javascript/core.js @@ -1075,11 +1075,11 @@ phpbb.toggleDisplay = function(id, action, type) { type = 'block'; } - var display = jQuery('#' + id).css('display'); + var display = $('#' + id).css('display'); if (!action) { action = (display === '' || display === type) ? -1 : 1; } - jQuery('#' + id).css('display', ((action === 1) ? type : 'none')); + $('#' + id).css('display', ((action === 1) ? type : 'none')); } /** -- cgit v1.2.1