|
|
第1行: |
第1行: |
| /* 这里的任何JavaScript将为所有用户在每次页面载入时加载。 */ | | /* 这里的任何JavaScript将为所有用户在每次页面载入时加载。 */ |
− | var vid = document.getElementById("vid");
| |
− | var myElement = document.getElementById("jkl");
| |
− | var search = document.getElementById("topsearch");
| |
− |
| |
− | $().ready( function() {
| |
− | //插入搜索框
| |
− | search.innerHTML = '<input type="text" id="myInput" placeholder="搜索" style="width: 100%;height: 100%; padding:0px 20px;border-radius: 2vw;">';
| |
− | const minput = document.getElementById('myInput'); // 获取输入框元素
| |
− | console.log(myInput)
| |
− | minput.addEventListener('keydown', function(event) {
| |
− | if (event.key === "Enter") {
| |
− | // 按下回车键时执行的操作
| |
− | event.preventDefault(); // 阻止默认的提交行为
| |
− | console.log("回车")
| |
− | // 在此处编写你希望执行的代码
| |
− | //if (minput.trim() === "") {
| |
− | //return;
| |
− | //}
| |
− |
| |
− | var content = document.getElementById("bodyContent").innerText;
| |
− | var regex = new RegExp(minput , "gi");
| |
− | var match = content.match(regex);
| |
− |
| |
− | if (match) {
| |
− | var elements = document.getElementsByClassName("mw-body")[0].querySelectorAll(":not(script):not(style)");
| |
− | Array.prototype.forEach.call(elements, function(element) {
| |
− | var text = element.textContent;
| |
− | console.log(regex.test(text))
| |
− | if (regex.test(text)) {
| |
− | element.scrollIntoView({ behavior: "smooth", block: "center" });
| |
− | }
| |
− | });
| |
− | } else {
| |
− | alert("未找到匹配的文本");
| |
− | }
| |
− | }
| |
− | });
| |
− | });
| |
− |
| |
| // 添加事件监听器 | | // 添加事件监听器 |
| $('#Qlink').click(function(){ | | $('#Qlink').click(function(){ |
2024年12月2日 (一) 12:26的版本
/* 这里的任何JavaScript将为所有用户在每次页面载入时加载。 */
// 添加事件监听器
$('#Qlink').click(function(){
localStorage.clear();
window.location.href = 'http://help.qlinkcloud.club/index.php?title=Qlink';
});
$('#MSG600').click(function(){
localStorage.clear();
window.location.href = 'http://help.qlinkcloud.club/index.php?title=%E5%B8%AE%E5%8A%A9';
});
$('#MSG500').click(function(){
localStorage.clear();
window.location.href = 'http://help.qlinkcloud.club/index.php?title=%E5%BC%80%E5%B1%80%E6%8C%87%E5%AF%BC';
});
$('#FAQ').click(function(){
localStorage.clear();
window.location.href = 'http://help.qlinkcloud.club/index.php?title=FAQ';
});