-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
settings menu is in place and is cool and good
- Loading branch information
Showing
6 changed files
with
146 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;700&display=swap" rel="stylesheet"> | ||
<style> | ||
body { | ||
font-size: 16px; | ||
font-family: 'Source Sans Pro'; | ||
width: 300px; | ||
background-color: #181818; | ||
color: white | ||
} | ||
|
||
.kofi-icon { | ||
position: absolute; | ||
right: 10px; | ||
cursor: pointer; | ||
} | ||
|
||
#current-url, | ||
#current-title { | ||
background-color: #f0f0f0; | ||
color: #666; | ||
cursor: default; | ||
} | ||
|
||
h1 { | ||
text-align: center; | ||
} | ||
</style> | ||
</head> | ||
|
||
<div class="settings-menu"> | ||
<h1>Settings</h1> | ||
|
||
<div class="option"> | ||
<label for="self-promotion">Block Self Promotion</label> | ||
<input type="checkbox" id="self-promotion" name="self-promotion"> | ||
</div><br> | ||
|
||
<button id="show-issue-form">Submit issue with current watchpage</button> | ||
<div id="issue-form" style="display: none;"> | ||
<input type="text" id="current-title" style="width:100%" placeholder="Current video Title"> | ||
<br> | ||
<input type="text" id="current-url" style="width:100%" placeholder="Current video URL"> | ||
<br> | ||
<textarea id="extra-notes" placeholder="Additional notes..."></textarea> | ||
<br> | ||
<div style="display: flex; align-items: center;"> | ||
<button id="submit-issue">Submit to GitHub</button> | ||
<div style="font-size: 12px; margin-left: 8px">(Requires a GitHub account)</div> | ||
</div> | ||
</div> | ||
|
||
<a href="https://ko-fi.com/magicjinn" target="_blank" class="kofi-icon"> | ||
<img src="https://ko-fi.com/favicon.ico" width="24" height="24"> | ||
</a> | ||
<script src="settings.js"></script> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
document.addEventListener('DOMContentLoaded', function () { | ||
const selfPromotionCheckbox = document.getElementById('self-promotion'); | ||
const showIssueFormButton = document.getElementById('show-issue-form'); | ||
const submitIssueButton = document.getElementById('submit-issue'); | ||
const issueForm = document.getElementById('issue-form'); | ||
const currentTitleInput = document.getElementById('current-title'); | ||
const currentUrlInput = document.getElementById('current-url'); | ||
const extraNotesTextarea = document.getElementById('extra-notes'); | ||
|
||
// Load saved setting | ||
chrome.storage.local.get(['blockSelfPromotion'], function (result) { | ||
selfPromotionCheckbox.checked = result.blockSelfPromotion || false; | ||
}); | ||
|
||
// Save setting when checkbox is clicked | ||
selfPromotionCheckbox.addEventListener('change', function () { | ||
chrome.storage.local.set({ blockSelfPromotion: this.checked }, function () { | ||
}); | ||
}); | ||
|
||
showIssueFormButton.addEventListener('click', () => { | ||
issueForm.style.display = issueForm.style.display === 'none' ? 'block' : 'none'; | ||
GetPageContext((pageTitle, pageURL) => { | ||
currentTitleInput.value = pageTitle.replace(" - YouTube", "") | ||
currentUrlInput.value = pageURL.replace("www.", "") | ||
}) | ||
}); | ||
|
||
// Function to get page context from chrome.storage.local | ||
function GetPageContext(callback) { | ||
chrome.storage.local.get(["pageURL", "pageTitle"], function (result) { | ||
const pageTitle = result.pageTitle || ''; // Default to empty string if not found | ||
const pageURL = result.pageURL || ''; // Default to empty string if not found | ||
callback(pageTitle, pageURL); | ||
}); | ||
} | ||
|
||
// Event listener for the submit issue button | ||
submitIssueButton.addEventListener('click', function () { | ||
GetPageContext((pageTitle, pageURL) => { | ||
const notes = extraNotesTextarea.value; | ||
|
||
// Create the GitHub issue URL with query parameters | ||
const issueUrl = `https://github.com/MagicJinn/Block-Sponsor-Comments/issues/new?title=New+sponsor+at:+${encodeURIComponent(pageTitle)}&body=${encodeURIComponent(`URL: ${pageURL}\n\nNotes:\n${notes}`)}`; | ||
|
||
// Open the new issue URL in a new tab | ||
window.open(issueUrl, '_blank'); | ||
}); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters