Added sane defaults for click behaviors at extension install time

This commit is contained in:
Akash Vacher 2022-11-13 10:41:54 -08:00
parent 8394f2763f
commit 580714d58c
3 changed files with 15 additions and 4 deletions

View File

@ -11,6 +11,12 @@ chrome.runtime.onInstalled.addListener(function() {
],
contexts: ['link'],
});
// Set sane defaults for click behaviors at extension install time
chrome.storage.sync.set({
"clickBehavior": "go-to-metube",
"contextMenuClickBehavior": "context-menu-send-current-url-and-switch"
});
});
function sendVideoUrlToMetube(videoUrl, metubeUrl, callback) {

View File

@ -36,13 +36,13 @@
<h4>When you left-click on the extension icon, you'd like it to:</h4>
<input type="radio" name="click-behavior" id="do-nothing" value="do-nothing"><label for="do-nothing">Do Nothing</label><br>
<input type="radio" name="click-behavior" id="go-to-metube" value="go-to-metube" checked><label for="go-to-metube">Go to MeTube URL</label><br>
<input type="radio" name="click-behavior" id="go-to-metube" value="go-to-metube"><label for="go-to-metube">Go to MeTube URL</label><br>
<input type="radio" name="click-behavior" id="send-current-url" value="send-current-url"><label for="send-current-url">Send current tab URL to MeTube (no tab switch)</label><br>
<input type="radio" name="click-behavior" id="send-current-url-and-switch" value="send-current-url-and-switch"><label for="send-current-url-and-switch">Send current tab URL to MeTube and switch to MeTube</label><br>
<h4>When you right-click on video preview, you'd like it to:</h4>
<input type="radio" name="context-menu-click-behavior" id="context-menu-send-current-url" value="context-menu-send-current-url"><label for="context-menu-send-current-url">Send the video URL to MeTube (no tab switch)</label><br>
<input type="radio" name="context-menu-click-behavior" id="context-menu-send-current-url-and-switch" value="context-menu-send-current-url-and-switch" checked><label for="context-menu-send-current-url-and-switch">Send the video URL to MeTube and switch to MeTube</label><br>
<input type="radio" name="context-menu-click-behavior" id="context-menu-send-current-url-and-switch" value="context-menu-send-current-url-and-switch"><label for="context-menu-send-current-url-and-switch">Send the video URL to MeTube and switch to MeTube</label><br>
<h3>Additional sites</h3>
<p>Youtube-dl support <a href="https://github.com/ytdl-org/youtube-dl/blob/master/docs/supportedsites.md" target="_blank">many another sites</a> except youtube. You can add mask url's of this sites in textfield bellow but it can affect performance and we have not tested them support</p>

View File

@ -62,8 +62,13 @@ async function restoreOptions() {
document.getElementById("additional").value = data.sites;
}
document.getElementById(data.clickBehavior).checked = true;
document.getElementById(data.contextMenuClickBehavior).checked = true;
if (data.clickBehavior != undefined) {
document.getElementById(data.clickBehavior).checked = true;
}
if (data.contextMenuClickBehavior != undefined) {
document.getElementById(data.contextMenuClickBehavior).checked = true;
}
})
}