File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -593,14 +593,28 @@ function createOmnibar(front, clipboard) {
593593 handler = null ;
594594 } ;
595595
596+ self . isUrl = function ( input ) {
597+ if ( input . match ( / \s + / ) ) {
598+ return false ;
599+ }
600+
601+ if ( input . match ( / ^ h t t p s ? : \/ \/ / ) ) {
602+ return true ;
603+ }
604+
605+ var regex = / ^ (?: w w w \. ) ? [ - a - z A - Z 0 - 9 @ : % . _ \+ ~ # = ] { 1 , 256 } \. [ a - z A - Z 0 - 9 ( ) ] { 1 , 6 } \b (?: [ - a - z A - Z 0 - 9 ( ) @ : % _ \+ . ~ # ? & \/ = ] * ) $ / ;
606+
607+ return input . match ( regex ) ;
608+ }
609+
596610 self . openFocused = function ( ) {
597611 var ret = false , fi = self . resultsDiv . querySelector ( 'li.focused' ) ;
598612 var url ;
599613 if ( fi ) {
600614 url = fi . url ;
601615 } else {
602616 url = self . input . value ;
603- if ( url . indexOf ( ':' ) === - 1 ) {
617+ if ( ! self . isUrl ( url ) ) {
604618 url = searchEngine . aliases [ runtime . conf . defaultSearchEngine ] . url + url ;
605619 }
606620 }
You can’t perform that action at this time.
0 commit comments