Clean up whitespace

This commit is contained in:
Marc Alexander
2023-02-28 20:51:47 +01:00
parent 1c88afc176
commit 1b4006b9a3
4 changed files with 137 additions and 138 deletions

View File

@@ -18,8 +18,8 @@ function helpline(help)
/** /**
* Fix a bug involving the TextRange object. From * Fix a bug involving the TextRange object. From
* http://www.frostjedi.com/terra/scripts/demo/caretBug.html * http://www.frostjedi.com/terra/scripts/demo/caretBug.html
*/ */
function initInsertions() function initInsertions()
{ {
var doc; var doc;
@@ -27,7 +27,7 @@ function initInsertions()
{ {
doc = document; doc = document;
} }
else else
{ {
doc = opener.document; doc = opener.document;
} }
@@ -45,12 +45,12 @@ function initInsertions()
* bbstyle * bbstyle
*/ */
function bbstyle(bbnumber) function bbstyle(bbnumber)
{ {
if (bbnumber != -1) if (bbnumber != -1)
{ {
bbfontstyle(bbtags[bbnumber], bbtags[bbnumber+1]); bbfontstyle(bbtags[bbnumber], bbtags[bbnumber+1]);
} }
else else
{ {
insert_text('[*]'); insert_text('[*]');
document.getElementById(text_name).focus(); document.getElementById(text_name).focus();
@@ -92,7 +92,7 @@ function bbfontstyle(bbopen, bbclose)
//The new position for the cursor after adding the bbcode //The new position for the cursor after adding the bbcode
var caret_pos = getCaretPosition(textarea).start; var caret_pos = getCaretPosition(textarea).start;
var new_pos = caret_pos + bbopen.length; var new_pos = caret_pos + bbopen.length;
// Open tag // Open tag
insert_text(bbopen + bbclose); insert_text(bbopen + bbclose);
@@ -103,7 +103,7 @@ function bbfontstyle(bbopen, bbclose)
{ {
textarea.selectionStart = new_pos; textarea.selectionStart = new_pos;
textarea.selectionEnd = new_pos; textarea.selectionEnd = new_pos;
} }
// IE // IE
else if (document.selection) else if (document.selection)
{ {
@@ -124,15 +124,15 @@ function insert_text(text, spaces, popup)
{ {
var textarea; var textarea;
if (!popup) if (!popup)
{ {
textarea = document.getElementById(text_name); textarea = document.getElementById(text_name);
} }
else else
{ {
textarea = opener.document.getElementById(text_name); textarea = opener.document.getElementById(text_name);
} }
if (spaces) if (spaces)
{ {
text = ' ' + text + ' '; text = ' ' + text + ' ';
} }
@@ -148,7 +148,7 @@ 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);
@@ -161,7 +161,7 @@ function insert_text(text, spaces, popup)
{ {
textarea.value = textarea.value + text; textarea.value = textarea.value + text;
} }
if (!popup) if (!popup)
{ {
textarea.focus(); textarea.focus();
} }
@@ -298,7 +298,7 @@ function mozWrap(txtarea, open, close)
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;
} }
@@ -424,7 +424,7 @@ function getCaretPosition(txtarea)
// calculate selection start point by moving beginning of range_all to beginning of range // calculate selection start point by moving beginning of range_all to beginning of range
var sel_start; 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); range_all.moveStart('character', 1);
} }
@@ -432,7 +432,7 @@ function getCaretPosition(txtarea)
// we ignore the end value for IE, this is already dirty enough and we don't need it // we ignore the end value for IE, this is already dirty enough and we don't need it
caretPos.start = txtarea.sel_start; caretPos.start = txtarea.sel_start;
caretPos.end = txtarea.sel_start; caretPos.end = txtarea.sel_start;
} }
return caretPos; return caretPos;

View File

@@ -1,5 +1,5 @@
/*! Copyright (c) 2008 Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net) /*! Copyright (c) 2008 Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
*/ */

View File

@@ -5,33 +5,33 @@
* to offer multiple easing options * to offer multiple easing options
* *
* TERMS OF USE - jQuery Easing * TERMS OF USE - jQuery Easing
* *
* Open source under the BSD License. * Open source under the BSD License.
* *
* Copyright © 2008 George McGinley Smith * Copyright © 2008 George McGinley Smith
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
* *
* Redistributions of source code must retain the above copyright notice, this list of * Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer. * conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list * Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials * of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution. * provided with the distribution.
* *
* Neither the name of the author nor the names of contributors may be used to endorse * Neither the name of the author nor the names of contributors may be used to endorse
* or promote products derived from this software without specific prior written permission. * or promote products derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE. * OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
@@ -147,7 +147,7 @@ jQuery.extend( jQuery.easing,
return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
}, },
easeInOutBack: function (x, t, b, c, d, s) { easeInOutBack: function (x, t, b, c, d, s) {
if (s == undefined) s = 1.70158; if (s == undefined) s = 1.70158;
if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
}, },
@@ -174,32 +174,32 @@ jQuery.extend( jQuery.easing,
/* /*
* *
* TERMS OF USE - EASING EQUATIONS * TERMS OF USE - EASING EQUATIONS
* *
* Open source under the BSD License. * Open source under the BSD License.
* *
* Copyright © 2001 Robert Penner * Copyright © 2001 Robert Penner
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
* *
* Redistributions of source code must retain the above copyright notice, this list of * Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer. * conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list * Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials * of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution. * provided with the distribution.
* *
* Neither the name of the author nor the names of contributors may be used to endorse * Neither the name of the author nor the names of contributors may be used to endorse
* or promote products derived from this software without specific prior written permission. * or promote products derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE. * OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */

View File

@@ -1,87 +1,86 @@
/** /**
* *
* @package Board3 Portal v2.1 - javascript code * @package Board3 Portal v2.1 - javascript code
* @copyright (c) 2014 Board3 Group ( www.board3.de ) * @copyright (c) 2014 Board3 Group ( www.board3.de )
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
* *
*/ */
/* global phpbb, jQuery */ /* global phpbb, jQuery */
(function($) { // Avoid conflicts with other libraries (function($) { // Avoid conflicts with other libraries
"use strict"; "use strict";
var portal_right_width; var portal_right_width;
/** /**
* Correctly align the right column underneath the left column. * Correctly align the right column underneath the left column.
* This will make sure that the right column doesn't start before the end of * This will make sure that the right column doesn't start before the end of
* the center column but rather right after the last module of the left column. * the center column but rather right after the last module of the left column.
*/ */
phpbb.b3p_fix_right_column_margin = function() { phpbb.b3p_fix_right_column_margin = function() {
var width = $(window).width(), var width = $(window).width(),
$portal_right = $('#portal-right'), $portal_right = $('#portal-right'),
$portal_left = $('#portal-left'), $portal_left = $('#portal-left'),
$portal_center = $('#portal-center'), $portal_center = $('#portal-center'),
marginLeft = 'margin-left', marginLeft = 'margin-left',
marginRight = 'margin-right'; marginRight = 'margin-right';
if ($('body').hasClass('rtl')) { if ($('body').hasClass('rtl')) {
marginLeft = marginRight; marginLeft = marginRight;
marginRight = 'margin-left'; marginRight = 'margin-left';
} }
if (width <= (895 - $.getScrollbarWidth())) {
if (width <= (895 - $.getScrollbarWidth())) { // Get correct margin-left for portal-right and add 10px for padding
// Get correct margin-left for portal-right and add 10px for padding if ($portal_left.width() > 0) {
if ($portal_left.width() > 0) { if (!$portal_center.length && $portal_left.length) {
if (!$portal_center.length && $portal_left.length) { $portal_right.css(marginLeft, 5);
$portal_right.css(marginLeft, 5); $portal_left.css(marginRight, 0);
$portal_left.css(marginRight, 0); } else {
} else { $portal_right.css(marginLeft, - ($portal_right.width() + 1));
$portal_right.css(marginLeft, - ($portal_right.width() + 1)); }
} } else {
} else { $portal_right.css(marginLeft, 0);
$portal_right.css(marginLeft, 0); }
} } else {
} else { if (!$portal_center.length && $portal_left.length) {
if (!$portal_center.length && $portal_left.length) { $portal_right.css(marginLeft, 0);
$portal_right.css(marginLeft, 0); } else {
} else { $portal_right.css(marginLeft, -portal_right_width);
$portal_right.css(marginLeft, -portal_right_width); }
} $portal_right.width(portal_right_width);
$portal_right.width(portal_right_width); phpbb.b3pFixLeftColumnMargin();
phpbb.b3pFixLeftColumnMargin(); }
} };
};
/**
/** * Correctly align left column if center column does not exist
* Correctly align left column if center column does not exist */
*/ phpbb.b3pFixLeftColumnMargin = function() {
phpbb.b3pFixLeftColumnMargin = function() { var $portalLeft = $('#portal-left'),
var $portalLeft = $('#portal-left'), marginLeft = 'margin-left',
marginLeft = 'margin-left', marginRight = 'margin-right';
marginRight = 'margin-right';
if ($('body').hasClass('rtl')) {
if ($('body').hasClass('rtl')) { marginLeft = marginRight;
marginLeft = marginRight; marginRight = 'margin-left';
marginRight = 'margin-left'; }
}
if ($portalLeft.length && !$('#portal-center').length) {
if ($portalLeft.length && !$('#portal-center').length) { $portalLeft.css(marginLeft, '0');
$portalLeft.css(marginLeft, '0'); $portalLeft.css(marginRight, 10);
$portalLeft.css(marginRight, 10); }
} };
};
$(document).ready(function() {
$(document).ready(function() { portal_right_width = $('#portal-right').attr('data-width');
portal_right_width = $('#portal-right').attr('data-width'); phpbb.b3pFixLeftColumnMargin();
phpbb.b3pFixLeftColumnMargin(); phpbb.b3p_fix_right_column_margin();
phpbb.b3p_fix_right_column_margin(); $(window).resize(function() {
$(window).resize(function() { phpbb.b3p_fix_right_column_margin();
phpbb.b3p_fix_right_column_margin(); });
}); });
});
})(jQuery); // Avoid conflicts with other libraries
})(jQuery); // Avoid conflicts with other libraries