From bf703532a7601d0e9a167c70151b045fda4ac57d Mon Sep 17 00:00:00 2001 From: netptop Date: Sun, 7 Jul 2024 14:21:52 +0000 Subject: [PATCH] updated www.netptop.com webpage. --- cf_www.netptop.com_worker.js | 130 ++++++++--------------------------- 1 file changed, 28 insertions(+), 102 deletions(-) diff --git a/cf_www.netptop.com_worker.js b/cf_www.netptop.com_worker.js index e8133bb..37880cd 100644 --- a/cf_www.netptop.com_worker.js +++ b/cf_www.netptop.com_worker.js @@ -65,32 +65,12 @@ const someHTML = ` background-color: #333333; } - .engine-tabs { - width: 100%; - } - - .engine-tab { - display: inline-block; - padding: 5px 10px; - margin: 0 10px 15px 0; - text-decoration: none; - border: 2px solid #a89e84; - background-color: #eee8d5; - border-radius: 3px; - cursor: pointer; - } - - .dark-mode .engine-tab { + .dark-mode { border-color: #777777; background-color: #333333; } - .engine-tab.active { - color: #7c786f; - background-color: #d9d2c2; - } - - .dark-mode .engine-tab.active { + .dark-mode { color: #ffffff; background-color: #555555; } @@ -188,24 +168,26 @@ const someHTML = ` -
- 访问网址 - Google IPv4 - Google IPv6 - DuckDuckGo - Bing +
+ +
+

搜索引擎

+
+ -

常用网站


新闻网站


@@ -233,18 +215,13 @@ const someHTML = `
- - - - ` - /** - * rawHtmlResponse delievers a response with HTML inputted directly - * into the worker script - * @param {string} html - */ -async function rawHtmlResponse(html) { - const init = { - headers: { - 'content-type': 'text/html;charset=UTF-8', - }, - } - - return new Response(html, init) -} - /** - * rawJsonResponse delievers a response with a Json Object inputted directly + * rawHtmlResponse delievers a response with HTML inputted directly * into the worker script - * @param {Object} json + * @param {string} html */ -async function rawJsonResponse(json) { +async function rawHtmlResponse(html) { const init = { headers: { - 'content-type': 'application/json;charset=UTF-8', + 'content-type': 'text/html;charset=UTF-8', }, - } - - return new Response(JSON.stringify(json), init) + }; + return new Response(html, init); } addEventListener('fetch', event => { - const { url } = event.request - - /*if (url.endsWith('/index_netptop.html')) { - */ - return event.respondWith(rawHtmlResponse(someHTML)) + const { url } = event.request; + return event.respondWith(rawHtmlResponse(someHTML)); }) \ No newline at end of file