Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements #2

Merged
merged 1 commit into from
Jun 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 27 additions & 28 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
}
42 changes: 18 additions & 24 deletions openinsteam.js
Original file line number Diff line number Diff line change
@@ -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', '<div class="header_installsteam_btn header_installsteam_btn_green"><a style="background-color: #397198 !important; background-image: url(\'https://steamcdn-a.akamaihd.net/store/about/icon-steamos.svg\') !important; background-size: 13px" class="header_installsteam_btn_content" href="' + url + '">' + str + '</a></div>');

if (document.querySelector("#footer_nav")) {
const footer_nav = document.querySelector('#footer_steam_pulldown').parentNode;
footer_nav.insertAdjacentHTML('afterbegin', '<a id="footer_steam_pulldown" class="pulldown btnv6_blue_hoverfade btn_small" href="' + url + '"><span>' + ustr + '</span></a>');
} else {
const valve_links = document.getElementsByClassName('valve_links')[0];
valve_links.insertAdjacentHTML('beforeend', '<a style="padding-left: 10px;"></a> | <a style="padding-left: 10px;" href="' + url + '">' + str + '</a>');
}
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)