From ab1ee743187fae21dc94e866256bb118b1f0101c Mon Sep 17 00:00:00 2001 From: C-Lodder Date: Wed, 1 Mar 2017 17:54:46 +0000 Subject: [PATCH 1/2] Improved layout for RTL languages --- changelog.php | 3 +++ mod_shoutbox/media/css/mod_shoutbox.css | 21 ++++++++++++++++++++ mod_shoutbox/media/js/mod_shoutbox.js | 20 +++++++++++++------ mod_shoutbox/mod_shoutbox.php | 1 + mod_shoutbox/tmpl/default.php | 26 +++++++++++++++---------- 5 files changed, 55 insertions(+), 16 deletions(-) diff --git a/changelog.php b/changelog.php index a5d653b..9ccb513 100644 --- a/changelog.php +++ b/changelog.php @@ -14,6 +14,9 @@ - -> Removed ! -> Note +###WIP +^ Improved layout for RTL languages + Version 8.1.12 * Prevent access via the 'window.opener' object with submitted links ^ Fix smiley being shown multiple times for the same image if there are multiple shortcuts diff --git a/mod_shoutbox/media/css/mod_shoutbox.css b/mod_shoutbox/media/css/mod_shoutbox.css index 3b3163e..71f5d5c 100644 --- a/mod_shoutbox/media/css/mod_shoutbox.css +++ b/mod_shoutbox/media/css/mod_shoutbox.css @@ -286,3 +286,24 @@ BBCode .jj-underline { text-decoration: underline !important; } + +/** +RTL +**/ +html[dir="rtl"] .jjshoutboxoutput .shout-header { + padding: 0 5px 0 35px; +} +html[dir="rtl"] .jjshoutbox .btn-group .btn { + min-width: 26px; + margin-bottom: 5px; +} +html[dir="rtl"] .jjshoutboxoutput div p { + text-align: right; + padding: 0 5px 0 0; +} +html[dir="rtl"] .jjshoutboxoutput .shout-actions { + position: absolute; + top: 0; + left: 3px; + right: auto; +} \ No newline at end of file diff --git a/mod_shoutbox/media/js/mod_shoutbox.js b/mod_shoutbox/media/js/mod_shoutbox.js index 07f6ad5..298d220 100644 --- a/mod_shoutbox/media/js/mod_shoutbox.js +++ b/mod_shoutbox/media/js/mod_shoutbox.js @@ -210,15 +210,23 @@ JJShoutbox.getRandomArbitrary = function(min, max) /** * Draw the maths question using a canvas */ -JJShoutbox.drawMathsQuestion = function(number1, number2) -{ - var c = document.getElementById('mathscanvas'); - var ctx = c.getContext('2d'); +JJShoutbox.drawMathsQuestion = function(number1, number2, rtl) +{ + var c = document.getElementById('mathscanvas'), + ctx = c.getContext('2d'); ctx.clearRect(0, 0, c.width, c.height); ctx.font = '14px Arial'; ctx.fillStyle = 'grey'; - ctx.fillText(number1 + ' + ' + number2 + ' = ', 10, 20); + + if (rtl == 1) + { + ctx.fillText(parseInt(number1) + ' + ' + parseInt(number2) + ' = ', 70, 20); + } + else + { + ctx.fillText(number1 + ' + ' + number2 + ' = ', 10, 20); + } } @@ -621,7 +629,7 @@ jQuery(document).ready(function($) { params.instance.find('input[name="jjshout[sum2]"]').val(val2); params.instance.find('label[for="math_output"]').text(val1 + ' + ' + val2); params.instance.find('input[name="jjshout[human]"]').val(''); - JJShoutbox.drawMathsQuestion(val1, val2); + JJShoutbox.drawMathsQuestion(val1, val2, params.rtl); } return false; diff --git a/mod_shoutbox/mod_shoutbox.php b/mod_shoutbox/mod_shoutbox.php index dfbcb91..62a022f 100644 --- a/mod_shoutbox/mod_shoutbox.php +++ b/mod_shoutbox/mod_shoutbox.php @@ -58,6 +58,7 @@ $editowntime = $params->get('editown-time', 5); $history = $params->get('history', 1); $remainingLength = JText::_('SHOUT_REMAINING'); +$rtl = JFactory::getLanguage()->isRTL(); // Assemble the factory variables needed $doc = JFactory::getDocument(); diff --git a/mod_shoutbox/tmpl/default.php b/mod_shoutbox/tmpl/default.php index 9423b43..829ad11 100644 --- a/mod_shoutbox/tmpl/default.php +++ b/mod_shoutbox/tmpl/default.php @@ -203,7 +203,7 @@ class=""