Tried to fix github readme decoding
This commit is contained in:
parent
401ee44c7b
commit
a3eec668c5
4 changed files with 11 additions and 5 deletions
|
@ -23,7 +23,7 @@ image_decoder = {"images":images}
|
||||||
image_decoder_json = json.dumps(image_decoder, indent=2, sort_keys=True)
|
image_decoder_json = json.dumps(image_decoder, indent=2, sort_keys=True)
|
||||||
|
|
||||||
js_file = None
|
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 = file.read()
|
||||||
|
|
||||||
js_file = js_file.replace("%image_decoder%", image_decoder_json)
|
js_file = js_file.replace("%image_decoder%", image_decoder_json)
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
"build-chrome": "crx pack chrome -o chrome/hipchat-emoticons-for-all.crx",
|
"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",
|
"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-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",
|
"build-js": "bash build-js.sh",
|
||||||
"develop": "npm run build-assets && npm run build-js && npm run distribute ",
|
"develop": "npm run build-assets && npm run build-js && npm run distribute ",
|
||||||
"build-assets": "python3 assets/build-assets.py",
|
"build-assets": "python3 assets/build-assets.py",
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
function insert_emoticons(ident, classes) {
|
function insert_emoticons(ident, classes) {
|
||||||
classes = classes || "";
|
classes = classes || "";
|
||||||
|
decoder = image_decoder.images;
|
||||||
|
console.log("Replacing " + $(ident).length + " of " + ident);
|
||||||
$(ident).each(function() {
|
$(ident).each(function() {
|
||||||
decoder = image_decoder.images;
|
|
||||||
for (var i = 0; i < decoder.length; i++) {
|
for (var i = 0; i < decoder.length; i++) {
|
||||||
key = Object.keys(decoder[i]);
|
key = Object.keys(decoder[i]);
|
||||||
image = decoder[i][key];
|
image = decoder[i][key];
|
||||||
|
@ -11,6 +12,7 @@ function insert_emoticons(ident, classes) {
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
console.log("Swapped " + ident);
|
||||||
}
|
}
|
||||||
|
|
||||||
function markdown_decoder(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%
|
var image_decoder = %image_decoder%
|
|
@ -7,6 +7,7 @@ function change_readme() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function change_wiki() {
|
function change_wiki() {
|
||||||
|
console.log("Changing wiki");
|
||||||
insert_emoticons('#wiki-body');
|
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"]');
|
markdown_decoder('form .timeline-comment textarea[placeholder="Leave a comment"]');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#wiki-body').on('load change', change_wiki);
|
||||||
|
|
||||||
$(document).on('ready', function() {
|
$(document).on('ready', function() {
|
||||||
|
console.log("Ready");
|
||||||
change_comments();
|
change_comments();
|
||||||
change_readme();
|
change_readme();
|
||||||
change_wiki();
|
|
||||||
});
|
});
|
||||||
|
console.log('Github');
|
Reference in a new issue