-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
118 lines (113 loc) · 3.01 KB
/
index.html
File metadata and controls
118 lines (113 loc) · 3.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<!DOCTYPE html>
<html lang="zh-Hant">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Felo AI Widget</title>
<style>
/* 重設部分預設樣式 */
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
background-color: #fff;
font-family: Arial, sans-serif;
padding: 20px;
}
/* 版面容器 */
form {
width: 100%;
background-color: #fff;
max-width: 500px;
margin: 50px auto;
padding: 20px;
border-radius: 8px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
/* 隱藏不需要顯示的 input */
form input[type="hidden"] {
display: none;
}
/* 搜尋框與按鈕容器,採用 Flex 排列 */
.search-container {
display: flex;
align-items: center;
width: 100%;
height: 48px;
border-radius: 24px;
}
/* 文字輸入框 */
form input[type="text"] {
height: 100%;
flex-grow: 1;
padding: 10px;
font-size: 1rem;
border: 1px solid #374151;
border-right: none;
border-radius: 4px 0 0 4px;
outline: none;
transition: border-color 0.2s ease-in-out;
}
form input[type="text"]:focus {
border-color: #007BFF;
}
/* 送出按鈕 */
form button {
height: 100%;
background-color: #374151;
color: #fff;
border: 1px solid #374151;
font-size: 1rem;
padding: 5px 10px;
border-radius: 0 4px 4px 0;
cursor: pointer;
transition: background-color 0.2s ease-in-out;
width: 60px;
}
form button:hover {
background-color: #D1D5DB;
color: #374151;
}
@media (max-width: 480px) {
.search-container {
height: 44px;
}
.search-container button {
width: 60px;
padding: 5px;
}
.search-container button img {
width: 12px;
height: 12px;
}
}
</style>
</head>
<body>
<form onsubmit="return setupFeloSearchAction(event)">
<input type="hidden" name="site" value="tylin23.tw" />
<input type="hidden" name="inviteCode" value="B84K3x3wo0Xr0" />
<div class="search-container">
<input type="text" name="query" value="" placeholder="以 Felo AI 搜尋本站" />
<button type="submit"><img src="https://felo.ai/icon.svg" alt="Felo AI Logo" style="width:20px; height:20px; margin-top:2px;"></button>
</div>
</form>
<script>
function setupFeloSearchAction(event) {
event.preventDefault(); // 阻止預設表單提交行為
let query = event.target.elements.query.value.trim();
if (query.length === 0) {
return false;
}
query = query + ' site:' + event.target.elements.site.value;
query = encodeURIComponent(query);
let url = 'https://felo.ai/search?q=' + query + '&mode=verbose';
url = url + '&invite=' + event.target.elements.inviteCode.value;
window.open(url, '_blank');
return false;
}
</script>
</body>
</html>