优化 搜索引擎切换
This commit is contained in:
parent
552ffb697d
commit
d0d20423f1
|
@ -18,45 +18,45 @@ a{text-decoration:none;color:#000}
|
|||
li img{width:14px;height:14px;margin:0 5px 0 8px;vertical-align:-0.15em;fill:currentColor;overflow:hidden}
|
||||
.con{width:100%;transition:1s all;margin:auto;min-width:320px;height:380px;position:absolute;left:0;top:-100px;right:0;bottom:0}
|
||||
.con .shlogo{position:relative;width:auto;height:auto;margin:20px auto}
|
||||
h2.title{text-align:center;color:#fff;font-size:36px;font-weight:600;text-shadow:1px 1px 8px #504b4b}
|
||||
h2.title{text-align:center;color:#fff;font-size:26px;font-weight:600;text-shadow:1px 1px 8px #504b4b}
|
||||
.con .shlogo a{width:100%;display:block;width:100%;height:100%}
|
||||
.con .sou{max-width:680px;position:relative;width:calc(100% - 60px);min-width:320px;margin:0 auto}
|
||||
.content{margin:10px}
|
||||
.con .sou form{width:100%;height:50px;display:block;margin:50px auto 30px;position:relative}
|
||||
.con .sou form .wd{background:#ffffff2e;padding-left:1em;width:100%;height:100%;display:block;border:1px solid #ddd;border-radius:25px;line-height:100%;font-size:17px;text-indent:50px;transition:0.3s all;color:#fff}
|
||||
.con .sou .lylme{width:100%;display:block;margin:50px auto 30px;position:relative}
|
||||
.con .sou .lylme .wd{background:#ffffff2e;padding-left:1em;width:100%;height:50px;display:block;border:1px solid #ddd;border-radius:25px;line-height:100%;font-size:17px;text-indent:50px;transition:0.3s all;color:#ffffffc4}
|
||||
.lg{z-index:1000}
|
||||
.con .sou form .lg svg{display:block;width:25px;height:25px;position:absolute;left:15px;top:12px;overflow:hidden;cursor:pointer}
|
||||
.con .sou form .lg img{display:block;width:25px;height:25px;position:absolute;left:25px;top:12px;overflow:hidden;cursor:pointer}
|
||||
.con .sou form .wd:focus{color:#000;background:#fff;box-shadow:0 0px 15px 0 rgba(32,33,36,0.2);border-color:#fff}
|
||||
.con .sou form button{width:40px;height:40px;display:block;position:absolute;z-index:10;right:6px;top:6px;cursor:pointer;font-size:22px;line-height:40px;border-radius:50%;color:#777}
|
||||
.con .sou .lylme .lg svg{display:block;width:25px;height:25px;position:absolute;left:15px;top:12px;overflow:hidden;cursor:pointer}
|
||||
.con .sou .lylme .lg img{display:block;width:25px;height:25px;position:absolute;left:25px;top:12px;overflow:hidden;cursor:pointer}
|
||||
.con .sou .lylme .wd:focus{color:#000;background:#fff;box-shadow:0 0px 15px 0 rgba(32,33,36,0.2);border-color:#fff}
|
||||
.con .sou .lylme button{width:40px;height:40px;display:block;position:absolute;z-index:10;right:6px;top:6px;cursor:pointer;font-size:22px;line-height:40px;border-radius:50%;color:#ddd}
|
||||
.con .sou #word{backdrop-filter: blur(10px);width:calc(100% - 70px);padding: 15px;border-radius:10px;left:20px;position:absolute;z-index:500;top:65px;background:#ffffffb0;;line-height:30px;font-size:16px;overflow:hidden;display:none}
|
||||
.con .sou #word li{cursor:pointer;color:#555;margin: 5px;}
|
||||
#word li:hover{background-color:#ddd}
|
||||
.foot{text-shadow: 0px 0px 5px black;position:absolute;bottom:10px;text-align:center;width:100%;color:#fff;line-height:20px;font-size:12px;height:auto}
|
||||
.foot{text-shadow: 0px 0px 5px black;position:fixed;bottom:20px;text-align:center;width:100%;color:#fff;line-height:20px;font-size:12px;height:auto}
|
||||
.foot a{color:#fff}
|
||||
.home{width:50px;height:50px;position:absolute;right:70px;top:10px;z-index:200;cursor:pointer}
|
||||
.home a{font-size:20px;color:#999;line-height:50px;display:block;text-align:center}
|
||||
#menu{width:50px;height:50px;background: #29f;border-radius: 50%;transform:scale(0.8);position:absolute;right:10px;top:5px;z-index:2000000;cursor:pointer;transition:0.5s}
|
||||
#menu{width:50px;height:50px;background: #f4f6f900;border-radius: 50%;transform:scale(0.8);position:absolute;right:10px;top:5px;z-index:2000000;cursor:pointer;transition:0.5s}
|
||||
#menu i{position:absolute;left:0;right:0;margin:24px auto;width:30px;height:2px;background:#fff}
|
||||
#menu i:before{content:'';width:20px;height:2px;top:-8px;background:#fff;position:absolute;right:0}
|
||||
#menu i:after{content:'';width:20px;height:2px;bottom:-8px;background:#fff;position:absolute;left:0}
|
||||
#menu.on{right:380px;background:#29f;border-radius:25px}
|
||||
#menu.on{right:380px;background:#f4f6f900;border-radius:25px}
|
||||
#menu.on i{width:20px;background:#fff}
|
||||
#menu.on i:before{top:-5px;transform:rotate(45deg);width:14px;right:-1px;left:auto;background:#fff}
|
||||
#menu.on i:after{bottom:-5px;transform:rotate(-45deg);width:14px;right:-1px;left:auto;background:#fff}
|
||||
.list{width:337px;padding:0 20px;height:100%;overflow:hidden;overflow-y:auto;position:absolute;right:0px;z-index:2000;background:#222d46;transition:0.3s all linear}
|
||||
.list.closed{right:-380px}
|
||||
.list ul{width:330px;float:left;padding:0 0 20px;margin-bottom:20px}
|
||||
.list ul{width:330px;float:left;padding:0 0 20px;margin-bottom:0px}
|
||||
.list ul li{word-break:break-all;display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden;float:left;margin:5px;width:100px;height:30px;text-align:left;line-height:30px}
|
||||
.list ul li a{width:100%;border-radius:5px;transition:0.2s all linear;height:100%;display:block;color:#fff;font-weight:500;background:#293550;text-align:left;font-size:12px}
|
||||
.list ul li:hover a{color:#fff;background-color:#29f;background-image:linear-gradient(135deg,rgba(35,153,255) 0%,rgba(84,175,253) 100%);box-shadow:0 3px 3px rgba(0,40,70,.3)}
|
||||
.list ul li.title{width:100%;height:40px;line-height:40px;margin:30px 0 0;text-align:left;text-indent:10px;color:#fff;font-size:18px;font-weight:bold}
|
||||
.list ul li.title{width:100%;height:40px;line-height:40px;margin:20px 0 0;text-align:center;text-indent:10px;color:#fff;font-size:18px;font-weight:bold}
|
||||
svg.icon{width:14px;height:14px;margin:0 5px 0 8px;vertical-align:-0.15em;fill:currentColor;overflow:hidden}
|
||||
.list ul li.title svg.icon{width:20px;height:20px}
|
||||
@media (max-width:640px){.con{top:0px}
|
||||
.con .shlogo{width:auto;height:auto}
|
||||
.con .sou form .wd:focus{background:#f1f1f1;box-shadow:none;border-color:#ccc}
|
||||
.con .sou form button{border-radius:25px}
|
||||
.con .sou .lylme .wd:focus{background:#f1f1f1;box-shadow:none;border-color:#ccc}
|
||||
.con .sou .lylme button{border-radius:25px}
|
||||
.con .sou #word{max-height:150px}
|
||||
#menu.on{right:270px}
|
||||
.list{width:227px}
|
||||
|
@ -70,8 +70,8 @@ svg.icon{width:14px;height:14px;margin:0 5px 0 8px;vertical-align:-0.15em;fill:c
|
|||
.home,#menu,.mywth,.foot{display:none}
|
||||
}@media (prefers-color-scheme:dark){body{background-color:#162035}
|
||||
.mywth{color:#bbb}
|
||||
.con .sou form .wd:focus{background:#293550;border:1px solid #162035}
|
||||
.con .sou form .wd{border:1px solid #293550;color:#bbb}
|
||||
.con .sou .lylme .wd:focus{background:#293550;border:1px solid #162035}
|
||||
.con .sou .lylme .wd{border:1px solid #293550;color:#bbb}
|
||||
.con .sou #word{border:15px solid #293550;background:#293550}
|
||||
.con .sou #word .click_work{color:#89b}
|
||||
}::-webkit-scrollbar{width:6px;height:6px}
|
||||
|
@ -79,3 +79,4 @@ svg.icon{width:14px;height:14px;margin:0 5px 0 8px;vertical-align:-0.15em;fill:c
|
|||
::-webkit-scrollbar-thumb{background:#293550;border-radius:0px}
|
||||
::-webkit-scrollbar-thumb:hover{background:#293550}
|
||||
::-webkit-scrollbar-corner{background:#222d46}
|
||||
.hide {display:none}
|
|
@ -1,18 +1,3 @@
|
|||
<?php
|
||||
$t=strtolower(urlencode($_GET["t"])); //搜索引擎
|
||||
$q=urlencode($_POST["q"]); //搜索词
|
||||
if (!empty($q)) {
|
||||
if($soulist = $DB->fetch($DB->query("SELECT * FROM `lylme_sou` WHERE `sou_alias` LIKE '".$t."'"))) {
|
||||
if (checkmobile()&& !empty($soulist["sou_waplink"])) {
|
||||
echo'<script>window.location.href="'.$soulist["sou_waplink"].$q.'";</script>';
|
||||
} else {
|
||||
echo'<script>window.location.href="'.$soulist["sou_link"].$q.'";</script>';
|
||||
}
|
||||
} else {
|
||||
echo'<script>window.location.href="https://www.baidu.com/s?word='.$q.'";</script>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
|
@ -34,7 +19,7 @@ if (!empty($q)) {
|
|||
<meta name="x5-fullscreen" content="true"><!--QQ强制全屏-->
|
||||
<meta name="x5-page-mode" content="app"><!--QQ应用模式-->
|
||||
<meta name="lsvn" content="<?php echo base64_encode($conf['version'])?>">
|
||||
<link href="<?php echo $templatepath;?>/css/style.css?v=20220611" rel="stylesheet">
|
||||
<link href="<?php echo $templatepath;?>/css/style.css?v=20221210" rel="stylesheet">
|
||||
<link href="<?php echo $templatepath;?>/css/wea.css" rel="stylesheet">
|
||||
<script src="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-2-M/jquery/3.5.1/jquery.min.js"></script>
|
||||
</head>
|
||||
|
@ -79,34 +64,26 @@ if ($conf['tq']) {
|
|||
<div class="con">
|
||||
<div class="shlogo"><?php echo $conf['home-title'] ?></div>
|
||||
<div class="sou">
|
||||
<form action="" method="post" target="_blank">
|
||||
<div class="lylme">
|
||||
<?php
|
||||
$soulists = $DB->query("SELECT * FROM `lylme_sou` ORDER BY `lylme_sou`.`sou_order` DESC");
|
||||
$i = 0;
|
||||
$soulists = $DB->query("SELECT * FROM `lylme_sou` WHERE `sou_st` = 1 ORDER BY `lylme_sou`.`sou_order` ASC");
|
||||
$json = array();
|
||||
while ($soulist = $DB->fetch($soulists)) {
|
||||
if ($soulist["sou_st"] == 1 && $soulist["sou_alias"] == $t) {
|
||||
if(empty($soun)) {
|
||||
$alias = $DB->fetch($DB->query("SELECT * FROM `lylme_sou` WHERE `sou_alias` NOT LIKE '".$soulist["sou_alias"]."' ORDER BY `sou_order` ASC LIMIT 1"));
|
||||
$soun = $alias["sou_alias"];
|
||||
}
|
||||
echo '<div class="lg" onclick="window.location.href=\'?t='.$soun.'\';">' . $soulist["sou_icon"] . '</div>
|
||||
<input class="wd" type="text" placeholder="' . $soulist["sou_hint"] . '" name="q" x-webkit-speech lang="zh-CN" autocomplete="off">';
|
||||
$sousw = 1;
|
||||
}
|
||||
if ($soulist["sou_st"] == 1) {
|
||||
$soun = $soulist["sou_alias"];
|
||||
}
|
||||
if(empty($soun))break;
|
||||
}
|
||||
if(empty($sousw)||empty($soun)) {
|
||||
$alias = $DB->fetch($DB->query("SELECT * FROM `lylme_sou` WHERE `sou_alias` NOT LIKE 'baidu' ORDER BY `sou_id` DESC LIMIT 1"));
|
||||
echo '<div class="lg" onclick="window.location.href=\'?t='.$alias["sou_alias"].'\';"><svg class="icon" aria-hidden="true"><use xlink:href="#icon-icon_baidulogo"></use></svg></div>
|
||||
<input class="wd" type="text" placeholder="百度一下,你就知道" name="q" x-webkit-speech lang="zh-CN" autocomplete="off">
|
||||
';
|
||||
echo '<div class="ss hide"><div class="lg">' . $soulist["sou_icon"] . '</div>
|
||||
</div>';
|
||||
if (checkmobile()&& !empty($soulist["sou_waplink"])) {
|
||||
$so = $soulist["sou_waplink"];
|
||||
} else {
|
||||
$so = $soulist["sou_link"];
|
||||
}
|
||||
array_push($json,array($soulist['sou_name'],$soulist['sou_hint'],$so));
|
||||
}
|
||||
$json = json_encode($json,JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES)
|
||||
?>
|
||||
<button><svg class="icon" style=" width: 21px; height: 21px; opacity: 0.5;" aria-hidden="true"><use xlink:href="#icon-sousuo"></use></svg></button>
|
||||
</form>
|
||||
|
||||
<input class="wd soinput" type="text" placeholder="" name="q" x-webkit-speech lang="zh-CN" autocomplete="off">
|
||||
<button onclick="go('');"><svg class="icon" style=" width: 21px; height: 21px; opacity: 0.5;" aria-hidden="true"><use xlink:href="#icon-sousuo"></use></svg></button>
|
||||
|
||||
<div id="word"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -138,16 +115,17 @@ while($taglists = $DB->fetch($tagslists)) {
|
|||
}
|
||||
?>
|
||||
<!--版权信息-->
|
||||
<p> Theme by <a href="https://github.com/5iux/sou/" target="_blank">5iux</a> .<?php echo $conf['copyright'];
|
||||
?></p>
|
||||
<!-- <p> Theme by <a href="https://github.com/5iux/sou/" target="_blank">5iux</a> .<?php echo $conf['copyright'];
|
||||
?></p> -->
|
||||
</div>
|
||||
<script src="<?php echo $cdnpublic ?>/assets/js/svg.js"></script>
|
||||
<script src="<?php echo $templatepath;?>/js/sou.js"></script>
|
||||
<script src="<?php echo $templatepath;?>/js/sou.js?v=20221210"></script>
|
||||
|
||||
<?php
|
||||
if(empty($t)) {echo '<script>var sou = "?t="+localStorage.getItem("sou");window.location.href=sou;</script>';}
|
||||
echo '<script>localStorage.setItem("sou", "'.$t.'");</script>';
|
||||
?>
|
||||
<script>
|
||||
function solist(){
|
||||
return <?php echo $json?>;
|
||||
}
|
||||
</script>
|
||||
<!--
|
||||
作者:D.Young
|
||||
主页:https://blog.5iux.cn/
|
||||
|
|
|
@ -1,3 +1,40 @@
|
|||
/*
|
||||
* 六零
|
||||
* 2022年12月10日
|
||||
*/
|
||||
$(document).ready(function(){
|
||||
//设置为上次使用的搜索引擎
|
||||
var index_id = localStorage.getItem("index_id")?localStorage.getItem("index_id"):0;
|
||||
sethint(index_id);
|
||||
$(".lylme").children().eq(index_id).show();
|
||||
});
|
||||
$(".lg").click(function () {
|
||||
//切换搜索引擎
|
||||
var count = $(".lylme").children(".ss").length;
|
||||
var index = $(".lg").index(this);
|
||||
if(count <= index+1){var index = -1;}
|
||||
$(".lylme").children(".ss").hide();
|
||||
$(".lylme").children().eq(index+1).show();
|
||||
sethint(index+1);
|
||||
localStorage.setItem("index_id",index+1);
|
||||
});
|
||||
function sethint(id){
|
||||
//设置搜索框提示
|
||||
$(".soinput").attr("placeholder",solist()[id][1]);
|
||||
}
|
||||
function go(input_text){
|
||||
// 跳转搜索结果
|
||||
var index_id = localStorage.getItem("index_id");
|
||||
var sourl = solist()[index_id][2];
|
||||
if(input_text==""){var input_text = $(".soinput").val();}
|
||||
var url = sourl+input_text;
|
||||
if(navigator.userAgent.match(/mobile/i)){
|
||||
window.location.href=url;
|
||||
}else{
|
||||
window.open(url, "_blank");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
作者:D.Young
|
||||
主页:https://yyv.me/
|
||||
|
@ -71,8 +108,13 @@ $(function() {
|
|||
var word = $(this).text();
|
||||
$('.wd').val(word);
|
||||
$('#word').hide();
|
||||
$("form").submit();
|
||||
go(word);
|
||||
// $('#texe').trigger('click');触发搜索事件
|
||||
})
|
||||
|
||||
$(".wd").keypress(function(event){
|
||||
if(event.which === 13) {
|
||||
var word = $(".soinput").val();
|
||||
go(word);
|
||||
}
|
||||
})
|
||||
})
|
Loading…
Reference in New Issue