1
Fork 0

Started to fix import bugs

This commit is contained in:
Jake Howard 2015-08-20 22:38:11 +01:00
parent 1ccd7bdbf4
commit f4fb7baaa7
4 changed files with 17 additions and 7 deletions

View file

@ -1,4 +1,4 @@
#~!/usr/bin/bash #!/usr/bin/bash
cp -r src/* build/ cp -r src/* build/
rm -rf build/injections/* rm -rf build/injections/*

View file

@ -1,10 +1,14 @@
var self = require('sdk/self'); var self = require('sdk/self');
var pageMod = require("sdk/page-mod"); var pageMod = require("sdk/page-mod");
var sites = require("data/site-decoder.json") var sites = require("data/site-decoder.json").sites;
for (var i = 0; i < sites.length; i++) { for (var i = 0; i < sites.length; i++) {
pattern = Object.keys(sites[i])[0];
script = sites[i][pattern];
console.log('script ' + script);
console.log('pattern ' + pattern);
pageMod.PageMod({ pageMod.PageMod({
include: sites[i][0], include: pattern,
contentScriptFile: ["lib/jquery.js", "./image_lookup.js", "injections/" + sites[i][1]] contentScriptFile: ["lib/jquery.js", "./image_lookup.js", "injections/" + script]
}); });
} }

View file

@ -1,4 +1,4 @@
var image_decoder = { // Image tag (no brackets) : Image URL var image_decoder = { // Image tag (no brackets) : Image URL
"noot" : "" "noot" : "https://dujrsrsgsd3nh.cloudfront.net/img/emoticons/23362/noot-1438871175.png"
} }

View file

@ -1,7 +1,8 @@
function change_chat_tabs() { function change_chat_tabs() {
$('._d97').each(function(){ $('._d97').each(function(){
for (var i = 0; i < image_decoder.length; i++) { for (var i = 0; i < image_decoder.length; i++) {
$(this).html($(this).html().replace(image_decoder[i][0], console.log('Checking for ' + image_decoder[i][0])
$(this).html($(this).html().replace("(" + image_decoder[i][0] + ")",
"<img class='emoticon' style='height: 30px; width: 30px;' src='" + image_decoder[i][1] + "'/>" "<img class='emoticon' style='height: 30px; width: 30px;' src='" + image_decoder[i][1] + "'/>"
)); ));
} }
@ -13,3 +14,8 @@ $('.fbNubFlyout').on(
'DOMNodeInserted DOMNodeRemoved change load', function(event) { 'DOMNodeInserted DOMNodeRemoved change load', function(event) {
change_chat_tabs(); change_chat_tabs();
}); });
$('._d97').on('change load', function(event){
change_chat_tabs();
});
alert("Injected");