! Copyright (C) 2011 John Benediktsson
! See https://factorcode.org/license.txt for BSD license
-USING: accessors command-line io.pathnames kernel namespaces
-sequences strings system ui.operations urls vocabs ;
+
+USING: accessors combinators.short-circuit command-line
+io.pathnames kernel namespaces sequences strings system
+ui.operations urls vocabs ;
+
IN: webbrowser
HOOK: open-item os ( item -- )
: open-url ( url -- )
>url open-item ;
-PREDICATE: url-string < string >url protocol>> >boolean ;
+PREDICATE: url-string < string
+ {
+ [ "://" subseq-index ]
+ [ >url protocol>> >boolean ]
+ } 1&& ;
[ pathname? ] \ open-item H{ } define-operation
[ [ url? ] [ url-string? ] bi or ] \ open-url H{ } define-operation