Skip to content

Commit

Permalink
September update (beta)
Browse files Browse the repository at this point in the history
  • Loading branch information
adokseo committed Sep 30, 2020
1 parent e630fca commit d83f00b
Show file tree
Hide file tree
Showing 53 changed files with 895 additions and 1,606 deletions.
Binary file removed assets/icons-legacy/128.png
Binary file not shown.
Binary file removed assets/icons-legacy/128g.png
Binary file not shown.
Binary file removed assets/icons-legacy/16.png
Binary file not shown.
Binary file removed assets/icons-legacy/16g.png
Binary file not shown.
Binary file removed assets/icons-legacy/32.png
Binary file not shown.
Binary file removed assets/icons-legacy/32g.png
Binary file not shown.
Binary file removed assets/icons-legacy/48.png
Binary file not shown.
Binary file removed assets/icons-legacy/48g.png
Binary file not shown.
Binary file modified assets/icons/128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/icons/16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/icons/32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/icons/48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 0 additions & 3 deletions assets/icons/gradient.svg

This file was deleted.

3 changes: 0 additions & 3 deletions assets/icons/large.svg

This file was deleted.

3 changes: 0 additions & 3 deletions assets/icons/small.svg

This file was deleted.

3 changes: 0 additions & 3 deletions assets/icons/vector-gradient.svg

This file was deleted.

3 changes: 0 additions & 3 deletions assets/icons/vector.svg

This file was deleted.

Binary file removed assets/preview.png
Binary file not shown.
1 change: 0 additions & 1 deletion assets/rating.svg

This file was deleted.

1 change: 0 additions & 1 deletion assets/size.svg

This file was deleted.

61 changes: 23 additions & 38 deletions background.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*-----------------------------------------------------------------------------
/*---------------------------------------------------------------
>>> BACKGROUND
-------------------------------------------------------------------------------
-----------------------------------------------------------------
1.0 Global variables
2.0 Functions
3.0 Context menu items
Expand All @@ -9,20 +9,19 @@
6.0 Initialization
7.0 Uninstall URL
8.0 Google Analytics
-----------------------------------------------------------------------------*/
---------------------------------------------------------------*/

/*-----------------------------------------------------------------------------
/*---------------------------------------------------------------
1.0 GLOBAL VARIABLES
-----------------------------------------------------------------------------*/
---------------------------------------------------------------*/

var locale_code = 'en',
browser_icon = false,
is_legacy_icon = true;
browser_icon = false;


/*-----------------------------------------------------------------------------
/*---------------------------------------------------------------
2.0 FUNCTIONS
-----------------------------------------------------------------------------*/
---------------------------------------------------------------*/

function isset(variable) {
if (typeof variable === 'undefined' || variable === null) {
Expand Down Expand Up @@ -60,25 +59,21 @@ function getTranslations(path) {
}

function browserActionIcon() {
var folder = is_legacy_icon === true ? 'icons-legacy' : 'icons';

console.log(folder);

if (browser_icon === 'always') {
chrome.browserAction.setIcon({
path: 'assets/' + folder + '/32.png'
path: 'assets/icons/32.png'
});
} else {
chrome.browserAction.setIcon({
path: 'assets/' + folder + '/32g.png'
path: 'assets/icons/32g.png'
});
}
}


/*-----------------------------------------------------------------------------
/*---------------------------------------------------------------
3.0 CONTEXT MENU ITEMS
-----------------------------------------------------------------------------*/
---------------------------------------------------------------*/

chrome.contextMenus.removeAll();

Expand Down Expand Up @@ -111,17 +106,15 @@ chrome.contextMenus.onClicked.addListener(function(event) {
});


/*-----------------------------------------------------------------------------
/*---------------------------------------------------------------
4.0 MESSAGE LISTENER
-----------------------------------------------------------------------------*/
---------------------------------------------------------------*/

chrome.runtime.onMessage.addListener(function(request, sender) {
if (isset(request) && typeof request === 'object') {
if (request.enabled === true && browser_icon !== 'always') {
var folder = is_legacy_icon === true ? 'icons-legacy' : 'icons';

chrome.browserAction.setIcon({
path: 'assets/' + folder + '/32.png',
path: 'assets/icons/32.png',
tabId: sender.tab.id
});
}
Expand Down Expand Up @@ -284,9 +277,9 @@ chrome.runtime.onMessage.addListener(function(request, sender) {
});


/*-----------------------------------------------------------------------------
/*---------------------------------------------------------------
5.0 STORAGE CHANGE LISTENER
-----------------------------------------------------------------------------*/
---------------------------------------------------------------*/

chrome.storage.onChanged.addListener(function(changes) {
if (isset(changes.improvedtube_language)) {
Expand All @@ -297,19 +290,15 @@ chrome.storage.onChanged.addListener(function(changes) {
browser_icon = changes.improvedtube_browser_icon.newValue;
}

if (isset(changes.red_popup_theme)) {
is_legacy_icon = changes.red_popup_theme.newValue;
}

browserActionIcon();

_gaq.push(['_trackPageview', '/improvedtube-' + chrome.runtime.getManifest().version + '/background', 'page-loaded']);
});


/*-----------------------------------------------------------------------------
/*---------------------------------------------------------------
6.0 INITIALIZATION
-----------------------------------------------------------------------------*/
---------------------------------------------------------------*/

chrome.storage.local.get(function(items) {
if (isset(items.improvedtube_language)) {
Expand All @@ -320,26 +309,22 @@ chrome.storage.local.get(function(items) {
browser_icon = items.improvedtube_browser_icon;
}

if (isset(items.red_popup_theme)) {
browser_icon = items.red_popup_theme;
}

browserActionIcon();

_gaq.push(['_trackPageview', '/improvedtube-' + chrome.runtime.getManifest().version + '/background', 'page-loaded']);
});


/*-----------------------------------------------------------------------------
/*---------------------------------------------------------------
7.0 UNINSTALL URL
-----------------------------------------------------------------------------*/
---------------------------------------------------------------*/

chrome.runtime.setUninstallURL('https://improvedtube.com/uninstalled');


/*-----------------------------------------------------------------------------
/*---------------------------------------------------------------
8.0 GOOGLE ANALYTICS
-----------------------------------------------------------------------------*/
---------------------------------------------------------------*/

var _gaq = _gaq || [];

Expand Down
4 changes: 2 additions & 2 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@
"popup.css": [
"src/template/css/themes.css",
"src/template/css/index.css",
"src/template/css/setup.css",
"src/template/css/header.css",
"src/template/css/main.css",
"src/template/css/template-parts/home.css",
"src/template/css/template-parts/appearance.css",
"src/template/css/template-parts/themes.css",
"src/template/css/template-parts/player.css",
"src/template/css/template-parts/blacklist.css",
"src/template/css/template-parts/analyzer.css",
"src/template/css/template-parts/mixer.css",
"src/template/css/template-parts/settings.css"
]
}
}
4 changes: 2 additions & 2 deletions content-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ ImprovedTube.events = function() {

chrome.storage.local.get(function(items) {
document.addEventListener('ImprovedTubeAnalyzer', function() {
if (items.analyzer_activation !== false) {
if (items.analyzer_activation === true) {
if (document.querySelector('ytd-channel-name a') && chrome && chrome.runtime) {
chrome.runtime.sendMessage({
name: 'improvedtube-analyzer',
Expand Down Expand Up @@ -997,7 +997,7 @@ ImprovedTube.blacklist = function() {
let channel_href = item.querySelector('.ytd-channel-name a, a.spf-link[href*="/user/"], a.spf-link[href*="/channel/"]').href;

for (var key in ImprovedTube.storage.blacklist.channels) {
if (channel_href.indexOf(key) !== -1) {
if (item.style && channel_href.indexOf(key) !== -1) {
item.style.display = 'none';
}
}
Expand Down
6 changes: 6 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>ImprovedTube</title>
<style>
html, body {
width: 300px;
height: 500px
}
</style>
<link rel="stylesheet" href="satus.css">
<link rel="stylesheet" href="popup.css">
</head>
Expand Down
5 changes: 3 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 2,
"short_name" : "ImprovedTube",
"name": "Improve YouTube! (Open-Source for YouTube)",
"version": "3.110",
"version": "3.150-beta",
"icons": {
"16": "assets/icons/16.png",
"32": "assets/icons/32.png",
Expand Down Expand Up @@ -69,7 +69,8 @@
]
},
"optional_permissions": [
"downloads", "https://*.youtube.com/*"
"downloads",
"https://*.youtube.com/*"
],
"permissions": [
"https://www.youtube.com/",
Expand Down
35 changes: 22 additions & 13 deletions page.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
document.addEventListener('DOMContentLoaded', function() {
document.documentElement.innerHTML = [
'<!doctype html>',
'<html>',
'<head>',
'<meta charset="utf-8">',
'<meta name="viewport" content="width=device-width,initial-scale=1">',
'<title>ImprovedTube</title>',
'</head>',
'<body class="improvedtube-page"></body>',
'</html>'
].join('');
});
document.documentElement.innerHTML = `
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>ImprovedTube</title>
<style>
html, body {
width: 100vw;
height: 100vh
}
</style>
<link rel="stylesheet" href="satus.css">
<link rel="stylesheet" href="popup.css">
</head>
<body>
<script src="satus.js"></script>
<script src="popup.js"></script>
</body>
</html>
`;
Loading

0 comments on commit d83f00b

Please sign in to comment.