gissehel / BarLauncher-WebApp

BarLauncher plugin to start a URL in a webapp mode
MIT License
3 stars 1 forks source link

Adds search feature to commands when the URL includes "{q}" or "%s" #5

Open tballas opened 11 months ago

tballas commented 11 months ago

Adds search feature to commands when the URL includes "{q}" or "%s"

Replaces "{q}" or "%s" in a URL when using a command with whatever the user types after the command, handles spaces and replaces them with "%20" to URL encode them in a basic way.

Also ensures that when URLs are started they have either http:// or https:// URL schemes, since Chrome requires a URL scheme to start that URL.

Examples

wap add https://duckduckgo.com/?q={q} ddg [default]

When using that command:

wap ddg banana split

Resulting URL used:

https://duckduckgo.com/?q=banana%20split

wap add https://time.is/?q={q} time [default]

When using that command:

wap time paris

Resulting URL used:

https://time.is/?q=paris

wap add https://www.urbandictionary.com/define.php?term={q} ud urban urbandictionary [default]

When using that command:

wap ud snooze

Resulting URL used:

https://www.urbandictionary.com/define.php?term=snooze