Skip to content

Fix issues 132 and 151 #152

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions assets/js/translator.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,6 @@ if(modeEnabled('translation')) {
synchronizeTextareaHeights();
});

$(window).resize(synchronizeTextareaHeights);
Copy link
Member

@sushain97 sushain97 Jun 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you figure out why this was added using git blame? I'm concerned about removing it without knowing why in case we regress on another front.

Copy link
Contributor Author

@share-with-me share-with-me Jun 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Um, Nop! I tried to figure out the code that was causing this. I will use git blame now!

Copy link
Contributor Author

@share-with-me share-with-me Jun 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using git blame, it shows that you have made the latest modification to that line with commit message as in this link. How do I infer from this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that commit just fixed a bunch of style issues. You'll have to look backwards in time a bit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure on it.

Copy link
Contributor Author

@share-with-me share-with-me Jun 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Um, the commit message says - Improve textarea mechanics.
The link to the blame where this line of code was added it link

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, that's not a helpful commit message.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm yeah. But I believe removing it should not cause an issue right? As in, it is just synchronizing heights! We could add it very easily in the event we need it. Inputs?


$('#originalText').blur(function () {
persistChoices('translator', true);
});
Expand Down
7 changes: 6 additions & 1 deletion assets/js/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ var TEXTAREA_AUTO_RESIZE_MINIMUM_WIDTH = 768,
BACK_TO_TOP_BUTTON_ACTIVATION_HEIGHT = 300,
THRESHOLD_REQUEST_URL_LENGTH = 2000; // maintain 48 characters buffer for generated parameters

var originalTextScrollHeight;

// From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign#Polyfill
/* eslint-disable */
if (typeof Object.assign != 'function') {
Expand Down Expand Up @@ -162,6 +164,9 @@ $(document).ready(function () {
return false;
});

$('#originalText').mouseup(function () {
$('#originalText').css('overflow-y', $('#originalText').height() < originalTextScrollHeight ? 'scroll' : 'hidden');
});
});

if(config.PIWIK_SITEID && config.PIWIK_URL) {
Expand Down Expand Up @@ -278,7 +283,7 @@ function synchronizeTextareaHeights() {
'overflow-y': 'hidden',
'height': 'auto'
});
var originalTextScrollHeight = $('#originalText')[0].scrollHeight;
originalTextScrollHeight = $('#originalText')[0].scrollHeight;
$('#originalText').css('height', originalTextScrollHeight + 'px');
$('#translatedText').css('height', originalTextScrollHeight + 'px');
}
Expand Down