Closed
Bug 177814
Opened 22 years ago
Closed 20 years ago
Return keyword arguments from getSelection
Categories
(SeaMonkey :: Bookmarks & History, enhancement)
SeaMonkey
Bookmarks & History
Tracking
(Not tracked)
RESOLVED
WONTFIX
People
(Reporter: josh966, Assigned: bugs)
Details
Many bookmarklets operate on text selected in the browser window. Some, such as Jesse Ruderman's "bug search" (http://squarefree.com/bookmarklets/mozilla.html#bug_search) make the effort to prompt for input when they are invoked with no text selected. Others, such as this one (sorry no source to cite handy): <BLOCKQUOTE>javascript:var s='';if(window.getSelection) s=window.getSelection();else if(document.getSelection) s=document.getSelection();void(window.open('http://www.dictionary.com/search?q='+escape(s),'Roundsearch','toolbar=no,location=no,scrollbars=yes,width=700,height=500,status=yes'));</BLOCKQUOTE> make no allowance for no text being selected. I propose that if a bookmarklet is invoked by an internet keyword, then the IK's arguments (%s) should be returned by window.getSelection and/or document.getSelection (only in the case where no text is actually selected, of course). This would permit bookmarklets such as the above to be invoked from the URL bar (e.g. "dict abstruse") even when the original author did not plan for it.
Comment 1•22 years ago
|
||
Tweaking summary, OS and platform. I don't think this will be implemented, simply because it violates the getSelection specification.
OS: Windows 2000 → All
Hardware: PC → All
Summary: [RFE] Make IK arguments available to bookmarklets → Return keyword arguments from getSelection
I wonder if it's possible to avoid violating the getSelection specification by programmatically selecting the keyword's arguments like so: 1. User types keyword plus arguments into URL bar, e.g. "dict abstruse" 2. (Proceed to following steps only if the keyword points to a bookmarklet) 3. Select arguments in URL bar, e.g. "dict ABSTRUSE" (u.c. = selected text) 4. Launch bookmarklet Currently, {window.,document.}getSelection don't appear to return text that is selected in the URL bar, so for example if I select "show" from the URL of this bug (http://bugzilla.mozilla.org/show_bug.cgi?id=177814) and launch the dictionary bookmarklet in the original description, getSelection doesn't return "show" to the bookmarklet. Does the getSelection specification leave room for the contents of the URL bar to be considered as part of the document? If so then selected URL bar text could be returned by document.getSelection with a clear conscience. Otherwise, I agree that the harm of violating the spec would probably exceed the benefit of the feature.
Comment 3•20 years ago
|
||
would bug 175419 accomplish the same thing.
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → WONTFIX
Updated•20 years ago
|
Product: Browser → Seamonkey
You need to log in
before you can comment on or make changes to this bug.
Description
•