1
Fork 0
mirror of https://github.com/Steffo99/chakra-magic.git synced 2024-12-22 22:54:19 +00:00

Merge pull request #2: Make script compatible on both Firefox and Chrome

This commit is contained in:
Steffo 2019-10-02 10:48:52 +02:00 committed by GitHub
commit 1177182df1
Signed by: github
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 9 deletions

View file

@ -1,7 +1,11 @@
let thisBrowser = null;
if(!thisBrowser) try { thisBrowser = browser; } catch(e) {}
if(!thisBrowser) try { thisBrowser = chrome; } catch(e) {}
function openPage() { function openPage() {
browser.tabs.create({ thisBrowser.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); thisBrowser.browserAction.onClicked.addListener(openPage);

View file

@ -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();

View file

@ -8,7 +8,7 @@
}, },
"name": "Chakra Magic", "name": "Chakra Magic",
"version": "2019.9.30.2", "version": "2019.10.2.1",
"developer": { "developer": {
"name": "Stefano Pigozzi", "name": "Stefano Pigozzi",
"url": "https://github.com/Steffo99/chakra-magic" "url": "https://github.com/Steffo99/chakra-magic"