mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-09 02:06:32 +02:00
[ticket/11314] Modify files to comply with coding standards
PHPBB3-11314
This commit is contained in:
@@ -19,8 +19,7 @@ var baseHeight;
|
||||
/**
|
||||
* Shows the help messages in the helpline window
|
||||
*/
|
||||
function helpline(help)
|
||||
{
|
||||
function helpline(help) {
|
||||
document.forms[form_name].helpbox.value = help_line[help];
|
||||
}
|
||||
|
||||
@@ -28,28 +27,22 @@ function helpline(help)
|
||||
* Fix a bug involving the TextRange object. From
|
||||
* http://www.frostjedi.com/terra/scripts/demo/caretBug.html
|
||||
*/
|
||||
function initInsertions()
|
||||
{
|
||||
function initInsertions() {
|
||||
var doc;
|
||||
|
||||
if (document.forms[form_name])
|
||||
{
|
||||
if (document.forms[form_name]) {
|
||||
doc = document;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
doc = opener.document;
|
||||
}
|
||||
|
||||
var textarea = doc.forms[form_name].elements[text_name];
|
||||
|
||||
if (is_ie && typeof(baseHeight) !== 'number')
|
||||
{
|
||||
if (is_ie && typeof(baseHeight) !== 'number') {
|
||||
textarea.focus();
|
||||
baseHeight = doc.selection.createRange().duplicate().boundingHeight;
|
||||
|
||||
if (!document.forms[form_name])
|
||||
{
|
||||
if (!document.forms[form_name]) {
|
||||
document.body.focus();
|
||||
}
|
||||
}
|
||||
@@ -58,14 +51,10 @@ function initInsertions()
|
||||
/**
|
||||
* bbstyle
|
||||
*/
|
||||
function bbstyle(bbnumber)
|
||||
{
|
||||
if (bbnumber !== -1)
|
||||
{
|
||||
function bbstyle(bbnumber) {
|
||||
if (bbnumber !== -1) {
|
||||
bbfontstyle(bbtags[bbnumber], bbtags[bbnumber+1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
insert_text('[*]');
|
||||
document.forms[form_name].elements[text_name].focus();
|
||||
}
|
||||
@@ -74,30 +63,26 @@ function bbstyle(bbnumber)
|
||||
/**
|
||||
* Apply bbcodes
|
||||
*/
|
||||
function bbfontstyle(bbopen, bbclose)
|
||||
{
|
||||
function bbfontstyle(bbopen, bbclose) {
|
||||
theSelection = false;
|
||||
|
||||
var textarea = document.forms[form_name].elements[text_name];
|
||||
|
||||
textarea.focus();
|
||||
|
||||
if ((clientVer >= 4) && is_ie && is_win)
|
||||
{
|
||||
if ((clientVer >= 4) && is_ie && is_win) {
|
||||
// Get text selection
|
||||
theSelection = document.selection.createRange().text;
|
||||
|
||||
if (theSelection)
|
||||
{
|
||||
if (theSelection) {
|
||||
// Add tags around selection
|
||||
document.selection.createRange().text = bbopen + theSelection + bbclose;
|
||||
document.forms[form_name].elements[text_name].focus();
|
||||
theSelection = '';
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (document.forms[form_name].elements[text_name].selectionEnd && (document.forms[form_name].elements[text_name].selectionEnd - document.forms[form_name].elements[text_name].selectionStart > 0))
|
||||
{
|
||||
} else if (document.forms[form_name].elements[text_name].selectionEnd
|
||||
&& (document.forms[form_name].elements[text_name].selectionEnd - document.forms[form_name].elements[text_name].selectionStart > 0)) {
|
||||
mozWrap(document.forms[form_name].elements[text_name], bbopen, bbclose);
|
||||
document.forms[form_name].elements[text_name].focus();
|
||||
theSelection = '';
|
||||
@@ -113,14 +98,12 @@ function bbfontstyle(bbopen, bbclose)
|
||||
|
||||
// Center the cursor when we don't have a selection
|
||||
// Gecko and proper browsers
|
||||
if (!isNaN(textarea.selectionStart))
|
||||
{
|
||||
if (!isNaN(textarea.selectionStart)) {
|
||||
textarea.selectionStart = new_pos;
|
||||
textarea.selectionEnd = new_pos;
|
||||
}
|
||||
// IE
|
||||
else if (document.selection)
|
||||
{
|
||||
else if (document.selection) {
|
||||
var range = textarea.createTextRange();
|
||||
range.move("character", new_pos);
|
||||
range.select();
|
||||
@@ -134,51 +117,39 @@ function bbfontstyle(bbopen, bbclose)
|
||||
/**
|
||||
* Insert text at position
|
||||
*/
|
||||
function insert_text(text, spaces, popup)
|
||||
{
|
||||
function insert_text(text, spaces, popup) {
|
||||
var textarea;
|
||||
|
||||
if (!popup)
|
||||
{
|
||||
if (!popup) {
|
||||
textarea = document.forms[form_name].elements[text_name];
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
textarea = opener.document.forms[form_name].elements[text_name];
|
||||
}
|
||||
|
||||
if (spaces)
|
||||
{
|
||||
if (spaces) {
|
||||
text = ' ' + text + ' ';
|
||||
}
|
||||
|
||||
if (!isNaN(textarea.selectionStart))
|
||||
{
|
||||
if (!isNaN(textarea.selectionStart)) {
|
||||
var sel_start = textarea.selectionStart;
|
||||
var sel_end = textarea.selectionEnd;
|
||||
|
||||
mozWrap(textarea, text, '');
|
||||
textarea.selectionStart = sel_start + text.length;
|
||||
textarea.selectionEnd = sel_end + text.length;
|
||||
}
|
||||
else if (textarea.createTextRange && textarea.caretPos)
|
||||
{
|
||||
if (baseHeight !== textarea.caretPos.boundingHeight)
|
||||
{
|
||||
} else if (textarea.createTextRange && textarea.caretPos) {
|
||||
if (baseHeight !== textarea.caretPos.boundingHeight) {
|
||||
textarea.focus();
|
||||
storeCaret(textarea);
|
||||
}
|
||||
|
||||
var caret_pos = textarea.caretPos;
|
||||
caret_pos.text = caret_pos.text.charAt(caret_pos.text.length - 1) === ' ' ? caret_pos.text + text + ' ' : caret_pos.text + text;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
textarea.value = textarea.value + text;
|
||||
}
|
||||
|
||||
if (!popup)
|
||||
{
|
||||
if (!popup) {
|
||||
textarea.focus();
|
||||
}
|
||||
}
|
||||
@@ -186,8 +157,7 @@ function insert_text(text, spaces, popup)
|
||||
/**
|
||||
* Add inline attachment at position
|
||||
*/
|
||||
function attach_inline(index, filename)
|
||||
{
|
||||
function attach_inline(index, filename) {
|
||||
insert_text('[attachment=' + index + ']' + filename + '[/attachment]');
|
||||
document.forms[form_name].elements[text_name].focus();
|
||||
}
|
||||
@@ -201,56 +171,39 @@ function addquote(post_id, username)
|
||||
var theSelection = '';
|
||||
var divarea = false;
|
||||
|
||||
if (document.all)
|
||||
{
|
||||
if (document.all) {
|
||||
divarea = document.all[message_name];
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
divarea = document.getElementById(message_name);
|
||||
}
|
||||
|
||||
// Get text selection - not only the post content :(
|
||||
if (window.getSelection)
|
||||
{
|
||||
if (window.getSelection) {
|
||||
theSelection = window.getSelection().toString();
|
||||
}
|
||||
else if (document.getSelection)
|
||||
{
|
||||
} else if (document.getSelection) {
|
||||
theSelection = document.getSelection();
|
||||
}
|
||||
else if (document.selection)
|
||||
{
|
||||
} else if (document.selection) {
|
||||
theSelection = document.selection.createRange().text;
|
||||
}
|
||||
|
||||
if (theSelection === '' || typeof theSelection === 'undefined' || theSelection === null)
|
||||
{
|
||||
if (divarea.innerHTML)
|
||||
{
|
||||
if (theSelection === '' || typeof theSelection === 'undefined' || theSelection === null) {
|
||||
if (divarea.innerHTML) {
|
||||
theSelection = divarea.innerHTML.replace(/<br>/ig, '\n');
|
||||
theSelection = theSelection.replace(/<br\/>/ig, '\n');
|
||||
theSelection = theSelection.replace(/<\;/ig, '<');
|
||||
theSelection = theSelection.replace(/>\;/ig, '>');
|
||||
theSelection = theSelection.replace(/&\;/ig, '&');
|
||||
theSelection = theSelection.replace(/ \;/ig, ' ');
|
||||
}
|
||||
else if (document.all)
|
||||
{
|
||||
} else if (document.all) {
|
||||
theSelection = divarea.innerText;
|
||||
}
|
||||
else if (divarea.textContent)
|
||||
{
|
||||
} else if (divarea.textContent) {
|
||||
theSelection = divarea.textContent;
|
||||
}
|
||||
else if (divarea.firstChild.nodeValue)
|
||||
{
|
||||
} else if (divarea.firstChild.nodeValue) {
|
||||
theSelection = divarea.firstChild.nodeValue;
|
||||
}
|
||||
}
|
||||
|
||||
if (theSelection)
|
||||
{
|
||||
if (theSelection) {
|
||||
insert_text('[quote="' + username + '"]' + theSelection + '[/quote]');
|
||||
}
|
||||
|
||||
@@ -260,15 +213,13 @@ function addquote(post_id, username)
|
||||
/**
|
||||
* From http://www.massless.org/mozedit/
|
||||
*/
|
||||
function mozWrap(txtarea, open, close)
|
||||
{
|
||||
function mozWrap(txtarea, open, close) {
|
||||
var selLength = (typeof(txtarea.textLength) === 'undefined') ? txtarea.value.length : txtarea.textLength;
|
||||
var selStart = txtarea.selectionStart;
|
||||
var selEnd = txtarea.selectionEnd;
|
||||
var scrollTop = txtarea.scrollTop;
|
||||
|
||||
if (selEnd === 1 || selEnd === 2)
|
||||
{
|
||||
if (selEnd === 1 || selEnd === 2) {
|
||||
selEnd = selLength;
|
||||
}
|
||||
|
||||
@@ -289,10 +240,8 @@ function mozWrap(txtarea, open, close)
|
||||
* Insert at Caret position. Code from
|
||||
* http://www.faqts.com/knowledge_base/view.phtml/aid/1052/fid/130
|
||||
*/
|
||||
function storeCaret(textEl)
|
||||
{
|
||||
if (textEl.createTextRange)
|
||||
{
|
||||
function storeCaret(textEl) {
|
||||
if (textEl.createTextRange) {
|
||||
textEl.caretPos = document.selection.createRange().duplicate();
|
||||
}
|
||||
}
|
||||
@@ -300,8 +249,7 @@ function storeCaret(textEl)
|
||||
/**
|
||||
* Color pallette
|
||||
*/
|
||||
function colorPalette(dir, width, height)
|
||||
{
|
||||
function colorPalette(dir, width, height) {
|
||||
var r = 0, g = 0, b = 0;
|
||||
var numberList = new Array(6);
|
||||
var color = '';
|
||||
@@ -314,36 +262,29 @@ function colorPalette(dir, width, height)
|
||||
|
||||
document.writeln('<table class="type2">');
|
||||
|
||||
for (r = 0; r < 5; r++)
|
||||
{
|
||||
if (dir === 'h')
|
||||
{
|
||||
for (r = 0; r < 5; r++) {
|
||||
if (dir === 'h') {
|
||||
document.writeln('<tr>');
|
||||
}
|
||||
|
||||
for (g = 0; g < 5; g++)
|
||||
{
|
||||
if (dir === 'v')
|
||||
{
|
||||
for (g = 0; g < 5; g++) {
|
||||
if (dir === 'v') {
|
||||
document.writeln('<tr>');
|
||||
}
|
||||
|
||||
for (b = 0; b < 5; b++)
|
||||
{
|
||||
for (b = 0; b < 5; b++) {
|
||||
color = String(numberList[r]) + String(numberList[g]) + String(numberList[b]);
|
||||
document.write('<td bgcolor="#' + color + '" style="width: ' + width + 'px; height: ' + height + 'px;">');
|
||||
document.write('<a href="#" onclick="bbfontstyle(\'[color=#' + color + ']\', \'[/color]\'); return false;"><img src="images/spacer.gif" width="' + width + '" height="' + height + '" alt="#' + color + '" title="#' + color + '" /></a>');
|
||||
document.writeln('</td>');
|
||||
}
|
||||
|
||||
if (dir === 'v')
|
||||
{
|
||||
if (dir === 'v') {
|
||||
document.writeln('</tr>');
|
||||
}
|
||||
}
|
||||
|
||||
if (dir === 'h')
|
||||
{
|
||||
if (dir === 'h') {
|
||||
document.writeln('</tr>');
|
||||
}
|
||||
}
|
||||
@@ -353,8 +294,7 @@ function colorPalette(dir, width, height)
|
||||
/**
|
||||
* Caret Position object
|
||||
*/
|
||||
function caretPosition()
|
||||
{
|
||||
function caretPosition() {
|
||||
var start = null;
|
||||
var end = null;
|
||||
}
|
||||
@@ -362,19 +302,16 @@ function caretPosition()
|
||||
/**
|
||||
* Get the caret position in an textarea
|
||||
*/
|
||||
function getCaretPosition(txtarea)
|
||||
{
|
||||
function getCaretPosition(txtarea) {
|
||||
var caretPos = new caretPosition();
|
||||
|
||||
// simple Gecko/Opera way
|
||||
if (txtarea.selectionStart || txtarea.selectionStart === 0)
|
||||
{
|
||||
if (txtarea.selectionStart || txtarea.selectionStart === 0) {
|
||||
caretPos.start = txtarea.selectionStart;
|
||||
caretPos.end = txtarea.selectionEnd;
|
||||
}
|
||||
// dirty and slow IE way
|
||||
else if (document.selection)
|
||||
{
|
||||
else if (document.selection) {
|
||||
// get current selection
|
||||
var range = document.selection.createRange();
|
||||
|
||||
@@ -384,8 +321,7 @@ function getCaretPosition(txtarea)
|
||||
|
||||
// calculate selection start point by moving beginning of range_all to beginning of range
|
||||
var sel_start;
|
||||
for (sel_start = 0; range_all.compareEndPoints('StartToStart', range) < 0; sel_start++)
|
||||
{
|
||||
for (sel_start = 0; range_all.compareEndPoints('StartToStart', range) < 0; sel_start++) {
|
||||
range_all.moveStart('character', 1);
|
||||
}
|
||||
|
||||
|
@@ -2,35 +2,27 @@
|
||||
* Hide and show all checkboxes
|
||||
* status = true (show boxes), false (hide boxes)
|
||||
*/
|
||||
function display_checkboxes(status)
|
||||
{
|
||||
function display_checkboxes(status) {
|
||||
var form = document.getElementById('set-permissions');
|
||||
var cb = document.getElementsByTagName('input');
|
||||
var display;
|
||||
|
||||
//show
|
||||
if (status)
|
||||
{
|
||||
if (status) {
|
||||
display = 'inline';
|
||||
}
|
||||
//hide
|
||||
else
|
||||
{
|
||||
else {
|
||||
display = 'none';
|
||||
}
|
||||
|
||||
for (var i = 0; i < cb.length; i++ )
|
||||
{
|
||||
if (cb[i].className === 'permissions-checkbox')
|
||||
{
|
||||
|
||||
for (var i = 0; i < cb.length; i++ ) {
|
||||
if (cb[i].className === 'permissions-checkbox') {
|
||||
cb[i].style.display = display;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Change opacity of element
|
||||
* e = element
|
||||
@@ -38,7 +30,7 @@ function display_checkboxes(status)
|
||||
*/
|
||||
function set_opacity(e, value) {
|
||||
e.style.opacity = value/10;
|
||||
|
||||
|
||||
//IE opacity currently turned off, because of its astronomical stupidity
|
||||
//e.style.filter = 'alpha(opacity=' + value*10 + ')';
|
||||
}
|
||||
@@ -50,13 +42,10 @@ function set_opacity(e, value) {
|
||||
function toggle_opacity(block_id) {
|
||||
var cb = document.getElementById('checkbox' + block_id);
|
||||
var fs = document.getElementById('perm' + block_id);
|
||||
|
||||
if (cb.checked)
|
||||
{
|
||||
|
||||
if (cb.checked) {
|
||||
set_opacity(fs, 5);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
set_opacity(fs, 10);
|
||||
}
|
||||
}
|
||||
@@ -71,21 +60,17 @@ function reset_opacity(status, except_id) {
|
||||
var fs = perm.getElementsByTagName('fieldset');
|
||||
var opacity = 5;
|
||||
|
||||
if (status)
|
||||
{
|
||||
opacity = 10;
|
||||
if (status) {
|
||||
opacity = 10;
|
||||
}
|
||||
|
||||
for (var i = 0; i < fs.length; i++ )
|
||||
{
|
||||
if (fs[i].className !== 'quick')
|
||||
{
|
||||
|
||||
for (var i = 0; i < fs.length; i++ ) {
|
||||
if (fs[i].className !== 'quick') {
|
||||
set_opacity(fs[i], opacity);
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof(except_id) !== 'undefined')
|
||||
{
|
||||
if (typeof(except_id) !== 'undefined') {
|
||||
set_opacity(document.getElementById('perm' + except_id), 10);
|
||||
}
|
||||
|
||||
@@ -93,20 +78,15 @@ function reset_opacity(status, except_id) {
|
||||
marklist('set-permissions', 'inherit', !status);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check whether we have a full radiobutton row of true
|
||||
* index = offset for the row of inputs (0 == first row, 1 == second, 2 == third),
|
||||
* rb = array of radiobuttons
|
||||
*/
|
||||
function get_radio_status(index, rb)
|
||||
{
|
||||
for (var i = index; i < rb.length; i = i + 3 )
|
||||
{
|
||||
if (rb[i].checked !== true)
|
||||
{
|
||||
if (i > index)
|
||||
{
|
||||
function get_radio_status(index, rb) {
|
||||
for (var i = index; i < rb.length; i = i + 3 ) {
|
||||
if (rb[i].checked !== true) {
|
||||
if (i > index) {
|
||||
//at least one is true, but not all (custom)
|
||||
return 2;
|
||||
}
|
||||
@@ -121,17 +101,15 @@ function get_radio_status(index, rb)
|
||||
|
||||
/**
|
||||
* Set tab colours
|
||||
* id = panel the tab needs to be set for,
|
||||
* init = initialising on open,
|
||||
* id = panel the tab needs to be set for,
|
||||
* init = initialising on open,
|
||||
* quick = If no calculation needed, this contains the colour
|
||||
*/
|
||||
function set_colours(id, init, quick)
|
||||
{
|
||||
function set_colours(id, init, quick) {
|
||||
var table = document.getElementById('table' + id);
|
||||
var tab = document.getElementById('tab' + id);
|
||||
|
||||
if (typeof(quick) !== 'undefined')
|
||||
{
|
||||
if (typeof(quick) !== 'undefined') {
|
||||
tab.className = 'permissions-preset-' + quick + ' activetab';
|
||||
return;
|
||||
}
|
||||
@@ -141,37 +119,27 @@ function set_colours(id, init, quick)
|
||||
|
||||
var status = get_radio_status(0, rb);
|
||||
|
||||
if (status === 1)
|
||||
{
|
||||
if (status === 1) {
|
||||
colour = 'yes';
|
||||
}
|
||||
else if (status === 0)
|
||||
{
|
||||
} else if (status === 0) {
|
||||
// We move on to No
|
||||
status = get_radio_status(1, rb);
|
||||
|
||||
if (status === 1)
|
||||
{
|
||||
if (status === 1) {
|
||||
colour = 'no';
|
||||
}
|
||||
else if (status === 0)
|
||||
{
|
||||
} else if (status === 0) {
|
||||
// We move on to Never
|
||||
status = get_radio_status(2, rb);
|
||||
|
||||
if (status === 1)
|
||||
{
|
||||
if (status === 1) {
|
||||
colour = 'never';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (init)
|
||||
{
|
||||
if (init) {
|
||||
tab.className = 'permissions-preset-' + colour;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
tab.className = 'permissions-preset-' + colour + ' activetab';
|
||||
}
|
||||
}
|
||||
@@ -180,16 +148,13 @@ function set_colours(id, init, quick)
|
||||
* Initialise advanced tab colours on first load
|
||||
* block_id = block that is opened
|
||||
*/
|
||||
function init_colours(block_id)
|
||||
{
|
||||
function init_colours(block_id) {
|
||||
var block = document.getElementById('advanced' + block_id);
|
||||
var panels = block.getElementsByTagName('div');
|
||||
var tab = document.getElementById('tab' + id);
|
||||
|
||||
for (var i = 0; i < panels.length; i++)
|
||||
{
|
||||
if(panels[i].className === 'permissions-panel')
|
||||
{
|
||||
for (var i = 0; i < panels.length; i++) {
|
||||
if (panels[i].className === 'permissions-panel') {
|
||||
set_colours(panels[i].id.replace(/options/, ''), true);
|
||||
}
|
||||
}
|
||||
@@ -203,17 +168,15 @@ function init_colours(block_id)
|
||||
* adv = we are opening advanced permissions
|
||||
* view = called from view permissions
|
||||
*/
|
||||
function swap_options(pmask, fmask, cat, adv, view)
|
||||
{
|
||||
function swap_options(pmask, fmask, cat, adv, view) {
|
||||
id = pmask + fmask + cat;
|
||||
active_option = active_pmask + active_fmask + active_cat;
|
||||
|
||||
var old_tab = document.getElementById('tab' + active_option);
|
||||
var old_tab = document.getElementById('tab' + active_option);
|
||||
var new_tab = document.getElementById('tab' + id);
|
||||
var adv_block = document.getElementById('advanced' + pmask + fmask);
|
||||
|
||||
if (adv_block.style.display === 'block' && adv === true)
|
||||
{
|
||||
if (adv_block.style.display === 'block' && adv === true) {
|
||||
dE('advanced' + pmask + fmask, -1);
|
||||
reset_opacity(1);
|
||||
display_checkboxes(false);
|
||||
@@ -221,20 +184,16 @@ function swap_options(pmask, fmask, cat, adv, view)
|
||||
}
|
||||
|
||||
// no need to set anything if we are clicking on the same tab again
|
||||
if (new_tab === old_tab && !adv)
|
||||
{
|
||||
if (new_tab === old_tab && !adv) {
|
||||
return;
|
||||
}
|
||||
|
||||
// init colours
|
||||
if (adv && (pmask + fmask) !== (active_pmask + active_fmask))
|
||||
{
|
||||
if (adv && (pmask + fmask) !== (active_pmask + active_fmask)) {
|
||||
init_colours(pmask + fmask);
|
||||
display_checkboxes(true);
|
||||
reset_opacity(1);
|
||||
}
|
||||
else if (adv)
|
||||
{
|
||||
} else if (adv) {
|
||||
//Checkbox might have been clicked, but we need full visibility
|
||||
display_checkboxes(true);
|
||||
reset_opacity(1);
|
||||
@@ -244,31 +203,26 @@ function swap_options(pmask, fmask, cat, adv, view)
|
||||
old_tab.className = old_tab.className.replace(/\ activetab/g, '');
|
||||
new_tab.className = new_tab.className + ' activetab';
|
||||
|
||||
if (id === active_option && adv !== true)
|
||||
{
|
||||
if (id === active_option && adv !== true) {
|
||||
return;
|
||||
}
|
||||
|
||||
dE('options' + active_option, -1);
|
||||
|
||||
|
||||
//hiding and showing the checkbox
|
||||
if (document.getElementById('checkbox' + active_pmask + active_fmask))
|
||||
{
|
||||
dE('checkbox' + pmask + fmask, -1);
|
||||
|
||||
if ((pmask + fmask) !== (active_pmask + active_fmask))
|
||||
{
|
||||
if (document.getElementById('checkbox' + active_pmask + active_fmask)) {
|
||||
dE('checkbox' + pmask + fmask, -1);
|
||||
|
||||
if ((pmask + fmask) !== (active_pmask + active_fmask)) {
|
||||
document.getElementById('checkbox' + active_pmask + active_fmask).style.display = 'inline';
|
||||
}
|
||||
}
|
||||
|
||||
if (!view)
|
||||
{
|
||||
if (!view) {
|
||||
dE('advanced' + active_pmask + active_fmask, -1);
|
||||
}
|
||||
|
||||
if (!view)
|
||||
{
|
||||
if (!view) {
|
||||
dE('advanced' + pmask + fmask, 1);
|
||||
}
|
||||
dE('options' + id, 1);
|
||||
@@ -282,41 +236,33 @@ function swap_options(pmask, fmask, cat, adv, view)
|
||||
* Mark all radio buttons in one panel
|
||||
* id = table ID container, s = status ['y'/'u'/'n']
|
||||
*/
|
||||
function mark_options(id, s)
|
||||
{
|
||||
function mark_options(id, s) {
|
||||
var t = document.getElementById(id);
|
||||
|
||||
if (!t)
|
||||
{
|
||||
if (!t) {
|
||||
return;
|
||||
}
|
||||
|
||||
var rb = t.getElementsByTagName('input');
|
||||
|
||||
for (var r = 0; r < rb.length; r++)
|
||||
{
|
||||
if (rb[r].id.substr(rb[r].id.length-1) === s)
|
||||
{
|
||||
for (var r = 0; r < rb.length; r++) {
|
||||
if (rb[r].id.substr(rb[r].id.length-1) === s) {
|
||||
rb[r].checked = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function mark_one_option(id, field_name, s)
|
||||
{
|
||||
function mark_one_option(id, field_name, s) {
|
||||
var t = document.getElementById(id);
|
||||
|
||||
if (!t)
|
||||
{
|
||||
if (!t) {
|
||||
return;
|
||||
}
|
||||
|
||||
var rb = t.getElementsByTagName('input');
|
||||
|
||||
for (var r = 0; r < rb.length; r++)
|
||||
{
|
||||
if (rb[r].id.substr(rb[r].id.length-field_name.length-3, field_name.length) === field_name && rb[r].id.substr(rb[r].id.length-1) === s)
|
||||
{
|
||||
for (var r = 0; r < rb.length; r++) {
|
||||
if (rb[r].id.substr(rb[r].id.length-field_name.length-3, field_name.length) === field_name && rb[r].id.substr(rb[r].id.length-1) === s) {
|
||||
rb[r].checked = true;
|
||||
}
|
||||
}
|
||||
@@ -325,12 +271,10 @@ function mark_one_option(id, field_name, s)
|
||||
/**
|
||||
* Reset role dropdown field to Select role... if an option gets changed
|
||||
*/
|
||||
function reset_role(id)
|
||||
{
|
||||
function reset_role(id) {
|
||||
var t = document.getElementById(id);
|
||||
|
||||
if (!t)
|
||||
{
|
||||
if (!t) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -340,20 +284,17 @@ function reset_role(id)
|
||||
/**
|
||||
* Load role and set options accordingly
|
||||
*/
|
||||
function set_role_settings(role_id, target_id)
|
||||
{
|
||||
function set_role_settings(role_id, target_id) {
|
||||
settings = role_options[role_id];
|
||||
|
||||
if (!settings)
|
||||
{
|
||||
if (!settings) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Mark all options to no (unset) first...
|
||||
mark_options(target_id, 'u');
|
||||
|
||||
for (var r in settings)
|
||||
{
|
||||
for (var r in settings) {
|
||||
mark_one_option(target_id, r, (settings[r] === 1) ? 'y' : 'n');
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
javascript for Bubble Tooltips by Alessandro Fulciniti
|
||||
- http://pro.html.it - http://web-graphics.com
|
||||
- http://pro.html.it - http://web-graphics.com
|
||||
obtained from: http://web-graphics.com/mtarchive/001717.php
|
||||
|
||||
phpBB Development Team:
|
||||
@@ -15,14 +15,12 @@ var head_text, tooltip_mode;
|
||||
/**
|
||||
* Enable tooltip replacements for links
|
||||
*/
|
||||
function enable_tooltips_link(id, headline, sub_id)
|
||||
{
|
||||
function enable_tooltips_link(id, headline, sub_id) {
|
||||
var links, i, hold;
|
||||
|
||||
|
||||
head_text = headline;
|
||||
|
||||
if (!document.getElementById || !document.getElementsByTagName)
|
||||
{
|
||||
if (!document.getElementById || !document.getElementsByTagName) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -33,26 +31,18 @@ function enable_tooltips_link(id, headline, sub_id)
|
||||
|
||||
document.getElementsByTagName('body')[0].appendChild(hold);
|
||||
|
||||
if (id === null)
|
||||
{
|
||||
if (id === null) {
|
||||
links = document.getElementsByTagName('a');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
links = document.getElementById(id).getElementsByTagName('a');
|
||||
}
|
||||
|
||||
for (i = 0; i < links.length; i++)
|
||||
{
|
||||
if (sub_id)
|
||||
{
|
||||
if (links[i].id.substr(0, sub_id.length) === sub_id)
|
||||
{
|
||||
for (i = 0; i < links.length; i++) {
|
||||
if (sub_id) {
|
||||
if (links[i].id.substr(0, sub_id.length) === sub_id) {
|
||||
prepare(links[i]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
prepare(links[i]);
|
||||
}
|
||||
}
|
||||
@@ -63,14 +53,12 @@ function enable_tooltips_link(id, headline, sub_id)
|
||||
/**
|
||||
* Enable tooltip replacements for selects
|
||||
*/
|
||||
function enable_tooltips_select(id, headline, sub_id)
|
||||
{
|
||||
function enable_tooltips_select(id, headline, sub_id) {
|
||||
var links, i, hold;
|
||||
|
||||
|
||||
head_text = headline;
|
||||
|
||||
if (!document.getElementById || !document.getElementsByTagName)
|
||||
{
|
||||
if (!document.getElementById || !document.getElementsByTagName) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -81,26 +69,18 @@ function enable_tooltips_select(id, headline, sub_id)
|
||||
|
||||
document.getElementsByTagName('body')[0].appendChild(hold);
|
||||
|
||||
if (id === null)
|
||||
{
|
||||
if (id === null) {
|
||||
links = document.getElementsByTagName('option');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
links = document.getElementById(id).getElementsByTagName('option');
|
||||
}
|
||||
|
||||
for (i = 0; i < links.length; i++)
|
||||
{
|
||||
if (sub_id)
|
||||
{
|
||||
if (links[i].parentNode.id.substr(0, sub_id.length) === sub_id)
|
||||
{
|
||||
for (i = 0; i < links.length; i++) {
|
||||
if (sub_id) {
|
||||
if (links[i].parentNode.id.substr(0, sub_id.length) === sub_id) {
|
||||
prepare(links[i]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
prepare(links[i]);
|
||||
}
|
||||
}
|
||||
@@ -111,14 +91,12 @@ function enable_tooltips_select(id, headline, sub_id)
|
||||
/**
|
||||
* Prepare elements to replace
|
||||
*/
|
||||
function prepare(element)
|
||||
{
|
||||
function prepare(element) {
|
||||
var tooltip, text, desc, title;
|
||||
|
||||
text = element.getAttribute('title');
|
||||
|
||||
if (text === null || text.length === 0)
|
||||
{
|
||||
if (text === null || text.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -139,8 +117,7 @@ function prepare(element)
|
||||
element.onmouseover = show_tooltip;
|
||||
element.onmouseout = hide_tooltip;
|
||||
|
||||
if (tooltip_mode === 'link')
|
||||
{
|
||||
if (tooltip_mode === 'link') {
|
||||
element.onmousemove = locate;
|
||||
}
|
||||
}
|
||||
@@ -148,8 +125,7 @@ function prepare(element)
|
||||
/**
|
||||
* Show tooltip
|
||||
*/
|
||||
function show_tooltip(e)
|
||||
{
|
||||
function show_tooltip(e) {
|
||||
document.getElementById('_tooltip_container').appendChild(this.tooltip);
|
||||
locate(this);
|
||||
}
|
||||
@@ -157,11 +133,9 @@ function show_tooltip(e)
|
||||
/**
|
||||
* Hide tooltip
|
||||
*/
|
||||
function hide_tooltip(e)
|
||||
{
|
||||
function hide_tooltip(e) {
|
||||
var d = document.getElementById('_tooltip_container');
|
||||
if (d.childNodes.length > 0)
|
||||
{
|
||||
if (d.childNodes.length > 0) {
|
||||
d.removeChild(d.firstChild);
|
||||
}
|
||||
}
|
||||
@@ -169,8 +143,7 @@ function hide_tooltip(e)
|
||||
/**
|
||||
* Set opacity on tooltip element
|
||||
*/
|
||||
function set_opacity(element)
|
||||
{
|
||||
function set_opacity(element) {
|
||||
element.style.filter = 'alpha(opacity:95)';
|
||||
element.style.KHTMLOpacity = '0.95';
|
||||
element.style.MozOpacity = '0.95';
|
||||
@@ -180,8 +153,7 @@ function set_opacity(element)
|
||||
/**
|
||||
* Create new element
|
||||
*/
|
||||
function create_element(tag, c)
|
||||
{
|
||||
function create_element(tag, c) {
|
||||
var x = document.createElement(tag);
|
||||
x.className = c;
|
||||
x.style.display = 'block';
|
||||
@@ -191,34 +163,26 @@ function create_element(tag, c)
|
||||
/**
|
||||
* Correct positioning of tooltip container
|
||||
*/
|
||||
function locate(e)
|
||||
{
|
||||
function locate(e) {
|
||||
var posx = 0;
|
||||
var posy = 0;
|
||||
|
||||
e = e.parentNode;
|
||||
|
||||
if (e.offsetParent)
|
||||
{
|
||||
for (posx = 0, posy = 0; e.offsetParent; e = e.offsetParent)
|
||||
{
|
||||
if (e.offsetParent) {
|
||||
for (posx = 0, posy = 0; e.offsetParent; e = e.offsetParent) {
|
||||
posx += e.offsetLeft;
|
||||
posy += e.offsetTop;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
posx = e.offsetLeft;
|
||||
posy = e.offsetTop;
|
||||
}
|
||||
|
||||
if (tooltip_mode === 'link')
|
||||
{
|
||||
if (tooltip_mode === 'link') {
|
||||
document.getElementById('_tooltip_container').style.top=(posy+20) + 'px';
|
||||
document.getElementById('_tooltip_container').style.left=(posx-20) + 'px';
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
document.getElementById('_tooltip_container').style.top=(posy+30) + 'px';
|
||||
document.getElementById('_tooltip_container').style.left=(posx-205) + 'px';
|
||||
}
|
||||
|
Reference in New Issue
Block a user