Skip to content

Commit

Permalink
Add tips buttons to settings & index pages
Browse files Browse the repository at this point in the history
  • Loading branch information
aiden2480 committed Jun 28, 2022
1 parent 91e04f8 commit 04e4d48
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
15 changes: 11 additions & 4 deletions css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ header h1 {
}

/* Install button */
#installbutton {
#installbutton, #tipsbutton {
position: fixed;
right: 10px;
top: 10px;
top: 66px;

min-width: fit-content;
font-size: 2.75vh;
Expand All @@ -44,11 +44,11 @@ header h1 {
transition: opacity 300ms ease-in-out 500ms, color 300ms ease-in-out;
}

#installbutton:hover {
:is(#installbutton, #tipsbutton):hover {
color: #36393e;
}

#installbutton img {
:is(#installbutton, #tipsbutton) img {
vertical-align: middle;
margin-right: 0.25vw;
}
Expand All @@ -58,6 +58,13 @@ header h1 {
cursor: pointer;
}

#tipsbutton {
top: 10px;
height: 46px;
opacity: 1;
cursor: pointer;
}

div#itemdescription {
text-align: center;
display: block;
Expand Down
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ <h1>KanjiThing</h1>

<!-- Button to install KanjiThing on the chrome store -->
<button id="installbutton"><img src="https://www.google.com/images/icons/product/chrome_web_store-32.png" draggable="false" />Install</button>
<button id="tipsbutton"><img src="https://icons.iconarchive.com/icons/dtafalonso/ios8/32/Tips-icon.png" draggable="false" />Tips page</button>

<!-- Badges -->
<div id="githubbadges" style="text-align: center">
Expand Down
4 changes: 4 additions & 0 deletions js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ chrome.extension || document.getElementById("installbutton").addEventListener("c
window.open("https://chrome.google.com/webstore/detail/kanjithing/nccfelhkfpbnefflolffkclhenplhiab/");
});

document.getElementById("tipsbutton").addEventListener("click", () => {
window.open("/tips.html");
});

// Helper function to transform date to human readable time
function howLongAgo(datestamp) {
var delta = (new Date() - new Date(datestamp)) / 1000;
Expand Down
4 changes: 4 additions & 0 deletions js/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ async function generateSettingsPage() {
// Ensure default settings are available
await ensureDefaultConfiguration();

document.getElementById("tipsbutton").addEventListener("click", () => {
window.open("/tips.html");
});

generateKanjiSets();
generateMisc();
}
Expand Down
3 changes: 3 additions & 0 deletions settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
<h1>KanjiThing</h1>
</header>

<!-- Tips page -->
<button id="tipsbutton"><img src="https://icons.iconarchive.com/icons/dtafalonso/ios8/32/Tips-icon.png" draggable="false" />Tips page</button>

<!-- Config panel for the custom sets -->
<h2>Kanji sets</h2>
<div id="setscontainer">
Expand Down

0 comments on commit 04e4d48

Please sign in to comment.