mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/11314] Fix issues mentioned in jshint report
Additionally, the editor.js files are now the same file in both subsilver2, prosilver, and the acp. PHPBB3-11314
This commit is contained in:
parent
96b1cabcf2
commit
36168b311e
8 changed files with 207 additions and 181 deletions
|
@ -21,7 +21,7 @@ function display_checkboxes(status)
|
||||||
|
|
||||||
for (var i = 0; i < cb.length; i++ )
|
for (var i = 0; i < cb.length; i++ )
|
||||||
{
|
{
|
||||||
if (cb[i].className == 'permissions-checkbox')
|
if (cb[i].className === 'permissions-checkbox')
|
||||||
{
|
{
|
||||||
cb[i].style.display = display;
|
cb[i].style.display = display;
|
||||||
}
|
}
|
||||||
|
@ -78,13 +78,13 @@ function reset_opacity(status, except_id) {
|
||||||
|
|
||||||
for (var i = 0; i < fs.length; i++ )
|
for (var i = 0; i < fs.length; i++ )
|
||||||
{
|
{
|
||||||
if (fs[i].className != 'quick')
|
if (fs[i].className !== 'quick')
|
||||||
{
|
{
|
||||||
set_opacity(fs[i], opacity);
|
set_opacity(fs[i], opacity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof(except_id) != 'undefined')
|
if (typeof(except_id) !== 'undefined')
|
||||||
{
|
{
|
||||||
set_opacity(document.getElementById('perm' + except_id), 10);
|
set_opacity(document.getElementById('perm' + except_id), 10);
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ function get_radio_status(index, rb)
|
||||||
{
|
{
|
||||||
for (var i = index; i < rb.length; i = i + 3 )
|
for (var i = index; i < rb.length; i = i + 3 )
|
||||||
{
|
{
|
||||||
if (rb[i].checked != true)
|
if (rb[i].checked !== true)
|
||||||
{
|
{
|
||||||
if (i > index)
|
if (i > index)
|
||||||
{
|
{
|
||||||
|
@ -130,7 +130,7 @@ function set_colours(id, init, quick)
|
||||||
var table = document.getElementById('table' + id);
|
var table = document.getElementById('table' + id);
|
||||||
var tab = document.getElementById('tab' + id);
|
var tab = document.getElementById('tab' + id);
|
||||||
|
|
||||||
if (typeof(quick) != 'undefined')
|
if (typeof(quick) !== 'undefined')
|
||||||
{
|
{
|
||||||
tab.className = 'permissions-preset-' + quick + ' activetab';
|
tab.className = 'permissions-preset-' + quick + ' activetab';
|
||||||
return;
|
return;
|
||||||
|
@ -141,25 +141,25 @@ function set_colours(id, init, quick)
|
||||||
|
|
||||||
var status = get_radio_status(0, rb);
|
var status = get_radio_status(0, rb);
|
||||||
|
|
||||||
if (status == 1)
|
if (status === 1)
|
||||||
{
|
{
|
||||||
colour = 'yes';
|
colour = 'yes';
|
||||||
}
|
}
|
||||||
else if (status == 0)
|
else if (status === 0)
|
||||||
{
|
{
|
||||||
// We move on to No
|
// We move on to No
|
||||||
status = get_radio_status(1, rb);
|
status = get_radio_status(1, rb);
|
||||||
|
|
||||||
if (status == 1)
|
if (status === 1)
|
||||||
{
|
{
|
||||||
colour = 'no';
|
colour = 'no';
|
||||||
}
|
}
|
||||||
else if (status == 0)
|
else if (status === 0)
|
||||||
{
|
{
|
||||||
// We move on to Never
|
// We move on to Never
|
||||||
status = get_radio_status(2, rb);
|
status = get_radio_status(2, rb);
|
||||||
|
|
||||||
if (status == 1)
|
if (status === 1)
|
||||||
{
|
{
|
||||||
colour = 'never';
|
colour = 'never';
|
||||||
}
|
}
|
||||||
|
@ -188,7 +188,7 @@ function init_colours(block_id)
|
||||||
|
|
||||||
for (var i = 0; i < panels.length; i++)
|
for (var i = 0; i < panels.length; i++)
|
||||||
{
|
{
|
||||||
if(panels[i].className == 'permissions-panel')
|
if(panels[i].className === 'permissions-panel')
|
||||||
{
|
{
|
||||||
set_colours(panels[i].id.replace(/options/, ''), true);
|
set_colours(panels[i].id.replace(/options/, ''), true);
|
||||||
}
|
}
|
||||||
|
@ -212,7 +212,7 @@ function swap_options(pmask, fmask, cat, adv, view)
|
||||||
var new_tab = document.getElementById('tab' + id);
|
var new_tab = document.getElementById('tab' + id);
|
||||||
var adv_block = document.getElementById('advanced' + pmask + fmask);
|
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);
|
dE('advanced' + pmask + fmask, -1);
|
||||||
reset_opacity(1);
|
reset_opacity(1);
|
||||||
|
@ -221,13 +221,13 @@ function swap_options(pmask, fmask, cat, adv, view)
|
||||||
}
|
}
|
||||||
|
|
||||||
// no need to set anything if we are clicking on the same tab again
|
// 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// init colours
|
// init colours
|
||||||
if (adv && (pmask + fmask) != (active_pmask + active_fmask))
|
if (adv && (pmask + fmask) !== (active_pmask + active_fmask))
|
||||||
{
|
{
|
||||||
init_colours(pmask + fmask);
|
init_colours(pmask + fmask);
|
||||||
display_checkboxes(true);
|
display_checkboxes(true);
|
||||||
|
@ -244,7 +244,7 @@ function swap_options(pmask, fmask, cat, adv, view)
|
||||||
old_tab.className = old_tab.className.replace(/\ activetab/g, '');
|
old_tab.className = old_tab.className.replace(/\ activetab/g, '');
|
||||||
new_tab.className = new_tab.className + ' activetab';
|
new_tab.className = new_tab.className + ' activetab';
|
||||||
|
|
||||||
if (id == active_option && adv != true)
|
if (id === active_option && adv !== true)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -256,7 +256,7 @@ function swap_options(pmask, fmask, cat, adv, view)
|
||||||
{
|
{
|
||||||
dE('checkbox' + pmask + fmask, -1);
|
dE('checkbox' + pmask + fmask, -1);
|
||||||
|
|
||||||
if ((pmask + fmask) != (active_pmask + active_fmask))
|
if ((pmask + fmask) !== (active_pmask + active_fmask))
|
||||||
{
|
{
|
||||||
document.getElementById('checkbox' + active_pmask + active_fmask).style.display = 'inline';
|
document.getElementById('checkbox' + active_pmask + active_fmask).style.display = 'inline';
|
||||||
}
|
}
|
||||||
|
@ -295,7 +295,7 @@ function mark_options(id, s)
|
||||||
|
|
||||||
for (var r = 0; r < rb.length; r++)
|
for (var r = 0; r < rb.length; r++)
|
||||||
{
|
{
|
||||||
if (rb[r].id.substr(rb[r].id.length-1) == s)
|
if (rb[r].id.substr(rb[r].id.length-1) === s)
|
||||||
{
|
{
|
||||||
rb[r].checked = true;
|
rb[r].checked = true;
|
||||||
}
|
}
|
||||||
|
@ -315,7 +315,7 @@ function mark_one_option(id, field_name, s)
|
||||||
|
|
||||||
for (var r = 0; r < rb.length; r++)
|
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)
|
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;
|
rb[r].checked = true;
|
||||||
}
|
}
|
||||||
|
@ -354,6 +354,6 @@ function set_role_settings(role_id, target_id)
|
||||||
|
|
||||||
for (var r in settings)
|
for (var r in settings)
|
||||||
{
|
{
|
||||||
mark_one_option(target_id, r, (settings[r] == 1) ? 'y' : 'n');
|
mark_one_option(target_id, r, (settings[r] === 1) ? 'y' : 'n');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ function enable_tooltips_link(id, headline, sub_id)
|
||||||
|
|
||||||
document.getElementsByTagName('body')[0].appendChild(hold);
|
document.getElementsByTagName('body')[0].appendChild(hold);
|
||||||
|
|
||||||
if (id == null)
|
if (id === null)
|
||||||
{
|
{
|
||||||
links = document.getElementsByTagName('a');
|
links = document.getElementsByTagName('a');
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ function enable_tooltips_link(id, headline, sub_id)
|
||||||
{
|
{
|
||||||
if (sub_id)
|
if (sub_id)
|
||||||
{
|
{
|
||||||
if (links[i].id.substr(0, sub_id.length) == sub_id)
|
if (links[i].id.substr(0, sub_id.length) === sub_id)
|
||||||
{
|
{
|
||||||
prepare(links[i]);
|
prepare(links[i]);
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ function enable_tooltips_select(id, headline, sub_id)
|
||||||
|
|
||||||
document.getElementsByTagName('body')[0].appendChild(hold);
|
document.getElementsByTagName('body')[0].appendChild(hold);
|
||||||
|
|
||||||
if (id == null)
|
if (id === null)
|
||||||
{
|
{
|
||||||
links = document.getElementsByTagName('option');
|
links = document.getElementsByTagName('option');
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ function enable_tooltips_select(id, headline, sub_id)
|
||||||
{
|
{
|
||||||
if (sub_id)
|
if (sub_id)
|
||||||
{
|
{
|
||||||
if (links[i].parentNode.id.substr(0, sub_id.length) == sub_id)
|
if (links[i].parentNode.id.substr(0, sub_id.length) === sub_id)
|
||||||
{
|
{
|
||||||
prepare(links[i]);
|
prepare(links[i]);
|
||||||
}
|
}
|
||||||
|
@ -117,7 +117,7 @@ function prepare(element)
|
||||||
|
|
||||||
text = element.getAttribute('title');
|
text = element.getAttribute('title');
|
||||||
|
|
||||||
if (text == null || text.length == 0)
|
if (text === null || text.length === 0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ function prepare(element)
|
||||||
element.onmouseover = show_tooltip;
|
element.onmouseover = show_tooltip;
|
||||||
element.onmouseout = hide_tooltip;
|
element.onmouseout = hide_tooltip;
|
||||||
|
|
||||||
if (tooltip_mode == 'link')
|
if (tooltip_mode === 'link')
|
||||||
{
|
{
|
||||||
element.onmousemove = locate;
|
element.onmousemove = locate;
|
||||||
}
|
}
|
||||||
|
@ -200,7 +200,7 @@ function locate(e)
|
||||||
|
|
||||||
if (e.offsetParent)
|
if (e.offsetParent)
|
||||||
{
|
{
|
||||||
for (var posx = 0, posy = 0; e.offsetParent; e = e.offsetParent)
|
for (posx = 0, posy = 0; e.offsetParent; e = e.offsetParent)
|
||||||
{
|
{
|
||||||
posx += e.offsetLeft;
|
posx += e.offsetLeft;
|
||||||
posy += e.offsetTop;
|
posy += e.offsetTop;
|
||||||
|
@ -212,7 +212,7 @@ function locate(e)
|
||||||
posy = e.offsetTop;
|
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.top=(posy+20) + 'px';
|
||||||
document.getElementById('_tooltip_container').style.left=(posx-20) + 'px';
|
document.getElementById('_tooltip_container').style.left=(posx-20) + 'px';
|
||||||
|
|
|
@ -353,7 +353,7 @@ phpbb.ajaxify = function(options) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (overlay && (typeof $this.attr('data-overlay') === 'undefined' || $this.attr('data-overlay') == 'true'))
|
if (overlay && (typeof $this.attr('data-overlay') === 'undefined' || $this.attr('data-overlay') === 'true'))
|
||||||
{
|
{
|
||||||
phpbb.loadingAlert();
|
phpbb.loadingAlert();
|
||||||
}
|
}
|
||||||
|
@ -387,7 +387,7 @@ phpbb.ajaxify = function(options) {
|
||||||
* @param bool keepSelection Shall we keep the value selected, or shall the user be forced to repick one.
|
* @param bool keepSelection Shall we keep the value selected, or shall the user be forced to repick one.
|
||||||
*/
|
*/
|
||||||
phpbb.timezoneSwitchDate = function(keepSelection) {
|
phpbb.timezoneSwitchDate = function(keepSelection) {
|
||||||
if ($('#timezone_copy').length == 0) {
|
if ($('#timezone_copy').length === 0) {
|
||||||
// We make a backup of the original dropdown, so we can remove optgroups
|
// We make a backup of the original dropdown, so we can remove optgroups
|
||||||
// instead of setting display to none, because IE and chrome will not
|
// instead of setting display to none, because IE and chrome will not
|
||||||
// hide options inside of optgroups and selects via css
|
// hide options inside of optgroups and selects via css
|
||||||
|
@ -397,17 +397,17 @@ phpbb.timezoneSwitchDate = function(keepSelection) {
|
||||||
$('#timezone').replaceWith($('#timezone_copy').clone().attr('id', 'timezone').css('display', 'block').attr('name', 'tz'));
|
$('#timezone').replaceWith($('#timezone_copy').clone().attr('id', 'timezone').css('display', 'block').attr('name', 'tz'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($('#tz_date').val() != '') {
|
if ($('#tz_date').val() !== '') {
|
||||||
$('#timezone > optgroup').remove(":not([label='" + $('#tz_date').val() + "'])");
|
$('#timezone > optgroup').remove(":not([label='" + $('#tz_date').val() + "'])");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($('#tz_date').val() == $('#tz_select_date_suggest').attr('data-suggested-tz')) {
|
if ($('#tz_date').val() === $('#tz_select_date_suggest').attr('data-suggested-tz')) {
|
||||||
$('#tz_select_date_suggest').css('display', 'none');
|
$('#tz_select_date_suggest').css('display', 'none');
|
||||||
} else {
|
} else {
|
||||||
$('#tz_select_date_suggest').css('display', 'inline');
|
$('#tz_select_date_suggest').css('display', 'inline');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($("#timezone > optgroup[label='" + $('#tz_date').val() + "'] > option").size() == 1) {
|
if ($("#timezone > optgroup[label='" + $('#tz_date').val() + "'] > option").size() === 1) {
|
||||||
// If there is only one timezone for the selected date, we just select that automatically.
|
// If there is only one timezone for the selected date, we just select that automatically.
|
||||||
$("#timezone > optgroup[label='" + $('#tz_date').val() + "'] > option:first").attr('selected', true);
|
$("#timezone > optgroup[label='" + $('#tz_date').val() + "'] > option:first").attr('selected', true);
|
||||||
keepSelection = true;
|
keepSelection = true;
|
||||||
|
@ -468,8 +468,8 @@ phpbb.timezonePreselectSelect = function(forceSelector) {
|
||||||
for (i = 0; i < selectorOptions.length; ++i) {
|
for (i = 0; i < selectorOptions.length; ++i) {
|
||||||
var option = selectorOptions[i];
|
var option = selectorOptions[i];
|
||||||
|
|
||||||
if (option.value.substring(0, prefixLength) == prefix) {
|
if (option.value.substring(0, prefixLength) === prefix) {
|
||||||
if ($('#tz_date').val() != option.value && !forceSelector) {
|
if ($('#tz_date').val() !== option.value && !forceSelector) {
|
||||||
// We do not select the option for the user, but notify him,
|
// We do not select the option for the user, but notify him,
|
||||||
// that we would suggest a different setting.
|
// that we would suggest a different setting.
|
||||||
phpbb.timezoneSwitchDate(true);
|
phpbb.timezoneSwitchDate(true);
|
||||||
|
|
|
@ -39,7 +39,7 @@ phpbb.addAjaxCallback('mark_forums_read', function(res) {
|
||||||
|
|
||||||
// Mark topics read if we are watching a category and showing active topics
|
// Mark topics read if we are watching a category and showing active topics
|
||||||
if ($('#active_topics').length) {
|
if ($('#active_topics').length) {
|
||||||
phpbb.ajaxCallbacks['mark_topics_read'].call(this, res, false);
|
phpbb.ajaxCallbacks.mark_topics_read.call(this, res, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update mark forums read links
|
// Update mark forums read links
|
||||||
|
@ -75,7 +75,7 @@ phpbb.addAjaxCallback('mark_topics_read', function(res, update_topic_links) {
|
||||||
$.each(iconsArray, function(unreadClass, readClass) {
|
$.each(iconsArray, function(unreadClass, readClass) {
|
||||||
$.each(iconsState, function(key, value) {
|
$.each(iconsState, function(key, value) {
|
||||||
// Only topics can be hot
|
// Only topics can be hot
|
||||||
if ((value == '_hot' || value == '_hot_mine') && unreadClass != 'topic_unread') {
|
if ((value === '_hot' || value === '_hot_mine') && unreadClass !== 'topic_unread') {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
classMap[unreadClass + value] = readClass + value;
|
classMap[unreadClass + value] = readClass + value;
|
||||||
|
@ -218,7 +218,7 @@ $('#quick-mod-select').change(function () {
|
||||||
*/
|
*/
|
||||||
$('#member_search').click(function () {
|
$('#member_search').click(function () {
|
||||||
$('#memberlist_search').slideToggle('fast');
|
$('#memberlist_search').slideToggle('fast');
|
||||||
phpbb.ajax_callbacks['alt_text'].call(this);
|
phpbb.ajax_callbacks.alt_text.call(this);
|
||||||
// Focus on the username textbox if it's available and displayed
|
// Focus on the username textbox if it's available and displayed
|
||||||
if ($('#memberlist_search').is(':visible')) {
|
if ($('#memberlist_search').is(':visible')) {
|
||||||
$('#username').focus();
|
$('#username').focus();
|
||||||
|
|
|
@ -6,15 +6,15 @@
|
||||||
// Startup variables
|
// Startup variables
|
||||||
var imageTag = false;
|
var imageTag = false;
|
||||||
var theSelection = false;
|
var theSelection = false;
|
||||||
|
|
||||||
var bbcodeEnabled = true;
|
var bbcodeEnabled = true;
|
||||||
|
|
||||||
// Check for Browser & Platform for PC & IE specific bits
|
// Check for Browser & Platform for PC & IE specific bits
|
||||||
// More details from: http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html
|
// More details from: http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html
|
||||||
var clientPC = navigator.userAgent.toLowerCase(); // Get client info
|
var clientPC = navigator.userAgent.toLowerCase(); // Get client info
|
||||||
var clientVer = parseInt(navigator.appVersion, 10); // Get browser version
|
var clientVer = parseInt(navigator.appVersion, 10); // Get browser version
|
||||||
|
|
||||||
var is_ie = ((clientPC.indexOf('msie') != -1) && (clientPC.indexOf('opera') == -1));
|
var is_ie = ((clientPC.indexOf('msie') !== -1) && (clientPC.indexOf('opera') === -1));
|
||||||
var is_win = ((clientPC.indexOf('win') != -1) || (clientPC.indexOf('16bit') != -1));
|
var is_win = ((clientPC.indexOf('win') !== -1) || (clientPC.indexOf('16bit') !== -1));
|
||||||
var baseHeight;
|
var baseHeight;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -44,7 +44,7 @@ function initInsertions()
|
||||||
|
|
||||||
var textarea = doc.forms[form_name].elements[text_name];
|
var textarea = doc.forms[form_name].elements[text_name];
|
||||||
|
|
||||||
if (is_ie && typeof(baseHeight) != 'number')
|
if (is_ie && typeof(baseHeight) !== 'number')
|
||||||
{
|
{
|
||||||
textarea.focus();
|
textarea.focus();
|
||||||
baseHeight = doc.selection.createRange().duplicate().boundingHeight;
|
baseHeight = doc.selection.createRange().duplicate().boundingHeight;
|
||||||
|
@ -61,7 +61,7 @@ function initInsertions()
|
||||||
*/
|
*/
|
||||||
function bbstyle(bbnumber)
|
function bbstyle(bbnumber)
|
||||||
{
|
{
|
||||||
if (bbnumber != -1)
|
if (bbnumber !== -1)
|
||||||
{
|
{
|
||||||
bbfontstyle(bbtags[bbnumber], bbtags[bbnumber+1]);
|
bbfontstyle(bbtags[bbnumber], bbtags[bbnumber+1]);
|
||||||
}
|
}
|
||||||
|
@ -147,6 +147,7 @@ function insert_text(text, spaces, popup)
|
||||||
{
|
{
|
||||||
textarea = opener.document.forms[form_name].elements[text_name];
|
textarea = opener.document.forms[form_name].elements[text_name];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (spaces)
|
if (spaces)
|
||||||
{
|
{
|
||||||
text = ' ' + text + ' ';
|
text = ' ' + text + ' ';
|
||||||
|
@ -165,19 +166,20 @@ function insert_text(text, spaces, popup)
|
||||||
}
|
}
|
||||||
else if (textarea.createTextRange && textarea.caretPos)
|
else if (textarea.createTextRange && textarea.caretPos)
|
||||||
{
|
{
|
||||||
if (baseHeight != textarea.caretPos.boundingHeight)
|
if (baseHeight !== textarea.caretPos.boundingHeight)
|
||||||
{
|
{
|
||||||
textarea.focus();
|
textarea.focus();
|
||||||
storeCaret(textarea);
|
storeCaret(textarea);
|
||||||
}
|
}
|
||||||
|
|
||||||
var caret_pos = textarea.caretPos;
|
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;
|
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;
|
textarea.value = textarea.value + text;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!popup)
|
if (!popup)
|
||||||
{
|
{
|
||||||
textarea.focus();
|
textarea.focus();
|
||||||
|
@ -201,6 +203,7 @@ function addquote(post_id, username, l_wrote)
|
||||||
var message_name = 'message_' + post_id;
|
var message_name = 'message_' + post_id;
|
||||||
var theSelection = '';
|
var theSelection = '';
|
||||||
var divarea = false;
|
var divarea = false;
|
||||||
|
var i;
|
||||||
|
|
||||||
if (l_wrote === undefined)
|
if (l_wrote === undefined)
|
||||||
{
|
{
|
||||||
|
@ -232,7 +235,7 @@ function addquote(post_id, username, l_wrote)
|
||||||
theSelection = document.selection.createRange().text;
|
theSelection = document.selection.createRange().text;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (theSelection == '' || typeof theSelection == 'undefined' || theSelection == null)
|
if (theSelection === '' || typeof theSelection === 'undefined' || theSelection === null)
|
||||||
{
|
{
|
||||||
if (divarea.innerHTML)
|
if (divarea.innerHTML)
|
||||||
{
|
{
|
||||||
|
@ -282,6 +285,8 @@ function split_lines(text)
|
||||||
var lines = text.split('\n');
|
var lines = text.split('\n');
|
||||||
var splitLines = new Array();
|
var splitLines = new Array();
|
||||||
var j = 0;
|
var j = 0;
|
||||||
|
var i;
|
||||||
|
|
||||||
for(i = 0; i < lines.length; i++)
|
for(i = 0; i < lines.length; i++)
|
||||||
{
|
{
|
||||||
if (lines[i].length <= 80)
|
if (lines[i].length <= 80)
|
||||||
|
@ -292,11 +297,12 @@ function split_lines(text)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var line = lines[i];
|
var line = lines[i];
|
||||||
|
var splitAt;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
var splitAt = line.indexOf(' ', 80);
|
splitAt = line.indexOf(' ', 80);
|
||||||
|
|
||||||
if (splitAt == -1)
|
if (splitAt === -1)
|
||||||
{
|
{
|
||||||
splitLines[j] = line;
|
splitLines[j] = line;
|
||||||
j++;
|
j++;
|
||||||
|
@ -308,22 +314,23 @@ function split_lines(text)
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while(splitAt != -1);
|
while(splitAt !== -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return splitLines;
|
return splitLines;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* From http://www.massless.org/mozedit/
|
* 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 selLength = (typeof(txtarea.textLength) === 'undefined') ? txtarea.value.length : txtarea.textLength;
|
||||||
var selStart = txtarea.selectionStart;
|
var selStart = txtarea.selectionStart;
|
||||||
var selEnd = txtarea.selectionEnd;
|
var selEnd = txtarea.selectionEnd;
|
||||||
var scrollTop = txtarea.scrollTop;
|
var scrollTop = txtarea.scrollTop;
|
||||||
|
|
||||||
if (selEnd == 1 || selEnd == 2)
|
if (selEnd === 1 || selEnd === 2)
|
||||||
{
|
{
|
||||||
selEnd = selLength;
|
selEnd = selLength;
|
||||||
}
|
}
|
||||||
|
@ -372,14 +379,14 @@ function colorPalette(dir, width, height)
|
||||||
|
|
||||||
for (r = 0; r < 5; r++)
|
for (r = 0; r < 5; r++)
|
||||||
{
|
{
|
||||||
if (dir == 'h')
|
if (dir === 'h')
|
||||||
{
|
{
|
||||||
document.writeln('<tr>');
|
document.writeln('<tr>');
|
||||||
}
|
}
|
||||||
|
|
||||||
for (g = 0; g < 5; g++)
|
for (g = 0; g < 5; g++)
|
||||||
{
|
{
|
||||||
if (dir == 'v')
|
if (dir === 'v')
|
||||||
{
|
{
|
||||||
document.writeln('<tr>');
|
document.writeln('<tr>');
|
||||||
}
|
}
|
||||||
|
@ -392,13 +399,13 @@ function colorPalette(dir, width, height)
|
||||||
document.writeln('</td>');
|
document.writeln('</td>');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dir == 'v')
|
if (dir === 'v')
|
||||||
{
|
{
|
||||||
document.writeln('</tr>');
|
document.writeln('</tr>');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dir == 'h')
|
if (dir === 'h')
|
||||||
{
|
{
|
||||||
document.writeln('</tr>');
|
document.writeln('</tr>');
|
||||||
}
|
}
|
||||||
|
@ -406,7 +413,6 @@ function colorPalette(dir, width, height)
|
||||||
document.writeln('</table>');
|
document.writeln('</table>');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Caret Position object
|
* Caret Position object
|
||||||
*/
|
*/
|
||||||
|
@ -416,7 +422,6 @@ function caretPosition()
|
||||||
var end = null;
|
var end = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the caret position in an textarea
|
* Get the caret position in an textarea
|
||||||
*/
|
*/
|
||||||
|
@ -425,15 +430,14 @@ function getCaretPosition(txtarea)
|
||||||
var caretPos = new caretPosition();
|
var caretPos = new caretPosition();
|
||||||
|
|
||||||
// simple Gecko/Opera way
|
// simple Gecko/Opera way
|
||||||
if(txtarea.selectionStart || txtarea.selectionStart == 0)
|
if (txtarea.selectionStart || txtarea.selectionStart === 0)
|
||||||
{
|
{
|
||||||
caretPos.start = txtarea.selectionStart;
|
caretPos.start = txtarea.selectionStart;
|
||||||
caretPos.end = txtarea.selectionEnd;
|
caretPos.end = txtarea.selectionEnd;
|
||||||
}
|
}
|
||||||
// dirty and slow IE way
|
// dirty and slow IE way
|
||||||
else if(document.selection)
|
else if (document.selection)
|
||||||
{
|
{
|
||||||
|
|
||||||
// get current selection
|
// get current selection
|
||||||
var range = document.selection.createRange();
|
var range = document.selection.createRange();
|
||||||
|
|
||||||
|
|
|
@ -23,9 +23,9 @@ function jumpto()
|
||||||
{
|
{
|
||||||
var page = prompt(jump_page, on_page);
|
var page = prompt(jump_page, on_page);
|
||||||
|
|
||||||
if (page !== null && !isNaN(page) && page == Math.floor(page) && page > 0)
|
if (page !== null && !isNaN(page) && page === Math.floor(page) && page > 0)
|
||||||
{
|
{
|
||||||
if (base_url.indexOf('?') == -1)
|
if (base_url.indexOf('?') === -1)
|
||||||
{
|
{
|
||||||
document.location.href = base_url + '?start=' + ((page - 1) * per_page);
|
document.location.href = base_url + '?start=' + ((page - 1) * per_page);
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ function marklist(id, name, state)
|
||||||
|
|
||||||
for (var r = 0; r < rb.length; r++)
|
for (var r = 0; r < rb.length; r++)
|
||||||
{
|
{
|
||||||
if (rb[r].name.substr(0, name.length) == name)
|
if (rb[r].name.substr(0, name.length) === name)
|
||||||
{
|
{
|
||||||
rb[r].checked = state;
|
rb[r].checked = state;
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,10 @@ function marklist(id, name, state)
|
||||||
*/
|
*/
|
||||||
function viewableArea(e, itself)
|
function viewableArea(e, itself)
|
||||||
{
|
{
|
||||||
if (!e) return;
|
if (!e) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!itself)
|
if (!itself)
|
||||||
{
|
{
|
||||||
e = e.parentNode;
|
e = e.parentNode;
|
||||||
|
@ -106,9 +109,9 @@ function dE(n, s, type)
|
||||||
var e = document.getElementById(n);
|
var e = document.getElementById(n);
|
||||||
if (!s)
|
if (!s)
|
||||||
{
|
{
|
||||||
s = (e.style.display == '' || e.style.display == type) ? -1 : 1;
|
s = (e.style.display === '' || e.style.display === type) ? -1 : 1;
|
||||||
}
|
}
|
||||||
e.style.display = (s == 1) ? type : 'none';
|
e.style.display = (s === 1) ? type : 'none';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -118,7 +121,7 @@ function subPanels(p)
|
||||||
{
|
{
|
||||||
var i, e, t;
|
var i, e, t;
|
||||||
|
|
||||||
if (typeof(p) == 'string')
|
if (typeof(p) === 'string')
|
||||||
{
|
{
|
||||||
show_panel = p;
|
show_panel = p;
|
||||||
}
|
}
|
||||||
|
@ -130,7 +133,7 @@ function subPanels(p)
|
||||||
|
|
||||||
if (e)
|
if (e)
|
||||||
{
|
{
|
||||||
if (panels[i] == show_panel)
|
if (panels[i] === show_panel)
|
||||||
{
|
{
|
||||||
e.style.display = 'block';
|
e.style.display = 'block';
|
||||||
if (t)
|
if (t)
|
||||||
|
@ -173,7 +176,7 @@ function printPage()
|
||||||
*/
|
*/
|
||||||
function displayBlocks(c, e, t)
|
function displayBlocks(c, e, t)
|
||||||
{
|
{
|
||||||
var s = (e.checked == true) ? 1 : -1;
|
var s = (e.checked === true) ? 1 : -1;
|
||||||
|
|
||||||
if (t)
|
if (t)
|
||||||
{
|
{
|
||||||
|
@ -184,9 +187,9 @@ function displayBlocks(c, e, t)
|
||||||
|
|
||||||
for (var d = 0; d < divs.length; d++)
|
for (var d = 0; d < divs.length; d++)
|
||||||
{
|
{
|
||||||
if (divs[d].className.indexOf(c) == 0)
|
if (divs[d].className.indexOf(c) === 0)
|
||||||
{
|
{
|
||||||
divs[d].style.display = (s == 1) ? 'none' : 'block';
|
divs[d].style.display = (s === 1) ? 'none' : 'block';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -195,11 +198,12 @@ function selectCode(a)
|
||||||
{
|
{
|
||||||
// Get ID of code block
|
// Get ID of code block
|
||||||
var e = a.parentNode.parentNode.getElementsByTagName('CODE')[0];
|
var e = a.parentNode.parentNode.getElementsByTagName('CODE')[0];
|
||||||
|
var s, r;
|
||||||
|
|
||||||
// Not IE and IE9+
|
// Not IE and IE9+
|
||||||
if (window.getSelection)
|
if (window.getSelection)
|
||||||
{
|
{
|
||||||
var s = window.getSelection();
|
s = window.getSelection();
|
||||||
// Safari
|
// Safari
|
||||||
if (s.setBaseAndExtent)
|
if (s.setBaseAndExtent)
|
||||||
{
|
{
|
||||||
|
@ -209,12 +213,12 @@ function selectCode(a)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// workaround for bug # 42885
|
// workaround for bug # 42885
|
||||||
if (window.opera && e.innerHTML.substring(e.innerHTML.length - 4) == '<BR>')
|
if (window.opera && e.innerHTML.substring(e.innerHTML.length - 4) === '<BR>')
|
||||||
{
|
{
|
||||||
e.innerHTML = e.innerHTML + ' ';
|
e.innerHTML = e.innerHTML + ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
var r = document.createRange();
|
r = document.createRange();
|
||||||
r.selectNodeContents(e);
|
r.selectNodeContents(e);
|
||||||
s.removeAllRanges();
|
s.removeAllRanges();
|
||||||
s.addRange(r);
|
s.addRange(r);
|
||||||
|
@ -223,8 +227,8 @@ function selectCode(a)
|
||||||
// Some older browsers
|
// Some older browsers
|
||||||
else if (document.getSelection)
|
else if (document.getSelection)
|
||||||
{
|
{
|
||||||
var s = document.getSelection();
|
s = document.getSelection();
|
||||||
var r = document.createRange();
|
r = document.createRange();
|
||||||
r.selectNodeContents(e);
|
r.selectNodeContents(e);
|
||||||
s.removeAllRanges();
|
s.removeAllRanges();
|
||||||
s.addRange(r);
|
s.addRange(r);
|
||||||
|
@ -232,7 +236,7 @@ function selectCode(a)
|
||||||
// IE
|
// IE
|
||||||
else if (document.selection)
|
else if (document.selection)
|
||||||
{
|
{
|
||||||
var r = document.body.createTextRange();
|
r = document.body.createTextRange();
|
||||||
r.moveToElementText(e);
|
r.moveToElementText(e);
|
||||||
r.select();
|
r.select();
|
||||||
}
|
}
|
||||||
|
@ -245,22 +249,23 @@ function selectCode(a)
|
||||||
function play_qt_file(obj)
|
function play_qt_file(obj)
|
||||||
{
|
{
|
||||||
var rectangle = obj.GetRectangle();
|
var rectangle = obj.GetRectangle();
|
||||||
|
var width, height;
|
||||||
|
|
||||||
if (rectangle)
|
if (rectangle)
|
||||||
{
|
{
|
||||||
rectangle = rectangle.split(',');
|
rectangle = rectangle.split(',');
|
||||||
var x1 = parseInt(rectangle[0]);
|
var x1 = parseInt(rectangle[0], 10);
|
||||||
var x2 = parseInt(rectangle[2]);
|
var x2 = parseInt(rectangle[2], 10);
|
||||||
var y1 = parseInt(rectangle[1]);
|
var y1 = parseInt(rectangle[1], 10);
|
||||||
var y2 = parseInt(rectangle[3]);
|
var y2 = parseInt(rectangle[3], 10);
|
||||||
|
|
||||||
var width = (x1 < 0) ? (x1 * -1) + x2 : x2 - x1;
|
width = (x1 < 0) ? (x1 * -1) + x2 : x2 - x1;
|
||||||
var height = (y1 < 0) ? (y1 * -1) + y2 : y2 - y1;
|
height = (y1 < 0) ? (y1 * -1) + y2 : y2 - y1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var width = 200;
|
width = 200;
|
||||||
var height = 0;
|
height = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
obj.width = width;
|
obj.width = width;
|
||||||
|
@ -276,7 +281,7 @@ function play_qt_file(obj)
|
||||||
*/
|
*/
|
||||||
function is_node_name(elem, name)
|
function is_node_name(elem, name)
|
||||||
{
|
{
|
||||||
return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
|
return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -285,10 +290,12 @@ function is_node_name(elem, name)
|
||||||
*/
|
*/
|
||||||
function is_in_array(elem, array)
|
function is_in_array(elem, array)
|
||||||
{
|
{
|
||||||
for (var i = 0, length = array.length; i < length; i++)
|
for (var i = 0, length = array.length; i < length; i++) {
|
||||||
// === is correct (IE)
|
// === is correct (IE)
|
||||||
if (array[i] === elem)
|
if (array[i] === elem) {
|
||||||
return i;
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -304,17 +311,22 @@ function find_in_tree(node, tag, type, class_name)
|
||||||
|
|
||||||
for (element = node.childNodes[0]; i < length; element = node.childNodes[++i])
|
for (element = node.childNodes[0]; i < length; element = node.childNodes[++i])
|
||||||
{
|
{
|
||||||
if (!element || element.nodeType != 1) continue;
|
if (!element || element.nodeType !== 1) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if ((!tag || is_node_name(element, tag)) && (!type || element.type == type) && (!class_name || is_in_array(class_name, (element.className || element).toString().split(/\s+/)) > -1))
|
if ((!tag || is_node_name(element, tag)) && (!type || element.type === type) && (!class_name || is_in_array(class_name, (element.className || element).toString().split(/\s+/)) > -1))
|
||||||
{
|
{
|
||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (element.childNodes.length)
|
if (element.childNodes.length) {
|
||||||
result = find_in_tree(element, tag, type, class_name);
|
result = find_in_tree(element, tag, type, class_name);
|
||||||
|
}
|
||||||
|
|
||||||
if (result) return result;
|
if (result) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -327,14 +339,15 @@ var last_key_entered = '';
|
||||||
function phpbb_check_key(event)
|
function phpbb_check_key(event)
|
||||||
{
|
{
|
||||||
// Keycode is array down or up?
|
// Keycode is array down or up?
|
||||||
if (event.keyCode && (event.keyCode == 40 || event.keyCode == 38))
|
if (event.keyCode && (event.keyCode === 40 || event.keyCode === 38)) {
|
||||||
in_autocomplete = true;
|
in_autocomplete = true;
|
||||||
|
}
|
||||||
|
|
||||||
// Make sure we are not within an "autocompletion" field
|
// Make sure we are not within an "autocompletion" field
|
||||||
if (in_autocomplete)
|
if (in_autocomplete)
|
||||||
{
|
{
|
||||||
// If return pressed and key changed we reset the autocompletion
|
// If return pressed and key changed we reset the autocompletion
|
||||||
if (!last_key_entered || last_key_entered == event.which)
|
if (!last_key_entered || last_key_entered === event.which)
|
||||||
{
|
{
|
||||||
in_autocompletion = false;
|
in_autocompletion = false;
|
||||||
return true;
|
return true;
|
||||||
|
@ -342,7 +355,7 @@ function phpbb_check_key(event)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Keycode is not return, then return. ;)
|
// Keycode is not return, then return. ;)
|
||||||
if (event.which != 13)
|
if (event.which !== 13)
|
||||||
{
|
{
|
||||||
last_key_entered = event.which;
|
last_key_entered = event.which;
|
||||||
return true;
|
return true;
|
||||||
|
@ -357,17 +370,20 @@ function phpbb_check_key(event)
|
||||||
function submit_default_button(event, selector, class_name)
|
function submit_default_button(event, selector, class_name)
|
||||||
{
|
{
|
||||||
// Add which for key events
|
// Add which for key events
|
||||||
if (!event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode))
|
if (!event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode)) {
|
||||||
event.which = event.charCode || event.keyCode;
|
event.which = event.charCode || event.keyCode;
|
||||||
|
}
|
||||||
|
|
||||||
if (phpbb_check_key(event))
|
if (phpbb_check_key(event)) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
var current = selector['parentNode'];
|
var current = selector.parentNode;
|
||||||
|
|
||||||
// Search parent form element
|
// Search parent form element
|
||||||
while (current && (!current.nodeName || current.nodeType != 1 || !is_node_name(current, 'form')) && current != document)
|
while (current && (!current.nodeName || current.nodeType !== 1 || !is_node_name(current, 'form')) && current !== document) {
|
||||||
current = current['parentNode'];
|
current = current.parentNode;
|
||||||
|
}
|
||||||
|
|
||||||
// Find the input submit button with the class name
|
// Find the input submit button with the class name
|
||||||
//current = find_in_tree(current, 'input', 'submit', class_name);
|
//current = find_in_tree(current, 'input', 'submit', class_name);
|
||||||
|
@ -376,12 +392,14 @@ function submit_default_button(event, selector, class_name)
|
||||||
|
|
||||||
for (var i = 0, element = input_tags[0]; i < input_tags.length; element = input_tags[++i])
|
for (var i = 0, element = input_tags[0]; i < input_tags.length; element = input_tags[++i])
|
||||||
{
|
{
|
||||||
if (element.type == 'submit' && is_in_array(class_name, (element.className || element).toString().split(/\s+/)) > -1)
|
if (element.type === 'submit' && is_in_array(class_name, (element.className || element).toString().split(/\s+/)) > -1) {
|
||||||
current = element;
|
current = element;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!current)
|
if (!current) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Submit form
|
// Submit form
|
||||||
current.focus();
|
current.focus();
|
||||||
|
@ -403,13 +421,15 @@ function apply_onkeypress_event()
|
||||||
{
|
{
|
||||||
var default_button = jQuery(this).parents('form').find('input[type=submit].default-submit-action');
|
var default_button = jQuery(this).parents('form').find('input[type=submit].default-submit-action');
|
||||||
|
|
||||||
if (!default_button || default_button.length <= 0)
|
if (!default_button || default_button.length <= 0) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (phpbb_check_key(e))
|
if (phpbb_check_key(e)) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13))
|
if ((e.which && e.which === 13) || (e.keyCode && e.keyCode === 13))
|
||||||
{
|
{
|
||||||
default_button.click();
|
default_button.click();
|
||||||
return false;
|
return false;
|
||||||
|
@ -425,7 +445,7 @@ function apply_onkeypress_event()
|
||||||
|
|
||||||
for (var i = 0, element = input_tags[0]; i < input_tags.length ; element = input_tags[++i])
|
for (var i = 0, element = input_tags[0]; i < input_tags.length ; element = input_tags[++i])
|
||||||
{
|
{
|
||||||
if (element.type == 'text' || element.type == 'password')
|
if (element.type === 'text' || element.type === 'password')
|
||||||
{
|
{
|
||||||
// onkeydown is possible too
|
// onkeydown is possible too
|
||||||
element.onkeypress = function (evt) { submit_default_button((evt || window.event), this, 'default-submit-action'); };
|
element.onkeypress = function (evt) { submit_default_button((evt || window.event), this, 'default-submit-action'); };
|
||||||
|
@ -436,4 +456,4 @@ function apply_onkeypress_event()
|
||||||
/**
|
/**
|
||||||
* Detect JQuery existance. We currently do not deliver it, but some styles do, so why not benefit from it. ;)
|
* Detect JQuery existance. We currently do not deliver it, but some styles do, so why not benefit from it. ;)
|
||||||
*/
|
*/
|
||||||
var jquery_present = typeof jQuery == 'function';
|
var jquery_present = typeof jQuery === 'function';
|
||||||
|
|
|
@ -15,7 +15,7 @@ $(document).ready(
|
||||||
);
|
);
|
||||||
|
|
||||||
$(document).ready(
|
$(document).ready(
|
||||||
phpbb.timezonePreselectSelect($('#tz_select_date_suggest').attr('data-is-registration') == 'true')
|
phpbb.timezonePreselectSelect($('#tz_select_date_suggest').attr('data-is-registration') === 'true')
|
||||||
);
|
);
|
||||||
|
|
||||||
})(jQuery); // Avoid conflicts with other libraries
|
})(jQuery); // Avoid conflicts with other libraries
|
||||||
|
|
|
@ -11,11 +11,10 @@ var bbcodeEnabled = true;
|
||||||
// Check for Browser & Platform for PC & IE specific bits
|
// Check for Browser & Platform for PC & IE specific bits
|
||||||
// More details from: http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html
|
// More details from: http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html
|
||||||
var clientPC = navigator.userAgent.toLowerCase(); // Get client info
|
var clientPC = navigator.userAgent.toLowerCase(); // Get client info
|
||||||
var clientVer = parseInt(navigator.appVersion); // Get browser version
|
var clientVer = parseInt(navigator.appVersion, 10); // Get browser version
|
||||||
|
|
||||||
var is_ie = ((clientPC.indexOf('msie') != -1) && (clientPC.indexOf('opera') == -1));
|
|
||||||
var is_win = ((clientPC.indexOf('win') != -1) || (clientPC.indexOf('16bit') != -1));
|
|
||||||
|
|
||||||
|
var is_ie = ((clientPC.indexOf('msie') !== -1) && (clientPC.indexOf('opera') === -1));
|
||||||
|
var is_win = ((clientPC.indexOf('win') !== -1) || (clientPC.indexOf('16bit') !== -1));
|
||||||
var baseHeight;
|
var baseHeight;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -44,7 +43,8 @@ function initInsertions()
|
||||||
}
|
}
|
||||||
|
|
||||||
var textarea = doc.forms[form_name].elements[text_name];
|
var textarea = doc.forms[form_name].elements[text_name];
|
||||||
if (is_ie && typeof(baseHeight) != 'number')
|
|
||||||
|
if (is_ie && typeof(baseHeight) !== 'number')
|
||||||
{
|
{
|
||||||
textarea.focus();
|
textarea.focus();
|
||||||
baseHeight = doc.selection.createRange().duplicate().boundingHeight;
|
baseHeight = doc.selection.createRange().duplicate().boundingHeight;
|
||||||
|
@ -61,7 +61,7 @@ function initInsertions()
|
||||||
*/
|
*/
|
||||||
function bbstyle(bbnumber)
|
function bbstyle(bbnumber)
|
||||||
{
|
{
|
||||||
if (bbnumber != -1)
|
if (bbnumber !== -1)
|
||||||
{
|
{
|
||||||
bbfontstyle(bbtags[bbnumber], bbtags[bbnumber+1]);
|
bbfontstyle(bbtags[bbnumber], bbtags[bbnumber+1]);
|
||||||
}
|
}
|
||||||
|
@ -147,6 +147,7 @@ function insert_text(text, spaces, popup)
|
||||||
{
|
{
|
||||||
textarea = opener.document.forms[form_name].elements[text_name];
|
textarea = opener.document.forms[form_name].elements[text_name];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (spaces)
|
if (spaces)
|
||||||
{
|
{
|
||||||
text = ' ' + text + ' ';
|
text = ' ' + text + ' ';
|
||||||
|
@ -163,22 +164,22 @@ function insert_text(text, spaces, popup)
|
||||||
textarea.selectionStart = sel_start + text.length;
|
textarea.selectionStart = sel_start + text.length;
|
||||||
textarea.selectionEnd = sel_end + text.length;
|
textarea.selectionEnd = sel_end + text.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (textarea.createTextRange && textarea.caretPos)
|
else if (textarea.createTextRange && textarea.caretPos)
|
||||||
{
|
{
|
||||||
if (baseHeight != textarea.caretPos.boundingHeight)
|
if (baseHeight !== textarea.caretPos.boundingHeight)
|
||||||
{
|
{
|
||||||
textarea.focus();
|
textarea.focus();
|
||||||
storeCaret(textarea);
|
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;
|
|
||||||
|
|
||||||
|
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;
|
textarea.value = textarea.value + text;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!popup)
|
if (!popup)
|
||||||
{
|
{
|
||||||
textarea.focus();
|
textarea.focus();
|
||||||
|
@ -202,6 +203,7 @@ function addquote(post_id, username, l_wrote)
|
||||||
var message_name = 'message_' + post_id;
|
var message_name = 'message_' + post_id;
|
||||||
var theSelection = '';
|
var theSelection = '';
|
||||||
var divarea = false;
|
var divarea = false;
|
||||||
|
var i;
|
||||||
|
|
||||||
if (l_wrote === undefined)
|
if (l_wrote === undefined)
|
||||||
{
|
{
|
||||||
|
@ -233,7 +235,7 @@ function addquote(post_id, username, l_wrote)
|
||||||
theSelection = document.selection.createRange().text;
|
theSelection = document.selection.createRange().text;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (theSelection == '' || typeof theSelection == 'undefined' || theSelection == null)
|
if (theSelection === '' || typeof theSelection === 'undefined' || theSelection === null)
|
||||||
{
|
{
|
||||||
if (divarea.innerHTML)
|
if (divarea.innerHTML)
|
||||||
{
|
{
|
||||||
|
@ -278,12 +280,13 @@ function addquote(post_id, username, l_wrote)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function split_lines(text)
|
function split_lines(text)
|
||||||
{
|
{
|
||||||
var lines = text.split('\n');
|
var lines = text.split('\n');
|
||||||
var splitLines = new Array();
|
var splitLines = new Array();
|
||||||
var j = 0;
|
var j = 0;
|
||||||
|
var i;
|
||||||
|
|
||||||
for(i = 0; i < lines.length; i++)
|
for(i = 0; i < lines.length; i++)
|
||||||
{
|
{
|
||||||
if (lines[i].length <= 80)
|
if (lines[i].length <= 80)
|
||||||
|
@ -294,11 +297,12 @@ function split_lines(text)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var line = lines[i];
|
var line = lines[i];
|
||||||
|
var splitAt;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
var splitAt = line.indexOf(' ', 80);
|
splitAt = line.indexOf(' ', 80);
|
||||||
|
|
||||||
if (splitAt == -1)
|
if (splitAt === -1)
|
||||||
{
|
{
|
||||||
splitLines[j] = line;
|
splitLines[j] = line;
|
||||||
j++;
|
j++;
|
||||||
|
@ -310,7 +314,7 @@ function split_lines(text)
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while(splitAt != -1);
|
while(splitAt !== -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return splitLines;
|
return splitLines;
|
||||||
|
@ -321,12 +325,12 @@ function split_lines(text)
|
||||||
*/
|
*/
|
||||||
function mozWrap(txtarea, open, close)
|
function mozWrap(txtarea, open, close)
|
||||||
{
|
{
|
||||||
var selLength = (typeof(txtarea.textLength) == 'undefined') ? txtarea.value.length : txtarea.textLength;
|
var selLength = (typeof(txtarea.textLength) === 'undefined') ? txtarea.value.length : txtarea.textLength;
|
||||||
var selStart = txtarea.selectionStart;
|
var selStart = txtarea.selectionStart;
|
||||||
var selEnd = txtarea.selectionEnd;
|
var selEnd = txtarea.selectionEnd;
|
||||||
var scrollTop = txtarea.scrollTop;
|
var scrollTop = txtarea.scrollTop;
|
||||||
|
|
||||||
if (selEnd == 1 || selEnd == 2)
|
if (selEnd === 1 || selEnd === 2)
|
||||||
{
|
{
|
||||||
selEnd = selLength;
|
selEnd = selLength;
|
||||||
}
|
}
|
||||||
|
@ -375,14 +379,14 @@ function colorPalette(dir, width, height)
|
||||||
|
|
||||||
for (r = 0; r < 5; r++)
|
for (r = 0; r < 5; r++)
|
||||||
{
|
{
|
||||||
if (dir == 'h')
|
if (dir === 'h')
|
||||||
{
|
{
|
||||||
document.writeln('<tr>');
|
document.writeln('<tr>');
|
||||||
}
|
}
|
||||||
|
|
||||||
for (g = 0; g < 5; g++)
|
for (g = 0; g < 5; g++)
|
||||||
{
|
{
|
||||||
if (dir == 'v')
|
if (dir === 'v')
|
||||||
{
|
{
|
||||||
document.writeln('<tr>');
|
document.writeln('<tr>');
|
||||||
}
|
}
|
||||||
|
@ -395,13 +399,13 @@ function colorPalette(dir, width, height)
|
||||||
document.writeln('</td>');
|
document.writeln('</td>');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dir == 'v')
|
if (dir === 'v')
|
||||||
{
|
{
|
||||||
document.writeln('</tr>');
|
document.writeln('</tr>');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dir == 'h')
|
if (dir === 'h')
|
||||||
{
|
{
|
||||||
document.writeln('</tr>');
|
document.writeln('</tr>');
|
||||||
}
|
}
|
||||||
|
@ -409,7 +413,6 @@ function colorPalette(dir, width, height)
|
||||||
document.writeln('</table>');
|
document.writeln('</table>');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Caret Position object
|
* Caret Position object
|
||||||
*/
|
*/
|
||||||
|
@ -419,7 +422,6 @@ function caretPosition()
|
||||||
var end = null;
|
var end = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the caret position in an textarea
|
* Get the caret position in an textarea
|
||||||
*/
|
*/
|
||||||
|
@ -428,13 +430,13 @@ function getCaretPosition(txtarea)
|
||||||
var caretPos = new caretPosition();
|
var caretPos = new caretPosition();
|
||||||
|
|
||||||
// simple Gecko/Opera way
|
// simple Gecko/Opera way
|
||||||
if(txtarea.selectionStart || txtarea.selectionStart == 0)
|
if (txtarea.selectionStart || txtarea.selectionStart === 0)
|
||||||
{
|
{
|
||||||
caretPos.start = txtarea.selectionStart;
|
caretPos.start = txtarea.selectionStart;
|
||||||
caretPos.end = txtarea.selectionEnd;
|
caretPos.end = txtarea.selectionEnd;
|
||||||
}
|
}
|
||||||
// dirty and slow IE way
|
// dirty and slow IE way
|
||||||
else if(document.selection)
|
else if (document.selection)
|
||||||
{
|
{
|
||||||
// get current selection
|
// get current selection
|
||||||
var range = document.selection.createRange();
|
var range = document.selection.createRange();
|
||||||
|
|
Loading…
Add table
Reference in a new issue