[html]代码库
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<div style="font-size:40px;font-weight:bold;"><p style="display:inline;color:#496835;margin:0;">Search</p><p style="display:inline;color:#A9CBB8;margin:0;"> For</p></div>
<script >
document.addEventListener("DOMContentLoaded", function () {
var h,
b = document.getElementById("search_submit"),
c = document.createElement("select"),
e = [],
f = search,
g = {
i: { name: "默认", url: "" },
bd: { name: "百度", url: " https://m.baidu.com/s?word=" },
gg: { name: "谷歌", url: " https://www.google.com/search?query=" },
bing: { name: "必应", url: " https://cn.bing.com/search?q=" },
wz: {
name: "无追",
url: " https://wuzhuiso.com/s?q="
},
dk: { name: "Duck", url: " https://duckduckgo.com/?q=" },
gk: { name: "夸克", url: " https://quark.sm.cn/s?q=" },
sg: {
name: "搜狗",
url: " https://m.sogou.com/web/searchList.jsp?keyword="
},
tt: {
name: "头条",
url: " https://m.toutiao.com/search?keyword="
},
zh: {
name: "知乎",
url: " https://www.zhihu.com/search?q="
},
c: { name: "其他", url: localStorage.c || "" },
m: {
name: "重设",
disabled: (!localStorage.c || "c" !== localStorage.se) && "disabled"
}
};
(c.style.color="#A0CAA9"),
(c.style.float = "left"),
(c.style.height = "46px"),
(c.style.border = "none"),
(c.style.paddingLeft = "10px"),
(c.style.background = "transparent"),
(c.style.outline = "none"),
(c.style.borderRadius = "inherit");
for (h in g)
e.push(
"<option value=" +
h +
" " +
(g[h].disabled || "") +
">" +
g[h].name +
"</option>"
);
(c.innerHTML = e.join("")),
(c.onchange = function () {
var b, c;
"c" !== this.value && "m" !== this.value
? ((b = !0), (localStorage.se = this.value))
: ((c = prompt(
"请修改自定义地址\n注:via上取消也可能会清空(′⊙ω⊙`)",
localStorage.c
)),
(c = (c || "").trim()),
(b = !c),
(this.value = b ? "i" : "c"),
(localStorage.c = c)),
(this.children[this.children.length - 1].disabled = b);
}),
(c.value = localStorage.se || "i"),
b.parentElement.insertBefore(c, b),
(search = function () {
var a = document.getElementById("search_input");
return (
(a.value = a.value.trim()),
a.value ? ((a.value = g[c.value].url + a.value), f()) : !1
);
});
});
</script>
<!--上搜索栏一言-->
<script src="https://widget.qweather.net/standard/static/js/he-standard-common.js?v=2.0"></script>
<script type="text/javascript">
var xhr = new XMLHttpRequest();
xhr.open('get', 'https://v1.jinrishici.com/all.txt');
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
var gushici = document.getElementsByTagName("title")[0];
gushici.innerText = xhr.responseText;
}
};
xhr.send();
</script>
<script type="text/javascript">
var s = false;
var t =document.getElementsByTagName("title")[0];
if(s){
t.innerHTML = str[0]+str[1];
}else{
t.innerHTML = str[0];
}
</script>
</body>
</html>