Lighter 1.3b newtab/desktop
<!DOCTYPE html>
<!-- Tiny, minimalistic, but act as it should newtab/desktop. Tested on Vivaldi (Chromium family).
v.1.3b
usage:
enter - search with google.com
ctrl+enter - search with duckduckgo.com (cyrillic encoding bug; need fix)
(you can change both below, if needed)
shift+enter - go to url
contacts:
plamch.blogspot.com
t.me/Plamcheg
-->
<head><title>[.!.]</title>
<style>
body {
margin: 0;
background: #000 url(bg.jpg) fixed no-repeat 30% top!important;
background-size: auto 100%!important;
}
*::selection {
background: #fff;
color: #333;
}
#bgmp4 {
position: fixed;
height: 100%;
bottom: 0;
pointer-events: none;
z-index: 1;
opacity: 0.5;
}
#inputf {
position: fixed;
opacity: 0;
border-radius: 5px;
padding-left: 10px;
background: rgba(0,0,0,0.3);
width: 40%;
height: 45px;
margin-top: 40px;
left: 50%;
transform: translateX(-50%);
border: 0;
outline: 0;
font-size: 20px;
font-family: sans;
color: #ccc;
border-right: none;
z-index: 2;
}
#inputf:focus {
background: rgba(0,0,0,0.5);
color: #fff;
}
#inputf:not(:focus)+span::after {
content: 'unfocused';
display: block;
position: fixed;
margin-top: 100px;
left: 50%;
transform: translateX(-50%);
padding: 5px;
width: 130px;
text-align: center;
background: rgba(0,0,0,0.5);
color: #fff;
font-family: sans;
font-size: 14px;
font-weight: bold;
border-radius: 50px;
z-index: 2;
}
</style>
</head><body>
<input id="inputf" autofocus />
<span></span>
<video id='bgmp4' muted loop autoplay>
<source src='bg.mp4' type=video/mp4>
</video>
<script>
var field = document.querySelector("#inputf");
var bg = document.querySelector("#bgmp4");
var searchE = 'https://google.com/search?q='; /* search engine for Enter */
var searchE2 = 'https://duckduckgo.com/?q='; /* search engine for crtl+enter */
field.addEventListener('keyup', function(e) {
field.style.setProperty('opacity','1');
var key = e.keyCode;
if (key == 13 && field.value !== '') {
if (e.shiftKey) {
window.open('http://'+field.value, '_blank').focus();
}
else if (e.ctrlKey) {
window.open(searchE2+field.value, '_blank').focus();
}
else {
window.open(searchE+field.value, '_blank').focus();
}
field.style.setProperty('opacity','0');
field.value = '';
}
else if (field.value == '') {
field.style.setProperty('opacity','0');
}
});
window.onfocus = function() {
field.focus();
}
document.addEventListener('mousedown', function(e) {
/* ctrl+click bg hide
if (e.ctrlKey) {
if (bg.style.display !== 'none') {
bg.style.display = 'none';
}
else {
bg.style.display = 'block';
}
} */
field.focus();
e.preventDefault();
});
field.addEventListener('mousedown', function(e) {
e.stopPropagation();
});
field.addEventListener("keydown",function(e){
var key = e.keyCode;
if (key === 27){
field.style.setProperty('opacity','0');
field.value = '';
e.stopPropagation();
}
});
/* bg right click override */
document.addEventListener('contextmenu', function(e) {
e.preventDefault();
});
field.addEventListener('contextmenu', function(e) {
e.stopPropagation();
});
</script>
</body>
Комментариев нет:
Отправить комментарий