From fcb056d385e0ece0c0c8f014a71292da7888a65e Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Tue, 25 Aug 2015 14:48:58 +0100 Subject: [PATCH] Renamed image decoder, and modified identifier for github comment form --- assets/build-assets.py | 4 ++-- build-js.sh | 4 ++-- chrome/build-manifest.py | 2 +- chrome/manifest.json | 4 ++-- src/injections/github.js | 10 ++++++---- src/{image-decoder.js => injector.js} | 0 6 files changed, 13 insertions(+), 11 deletions(-) rename src/{image-decoder.js => injector.js} (100%) diff --git a/assets/build-assets.py b/assets/build-assets.py index d6a46a1..e26ba77 100644 --- a/assets/build-assets.py +++ b/assets/build-assets.py @@ -22,10 +22,10 @@ image_decoder = {"images":images} image_decoder_json = json.dumps(image_decoder, indent=2, sort_keys=True) js_file = None -with open('src/image-decoder.js', "r") as file: +with open('src/injector.js', "r") as file: js_file = file.read() js_file = js_file.replace("%image_decoder%", image_decoder_json) -with open('build/image-decoder.js', 'w') as file: +with open('build/injector.js', 'w') as file: file.write(js_file) diff --git a/build-js.sh b/build-js.sh index 5144fc8..f756e15 100644 --- a/build-js.sh +++ b/build-js.sh @@ -5,8 +5,8 @@ cp -r src/decoder.json build/ rm -rf build/injections/* mkdir -p build/src/injections -uglifyjs build/image-decoder.js --compress --screw-ie8 --define --keep-fnames -o build/image-decoder.js -for f in src/injections/*; do uglifyjs "build/image-decoder.js" "src/lib/jquery.js" $f --compress --screw-ie8 --define --stats --keep-fnames -o build/$f; done +uglifyjs build/injector.js --compress --screw-ie8 --define --keep-fnames -o build/injector.js +for f in src/injections/*; do uglifyjs "build/injector.js" "src/lib/jquery.js" $f --compress --screw-ie8 --define --stats --keep-fnames -o build/$f; done cp -rp build/src/* build/ rm -rf build/src \ No newline at end of file diff --git a/chrome/build-manifest.py b/chrome/build-manifest.py index 6c16229..860caf0 100644 --- a/chrome/build-manifest.py +++ b/chrome/build-manifest.py @@ -30,7 +30,7 @@ for site in site_decoder: site = list(site.items())[0] temp = {} temp['matches'] = ["*://" + site[0] + '/*'] - temp['js'] = ['data/lib/jquery.js', 'data/image-decoder.js', 'data/injections/' + site[1]] + temp['js'] = ['data/lib/jquery.js', 'data/injector.js', 'data/injections/' + site[1]] content_scripts.append(temp) diff --git a/chrome/manifest.json b/chrome/manifest.json index 368c938..d17b197 100644 --- a/chrome/manifest.json +++ b/chrome/manifest.json @@ -3,7 +3,7 @@ { "js": [ "data/lib/jquery.js", - "data/image-decoder.js", + "data/injector.js", "data/injections/facebook.js" ], "matches": [ @@ -13,7 +13,7 @@ { "js": [ "data/lib/jquery.js", - "data/image-decoder.js", + "data/injector.js", "data/injections/github.js" ], "matches": [ diff --git a/src/injections/github.js b/src/injections/github.js index eecd271..15e540f 100644 --- a/src/injections/github.js +++ b/src/injections/github.js @@ -10,9 +10,11 @@ $('.js-comment-container').on('load change', change_comments); $('#readme').on('load change', change_readme); -$('.timeline-comment textarea[placeholder="Leave a comment"]').on('change input', function() { - markdown_injector('.timeline-comment textarea[placeholder="Leave a comment"]'); +$('form .timeline-comment textarea[placeholder="Leave a comment"]').on('change input', function() { + markdown_injector('form .timeline-comment textarea[placeholder="Leave a comment"]'); }); -change_comments(); -change_readme(); +$(document).on('ready', function() { + change_comments(); + change_readme(); +}); diff --git a/src/image-decoder.js b/src/injector.js similarity index 100% rename from src/image-decoder.js rename to src/injector.js