Overview
| Comment: | Fix for firefox |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | comunicate |
| Files: | files | file ages | folders |
| SHA3-256: |
175e6bd8bff414a30aaaaa5640d2ee09 |
| User & Date: | IllusionPerdu on 2018-11-08 17:51:52 |
| Other Links: | branch diff | manifest | tags |
Context
|
2018-11-10
| ||
| 14:23 | Fix some case check-in: 73aa037b8d user: IllusionPerdu tags: comunicate | |
|
2018-11-08
| ||
| 17:51 | Fix for firefox check-in: 175e6bd8bf user: IllusionPerdu tags: comunicate | |
| 17:13 | Hack for acces to iframe content and somme cleanup check-in: c5404a7d12 user: IllusionPerdu tags: comunicate | |
Changes
Modified gc_lang/fr/webext/content_scripts/event.js from [52dc78c9a0] to [cef6680984].
1 2 3 4 5 6 7 8 9 |
var min = Math.ceil(0);
var max = Math.floor(9999999);
function uniqueID() {
return Date.now().toString(36) + "-" + (Math.floor(Math.random() * (max - min)) + min).toString(36);
}
// ! Ecoute des messages venant du content script
let browserURL;
document.addEventListener("GrammalecteToPage", function respListener(event) {
| > | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
var min = Math.ceil(0);
var max = Math.floor(9999999);
function uniqueID() {
return Date.now().toString(36) + "-" + (Math.floor(Math.random() * (max - min)) + min).toString(36);
}
// ! Ecoute des messages venant du content script
let browserURL;
document.addEventListener("GrammalecteToPage", function respListener(event) {
//console.log(event);
var data = JSON.parse(event.detail);
// Message envoyer dès que le script est injecté
if (typeof data.init !== "undefined") {
browserURL = data.init;
}
//console.log("GrammalecteToPage",data);
});
|
| ︙ | ︙ | |||
27 28 29 30 31 32 33 |
if (!dataAction.elm.id) {
dataAction.elm.id = uniqueID();
}
dataToSend.elm = dataAction.elm.id;
}
//console.log('dataToSend', dataToSend);
| | | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
if (!dataAction.elm.id) {
dataAction.elm.id = uniqueID();
}
dataToSend.elm = dataAction.elm.id;
}
//console.log('dataToSend', dataToSend);
var eventGrammalecte = new CustomEvent("GrammalecteEvent", { detail: JSON.stringify(dataToSend) });
document.dispatchEvent(eventGrammalecte);
return dataToSend.IdAction;
}
// ! Envoie de l'information que l'injection est bien faite ;)
// (peut être lu aussi bien par la page web que le content script)
var customAPILoaded = new CustomEvent("GrammalecteIsLoaded");
|
| ︙ | ︙ |
Modified gc_lang/fr/webext/content_scripts/init.js from [342fbed920] to [16c99e6a6e].
| ︙ | ︙ | |||
372 373 374 375 376 377 378 |
var max = Math.floor(9999999);
function uniqueID() {
return Date.now().toString(36) + "-" + (Math.floor(Math.random() * (max - min)) + min).toString(36);
}
// ! Ecoute des messages venant du scipt injecté
document.addEventListener("GrammalecteEvent", function(event) {
| | | 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 |
var max = Math.floor(9999999);
function uniqueID() {
return Date.now().toString(36) + "-" + (Math.floor(Math.random() * (max - min)) + min).toString(36);
}
// ! Ecoute des messages venant du scipt injecté
document.addEventListener("GrammalecteEvent", function(event) {
let actionFromPage = JSON.parse(event.detail);
//console.log(event);
let sText = false;
let dInfo = {};
let elmForGramma = null;
if (actionFromPage.iframe) {
elmForGramma = document.getElementById(actionFromPage.iframe).contentWindow.document.body;
|
| ︙ | ︙ | |||
425 426 427 428 429 430 431 |
dataToSend.elm = dataAction.elm.id;
}
if (!isLoaded) {
bufferMsg.push(dataToSend);
} else {
//console.log('sendToWebpage', dataToSend);
| | | | 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 |
dataToSend.elm = dataAction.elm.id;
}
if (!isLoaded) {
bufferMsg.push(dataToSend);
} else {
//console.log('sendToWebpage', dataToSend);
var eventGrammalecte = new CustomEvent("GrammalecteToPage", { detail: JSON.stringify(dataToSend) });
document.dispatchEvent(eventGrammalecte);
}
return dataToSend.IdAction;
}
// ! Les message ne peuvent être envoyer qu'après que le script est injecté
document.addEventListener("GrammalecteIsLoaded", function() {
//console.log("GrammalecteIsLoaded EXT");
isLoaded = true;
if (bufferMsg.length > 0) {
for (const dataToSend of bufferMsg) {
var eventGrammalecte = new CustomEvent("GrammalecteToPage", { detail: JSON.stringify(dataToSend) });
document.dispatchEvent(eventGrammalecte);
}
}
});
sendToWebpage({ init: browser.extension.getURL("") });
|