mirror of
https://github.com/32Bites/LetsGet
synced 2026-01-16 21:04:20 -05:00
Version 0.0.6
Fixes an icon issue in Firefox, cleans up some code, and enhances the GUI a bit.
This commit is contained in:
@@ -18,10 +18,12 @@ function run() {
|
||||
}
|
||||
}
|
||||
|
||||
chrome.storage.sync.get('enabled', function(data) {
|
||||
chrome.storage.sync.get('enabled', function (data) {
|
||||
var enabled = data.enabled;
|
||||
if (enabled === undefined) {
|
||||
chrome.storage.sync.set({enabled: true}, null);
|
||||
chrome.storage.sync.set({
|
||||
enabled: true
|
||||
}, null);
|
||||
enabled = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ function run() {
|
||||
if (doc.innerHTML.includes('Raw') && doc.parentElement.classList.contains('file-actions') && !doc.getAttribute('injected')) {
|
||||
const el = document.createElement('button');
|
||||
el.innerText = "Download";
|
||||
el.onclick = function() {
|
||||
el.onclick = function () {
|
||||
chrome.runtime.sendMessage(window.location.protocol + window.location.host + doc.getAttribute('href'));
|
||||
};
|
||||
el.classList.add('btn', 'btn-sm');
|
||||
@@ -18,10 +18,12 @@ function run() {
|
||||
}
|
||||
}
|
||||
|
||||
chrome.storage.sync.get('enabled', function(data) {
|
||||
chrome.storage.sync.get('enabled', function (data) {
|
||||
var enabled = data.enabled;
|
||||
if (enabled === undefined) {
|
||||
chrome.storage.sync.set({enabled: true}, null);
|
||||
chrome.storage.sync.set({
|
||||
enabled: true
|
||||
}, null);
|
||||
enabled = true;
|
||||
}
|
||||
|
||||
|
||||
BIN
icon_128.png
Normal file
BIN
icon_128.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.0 KiB |
BIN
icon_16.png
Normal file
BIN
icon_16.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.3 KiB |
BIN
icon_32.png
Normal file
BIN
icon_32.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.8 KiB |
BIN
icon_48.png
Normal file
BIN
icon_48.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.4 KiB |
BIN
icon_64.png
Normal file
BIN
icon_64.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.8 KiB |
@@ -18,6 +18,12 @@
|
||||
<input type="checkbox" class="checked:bg-blue-800 h-6 w-6" id="enabled">
|
||||
<p class="ml-2 text-gray-200 font-semibold text-lg">Enabled</p>
|
||||
</div>
|
||||
<div class="text-blue-200 mt-6 text-center text-sm">
|
||||
<p>
|
||||
Developed by <a href="https://32bites.party/" class="text-blue-500 font-semibold" id="my_page">Noah Shanaberger</a>.
|
||||
</p>
|
||||
<p id="version"></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="index.js"></script>
|
||||
|
||||
41
index.js
41
index.js
@@ -1,27 +1,36 @@
|
||||
const enabled_box = document.getElementById('enabled');
|
||||
const my_page = document.getElementById('my_page');
|
||||
my_page.addEventListener('click', function () {
|
||||
chrome.tabs.create({
|
||||
url: my_page.getAttribute('href') ?? 'https://github.com/32Bites/'
|
||||
});
|
||||
});
|
||||
|
||||
chrome.storage.sync.get('enabled', function(data) {
|
||||
const version = document.getElementById('version');
|
||||
if (version.innerHTML === '') {
|
||||
version.innerHTML = "Let's Get v" + chrome.runtime.getManifest().version;
|
||||
}
|
||||
|
||||
const enabled_box = document.getElementById('enabled');
|
||||
chrome.storage.sync.get('enabled', function (data) {
|
||||
var enabled = false;
|
||||
// I should clean this up.
|
||||
if (data === undefined) {
|
||||
chrome.storage.sync.set({enabled: true}, null);
|
||||
if (data === undefined || data.enabled === undefined) {
|
||||
chrome.storage.sync.set({
|
||||
enabled: true
|
||||
}, null);
|
||||
enabled = true;
|
||||
} else {
|
||||
if (data.enabled === undefined) {
|
||||
chrome.storage.sync.set({enabled: true}, null);
|
||||
enabled = true;
|
||||
} else {
|
||||
enabled = data.enabled;
|
||||
}
|
||||
enabled_box = data.enabled;
|
||||
}
|
||||
if (enabled) enabled_box.setAttribute("checked", "");
|
||||
});
|
||||
|
||||
enabled_box.addEventListener('click', function() {
|
||||
chrome.storage.sync.get('enabled', function(data) {
|
||||
enabled_box.addEventListener('click', function () {
|
||||
chrome.storage.sync.get('enabled', function (data) {
|
||||
var enabled = false;
|
||||
if (data === undefined || data.enabled === undefined) {
|
||||
chrome.storage.sync.set({enabled: true});
|
||||
chrome.storage.sync.set({
|
||||
enabled: true
|
||||
});
|
||||
enabled = true;
|
||||
} else {
|
||||
enabled = data.enabled;
|
||||
@@ -29,6 +38,8 @@ enabled_box.addEventListener('click', function() {
|
||||
|
||||
if (enabled) enabled_box.setAttribute("checked", "");
|
||||
// else enabled_box.removeAttribute("checked");
|
||||
chrome.storage.sync.set({enabled: !enabled}, null);
|
||||
chrome.storage.sync.set({
|
||||
enabled: !enabled
|
||||
}, null);
|
||||
});
|
||||
});
|
||||
@@ -1,8 +1,9 @@
|
||||
{
|
||||
"name": "Let's Get!",
|
||||
"author": "Noah Shanaberger",
|
||||
"description": "Download those pesky raw files on Github!",
|
||||
"manifest_version": 2,
|
||||
"version": "0.0.5",
|
||||
"version": "0.0.6",
|
||||
"background": {
|
||||
"scripts": ["background.js"],
|
||||
"persistent": true
|
||||
@@ -20,15 +21,27 @@
|
||||
"permissions": [
|
||||
"downloads",
|
||||
"storage",
|
||||
"tabs",
|
||||
"*://github.com/*",
|
||||
"*://gist.github.com/*"
|
||||
],
|
||||
"browser_action": {
|
||||
"default_popup": "index.html"
|
||||
"default_popup": "index.html",
|
||||
"default_title": "Let's Get!",
|
||||
"default_icon": {
|
||||
"16": "icon_16.png",
|
||||
"32": "icon_32.png",
|
||||
"64": "icon_64.png"
|
||||
}
|
||||
},
|
||||
"browser_specific_settings": {
|
||||
"gecko": {
|
||||
"id": "noah@thenoah.party"
|
||||
}
|
||||
},
|
||||
"icons": {
|
||||
"16": "icon_16.png",
|
||||
"48": "icon_48.png",
|
||||
"128": "icon_128.png"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user