mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 04:07:59 +01:00
Fixed ':open google this is a sentence. this is another'
This commit is contained in:
@@ -481,11 +481,17 @@ const util = { //{{{
|
|||||||
// strip each 'URL' - makes things simpler later on
|
// strip each 'URL' - makes things simpler later on
|
||||||
url = url.replace(/^\s+|\s+$/, "");
|
url = url.replace(/^\s+|\s+$/, "");
|
||||||
|
|
||||||
// if the string doesn't look like a valid URL (i.e. contains a space or no dot)
|
// if the string
|
||||||
// or starts with a known protocol try opening it with a search engine
|
// * contains a space OR
|
||||||
// or keyword bookmark
|
// * does NOT have a period or a slash in it
|
||||||
|
// AND
|
||||||
|
// * has no valid protocol
|
||||||
|
// then assume that we want to defsearch (or bookmark
|
||||||
|
// keyword) it. Otherwise, let Firefox figure it out
|
||||||
let proto = url.match(/^([-\w]+):/);
|
let proto = url.match(/^([-\w]+):/);
|
||||||
if (!/\./.test(url) && (/[\s]/.test(url) || !proto || !Components.classes["@mozilla.org/network/protocol;1?name=" + proto[1]]))
|
if( ( /\s/.test(url) || !/[.\/]/.test(url) )
|
||||||
|
&&
|
||||||
|
!( proto && Components.classes["@mozilla.org/network/protocol;1?name=" + proto[1]] ) )
|
||||||
{
|
{
|
||||||
// TODO: it would be clearer if the appropriate call to
|
// TODO: it would be clearer if the appropriate call to
|
||||||
// getSearchURL was made based on whether or not the first word was
|
// getSearchURL was made based on whether or not the first word was
|
||||||
|
|||||||
Reference in New Issue
Block a user