diff --git a/src/content.js b/src/content.js index 1d0b928..5b479ff 100644 --- a/src/content.js +++ b/src/content.js @@ -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") {