Merge pull request #10 from dcaldastp/feat-command-aliases

feat: add alias names for commands
This commit is contained in:
Alyssa X 2022-01-14 14:32:56 +01:00 committed by GitHub
commit 839ec7e00f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -106,36 +106,41 @@ $(document).ready(function(){
} else {
populateOmni();
$("#omni-extension #omni-list .omni-item").filter(function(){
if (value.startsWith("/tabs")) {
var tempvalue = value.replace("/tabs ", "");
if (tempvalue == "/tabs") {
if (value.startsWith("/tabs") || value.startsWith("/t")) {
var targetAction = value.startsWith("/tabs") ? "/tabs" : "/t";
var tempvalue = value.replace(targetAction + " ", "")
if (tempvalue == targetAction) {
$(this).toggle($(this).attr("data-type") == "tab");
} else {
tempvalue = value.replace("/tabs ", "");
tempvalue = value.replace(targetAction + " ", "");
$(this).toggle(($(this).find(".omni-item-name").text().toLowerCase().indexOf(tempvalue) > -1 || $(this).find(".omni-item-desc").text().toLowerCase().indexOf(tempvalue) > -1) && $(this).attr("data-type") == "tab");
}
} else if (value.startsWith("/bookmarks")) {
} else if (value.startsWith("/bookmarks") || value.startsWith("/b")) {
var targetAction = value.startsWith("/bookmarks") ? "/bookmarks" : "/b";
var tempvalue = value.replace(targetAction + " ", "")
var tempvalue = value.replace("/bookmarks ", "");
if (tempvalue == "/bookmarks") {
if (tempvalue == targetAction) {
$(this).toggle($(this).attr("data-type") == "bookmark");
} else {
tempvalue = value.replace("/bookmarks ", "");
tempvalue = value.replace(targetAction + " ", "");
$(this).toggle(($(this).find(".omni-item-name").text().toLowerCase().indexOf(tempvalue) > -1 || $(this).find(".omni-item-desc").text().toLowerCase().indexOf(tempvalue) > -1) && $(this).attr("data-type") == "bookmark");
}
} else if (value.startsWith("/remove")) {
var tempvalue = value.replace("/remove ", "");
if (tempvalue == "/remove") {
} else if (value.startsWith("/remove") || value.startsWith("/r")) {
var targetAction = value.startsWith("/remove") ? "/remove" : "/r";
var tempvalue = value.replace(targetAction + " ", "")
if (tempvalue == targetAction) {
$(this).toggle($(this).attr("data-type") == "bookmark" || $(this).attr("data-type") == "tab");
} else {
tempvalue = value.replace("/remove ", "");
tempvalue = value.replace(targetAction + " ", "");
$(this).toggle(($(this).find(".omni-item-name").text().toLowerCase().indexOf(tempvalue) > -1 || $(this).find(".omni-item-desc").text().toLowerCase().indexOf(tempvalue) > -1) && ($(this).attr("data-type") == "bookmark" || $(this).attr("data-type") == "tab"));
}
} else if (value.startsWith("/actions")) {
var tempvalue = value.replace("/actions ", "");
if (tempvalue == "/actions") {
} else if (value.startsWith("/actions") || value.startsWith("/a")) {
var targetAction = value.startsWith("/actions") ? "/actions" : "/a";
var tempvalue = value.replace(targetAction + " ", "")
if (tempvalue == targetAction) {
$(this).toggle($(this).attr("data-type") == "action");
} else {
tempvalue = value.replace("/actions ", "");
tempvalue = value.replace(targetAction + " ", "");
$(this).toggle(($(this).find(".omni-item-name").text().toLowerCase().indexOf(tempvalue) > -1 || $(this).find(".omni-item-desc").text().toLowerCase().indexOf(tempvalue) > -1) && $(this).attr("data-type") == "action");
}
} else {
@ -276,7 +281,7 @@ $(document).ready(function(){
down = [];
});
// Recieve messages from background
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
if (message.request == "open-omni") {