diff --git a/assets/build-assets.py b/assets/build-assets.py index daefa63..d6a46a1 100644 --- a/assets/build-assets.py +++ b/assets/build-assets.py @@ -1,26 +1,31 @@ import json from glob import glob +ASSETS_URL="https://raw.githubusercontent.com/RealOrangeOne/hipchat-emoticons-for-all/master/assets/" + + +def get_icon_name(path): + return get_filename(path).replace('.png', '') + def get_filename(path): - return path.replace('assets/', "").replace('.png', '') + return path.replace('assets/', '') files = glob('assets/*.png') -image_bin = [] +images = [] for filename in files: - with open(filename, 'rb') as file: - image_bin.append({ get_filename(filename): - "data:image/png;base64," + (open(filename, 'rb').read().encode('base64').replace('\n', '')) - }) + images.append({get_icon_name(filename): ASSETS_URL + get_filename(filename)}) -image_decoder = {"images":image_bin} +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: js_file = file.read() + js_file = js_file.replace("%image_decoder%", image_decoder_json) + with open('build/image-decoder.js', 'w') as file: file.write(js_file) diff --git a/package.json b/package.json index 3d2a2a5..c7aa726 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "test-firefox": "cd firefox/ && jpm run -b /usr/bin/firefox && cd -", "test": "npm run build-assets && npm run build-js && npm run distribute && npm run test-firefox", "build-js": "bash build-js.sh", + "develop": "npm run build-assets && npm run build-js && npm run distribute ", "build-assets": "python assets/build-assets.py", "build-data-files": "python firefox/build-package.py && python chrome/build-manifest.py", "distribute": "rm -rf firefox/data/* chrome/data/* && cp -rf build/* firefox/data/ && cp -rf build/* chrome/data/", @@ -19,7 +20,7 @@ }, "repository": { "type": "git", - "url": "https://bitbucket.org/theorangeone/hipchat-emoticons-for-all" + "url": "https://github.com/realorangeone/hipchat-emoticons-for-all" }, "keywords": [ "hipchat", @@ -28,9 +29,9 @@ "author": "TheOrangeOne", "license": "MIT", "bugs": { - "url": "https://bitbucket.org/theorangeone/hipchat-emoticons-for-all/issues" + "url": "https://github.com/realorangeone/hipchat-emoticons-for-all/issues" }, - "homepage": "https://bitbucket.org/theorangeone/hipchat-emoticons-for-all", + "homepage": "https://github.com/realorangeone/hipchat-emoticons-for-all", "dependencies": { "ionic-sdk": "=1.0.0", "jpm":"=1.0.1", diff --git a/src/image-decoder.js b/src/image-decoder.js index c6917f7..f5221ec 100644 --- a/src/image-decoder.js +++ b/src/image-decoder.js @@ -21,13 +21,12 @@ function markdown_injector(ident) { raw_key = Object.keys(decoder[i]); image = decoder[i][raw_key]; key = "(" + raw_key + ")"; - $(ident).text($(ident).text().replace(key, + $(ident).val($(ident).val().replace(key, "![" + raw_key + "](" + image + ")" )); } } - console.log("Injection"); var image_decoder = %image_decoder% \ No newline at end of file diff --git a/src/injections/github.js b/src/injections/github.js index 6f279cd..e2e7cd4 100644 --- a/src/injections/github.js +++ b/src/injections/github.js @@ -6,14 +6,13 @@ function change_readme() { inject_image('#readme'); } -$('#partial-new-comment-form-actions').append(''); - -$("button.btn[name='comment_and_close']").prev().on('click', change_comments); - $('.js-comment-container').on('load change', change_comments); $('#readme').on('load change', change_readme); -$('#markdown-inject-btn').on('click', function() { markdown_injector('#new-comment-field');}) +$('.timeline-comment textarea[placeholder="Leave a comment"]').on('change input', function() { + console.log("Change"); markdown_injector('.timeline-comment textarea[placeholder="Leave a comment"]'); +}); + change_comments(); -change_readme(); \ No newline at end of file +change_readme();