Skip to content

Commit

Permalink
Merge branch 'v-next'
Browse files Browse the repository at this point in the history
  • Loading branch information
Saphareas committed Nov 4, 2018
2 parents d861b7d + 26f2551 commit 7023d5f
Show file tree
Hide file tree
Showing 30 changed files with 214 additions and 416 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
desktop.ini
icons/action.xcf
TODO.txt
.releases
releases/*
Expand Down
15 changes: 0 additions & 15 deletions _shared/darken_podcast.css

This file was deleted.

57 changes: 0 additions & 57 deletions _shared/darken_ps.css

This file was deleted.

Binary file added after.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
if (typeof browser == "undefined") {
var browser = chrome;
}

function updateTheme(tab) {
browser.storage.local.get(null, (item) => {
if (item.isDark === true) {
browser.tabs.sendMessage(tab.id, {isDark:true})
browser.pageAction.setIcon({
tabId: tab.id,
path: {
19: "icons/action-19.png",
38: "icons/action-38.png"
}
});
}
else {
browser.tabs.sendMessage(tab.id, {isDark:false})
browser.pageAction.setIcon({
tabId: tab.id,
path: {
19: "icons/action-off-19.png",
38: "icons/action-off-38.png"
}
});
}
});
}

function toggleTheme(tab) {
browser.storage.local.get(null, (item) => {
browser.storage.local.set({ isDark: !item.isDark });
updateTheme(tab);
});
}

function init(tab) {
if (tab.url.includes("pietsmiet.de")) {
updateTheme(tab);
browser.pageAction.show(tab.id);
}
}

browser.tabs.onUpdated.addListener((id, info, tab) => {
init(tab);
});

browser.pageAction.onClicked.addListener(toggleTheme);
Binary file added before.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions changelog.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
function handleOnInstalled(details) {
let manifest = browser.runtime.getManifest();
if (details.reason == "install") {
browser.tabs.create({ url: "/onboarding-page.html" })
}
else if (details.reason == "update") {
let notificationOptions = {
type: "basic",
title: `Version ${manifest.version} Changelog`,
message: `${manifest.name} wurde aktualisiert. Das hat sich geändert:
• Alles wurde komplett neu geschrieben, d.h. alle alten Bugs wurden behoben und (hoffentlich bessere Performance)
• Diese Benachrichtigung wurde eingeführt`,
iconUrl: "icons/icon-48.png"
};
browser.notifications.create(notificationOptions);
}
}

browser.runtime.onInstalled.addListener(handleOnInstalled);
51 changes: 0 additions & 51 deletions chrome/background.js

This file was deleted.

49 changes: 0 additions & 49 deletions chrome/content.js

This file was deleted.

47 changes: 0 additions & 47 deletions chrome/manifest.json

This file was deleted.

20 changes: 20 additions & 0 deletions content.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
if (typeof browser == "undefined") {
var browser = chrome;
}

function handleMessage(msg) {
let head = document.head;
let style = document.getElementById("darken-ps");
if (msg.isDark === true && !style) {
style = document.createElement("link");
style.href = browser.runtime.getURL("darken_ps.css");
style.rel = "stylesheet";
style.id = "darken-ps";
head.append(style);
}
else if (msg.isDark === false) {
style.remove();
}
}

browser.runtime.onMessage.addListener(handleMessage);
38 changes: 38 additions & 0 deletions darken_ps.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
:root {
--background-dark: #242424;
--background-darker: #111111;
--pietsmiet-green-dark: #007734;
}

#creativeAdWrapper {
filter: brightness(0);
}

body, #app {
background: var(--background-darker) !important;
}
main.container,
.bg-white {
background: var(--background-dark) !important;
color: white !important;
}
.dropdown .bg-white {
background: var(--pietsmiet-green-dark) !important;
color: white !important;
}

.text-smoke {
color: lightgray !important;
}
.text-smoke-darker{
color: darkgray !important;
}

.collapse .more,
.ob-widget-section .ob-widget-header {
color: gray !important;
}
.item.disabled,
.text-muted {
color: dimgray !important;
}
Loading

0 comments on commit 7023d5f

Please sign in to comment.