[ticket/12372] Unify definition of function dE() across all files

PHPBB3-12372
This commit is contained in:
Marc Alexander 2014-04-07 20:43:32 +02:00
parent 385420c8f5
commit ad98a070c3
4 changed files with 51 additions and 38 deletions

View file

@ -13,21 +13,23 @@
/** /**
* Set display of page element * Set display of page element
* s[-1,0,1] = hide,toggle display,show *
* @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(n, s, type) function dE(id, action, type) {
{ if (!type) {
if (!type)
{
type = 'block'; type = 'block';
} }
var e = document.getElementById(n); var display = jQuery('#' + id).css('display');
if (!s) if (!action) {
{ action = (display === '' || display === type) ? -1 : 1;
s = (e.style.display == '' || e.style.display == 'block') ? -1 : 1;
} }
e.style.display = (s == 1) ? type : 'none'; jQuery('#' + id).css('display', ((action === 1) ? type : 'none'));
} }
// ]]> // ]]>

View file

@ -37,21 +37,23 @@ function jumpto()
/** /**
* Set display of page element * Set display of page element
* s[-1,0,1] = hide,toggle display,show *
* @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(n, s, type) function dE(id, action, type) {
{ if (!type) {
if (!type)
{
type = 'block'; type = 'block';
} }
var e = document.getElementById(n); var display = jQuery('#' + id).css('display');
if (!s) if (!action) {
{ action = (display === '' || display === type) ? -1 : 1;
s = (e.style.display == '') ? -1 : 1;
} }
e.style.display = (s == 1) ? type : 'none'; jQuery('#' + id).css('display', ((action === 1) ? type : 'none'));
} }
/** /**

View file

@ -50,21 +50,23 @@ function jumpto()
/** /**
* Set display of page element * Set display of page element
* s[-1,0,1] = hide,toggle display,show *
* @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(n, s, type) function dE(id, action, type) {
{ if (!type) {
if (!type)
{
type = 'block'; type = 'block';
} }
var e = document.getElementById(n); var display = jQuery('#' + id).css('display');
if (!s) if (!action) {
{ action = (display === '' || display === type) ? -1 : 1;
s = (e.style.display == '') ? -1 : 1;
} }
e.style.display = (s == 1) ? type : 'none'; jQuery('#' + id).css('display', ((action === 1) ? type : 'none'));
} }
/** /**

View file

@ -4,16 +4,23 @@
// <![CDATA[ // <![CDATA[
/** /**
* Set display of page element * Set display of page element
* s[-1,0,1] = hide,toggle display,show *
* @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(n,s) function dE(id, action, type) {
{ if (!type) {
var e = document.getElementById(n); type = 'block';
if (!s)
{
s = (e.style.display == '') ? -1 : 1;
} }
e.style.display = (s == 1) ? 'block' : 'none';
var display = jQuery('#' + id).css('display');
if (!action) {
action = (display === '' || display === type) ? -1 : 1;
}
jQuery('#' + id).css('display', ((action === 1) ? type : 'none'));
} }
var default_dateformat = '{A_DEFAULT_DATEFORMAT}'; var default_dateformat = '{A_DEFAULT_DATEFORMAT}';