mirror of
https://github.com/Steffo99/chakra-magic.git
synced 2024-12-22 14:44:18 +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:
parent
f7471b24ea
commit
2d42c75f9b
2 changed files with 10 additions and 8 deletions
|
@ -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() {
|
function openPage() {
|
||||||
browser.tabs.create({
|
this_browser.tabs.create({
|
||||||
url: "https://steamcommunity.com/my/gcpd/570/?category=Account&tab=MatchPlayerReportIncoming"
|
url: "https://steamcommunity.com/my/gcpd/570/?category=Account&tab=MatchPlayerReportIncoming"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
browser.browserAction.onClicked.addListener(openPage);
|
this_browser.browserAction.onClicked.addListener(openPage);
|
|
@ -94,15 +94,13 @@ function chakraMagic() {
|
||||||
|
|
||||||
let chakraElement = document.createElement("button");
|
let chakraElement = document.createElement("button");
|
||||||
parentElement.appendChild(chakraElement);
|
parentElement.appendChild(chakraElement);
|
||||||
chakraElement.setAttribute("onclick", "illuminate()")
|
chakraElement.onclick = illuminate;
|
||||||
chakraElement.setAttribute("class", "chakramagic-button")
|
chakraElement.setAttribute("class", "chakramagic-button");
|
||||||
|
|
||||||
let imageElement = document.createElement("img")
|
let imageElement = document.createElement("img");
|
||||||
chakraElement.appendChild(imageElement);
|
chakraElement.appendChild(imageElement);
|
||||||
imageElement.setAttribute("src", "http://cdn.dota2.com/apps/dota2/images/abilities/keeper_of_the_light_illuminate_hp2.png");
|
imageElement.setAttribute("src", "http://cdn.dota2.com/apps/dota2/images/abilities/keeper_of_the_light_illuminate_hp2.png");
|
||||||
imageElement.setAttribute("class", "chakramagic-image")
|
imageElement.setAttribute("class", "chakramagic-image");
|
||||||
|
|
||||||
exportFunction(illuminate, window, {defineAs: "illuminate"});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
chakraMagic();
|
chakraMagic();
|
||||||
|
|
Loading…
Reference in a new issue