From 3817e6e43d798cd83cb315d60692443c018cbdc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BA=95=E5=B1=82=E7=94=A8=E6=88=B7?= Date: Sat, 29 Jan 2022 16:46:29 +0800 Subject: [PATCH] add Firefox support --- css/firefox.css | 22 ++++++++++++++++++++++ css/style.css | 1 + js/main.js | 16 ++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 css/firefox.css diff --git a/css/firefox.css b/css/firefox.css new file mode 100644 index 0000000..ccc673d --- /dev/null +++ b/css/firefox.css @@ -0,0 +1,22 @@ +#section { + background-image: url(../img/background.jpg) !important; +} + +.message, +.time, +.hitokoto, +.music, +.link-card, +.more, +.box-wrapper, +footer { + background: rgba(0, 0, 0, 0.5); +} + +.link-card:hover { + background: rgb(0, 0, 0, 0.6); +} + +.progress { + background: rgba(0, 0, 0, 0.5) !important; +} diff --git a/css/style.css b/css/style.css index 4e7b782..d250a40 100644 --- a/css/style.css +++ b/css/style.css @@ -308,6 +308,7 @@ i#next { } .music-text { + margin-top: 6px; font-size: 1.10rem; text-overflow: ellipsis; max-width: 220px; diff --git a/js/main.js b/js/main.js index b743026..348b6c9 100644 --- a/js/main.js +++ b/js/main.js @@ -34,6 +34,22 @@ iziToast.settings({ iconColor: '#efefef', }); +//火狐浏览器独立样式 +if (isFirefox = navigator.userAgent.indexOf("Firefox") > 0) { + var head = document.getElementsByTagName('head')[0]; + var link = document.createElement('link'); + link.href = './css/firefox.css'; + link.rel = 'stylesheet'; + link.type = 'text/css'; + head.appendChild(link); + iziToast.info({ + timeout: 8000, + iconUrl: './img/warn.png', + title: '兼容提醒', + message: '您正在使用火狐浏览器,部分功能可能不支持' + }); +} + //获取一言 fetch('https://v1.hitokoto.cn?max_length=24') .then(response => response.json())