diff --git a/manifest.json b/manifest.json index 1c49741..a9b0e61 100644 --- a/manifest.json +++ b/manifest.json @@ -1,35 +1,34 @@ { - "manifest_version":2, - "name":"__MSG_extensionName__", - "version":"1.2", - "author":"shinrax2", - "description":"__MSG_extensionDescription__", - "default_locale": "en", - - "content_scripts":[ - { - "exclude_matches":[ - "*://help.steampowered.com/*", - "*://steamcommunity.com/openid/login*" - ], - "matches":[ - "*://*.steamcommunity.com/*", - "*://*.steampowered.com/*" - ], - "js":[ + "manifest_version": 2, + "name": "__MSG_extensionName__", + "version": "1.2", + "author": "shinrax2", + "description": "__MSG_extensionDescription__", + "default_locale": "en", + + "content_scripts": [{ + "exclude_matches": [ + "*://steamcommunity.com/login*", + "*://steamcommunity.com/openid/login*", + "*://help.steampowered.com/*/wizard/Login*", + "*://*.steampowered.com/login*", + "*://store.steampowered.com/about*" + ], + "matches": [ + "*://steamcommunity.com/*", + "*://*.steampowered.com/*" + ], + "js": [ "openinsteam.js" - ] - } - ], - - "icons" : { - "48" : "icons/48x48.png", - "96" : "icons/96x96.png" + ] + }], + "icons" : { + "48" : "icons/48x48.png", + "96" : "icons/96x96.png" }, - - "applications": { + "applications": { "gecko": { "id": "openinsteampublic@shinrax2" } - } + } } diff --git a/openinsteam.js b/openinsteam.js index 56392f8..cc9897d 100644 --- a/openinsteam.js +++ b/openinsteam.js @@ -1,26 +1,20 @@ +'use strict'; + if(!browser) { - var browser = chrome // to support chrome + var browser = chrome // to support chrome +} + +let str = browser.i18n.getMessage("steamButtonText") +let ustr = str.toUpperCase(); +let url = "steam://openurl/" + encodeURI(window.location) + +const instbtn = document.getElementsByClassName('header_installsteam_btn header_installsteam_btn_green')[0].parentNode; +instbtn.insertAdjacentHTML('afterbegin', '
' + str + '
'); + +if (document.querySelector("#footer_nav")) { + const footer_nav = document.querySelector('#footer_steam_pulldown').parentNode; + footer_nav.insertAdjacentHTML('afterbegin', '' + ustr + ''); +} else { + const valve_links = document.getElementsByClassName('valve_links')[0]; + valve_links.insertAdjacentHTML('beforeend', ' | ' + str + ''); } -var btntxt = browser.i18n.getMessage("steamButtonText") -var e = document.getElementsByClassName("logo")[0] -var f = document.getElementsByClassName("footer_content")[0] -var a = document.createElement("a") -var ref = document.createAttribute("href") -ref.value = "steam://openurl/"+encodeURI(window.location) -var btn = document.createElement("button") -var t = document.createTextNode(btntxt) -btn.append(t) -a.setAttributeNode(ref) -a.append(btn) -e.append(a) -var span = document.createElement("span") -var ab = document.createElement("a") -var refb = document.createAttribute("href") -refb.value = "steam://openurl/"+encodeURI(window.location) -var btnb = document.createElement("button") -var tb = document.createTextNode(btntxt) -btnb.append(tb) -ab.setAttributeNode(refb) -ab.append(btnb) -span.append(ab) -f.append(span)