Skip to content

Commit

Permalink
update: better language
Browse files Browse the repository at this point in the history
- Add click event to the logo in actions.js
- Update documentation in docs.html
  • Loading branch information
Lord-Turmoil committed Oct 4, 2024
1 parent 89837f8 commit 32ac49a
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 26 deletions.
4 changes: 4 additions & 0 deletions src/css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ body {
margin: 0 5px;
}

#logo {
cursor: pointer;
}

/* marquee */
.banner {
margin: 5px 0;
Expand Down
14 changes: 13 additions & 1 deletion src/js/events/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ function registerActions() {
makeRandomPaste(null);
});

$("#logo").on("click", () => {
promptNotification();
});

registerSupport();
}

Expand Down Expand Up @@ -93,4 +97,12 @@ function makeRandomPaste(lang) {
toggleHelp();
}

export { registerActions, makeRandomPaste };
function promptNotification() {
const agreement = $("#notification");
if (agreement.children().length === 1) {
const html = agreement.html();
alertify.alert("Notification ๐Ÿ””", html);
}
}

export { registerActions, makeRandomPaste, promptNotification };
20 changes: 7 additions & 13 deletions src/js/state.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import $ from "~/vendor/jquery-extensions";
import { makeRandomPaste } from "~/events/actions";
import { makeRandomPaste, promptNotification } from "~/events/actions";
import { setMode, updateLineNumber } from "~/events/options";
import alertify from "~/vendor/alertify-extension";
import { getCookie, setCookie } from "./vendor/cookie-extension";
import { setTheme } from "~/vendor/prism-extension";

Expand All @@ -10,7 +8,7 @@ function restoreUserPreferences() {
restoreLanguage();
restoreLineNumber();
restoreTheme();
promptAgreement();
restoreNotification();
}

function restoreLanguage() {
Expand Down Expand Up @@ -48,18 +46,14 @@ function restoreTheme() {
}
}

function promptAgreement() {
const agreement = $("#agreement");
const cookie = getCookie("agreement");
function restoreNotification() {
const cookie = getCookie("notification");
if (cookie !== "") {
return;
}
setCookie("agreement", "agreed", 24 * 7); // one week

if (agreement.children().length === 1) {
const html = agreement.html();
alertify.alert("Notification ๐Ÿ””", html);
}
setCookie("notification", "notified", 24 * 7); // one week

promptNotification();
}

export { restoreUserPreferences };
2 changes: 1 addition & 1 deletion src/views/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<div id="support" style="display: none;">
<module href="/components/support.html"></module>
</div>
<div id="agreement" style="display: none;">
<div id="notification" style="display: none;">
<module href="/components/notification.html"></module>
</div>
</div>
Expand Down
25 changes: 15 additions & 10 deletions src/views/parts/docs.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,22 @@ <h1>Why Code Paste?</h1>
<div class="doc-section">
<div class="doc-entry">
<div class="doc-text doc-align-justify">
<p class="doc-indent">If you want to add code snippets to your Office document like Word or
PowerPoint, you'll probably find it hard to preserve the original format, especially the
highlight.๐Ÿ˜ขWhat's more, the common dark theme of the IDE is not suitable for
presentation. Although you can convert code into image, but the background and size...๐Ÿ˜–
<p class="doc-indent">
Adding code snippets to Office documents like Word or PowerPoint often disrupts the original
formatting, especially the syntax highlighting. ๐Ÿ˜ข Furthermore, the typical dark theme of most
IDEs doesn't work well for presentations. While converting code to images is an option, it often
suffers from non-transparent background, and apparently not as crystal clear as text. ๐Ÿ˜–
</p>
<p class="doc-indent">
So, is there a better way to include highlighted code snippets in these documents? ๐Ÿค”
<b>Absolutely!</b> That's where Code Paste comes in. ๐Ÿ˜† Simply paste your code into the left
panel, choose your preferred language, and with a single click, you'll have a beautifully
highlighted code snippet ready to go.
</p>
<p class="doc-indent">
You may wonder, why "Code Paste"? ๐Ÿ˜• Well, as you may know, "paste" can be both a verb and a
noun. ๐Ÿ˜
</p>
<p class="doc-indent">So is there any way to create highlighted code snippets for these
documents?๐Ÿค”The answer is - <b>YES</b>! And this is why Code Paste is here to
help.๐Ÿ˜†Just copy and paste your code to the left panel, and select the desired language,
you will then get a well highlighted code snippet with one more click.</p>
<p class="doc-indent">You may wonder, why "Code Paste"?๐Ÿ˜•Well, as you know, "paste" can
be both a verb and a noun.๐Ÿ˜</p>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/views/parts/header.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="header animate__animated animate__fadeInDown">
<span>Code</span>
<span><img src="res/logo.png" alt="Stir"></span>
<span id="logo"><img src="res/logo.png" alt="Stir"></span>
<span>Paste</span>
</div>

0 comments on commit 32ac49a

Please sign in to comment.