diff --git a/index.html b/index.html index 18f07f2..7e53a9a 100644 --- a/index.html +++ b/index.html @@ -21,8 +21,6 @@ - - - diff --git a/js/main.js b/js/main.js index 35fc3a1..50b330c 100644 --- a/js/main.js +++ b/js/main.js @@ -30,11 +30,25 @@ window.addEventListener('load', function () { }, false) -//屏蔽浏览器默认右键 -// document.oncontextmenu = function () { -// undefined -// return false; -// } +//进入问候 +now = new Date(), hour = now.getHours() +if (hour < 6) { + var hello = "凌晨好"; +} else if (hour < 9) { + var hello = "早上好"; +} else if (hour < 12) { + var hello = "上午好"; +} else if (hour < 14) { + var hello = "中午好"; +} else if (hour < 17) { + var hello = "下午好"; +} else if (hour < 19) { + var hello = "傍晚好"; +} else if (hour < 22) { + var hello = "晚上好"; +} else { + var hello = "夜深了"; +} //获取时间 var t = null; @@ -107,22 +121,33 @@ $(function () { }) }) -// 检测浏览器是否支持SW -function registerServiceWorker() { - // 注册 service worker - return navigator.serviceWorker.register('./js/sw.js').then(registration => { - console.log('注册成功'); - // 返回 - return registration; - }) - .catch(err => { - console.error('注册失败', err); - }); -} -window.onload = function () { - //是否支持 - if (!('serviceWorker' in navigator)) { - return; - } - registerServiceWorker() -} \ No newline at end of file +//控制台输出 +var styleTitle1 = ` +font-size: 20px; +font-weight: 600; +color: rgb(244,167,89); +` +var styleTitle2 = ` +font-size:12px; +color: rgb(244,167,89); +` +var styleContent = ` +color: rgb(30,152,255); +` +var title1 = 'Snavigation' +var title2 = ` + _____ __ __ _______ ____ __ +|_ _| \\/ |/ ____\\ \\ / /\\ \\ / / + | | | \\ / | (___ \\ \\_/ / \\ \\_/ / + | | | |\\/| |\\___ \\ \\ / \\ / + _| |_| | | |____) | | | | | +|_____|_| |_|_____/ |_| |_| +` +var content = ` +版 本 号:1.0 +更新日期:2022-03-22 + +Github: https://github.com/imsyy/Snavigation +` +console.log(`%c${title1} %c${title2} +%c${content}`, styleTitle1, styleTitle2, styleContent) \ No newline at end of file diff --git a/js/set.js b/js/set.js index bcf4437..e78272b 100644 --- a/js/set.js +++ b/js/set.js @@ -635,11 +635,21 @@ $(document).ready(function () { $(".search-engine").slideUp(160); }); + $("#s-button").focus(function () { + focusWd(); + keywordReminder(); + $(".search-engine").slideUp(160); + }); + // 搜索框失去焦点事件 $(".wd").blur(function () { blurWd(); }); + $("#s-button").blur(function () { + blurWd(); + }); + // 自动提示( 调用百度 api ) $('.wd').keyup(function (event) { var key = event.keyCode; diff --git a/js/sw.js b/js/sw.js deleted file mode 100644 index b167104..0000000 --- a/js/sw.js +++ /dev/null @@ -1,48 +0,0 @@ -const CURCACHE = 'CURCACHE_test_1' -const RUNTIME = 'runtime'; -const CURCACHE_URLS = [ - './', - 'index.html' -] -self.addEventListener('install', e => { - e.waitUntil( - //存储缓存路径对应的资源 - caches.open(CURCACHE).then(cache => { - cache.addAll(CURCACHE_URLS) - }).then( - self.skipWaiting() - ) - ) -}) - -//代理请求,使用缓存,请求发送之前 -self.addEventListener('fetch', e => { - e.respondWith( - //缓存是否匹配 - caches.match(e.request).then(function (response) { - if (response != null) { - //命中缓存返回缓存,结束请求 - return response - } - //未命中缓存,正常请求 - return fetch(e.request.url) - }) - ) -}); - -//假设上个版本的key为precache_test_2 反正不等于CURCACHE -self.addEventListener('activate', e => { - e.waitUntil( - //遍历当前缓存keys - caches.keys().then(cacheNames => { - return Promise.all( - cacheNames.map(function (cacheName) { - //是否等于当前key,保留自己 - if (cacheName !== CURCACHE) { - return caches.delete(cacheName); - } - }) - ) - }).then(() => self.clients.claim()) - ) -}) \ No newline at end of file diff --git a/js/time.js b/js/time.js deleted file mode 100644 index 33977c6..0000000 --- a/js/time.js +++ /dev/null @@ -1,18 +0,0 @@ -now = new Date(), hour = now.getHours() -if (hour < 6) { - var hello = "凌晨好"; -} else if (hour < 9) { - var hello = "早上好"; -} else if (hour < 12) { - var hello = "上午好"; -} else if (hour < 14) { - var hello = "中午好"; -} else if (hour < 17) { - var hello = "下午好"; -} else if (hour < 19) { - var hello = "傍晚好"; -} else if (hour < 22) { - var hello = "晚上好"; -} else { - var hello = "夜深了"; -} \ No newline at end of file diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 93e56e0..0000000 --- a/manifest.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "Snavigation", - "short_name": "Snavigation", - "display": "standalone", - "start_url": "/", - "theme_color": "#efefef", - "background_color": "#333333", - "icons": [ - { - "src": "img/icon/favicon_32.png", - "sizes": "32x32", - "type": "image/png" - }, - { - "src": "img/icon/favicon_64.png", - "sizes": "64x64", - "type": "image/png" - }, - { - "src": "img/icon/favicon_128.png", - "sizes": "128x128", - "type": "image/png" - }, - { - "src": "img/icon/favicon_144.png", - "sizes": "144x144", - "type": "image/png" - } - ] - } \ No newline at end of file