1
Fork 0
mirror of https://github.com/Steffo99/chakra-magic.git synced 2024-10-16 06:27:27 +00:00

Make browser button compatible with chrome

Make in-page button runnable on chrome (not sure if this break firefox compat)
This commit is contained in:
Sutas Nakasawek 2019-09-30 17:30:38 +07:00
parent f7471b24ea
commit 2d42c75f9b
2 changed files with 10 additions and 8 deletions

View file

@ -1,7 +1,11 @@
let this_browser = null;
if(!this_browser) try { this_browser = browser; } catch(e){}
if(!this_browser)try { this_browser = chrome; } catch(e) {}
function openPage() {
browser.tabs.create({
this_browser.tabs.create({
url: "https://steamcommunity.com/my/gcpd/570/?category=Account&tab=MatchPlayerReportIncoming"
});
}
browser.browserAction.onClicked.addListener(openPage);
this_browser.browserAction.onClicked.addListener(openPage);

View file

@ -94,15 +94,13 @@ function chakraMagic() {
let chakraElement = document.createElement("button");
parentElement.appendChild(chakraElement);
chakraElement.setAttribute("onclick", "illuminate()")
chakraElement.setAttribute("class", "chakramagic-button")
chakraElement.onclick = illuminate;
chakraElement.setAttribute("class", "chakramagic-button");
let imageElement = document.createElement("img")
let imageElement = document.createElement("img");
chakraElement.appendChild(imageElement);
imageElement.setAttribute("src", "http://cdn.dota2.com/apps/dota2/images/abilities/keeper_of_the_light_illuminate_hp2.png");
imageElement.setAttribute("class", "chakramagic-image")
exportFunction(illuminate, window, {defineAs: "illuminate"});
imageElement.setAttribute("class", "chakramagic-image");
}
chakraMagic();