From 778672f6aecc379f3dd5da3878c26f8a436f4546 Mon Sep 17 00:00:00 2001 From: Martin Stubenschrott Date: Thu, 11 Dec 2008 23:12:55 +0100 Subject: [PATCH] added beep() for p/P when there is no content --- common/content/buffer.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/common/content/buffer.js b/common/content/buffer.js index 0b2b2aa3..18b9e39c 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -372,15 +372,24 @@ function Buffer() //{{{ mappings.add(myModes, ["p", ""], "Open (put) a URL based on the current clipboard contents in the current buffer", - function () { liberator.open(util.readFromClipboard()); }); + function () + { + let url = util.readFromClipboard(); + if (url) + liberator.open(url); + else + liberator.beep(); + }); mappings.add(myModes, ["P"], "Open (put) a URL based on the current clipboard contents in a new buffer", function () { - liberator.open(util.readFromClipboard(), - /\bpaste\b/.test(options["activate"]) ? - liberator.NEW_TAB : liberator.NEW_BACKGROUND_TAB); + let url = util.readFromClipboard(); + if (url) + liberator.open(url, options.get("activate").has("paste") ? liberator.NEW_TAB : liberator.NEW_BACKGROUND_TAB); + else + liberator.beep(); }); // reloading