From 0c49772efba8696cb9a6713cb70008512e692ccd Mon Sep 17 00:00:00 2001 From: maxming2333 Date: Mon, 3 Jun 2024 00:18:20 +0800 Subject: [PATCH 1/2] feat: get gon object flag --- content/src/scripts/index.js | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/content/src/scripts/index.js b/content/src/scripts/index.js index 4f927a4..35280a8 100644 --- a/content/src/scripts/index.js +++ b/content/src/scripts/index.js @@ -11,16 +11,13 @@ const proxyStore = new Store(); const anchor = document.createElement("div"); anchor.id = "rcr-anchor"; -if (document.querySelectorAll('[aria-label="Loading"]').length === 0) { - mount(); -} else { - let intervalId = null; - intervalId = setInterval(() => { - if (document.querySelectorAll('[aria-label="Loading"]').length === 0) { - clearInterval(intervalId); - mount(); - } - }, 500); +const isGitlabPage = function() { + const headList = Array.from(document.head.querySelectorAll('script')); + const gonEl = headList.find(item => item.innerHTML.includes('gon.gitlab_url')); + if (gonEl) { + return true; + } + return document.querySelectorAll('[aria-label="Loading"]').length === 0; } const mount = () => { @@ -44,4 +41,16 @@ const mount = () => { } }; +if (isGitlabPage()) { + mount(); +} else { + let intervalId = null; + intervalId = setInterval(() => { + if (isGitlabPage()) { + clearInterval(intervalId); + mount(); + } + }, 500); +} + export default proxyStore; From 66b99dabffeda37f3f65d738eb6615b50162b81d Mon Sep 17 00:00:00 2001 From: maxming2333 Date: Mon, 3 Jun 2024 14:20:38 +0800 Subject: [PATCH 2/2] feat: disable navigation sidebar animation --- content/src/scripts/containers/app/App.css | 3 +++ 1 file changed, 3 insertions(+) diff --git a/content/src/scripts/containers/app/App.css b/content/src/scripts/containers/app/App.css index e69de29..05e1525 100644 --- a/content/src/scripts/containers/app/App.css +++ b/content/src/scripts/containers/app/App.css @@ -0,0 +1,3 @@ +.nav-sidebar { + transition: width 0.3s !important; +}