Skip to content

Commit

Permalink
NotePlus version 4.0 is here!
Browse files Browse the repository at this point in the history
  • Loading branch information
BlazeInferno64 authored Oct 9, 2024
1 parent 91277f3 commit d093e9d
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 4 deletions.
22 changes: 22 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<!-- Copyright (c) 2024 BlazeInferno64 -> https://github.com/blazeinferno64 -->

<!DOCTYPE html>
<html lang="en">
<head>
Expand Down Expand Up @@ -33,6 +35,16 @@
</p>
<div class="action-list up hide">
<ul>
<li id="new-win" title="Creates a new Untitled NotePlus window as a seperate tab">
<span>
<p>
<i class="fa-regular fa-pen-to-square"></i> New Tab
</p>
<p>
Ctrl + Alt + P
</p>
</span>
</li>
<li id="new-doc" title="Creates a new Untitled NotePlus Document">
<span>
<p>
Expand Down Expand Up @@ -73,6 +85,16 @@
</p>
</span>
</li>
<li id="cl-tab" title="Closes the current active NotePlus Tab">
<span>
<p>
<i class="fa-solid fa-arrow-right-from-bracket"></i> Close Tab
</p>
<p>
Ctrl + Alt + F
</p>
</span>
</li>
<li id="ex" title="Exits the file tab">
<span>
<p>
Expand Down
3 changes: 3 additions & 0 deletions public/css/styles.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/*
Copyright (c) BlazeInferno64 --> https://github.com/blazeInferno64
*/
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@200;300;400;500;600;700&display=swap');
:root{
--ff: "Poppins", sans-serif
Expand Down
70 changes: 66 additions & 4 deletions public/js/script.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* Copyright (c) 2024 BlazeInferno64 --> https://github.com/blazeinferno64
*/
const textInput = document.querySelector(".text");

const browserName = document.querySelector("#browser");
Expand Down Expand Up @@ -26,6 +29,8 @@ const saveAsBtn = document.querySelector("#sv-as");
const saveBtn = document.querySelector("#sv");
const exitBtn = document.querySelector("#ex");
const newDocumentBtn = document.querySelector("#new-doc");
const newTabBtn = document.querySelector("#new-win");
const closeTabBtn = document.querySelector("#cl-tab");

const selectAllBtn = document.querySelector("#sel-all");
const copyAllBtn = document.querySelector("#copy-all");
Expand Down Expand Up @@ -109,14 +114,41 @@ const detectBrowser = () => {
}
if (userAgent.includes("Insomnia")) {
return "Insomnia";
}
}
if (userAgent.indexOf("Code") !== -1 && userAgent.indexOf("VS") !== -1) {
return "VSCode";
}
// Fallback for unknown browsers
return "Unknown";
};

const detectOS = () => {
const userAgent = navigator.userAgent;

//Check for windows
if (userAgent.indexOf("Windows NT") !== -1) {
return "Windows";
}
//Check for macOS
if (userAgent.indexOf("Mac OS X") !== -1) {
return "MacOS";
}
//Check for linux
if (userAgent.indexOf("Linux") !== -1) {
return "Linux";
}
//Check for android
if (userAgent.indexOf("Android") !== -1) {
return "Android";
}
//Check for iOS
if (userAgent.indexOf("iPhone") !== -1) {
return "iOS";
}
// If none of the above match then return 'Unknown'
return "Unknown";
}

// Function to set browser icon based on browser name
const setBrowserIcon = (name) => {
const classes = ["fa-edge", "fa-opera", "fa-brave", "fa-safari", "fa-firefox", "fa-chrome", "fa-triangle-exclamation", "fa-code", "fa-user-secret"];
Expand Down Expand Up @@ -337,6 +369,14 @@ helpBtn.addEventListener("click", (e) => {
}, 100);
})

// Event listener for close tab btn
closeTabBtn.addEventListener("click", async(e) => {
alert(`Current active tab of NotePlus has been successfully closed!`);
setTimeout(() => {
return window.close();
}, 300);
})

// Event listener to close action, edit, and help lists when clicking outside
document.addEventListener("click", (e) => {
if (!e.target.classList.contains("fl") &&
Expand Down Expand Up @@ -581,18 +621,30 @@ reportIssuesBtn.addEventListener("click", async (e) => {
// Any further changes to NotePlus in future will be updated here
const about = {
Name: "NotePlus",
Version: '3.9',
Version: '4.0',
Developer: "BlazeInferno64",
Platform: detectBrowser()
Platform: detectBrowser(),
OS: detectOS()
}

// Event listener for versionInfoBtn click
versionInfoBtn.addEventListener("click", (e) => {
alert(`Name: ${about.Name}\nVersion: ${about.Version}\nDeveloper: ${about.Developer}\nPlatform: ${about.Platform}`);
alert(`Name: ${about.Name}\nVersion: ${about.Version}\nDeveloper: ${about.Developer}\nPlatform: ${about.Platform}\nOS: ${about.OS}`);
})

versionP.innerText = about.Version;

// Event listener for newTabBtn click
newTabBtn.addEventListener("click", (e) => {
const aTag = document.createElement("a");
aTag.href = "";
aTag.target = "_blank";
aTag.click();
aTag.remove();
console.log(`Successfully created a new `)
return alert(`New Untitled NotePlus window has been created!`);
})

// Event listener for copyAllBtn click
copyAllBtn.addEventListener("click", async () => {
if (!navigator.clipboard) {
Expand Down Expand Up @@ -770,6 +822,16 @@ document.addEventListener("keyup", (e) => {
isCtrlPressed = false;
return isAltKeyPressed = false;
}
if (e.key === "p" && isCtrlPressed && isAltKeyPressed) {
newTabBtn.click();
isCtrlPressed = false;
return isAltKeyPressed = false;
}
if (e.key === "f" && isCtrlPressed && isAltKeyPressed) {
closeTabBtn.click();
isCtrlPressed = false;
return isAltKeyPressed = false;
}
})

// Event listener for beforeunload to prompt user with unsaved changes
Expand Down
3 changes: 3 additions & 0 deletions public/js/search.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* Copyright (c) 2024 BlazeInferno64 --> https://github.com/blazeinferno64
*/
const searchWordInput = document.querySelector(".srch");
const replaceWordInput = document.querySelector(".rep");

Expand Down
3 changes: 3 additions & 0 deletions public/js/themes.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* Copyright (c) 2024 BlazeInferno64 --> https://github.com/blazeinferno64
*/
const app = document.querySelector(".app");
const appHead = document.querySelector(".app-head");
const appOptions = document.querySelector(".app-options");
Expand Down

0 comments on commit d093e9d

Please sign in to comment.