Update script.js
Fix annoying spaces in two letter prefixes
This commit is contained in:
parent
86743586c3
commit
059f3cd348
|
@ -2,7 +2,7 @@
|
||||||
* Evening Startpage
|
* Evening Startpage
|
||||||
* Inspired by https://github.com/jeroenpardon/sui
|
* Inspired by https://github.com/jeroenpardon/sui
|
||||||
* You can find it at https://github.com/TB-96/Evening-Startpage
|
* You can find it at https://github.com/TB-96/Evening-Startpage
|
||||||
* Made by TB-96 2020
|
* Made by TB-96 2021
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ function engines () {
|
||||||
g: ['https://google.com/search?q=', 'Google'],
|
g: ['https://google.com/search?q=', 'Google'],
|
||||||
i: ['https://google.com/search?tbm=isch&q=', 'Google Images'],
|
i: ['https://google.com/search?tbm=isch&q=', 'Google Images'],
|
||||||
yt: ['https://youtube.com/results?search_query=', 'Youtube'],
|
yt: ['https://youtube.com/results?search_query=', 'Youtube'],
|
||||||
s: ['https://stackoverflow.com/search?q=', 'Stackoverflow'],
|
s: ['https://stackoverflow.com/search?q=', 'Stackoverflow'],
|
||||||
a: ['https://web.archive.org/web/*/', 'Archive'],
|
a: ['https://web.archive.org/web/*/', 'Archive'],
|
||||||
w: ['https://en.wikipedia.org/w/index.php?search=', 'Wikipedia'],
|
w: ['https://en.wikipedia.org/w/index.php?search=', 'Wikipedia'],
|
||||||
};
|
};
|
||||||
|
@ -99,7 +99,7 @@ document.onkeypress = (e) => {
|
||||||
|
|
||||||
if (e.key == 'Enter') {
|
if (e.key == 'Enter') {
|
||||||
if (prefix.indexOf('!') == 0)
|
if (prefix.indexOf('!') == 0)
|
||||||
(engine = engines[prefix.substr(1)][0], str = 3);
|
(engine = engines[prefix.substr(1)][0], str = prefix.length + 1);
|
||||||
|
|
||||||
window.location = engine + args.join(' ').substr(str).toString().replace(/\s+/m, '%20');
|
window.location = engine + args.join(' ').substr(str).toString().replace(/\s+/m, '%20');
|
||||||
} else if (e.keyCode == 27)
|
} else if (e.keyCode == 27)
|
||||||
|
|
Loading…
Reference in New Issue