This repository has been archived on 2024-04-03. You can view files and clone it, but cannot push or open issues or pull requests.
OLD-GZod01.fr_Source_Code-OLD/main-site/search.html

105 lines
3.3 KiB
HTML
Raw Permalink Normal View History

2023-03-25 09:29:34 +00:00
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" href="//api.gzod01.fr/pictures/gzod01.ico">
<link rel="stylesheet" href="//api.gzod01.fr/css/style.css">
<script src="//api.gzod01.fr/scripts/main.js"></script>
<title>Page d'Accueil Navigateur</title>
</head>
<body>
<div id="header"></div>
<div class=content>
<div style="position:absolute;right:0">
<label for=searchmotorselect>Choisissez votre moteur de recherche</label>
<select id=searchmotorselect name=searchmototselect>
<option value=duckduckgo>DuckDuckGo</option>
<option value=google>Google</option>
<option value=bing>Bing</option>
</select>
</div>
<div class=fullcentered name=searchbar>
<label for=q>Rechercher (Entrez un url ou un texte):</label><input type="text" id="q" name="q"><button id="search">GO</button>
</div>
<script>/*function isveryvalidurl(urlString){
try {
return Boolean(new URL(urlString));
}
catch(e){
console.warn(e)
return false;
}
}*/
function isveryvalidurl(urlString){
var urlPattern = new RegExp('^(https?:\\/\\/)?'+ // validate protocol
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|'+ // validate domain name
'((\\d{1,3}\\.){3}\\d{1,3}))'+ // validate OR ip (v4) address
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+ // validate port and path
'(\\?[;&a-z\\d%_.~+=-]*)?'+ // validate query string
'(\\#[-a-z\\d_]*)?$','i'); // validate fragment locator
return !!urlPattern.test(urlString);
}
document.getElementById('q').onkeydown = function(e){if(e.keyCode==13){functiontosearch()}}
function functiontosearch(){
let queryvalue = document.getElementById('q').value;
if(queryvalue.startsWith('http')){
if(isveryvalidurl(queryvalue)){
open(queryvalue)
}
else{
open('//duckduckgo.com/?q='+encodeURIComponent(queryvalue))
}
}
else if(queryvalue.startsWith('//')){
if(isveryvalidurl('http:'+queryvalue)){
open(queryvalue)
}
else{
open('//duckduckgo.com/?q='+encodeURIComponent(queryvalue))
}
}
else{
if(isveryvalidurl('http://'+queryvalue)){
open('//'+queryvalue)
}
else{
open('//duckduckgo.com/?q='+encodeURIComponent(queryvalue))
}
}
}
document.getElementById('search').addEventListener('click', functiontosearch)</script>
<!--<div id="f"></div>
<button id="addf">Ajouter un lien aux favoris</button>
<script>
function deletefromarray(mat,p){
let nmat = []
for(let i; i<length(mat)+1;i++){
if (i==p){}
else{
nmat.push(mat[i])
}
}
return nmat
}
let fav = JSON.parse(localStorage.getItem('favoris'))
for(let i; i<length(fav)+1; i++){
let cf = fav[i]
let fnode = document.createElement('div')
let furl= document.createElement('a')
furl.href=cf['url']
furl.innerText=cf['name']
fnode.appendChild('furl')
let delbutton = document.createElement('button')
delbutton.innerText= 'Supprimer'
delbutton.setAttribute('onclick',`function(){localStorage.setItem('favoris',JSON.stringify(deletefromarray(JSON.parse(localStorage.getItem('favoris')),${i})))}`)
document.getElementById('f').appendChild(fnode)
}
document.getElementById('')
</script>-->
</div>
<div id="footer"></div>
</body>
</html>