Skip to content

Commit

Permalink
Structural changes and config changes
Browse files Browse the repository at this point in the history
  • Loading branch information
iamarav committed Dec 5, 2024
1 parent 56838b8 commit 7a553a9
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 17 deletions.
1 change: 1 addition & 0 deletions assets/styles/journey.css
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ a:visited {
header {
text-align: right;
color: #aaa;
font-size: 12px;
}

header:hover {
Expand Down
2 changes: 2 additions & 0 deletions env.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
window.__defaultConfig = Object.freeze({
githubLink: `https://github.com/see-bz/journey`,
installLink: `https://github.com/see-bz/journey/releases/`,
widgets: {
clocks: {
timezones: [
Expand Down
23 changes: 10 additions & 13 deletions pages/index.html → index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,40 +12,37 @@
<!-- Styles -->
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link rel="stylesheet" href="../assets/styles/journey.css" />
<link rel="stylesheet" href="./assets/styles/journey.css" />

<!-- Favicon -->
<link rel="icon" href="../assets/images/favicon.ico" type="image/x-icon" />
<link rel="icon" href="./assets/images/favicon.ico" type="image/x-icon" />
<link
rel="shortcut icon"
href="../assets/images/favicon.ico"
href="./assets/images/favicon.ico"
type="image/x-icon"
/>

<link
rel="icon"
type="image/png"
sizes="32x32"
href="../assets/images/journey-32x32.png"
href="./assets/images/journey-32x32.png"
/>
<link
rel="icon"
type="image/png"
sizes="16x16"
href="../assets/images/journey-16x16.png"
href="./assets/images/journey-16x16.png"
/>

<script src="../env.js"></script>
<script src="./env.js"></script>
</head>
<body class="fade-in journey">
<div id="bg-overlay" class="bg-overlay gray-filter"></div>

<!-- Main Content -->
<main id="content" class="vignette">
<header>
<a href="#http://github.com/">GitHub</a>
| <a href="./config.html">Config</a>
</header>
<header></header>

<section id="welcome" class="glowing-text">
<h1 id="greeting"></h1>
Expand All @@ -63,7 +60,7 @@ <h3 class="fade-in">Start your Journey</h3>
<label for="search-box">
<img
class="search-logo"
src="../assets/images/google-brands-solid.svg"
src="./assets/images/google-brands-solid.svg"
alt="Google Logo"
/>
</label>
Expand All @@ -84,7 +81,7 @@ <h3 class="fade-in">Start your Journey</h3>
class="search-btn"
title="Search button"
>
<img src="../assets/images/search-icon.svg" alt="Search" />
<img src="./assets/images/search-icon.svg" alt="Search" />
</button>
</form>
</section>
Expand All @@ -97,6 +94,6 @@ <h3 class="fade-in">Start your Journey</h3>
</div>
</main>

<script type="application/javascript" src="./script-min.js"></script>
<script type="application/javascript" src="./pages/script.js"></script>
</body>
</html>
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"manifest_version": 3,
"name": "Journey",
"version": "1.0",
"version": "1.1",
"description": "Beautifully crafted minimalist chrome extension.",
"chrome_url_overrides": {
"newtab": "pages/index.html"
"newtab": "index.html"
},
"permissions": ["activeTab", "tabs", "topSites", "storage", "system"],
"content_scripts": [],
Expand Down
2 changes: 1 addition & 1 deletion pages/script-min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 17 additions & 1 deletion pages/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
if (!journey) return;

return {
header: journey.querySelector("header"),
name: journey.querySelector("#name"),
greetings: journey.querySelector("#greeting"),
clocks: journey.querySelector("#clocks"),
Expand All @@ -44,7 +45,7 @@

function registerEvents() {
onKeyPress([...__magicKeys.OPEN_CONFIG], () => {
window.location.href = "./config.html";
window.location.href = "./pages/config.html";
});
}

Expand All @@ -60,6 +61,7 @@
function setWidgets(...widgets) {
const config = JSON.parse(localStorage.getItem(lsKeys.CONFIG));
setBackgroundImage({ config, dom, lsKeys });
setHeader({ config, dom });

widgets.forEach((widget) => widget({ config, dom, lsKeys }).run());
}
Expand Down Expand Up @@ -317,4 +319,18 @@
dom().bgOverlay.style.backgroundImage = `url(${base64data})`;
};
}

function isExtensionInstalled() {
return !location.protocol.includes("http");
}

async function setHeader({ dom, config }) {
dom().header.innerHTML = `
<a href="${config.githubLink}" target="_blank">GitHub</a>
| <a href="./pages/config.html" target="_blank">Config</a>
`;
if (!isExtensionInstalled()) {
dom().header.innerHTML += ` | <a target="_blank" href="${config.installLink}">Install</a>`;
}
}
}

0 comments on commit 7a553a9

Please sign in to comment.