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; +} 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;