commit 9cc606ce78eba120fc55e721d0b1b087e1339e98 parent 6add697cdcd12562c223df2b0b7f4e5799d30229 Author: breadcat <breadcat@users.noreply.github.com> Date: Tue, 19 Apr 2022 20:29:29 +0100 Minify javascript Also add up command for repeating previous command from mhmdali102 Diffstat:
M | src/js/commands.js | | | 143 | +++++++++++++++++++++++++++++++++++++++---------------------------------------- |
M | src/js/terminal.js | | | 37 | ++----------------------------------- |
2 files changed, 73 insertions(+), 107 deletions(-)
diff --git a/src/js/commands.js b/src/js/commands.js @@ -1,73 +1,71 @@ -// Search engine functions -function a(cmd) { if (cmd != "a") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://www.amazon.co.uk/s?k=" + str.substring(1)); } else { window.open("https://www.amazon.co.uk/"); } } -function alp(cmd) { if (cmd != "alp") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://pkgs.alpinelinux.org/packages?branch=edge&arch=x86_64&name=" + str.substring(1)); } else { window.open("https://pkgs.alpinelinux.org/packages?name=&branch=edge&arch=x86_64"); } } -function ap(cmd) { if (cmd != "ap") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://www.archlinux.org/packages/?sort=&q=" + str.substring(1)); } else { window.open("https://www.archlinux.org/packages/"); } } -function archive(cmd) { if (cmd != "archive") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://web.archive.org/web/*/" + str.substring(1)); } else { window.open("https://web.archive.org/"); } } -function aur(cmd) { if (cmd != "aur") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://aur.archlinux.org/packages/?O=0&K=" + str.substring(1)); } else { window.open("https://aur.archlinux.org/packages/"); } } -function aw(cmd) { if (cmd != "aw") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://wiki.archlinux.org/index.php?title=Special:Search&search=" + str.substring(1)); } else { window.open("https://wiki.archlinux.org/"); } } -function bok(cmd) { if (cmd != "bok") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "%20" + parameters[i]; } window.open("https://b-ok.xyz/s/" + str.substring(3)); } else { window.open("https://b-ok.xyz/"); } } -function cb(cmd) { if (cmd != "cb") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://comicvine.gamespot.com/search/?q=" + str.substring(1)); } else { window.open("https://comicvine.gamespot.com/"); } } -function choco(cmd) { if (cmd != "choco") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://chocolatey.org/packages?q=" + str.substring(1)); } else { window.open("https://chocolatey.org/packages"); } } -function cron(cmd) { if (cmd != "cron") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "%20" + parameters[i]; } window.open("https://crontab.guru/#" + str.substring(3)); } else { window.open("https://crontab.guru/"); } } -function d(cmd) { if (cmd != "d") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://start.duckduckgo.com/?q=" + str.substring(1)); } else { window.open("https://start.duckduckgo.com/"); } } -function deb(cmd) { if (cmd != "deb") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://packages.debian.org/" + str.substring(1)); } else { window.open("https://packages.debian.org/"); } } -function dock(cmd) { if (cmd != "dock") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://hub.docker.com/search/?pullCount=1&q=" + str.substring(1)); } else { window.open("https://hub.docker.com/"); } } -function down(cmd) { if (cmd != "down") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://downforeveryoneorjustme.com/" + str.substring(1)); } else { window.open("https://downforeveryoneorjustme.com/"); } } -function e(cmd) { if (cmd != "e") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://www.ebay.co.uk/sch/i.html?_nkw=" + str.substring(1)); } else { window.open("https://www.ebay.co.uk/"); } } -function f(cmd) { if (cmd != "f") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "%20" + parameters[i]; } window.open("https://search.f-droid.org/?lang=en&q=" + str.substring(3)); } else { window.open("https://f-droid.org/"); } } -function g(cmd) { if (cmd != "g") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://www.google.co.uk/search?q=" + str.substring(1)); } else { window.open("https://www.google.co.uk"); } } -function ge(cmd) { if (cmd != "ge") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "%20" + parameters[i]; } window.open("https://www.ge-tracker.com/names/" + str.substring(3)); } else { window.open("https://www.ge-tracker.com/"); } } -function gf(cmd) { if (cmd != "gf") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://gamefaqs.gamespot.com/search?game=" + str.substring(1)); } else { window.open("https://gamefaqs.gamespot.com/"); } } -function gist(cmd) { if (cmd != "gist") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://gist.github.com/search?utf8=%E2%9C%93&q=" + str.substring(1)); } else { window.open("https://gist.github.com/"); } } -function git(cmd) { if (cmd != "git") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://github.com/search?q=" + str.substring(1)); } else { window.open("https://github.com/"); } } -function gl(cmd) { if (cmd != "gl") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://www.google.co.uk/search?btnI=1&q=" + str.substring(1)); } else { window.open("https://www.google.co.uk"); } } -function gm(cmd) { if (cmd != "gm") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://www.google.co.uk/maps/search/" + str.substring(1)); } else { window.open("https://www.google.co.uk/maps/"); } } -function gog(cmd) { if (cmd != "gog") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "%20" + parameters[i]; } window.open("https://www.gog.com/games?query=" + str.substring(3)); } else { window.open("https://www.gog.com/"); } } -function gr(cmd) { if (cmd != "gr") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://www.goodreads.com/search?utf8=%E2%9C%93&query=" + str.substring(1)); } else { window.open("https://www.goodreads.com/"); } } -function i(cmd) { if (cmd != "i") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://www.google.co.uk/search?tbm=isch&q=" + str.substring(1)); } else { window.open("https://images.google.co.uk/"); } } -function im(cmd) { if (cmd != "im") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://www.imdb.com/find?ref_=nv_sr_fn&s=all&q=" + str.substring(1)); } else { window.open("https://imdb.com/"); } } -function ip(cmd) { if (cmd != "ip") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://www.ip2location.com/demo/" + str.substring(1)); } else { window.open("https://www.ip2location.com/"); } } -function jack(cmd) { if (cmd != "jack") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://jack.minskio.co.uk/UI/Dashboard#search=" + str.substring(1)); } else { window.open("https://jack.minskio.co.uk"); } } -function last(cmd) { if (cmd != "last") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://www.last.fm/search?q=" + str.substring(1)); } else { window.open("https://www.last.fm/"); } } -function lut(cmd) { if (cmd != "lut") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://lutris.net/games?q=" + str.substring(1)); } else { window.open("https://lutris.net/"); } } -function m(cmd) { if (cmd != "m") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://wego.here.com/search/" + str.substring(1)); } else { window.open("https://wego.here.com/"); } } -function mac(cmd) { if (cmd != "mac") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://api.macvendors.com/" + str.substring(1)); } else { window.open("https://macvendors.com/"); } } -function mb(cmd) { if (cmd != "mb") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://musicbrainz.org/search?type=artist&limit=100&method=indexed&query=" + str.substring(1)); } else { window.open("https://musicbrainz.org/"); } } -function mx(cmd) { if (cmd != "mx") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://mxtoolbox.com/SuperTool.aspx?action=" + str.substring(1)); } else { window.open("https://mxtoolbox.com/SuperTool.aspx"); } } -function no(cmd) { if (cmd != "no") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://enno.dict.cc/?s=" + str.substring(1)); } else { window.open("https://enno.dict.cc/"); } } -function nyaa(cmd) { if (cmd != "nyaa") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://nyaa.si/?s=seeders&o=desc&q=" + str.substring(1)); } else { window.open("https://nyaa.si/"); } } -function osm(cmd) { if (cmd != "osm") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://www.openstreetmap.org/search?query=" + str.substring(1)); } else { window.open("https://www.openstreetmap.org/"); } } -function osrs(cmd) { if (cmd != "osrs") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://oldschool.runescape.wiki/?title=Special%3ASearch&search=" + str.substring(1)); } else { window.open("https://oldschool.runescape.wiki/"); } } -function pc(cmd) { if (cmd != "pc") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://pcgamingwiki.com/w/index.php?title=Special:Search&search=" + str.substring(1)); } else { window.open("https://pcgamingwiki.com/w/index.php"); } } -function proton(cmd) { if (cmd != "proton") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://protondb.com/search?q=" + str.substring(1)); } else { window.open("https://protondb.com/explore"); } } -function rfc(cmd) { if (cmd != "rfc") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "%20" + parameters[i]; } window.open("https://datatracker.ietf.org/doc/search?rfcs=on&name=" + str.substring(3)); } else { window.open("https://datatracker.ietf.org/"); } } -function rshs(cmd) { if (cmd != "rshs") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://secure.runescape.com/m=hiscore_oldschool/hiscorepersonal?user1=" + str.substring(1)); } else { window.open("https://secure.runescape.com/m=hiscore_oldschool/"); } } -function rt(cmd) { if (cmd != "rt") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://www.rottentomatoes.com/search/?search=" + str.substring(1)); } else { window.open("https://www.rottentomatoes.com/"); } } -function s(cmd) { if (cmd != "s") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://store.steampowered.com/search/?term=" + str.substring(1)); } else { window.open("https://store.steampowered.com/"); } } -function spot(cmd) { if (cmd != "spot") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "%20" + parameters[i]; } window.open("https://open.spotify.com/search/" + str.substring(3)); } else { window.open("https://open.spotify.com/"); } } -function srx(cmd) { if (cmd != "srx") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://anon.sx/?q=" + str.substring(1)); } else { window.open("https://anon.sx/"); } } -function ss(cmd) { if (cmd != "ss") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://steamspy.com/search.php?s=" + str.substring(1)); } else { window.open("https://steamspy.com/"); } } -function st(cmd) { if (cmd != "st") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://www.startpage.com/do/metasearch.pl?query=" + str.substring(1)); } else { window.open("https://www.startpage.com/"); } } -function t(cmd) { if (cmd != "t") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://tineye.com/parse?url=" + str.substring(1)); } else { window.open("https://tineye.com/"); } } -function tm(cmd) { if (cmd != "tm") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://www.themoviedb.org/search?query=" + str.substring(1)); } else { window.open("https://www.themoviedb.org/"); } } -function tmt(cmd) { if (cmd != "tmt") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://www.themoviedb.org/search/tv?query=" + str.substring(1)); } else { window.open("https://www.themoviedb.org/"); } } -function tr(cmd) { if (cmd != "tr") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://translate.google.com/?sl=auto&tl=en&text=" + str.substring(1)); } else { window.open("https://translate.google.com/"); } } -function tv(cmd) { if (cmd != "tv") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://www.thetvdb.com/search?query=" + str.substring(1)); } else { window.open("https://www.thetvdb.com/"); } } -function tvt(cmd) { if (cmd != "tvt") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://tvtropes.org/pmwiki/search_result.php?q=" + str.substring(1)); } else { window.open("https://tvtropes.org/"); } } -function ud(cmd) { if (cmd != "ud") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://www.urbandictionary.com/define.php?term=" + str.substring(1)); } else { window.open("https://www.urbandictionary.com/"); } } -function ujs(cmd) { if (cmd != "ujs") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://greasyfork.org/en/scripts?q=" + str.substring(1)); } else { window.open("https://greasyfork.org/en/scripts"); } } -function valid(cmd) { if (cmd != "valid") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://validator.w3.org/nu/?doc=" + str.substring(1)); } else { window.open("https://validator.w3.org/nu/"); } } -function w(cmd) { if (cmd != "w") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://en.wikipedia.org/w/index.php?title=Special:Search&search=" + str.substring(1)); } else { window.open("https://en.wikipedia.org/w/index.php"); } } -function w3w(cmd) { if (cmd != "w3w") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "." + parameters[i]; } window.open("https://what3words.com/" + str.substring(1)); } else { window.open("https://what3words.com/"); } } -function wa(cmd) { if (cmd != "wa") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://www.wolframalpha.com/input/?i=" + str.substring(1)); } else { window.open("https://www.wolframalpha.com/"); } } -function whois(cmd) { if (cmd != "whois") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://whois.gandi.net/en/results?search=" + str.substring(1)); } else { window.open("https://whois.gandi.net/"); } } -function wikt(cmd) { if (cmd != "wikt") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://en.wiktionary.org/w/index.php?title=Special:Search&search=" + str.substring(1)); } else { window.open("https://en.wiktionary.org/w/index.php"); } } -function wiktno(cmd) { if (cmd != "wiktno") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://no.wiktionary.org/w/index.php?title=Special:Search&search=" + str.substring(1)); } else { window.open("https://no.wiktionary.org/w/index.php"); } } -function wine(cmd) { if (cmd != "wine") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://www.winehq.org/search?q=" + str.substring(1)); } else { window.open("https://www.winehq.org/"); } } -function wno(cmd) { if (cmd != "wno") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://no.wikipedia.org/w/index.php?title=Special:Search&search=" + str.substring(1)); } else { window.open("https://no.wikipedia.org/w/index.php"); } } -function y(cmd) { if (cmd != "y") { str = ""; var parameters = cmd.split(" ").slice(1); for (var i = 0; i < parameters.length; i++) { str = str + "+" + parameters[i]; } window.open("https://www.youtube.com/results?search_query=" + str.substring(1)); } else { window.open("https://www.youtube.com/"); } } +function a(t){if("a"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://www.amazon.co.uk/s?k="+str.substring(1))}else window.open("https://www.amazon.co.uk/")} +function alp(t){if("alp"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://pkgs.alpinelinux.org/packages?branch=edge&arch=x86_64&name="+str.substring(1))}else window.open("https://pkgs.alpinelinux.org/packages?name=&branch=edge&arch=x86_64")} +function ap(t){if("ap"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://www.archlinux.org/packages/?sort=&q="+str.substring(1))}else window.open("https://www.archlinux.org/packages/")} +function archive(t){if("archive"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://web.archive.org/web/*/"+str.substring(1))}else window.open("https://web.archive.org/")} +function aur(t){if("aur"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://aur.archlinux.org/packages/?O=0&K="+str.substring(1))}else window.open("https://aur.archlinux.org/packages/")} +function aw(t){if("aw"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://wiki.archlinux.org/index.php?title=Special:Search&search="+str.substring(1))}else window.open("https://wiki.archlinux.org/")} +function bok(t){if("bok"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"%20"+s[o];window.open("https://b-ok.xyz/s/"+str.substring(3))}else window.open("https://b-ok.xyz/")} +function cb(t){if("cb"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://comicvine.gamespot.com/search/?q="+str.substring(1))}else window.open("https://comicvine.gamespot.com/")} +function choco(t){if("choco"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://chocolatey.org/packages?q="+str.substring(1))}else window.open("https://chocolatey.org/packages")} +function cron(t){if("cron"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"%20"+s[o];window.open("https://crontab.guru/#"+str.substring(3))}else window.open("https://crontab.guru/")} +function d(t){if("d"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://start.duckduckgo.com/?q="+str.substring(1))}else window.open("https://start.duckduckgo.com/")} +function deb(t){if("deb"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://packages.debian.org/"+str.substring(1))}else window.open("https://packages.debian.org/")} +function dock(t){if("dock"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://hub.docker.com/search/?pullCount=1&q="+str.substring(1))}else window.open("https://hub.docker.com/")} +function down(t){if("down"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://downforeveryoneorjustme.com/"+str.substring(1))}else window.open("https://downforeveryoneorjustme.com/")} +function e(t){if("e"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://www.ebay.co.uk/sch/i.html?_nkw="+str.substring(1))}else window.open("https://www.ebay.co.uk/")} +function f(t){if("f"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"%20"+s[o];window.open("https://search.f-droid.org/?lang=en&q="+str.substring(3))}else window.open("https://f-droid.org/")} +function g(t){if("g"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://www.google.co.uk/search?q="+str.substring(1))}else window.open("https://www.google.co.uk")} +function ge(t){if("ge"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"%20"+s[o];window.open("https://www.ge-tracker.com/names/"+str.substring(3))}else window.open("https://www.ge-tracker.com/")} +function gf(t){if("gf"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://gamefaqs.gamespot.com/search?game="+str.substring(1))}else window.open("https://gamefaqs.gamespot.com/")} +function gist(t){if("gist"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://gist.github.com/search?utf8=%E2%9C%93&q="+str.substring(1))}else window.open("https://gist.github.com/")} +function git(t){if("git"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://github.com/search?q="+str.substring(1))}else window.open("https://github.com/")} +function gl(t){if("gl"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://www.google.co.uk/search?btnI=1&q="+str.substring(1))}else window.open("https://www.google.co.uk")} +function gm(t){if("gm"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://www.google.co.uk/maps/search/"+str.substring(1))}else window.open("https://www.google.co.uk/maps/")} +function gog(t){if("gog"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"%20"+s[o];window.open("https://www.gog.com/games?query="+str.substring(3))}else window.open("https://www.gog.com/")} +function gr(t){if("gr"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://www.goodreads.com/search?utf8=%E2%9C%93&query="+str.substring(1))}else window.open("https://www.goodreads.com/")} +function i(t){if("i"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://www.google.co.uk/search?tbm=isch&q="+str.substring(1))}else window.open("https://images.google.co.uk/")} +function im(t){if("im"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://www.imdb.com/find?ref_=nv_sr_fn&s=all&q="+str.substring(1))}else window.open("https://imdb.com/")} +function ip(t){if("ip"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://www.ip2location.com/demo/"+str.substring(1))}else window.open("https://www.ip2location.com/")} +function jack(t){if("jack"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://jack.minskio.co.uk/UI/Dashboard#search="+str.substring(1))}else window.open("https://jack.minskio.co.uk")} +function last(t){if("last"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://www.last.fm/search?q="+str.substring(1))}else window.open("https://www.last.fm/")} +function lut(t){if("lut"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://lutris.net/games?q="+str.substring(1))}else window.open("https://lutris.net/")} +function m(t){if("m"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://wego.here.com/search/"+str.substring(1))}else window.open("https://wego.here.com/")} +function mac(t){if("mac"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://api.macvendors.com/"+str.substring(1))}else window.open("https://macvendors.com/")} +function mb(t){if("mb"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://musicbrainz.org/search?type=artist&limit=100&method=indexed&query="+str.substring(1))}else window.open("https://musicbrainz.org/")} +function mx(t){if("mx"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://mxtoolbox.com/SuperTool.aspx?action="+str.substring(1))}else window.open("https://mxtoolbox.com/SuperTool.aspx")} +function no(t){if("no"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://enno.dict.cc/?s="+str.substring(1))}else window.open("https://enno.dict.cc/")} +function nyaa(t){if("nyaa"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://nyaa.si/?s=seeders&o=desc&q="+str.substring(1))}else window.open("https://nyaa.si/")} +function osm(t){if("osm"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://www.openstreetmap.org/search?query="+str.substring(1))}else window.open("https://www.openstreetmap.org/")} +function osrs(t){if("osrs"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://oldschool.runescape.wiki/?title=Special%3ASearch&search="+str.substring(1))}else window.open("https://oldschool.runescape.wiki/")} +function pc(t){if("pc"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://pcgamingwiki.com/w/index.php?title=Special:Search&search="+str.substring(1))}else window.open("https://pcgamingwiki.com/w/index.php")} +function proton(t){if("proton"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://protondb.com/search?q="+str.substring(1))}else window.open("https://protondb.com/explore")} +function rfc(t){if("rfc"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"%20"+s[o];window.open("https://datatracker.ietf.org/doc/search?rfcs=on&name="+str.substring(3))}else window.open("https://datatracker.ietf.org/")} +function rshs(t){if("rshs"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://secure.runescape.com/m=hiscore_oldschool/hiscorepersonal?user1="+str.substring(1))}else window.open("https://secure.runescape.com/m=hiscore_oldschool/")} +function rt(t){if("rt"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://www.rottentomatoes.com/search/?search="+str.substring(1))}else window.open("https://www.rottentomatoes.com/")} +function s(t){if("s"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://store.steampowered.com/search/?term="+str.substring(1))}else window.open("https://store.steampowered.com/")} +function spot(t){if("spot"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"%20"+s[o];window.open("https://open.spotify.com/search/"+str.substring(3))}else window.open("https://open.spotify.com/")} +function srx(t){if("srx"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://anon.sx/?q="+str.substring(1))}else window.open("https://anon.sx/")} +function ss(t){if("ss"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://steamspy.com/search.php?s="+str.substring(1))}else window.open("https://steamspy.com/")} +function st(t){if("st"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://www.startpage.com/do/metasearch.pl?query="+str.substring(1))}else window.open("https://www.startpage.com/")} +function t(t){if("t"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://tineye.com/parse?url="+str.substring(1))}else window.open("https://tineye.com/")} +function tm(t){if("tm"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://www.themoviedb.org/search?query="+str.substring(1))}else window.open("https://www.themoviedb.org/")} +function tmt(t){if("tmt"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://www.themoviedb.org/search/tv?query="+str.substring(1))}else window.open("https://www.themoviedb.org/")} +function tr(t){if("tr"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://translate.google.com/?sl=auto&tl=en&text="+str.substring(1))}else window.open("https://translate.google.com/")} +function tv(t){if("tv"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://www.thetvdb.com/search?query="+str.substring(1))}else window.open("https://www.thetvdb.com/")} +function tvt(t){if("tvt"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://tvtropes.org/pmwiki/search_result.php?q="+str.substring(1))}else window.open("https://tvtropes.org/")} +function ud(t){if("ud"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://www.urbandictionary.com/define.php?term="+str.substring(1))}else window.open("https://www.urbandictionary.com/")} +function ujs(t){if("ujs"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://greasyfork.org/en/scripts?q="+str.substring(1))}else window.open("https://greasyfork.org/en/scripts")} +function valid(t){if("valid"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://validator.w3.org/nu/?doc="+str.substring(1))}else window.open("https://validator.w3.org/nu/")} +function w(t){if("w"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://en.wikipedia.org/w/index.php?title=Special:Search&search="+str.substring(1))}else window.open("https://en.wikipedia.org/w/index.php")} +function w3w(t){if("w3w"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"."+s[o];window.open("https://what3words.com/"+str.substring(1))}else window.open("https://what3words.com/")} +function wa(t){if("wa"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://www.wolframalpha.com/input/?i="+str.substring(1))}else window.open("https://www.wolframalpha.com/")} +function whois(t){if("whois"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://whois.gandi.net/en/results?search="+str.substring(1))}else window.open("https://whois.gandi.net/")} +function wikt(t){if("wikt"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://en.wiktionary.org/w/index.php?title=Special:Search&search="+str.substring(1))}else window.open("https://en.wiktionary.org/w/index.php")} +function wiktno(t){if("wiktno"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://no.wiktionary.org/w/index.php?title=Special:Search&search="+str.substring(1))}else window.open("https://no.wiktionary.org/w/index.php")} +function wine(t){if("wine"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://www.winehq.org/search?q="+str.substring(1))}else window.open("https://www.winehq.org/")} +function wno(t){if("wno"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://no.wikipedia.org/w/index.php?title=Special:Search&search="+str.substring(1))}else window.open("https://no.wikipedia.org/w/index.php")} +function y(t){if("y"!=t){str="";for(var s=t.split(" ").slice(1),o=0;o<s.length;o++)str=str+"+"+s[o];window.open("https://www.youtube.com/results?search_query="+str.substring(1))}else window.open("https://www.youtube.com/")} -// Other functions -function clear(cmd) { document.getElementById('wrapper').innerHTML = ""; } -function echo(cmd) { block_log(cmd.split(" ").slice(1).join(" ")) } -function file(cmd) { if (cmd != "file") { window.open("file:///" + cmd.split(" ").slice(1)[0]); } else { window.open("file:///"); } } +function clear(t){document.getElementById("wrapper").innerHTML=""} +function echo(t){block_log(t.split(" ").slice(1).join(" "))} +function file(t){"file"!=t?window.open("file:///"+t.split(" ").slice(1)[0]):window.open("file:///")} +\ No newline at end of file diff --git a/src/js/terminal.js b/src/js/terminal.js @@ -1,34 +1 @@ -config = { - shellPrompt: "$ " -} - -document.getElementById("input_title").innerText = config.shellPrompt; -document.getElementById('input_source').addEventListener('keyup', submit_command); - -var current_block; - -function new_block() { - current_block = document.createElement("div"); - current_block.classList.add("log"); - document.getElementById('wrapper').appendChild(current_block); -} - -function block_log(message) { - current_block.innerHTML = "<p>" + message + "</p>"; - new_block(); -} - -function submit_command() { - if (!(event.keyCode === 13)) return; - var command = document.getElementById("input_source").value; - document.getElementById("input_source").value = ""; - - new_block(); - - if (typeof window[command.split(" ")[0]] === "function") { - block_log(config.shellPrompt + command); - window[command.split(" ")[0]](command); - } else if (command != "") { - block_log("command not found : " + command); - } -} -\ No newline at end of file +var current_block;function new_block(){(current_block=document.createElement("div")).classList.add("log"),document.getElementById("wrapper").appendChild(current_block)}function block_log(e,n=!1){current_block.innerHTML=`<p class=${n&&"shell"}>`+e+"</p>",new_block()}function handleKeyUp(){13===event.keyCode&&submit_command(),38===event.keyCode&&last_command()}function submit_command(){var e=document.getElementById("input_source").value;document.getElementById("input_source").value="",new_block(),"function"==typeof window[e.split(" ")[0]]?(block_log(config.shellPrompt+e,shell=!0),window[e.split(" ")[0]](e)):""!=e&&block_log("command not found : "+e)}function last_command(){const e=document.getElementsByClassName("shell");document.getElementById("input_source").value=e[e.length-1].innerText.substr(2)}config={shellPrompt:"$ "},document.getElementById("input_title").innerText=config.shellPrompt,document.getElementById("input_source").addEventListener("keyup",handleKeyUp); +\ No newline at end of file