-
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.
- Loading branch information
1 parent
d590645
commit ac5f3ce
Showing
12 changed files
with
301 additions
and
40 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
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -1,13 +1,50 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<title>TMDB Extension</title> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>TMDB Player</title> | ||
|
||
<!-- Include Font Awesome --> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css"> | ||
|
||
<!-- Link to the external CSS file --> | ||
<link rel="stylesheet" href="styles.css"> | ||
</head> | ||
<body> | ||
<h3>TMDB Extension</h3> | ||
<button id="goToTmdb">Open TMDB</button> | ||
|
||
<div class="header"> | ||
TMDB Player | ||
</div> | ||
<div class="row"> | ||
<span>Open movie/tv show in new tab</span> | ||
<label class="toggle"> | ||
<input type="checkbox"> | ||
<span class="slider"></span> | ||
</label> | ||
</div> | ||
<div class="row"> | ||
<span>Default server</span> | ||
<select class="server-selection" id="server-select"> | ||
<option server-number="1">Rakan</option> | ||
<option server-number="2">Bard</option> | ||
<option server-number="3">Xayah</option> | ||
<option server-number="4">Ekko</option> | ||
<option server-number="5">Naafiri</option> | ||
<option server-number="6">Ryze</option> | ||
</select> | ||
</div> | ||
<div class="row center-row"> | ||
<button class="tmdb-button" id="tmdb-button">Open TMDB Website</button> | ||
</div> | ||
<div class="row center-row"> | ||
<div class="button-group"> | ||
<button class="git-button" id="git-button"> | ||
<i class="fab fa-github"></i> GitHub | ||
</button> | ||
<button class="bug-button" id="bug-button">Report Bug</button> | ||
</div> | ||
</div> | ||
|
||
<script src="popup.js"></script> | ||
</body> | ||
</html> | ||
</html> |
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 |
---|---|---|
@@ -1,5 +1,54 @@ | ||
document.addEventListener("DOMContentLoaded", () => { | ||
document.getElementById('goToTmdb').addEventListener('click', () => { | ||
chrome.tabs.create({ url: 'https://www.themoviedb.org/' }); | ||
// popup.js | ||
|
||
// Get references to DOM elements | ||
const toggleButton = document.querySelector('.toggle input'); | ||
const serverSelect = document.getElementById('server-select'); | ||
const tmdbButton = document.getElementById('tmdb-button'); | ||
const gitButton = document.getElementById('git-button'); | ||
const bugButton = document.getElementById('bug-button'); | ||
|
||
// Load saved preferences when the popup is opened | ||
document.addEventListener('DOMContentLoaded', () => { | ||
chrome.storage.sync.get(['isToggleActive', 'selectedServerNumber'], (data) => { | ||
// Set the toggle button state | ||
toggleButton.checked = data.isToggleActive !== undefined ? data.isToggleActive : true; // Default to true | ||
|
||
// Set the selected server based on the saved server number | ||
if (data.selectedServerNumber) { | ||
const optionToSelect = Array.from(serverSelect.options).find( | ||
(option) => option.getAttribute('server-number') === data.selectedServerNumber | ||
); | ||
if (optionToSelect) { | ||
serverSelect.value = optionToSelect.value; | ||
} | ||
} | ||
}); | ||
}); | ||
|
||
// Save toggle button state when changed | ||
toggleButton.addEventListener('change', () => { | ||
const isToggleActive = toggleButton.checked; | ||
chrome.storage.sync.set({ isToggleActive }); | ||
}); | ||
|
||
// Save selected server number when changed | ||
serverSelect.addEventListener('change', () => { | ||
const selectedOption = serverSelect.options[serverSelect.selectedIndex]; | ||
const selectedServerNumber = selectedOption.getAttribute('server-number'); | ||
chrome.storage.sync.set({ selectedServerNumber }); | ||
}); | ||
|
||
// Open TMDB Website | ||
tmdbButton.addEventListener('click', () => { | ||
window.open('https://www.themoviedb.org/', '_blank'); | ||
}); | ||
|
||
// Open GitHub Repository | ||
gitButton.addEventListener('click', () => { | ||
window.open('https://github.com/TomasTNunes/TMDB-Player/tree/master?tab=readme-ov-file#tmdb-player', '_blank'); | ||
}); | ||
|
||
// Open Bug Report Page | ||
bugButton.addEventListener('click', () => { | ||
window.open('https://github.com/TomasTNunes/TMDB-Player/issues', '_blank'); | ||
}); |
Oops, something went wrong.