1
Fork 0

Tried to fix github readme decoding

This commit is contained in:
Jake Howard 2015-08-28 15:52:12 +01:00
parent 401ee44c7b
commit a3eec668c5
4 changed files with 11 additions and 5 deletions

View File

@ -23,7 +23,7 @@ image_decoder = {"images":images}
image_decoder_json = json.dumps(image_decoder, indent=2, sort_keys=True)
js_file = None
with open('src/injector.js', "r") as file:
with open('src/global.js', "r") as file:
js_file = file.read()
js_file = js_file.replace("%image_decoder%", image_decoder_json)

View File

@ -10,7 +10,7 @@
"build-chrome": "crx pack chrome -o chrome/hipchat-emoticons-for-all.crx",
"release-chrome": "crx pack chrome -o chrome/hipchat-emoticons-for-all.crx -p chrome/key.pem",
"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",
"test": "npm run develop && npm run test-firefox",
"build-js": "bash build-js.sh",
"develop": "npm run build-assets && npm run build-js && npm run distribute ",
"build-assets": "python3 assets/build-assets.py",

View File

@ -1,7 +1,8 @@
function insert_emoticons(ident, classes) {
classes = classes || "";
decoder = image_decoder.images;
console.log("Replacing " + $(ident).length + " of " + ident);
$(ident).each(function() {
decoder = image_decoder.images;
for (var i = 0; i < decoder.length; i++) {
key = Object.keys(decoder[i]);
image = decoder[i][key];
@ -11,6 +12,7 @@ function insert_emoticons(ident, classes) {
));
}
});
console.log("Swapped " + ident);
}
function markdown_decoder(ident) {
@ -25,6 +27,6 @@ function markdown_decoder(ident) {
}
}
console.log("Hipchat-emoticons-for-all is enabled.");
console.log("Hipchat-emoticons-for-all is enabled on " + location.href);
var image_decoder = %image_decoder%

View File

@ -7,6 +7,7 @@ function change_readme() {
}
function change_wiki() {
console.log("Changing wiki");
insert_emoticons('#wiki-body');
}
@ -18,8 +19,11 @@ $('form .timeline-comment textarea[placeholder="Leave a comment"]').on('change i
markdown_decoder('form .timeline-comment textarea[placeholder="Leave a comment"]');
});
$('#wiki-body').on('load change', change_wiki);
$(document).on('ready', function() {
console.log("Ready");
change_comments();
change_readme();
change_wiki();
});
console.log('Github');