feat: add alias names for commands

This commit is contained in:
Daniel Caldas 2022-01-13 09:01:55 +01:00
parent e498d1b1ef
commit 07368abb20

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 {
@ -249,7 +254,7 @@ $(document).ready(function(){
down = [];
});
// Recieve messages from background
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
if (message.request == "open-omni") {