Skip to content
Closed
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
4 changes: 2 additions & 2 deletions .hound.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ eslint:
python:
enabled: true
config_file: tools/.flake8.ini
scss:
sass-lint:
enabled: true
config_file: assets/css/.scss-lint.yml
config_file: assets/css/.sass-lint.yml
13 changes: 10 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
sudo: required
dist: trusty
language: node_js
node_js:
- stable
before_install:
- sudo apt-get install python3 python3-pip
install:
- npm install jsonlint eslint htmlhint sass-lint -g
- pip3 install flake8
script:
- find assets/strings -type f -name '*.json' -exec jsonlint -q '{}' +
- eslint -c assets/js/.eslintrc.json assets/js/*.js
- eslint --config assets/js/.eslintrc.json assets/js/*.js
- htmlhint --config .htmlhintrc.json *.html
before_install:
- npm install jsonlint eslint htmlhint -g
- sass-lint --config assets/css/.sass-lint.yml --verbose --no-exit --max-warnings 0
- flake8 --config tools/.flake8.ini *.py **/**.py **/**/*.py
19 changes: 19 additions & 0 deletions assets/css/.sass-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
files:
ignore: assets/css/bootstrap.css
include: 'assets/css/**/*.css'
rules:
no-ids: 0
single-line-per-selector: 0
no-color-literals: 0
force-element-nesting: 0
force-pseudo-nesting: 0
force-attribute-nesting: 0
no-vendor-prefixes: 0
no-css-comments: 0
no-transition-all: 0
no-qualifying-elements:
- 1
- allow-element-with-attribute: true
class-name-format:
- 1
- convention: camelcase
25 changes: 0 additions & 25 deletions assets/css/.scss-lint.yml

This file was deleted.

77 changes: 34 additions & 43 deletions assets/css/style.css

Large diffs are not rendered by default.

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);

$('#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 () {
Copy link
Member

Choose a reason for hiding this comment

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

Why the mouseup event? Is there not a resize event?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is there not a resize event?

This stackoverflow link discusses about a resize event that we will need to code up to detect a change in textarea dimensions. This too, uses mouseup event only! Thus, I chose to go with the mouseup approach!

$('#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
1 change: 1 addition & 0 deletions assets/strings/localisation-tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def dumpJSON(f, data):
def loadJSON(f):
return json.loads(f.read(), object_pairs_hook=OrderedDict)


if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Manipulate localisation files', formatter_class=argparse.RawTextHelpFormatter)
parser.add_argument('actions', nargs='+', help="new/create: creates a new localisation file\n"
Expand Down
1 change: 1 addition & 0 deletions tools/localise-html.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ def run(html_path, json_path, out_path, conf_path, fallback_path):
with open(out_path, 'w') as out:
out.write("".join(parser.output))


if __name__ == "__main__":
argparser = argparse.ArgumentParser(description='Localise an HTML file using a json file from stdin')
argparser.add_argument('template', help='HTML file to localise')
Expand Down