Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Todo List Feature #322

Merged
merged 17 commits into from
Dec 16, 2024
Merged

Conversation

Thunder-Blaze
Copy link
Contributor

@Thunder-Blaze Thunder-Blaze commented Dec 14, 2024

Description

Added a ToDo List on the right corner of the page.

  • Followed the default colorscheme.
  • The todo list has an input box to add items.
  • You can either click the plus button or press enter to add an item
  • It alerts the user to write something if the input field is empty
  • And each added item has a remove button to remove them from the list.
  • You can check the list item by clicking on it.
  • The list will automatically reset after 23:59

Related Issues

Checklist

  • I have read and followed the Contributing Guidelines.
  • The ToDo List refreshes next day automatically
  • I have done necessary testing.
  • Added a toggle for Todo List in Settings Page
New.Tab.-.Brave.2024-12-14.22-16-02.mp4
New.Tab.-.Brave.2024-12-14.23-05-07.mp4

@prem-k-r
Copy link
Collaborator

Great work, really impressive!
It would be even better if you could add a toggle to hide or show the ToDo list in the menu.

@Thunder-Blaze
Copy link
Contributor Author

Done :D
there is only one Issue, the To Do List auto closes (as it looses focus) when a item is removed from it

@prem-k-r
Copy link
Collaborator

Btw guys, on an unrelated note, I noticed that the menu icon is not perfectly centered in the screen recording.

@Thunder-Blaze
Copy link
Contributor Author

hmm, can you clarify which menu icon are we talking about

@prem-k-r
Copy link
Collaborator

prem-k-r commented Dec 14, 2024

hmm, can you clarify which menu icon are we talking about

image
No worries bro,
As I said, it's unrelated to the changes made in the PR

@prem-k-r
Copy link
Collaborator

I can only add new items in list.. unable to delete or complete it
error:

Refused to execute inline event handler because it violates the following Content Security Policy directive: "script-src 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-...'), or a nonce ('nonce-...') is required to enable inline execution. Note that hashes do not apply to event handlers, style attributes and javascript: navigations unless the 'unsafe-hashes' keyword is present.
Understand this errorAI
index.html:1337 Refused to execute inline event handler because it violates the following Content Security Policy directive: "script-src 'self' 'wasm-unsafe-eval' 'inline-speculation-rules' http://localhost:* http://127.0.0.1:*". Either the 'unsafe-inline' keyword, a hash ('sha256-...'), or a nonce ('nonce-...') is required to enable inline execution. Note that hashes do not apply to event handlers, style attributes and javascript: navigations unless the 'unsafe-hashes' keyword is present.

@prem-k-r
Copy link
Collaborator

in windows/chrome

script.js Outdated Show resolved Hide resolved
@prem-k-r
Copy link
Collaborator

There is one minor issue.. upon page reload, todo icon briefly flash in default blue color theme for a split second.
this is also for google apps 9-dot icon.
check 6fa436a , same approach can be used

Also can you please make alert translatable like other alerts

No hurry bro.. take your time

languages.js Outdated
@@ -867,6 +879,7 @@ const translations = {
"failedbackup": "ব্যাকআপ ব্যর্থ: ",
"restorecompleted": "পুনরুদ্ধার সফলভাবে সম্পন্ন হয়েছে!",
"restorefailed": "পুনরুদ্ধার ব্যর্থ: ",
"emptytodoinput": "ইউ মাস্ট রাইট সামথিং",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong translation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

¯\_(ツ)_/¯ Used google translate

image

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Odd, they transliterated it lol

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

He translation should be "তোমার কিছু লেখা উচিত"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I gave up on languages I don't know.
Someone who knows them can maybe add them later in language.js :)

languages.js Outdated
"restorefailed": "पुनर्संचयित अयशस्वी: "

"restorefailed": "पुनर्संचयित अयशस्वी: ",
"emptytodoinput":"यू मस्ट रायट समथिंग",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also wrong.
Other languages could also be incorrect.
You can leave the translations for languages you're not familiar with.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure I'll leave the translations then 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -278,6 +278,9 @@ body {
border-radius: 25%;
padding: 1px;
cursor: pointer;
}

.theme-transition .dot-icon{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

Please do same for ToDo icon

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it works for both as I reused the dot-icon class for the to do icon

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohk nice

@Thunder-Blaze
Copy link
Contributor Author

Thunder-Blaze commented Dec 14, 2024

I checked it on Chrome, Brave and Firefox (Windows), so I think it should work properly
but you can check again for cross-platform or cross-browser compatibility issues

New.Tab.-.Google.Chrome.2024-12-15.01-33-57.1.mp4

@prem-k-r
Copy link
Collaborator

prem-k-r commented Dec 14, 2024

You removed Hindi too for you must write something by mistake
Translation for toggle, and To Do list and placeholder type here.. these four are missing
Placeholder Type here... can be To-do..., Add task..., New task..., Add item..., New item..., etc.
Rest seems okay

@Thunder-Blaze
Copy link
Contributor Author

Thunder-Blaze commented Dec 14, 2024

I added the translation for toggle, and To Do list and placeholder in English and Hindi
Oh should I change the placeholder to Add task ?

@prem-k-r
Copy link
Collaborator

I added the translation for toggle, and To Do list and placeholder in English and Hindi Oh should I change the placeholder to Add task ?

Yeah, would be better, I think

@@ -27,6 +27,8 @@ const translations = {
"enable_ai_tools": "Show shortcuts for AI tools",
"googleAppsMenuText": "Google Apps",
"googleAppsMenuInfo": "Show shortcuts for Google Apps",
"todoListText": "To Do List",
"todoListInfo": "Show a Daily To Do List",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todoListHeading and todoInput missing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was no need to write the same thing twice so I did this

image

Added the todoPlaceholder in my recent commit

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my bad, didn't noticed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no problem :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like this new person is better than prem 😄

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hehe.. I always miss something when checking from mobile

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol no, I am not better
I'm still learning from other great people
Before yesterday I didn't even knew what XSS was
so you have my thanks @prem-k-r

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah we are just friends. Just making some fun. Thats all. 🙃
Don't worry.

languages.js Outdated
@@ -82,11 +84,13 @@ const translations = {
"conditionText": "Hello! How are you today?",
"enterBtn": "Search",
"searchPlaceholder": "Type here...",
"searchPlaceholder": "Type here...",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra

"listenPlaceholder": "Listening...",
"searchWithHint": "Search With",
"todoPlaceholder": "Add task...",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed wrong

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh lol, I'll fix this in a min

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done 👍

@Thunder-Blaze
Copy link
Contributor Author

btw @prem-k-r

image
to
image

I tried fixing the icon but idk if this is right or not ?
If it is right then I'll commit and push the changes

Copy link
Collaborator

@prem-k-r prem-k-r left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • When a task is marked as completed, the strikethrough data is not being saved; it reverts to a normal task after the page reloads.
  • Assigning innerText directly from user input (e.g., li.innerText = todoInput.value) is not sanitized. This can still lead to XSS
  • It would be better if clicking on to-do icon moves the cursor to the input area.
  • Since you are using "\u00d7" (×), if it is contained within a task, it breaks the task into multiple tasks. Also, users can create blank tasks with it, but their row width is shortened.

You may switch to json based approach.. it will solve 2 and 4.

@Thunder-Blaze
Copy link
Contributor Author

Thunder-Blaze commented Dec 15, 2024

New.Tab.-.Brave.2024-12-15.16-44-54.mp4

I switched to JSON and this is the current situation
I don't know much about XSS (I thought since the h1 tag is getting rendered as normal text, XSS attacks will not work)

  • Fixed the problem, now you cannot give empty spaces as input
  • Now the strikethrough remains on reload
  • Focus shifts to todo input box when clicked on Todo Icon
  • You can now use the "\u00d7" (×) without breaking the todo task into parts

image
these all are getting rendered as normal text, so I think there should be no problem

@prem-k-r
Copy link
Collaborator

we generally use something like this
function sanitizeInput(input) {
const div = document.createElement('div');
div.textContent = input;
return div.innerHTML;
}

I ask chatgpt, it gave me following code.. please check..
there are other minors changes too..
note: there might be mistakes

// ----------------------------------- To Do List ----------------------------------------

// DOM elements for managing the To-Do list
const todoContainer = document.getElementById("todoContainer");
const todoListCont = document.getElementById("todoListCont");
const todoulList = document.getElementById("todoullist");
const todoAdd = document.getElementById("todoAdd");
const todoInput = document.getElementById("todoInput");
let todoList = {}; // Object to store To-Do items

// Utility function to sanitize input
function sanitizeInput(input) {
    const div = document.createElement('div');
    div.textContent = input;
    return div.innerHTML;
}

// Add a new To-Do item on button click or "Enter" keypress
todoAdd.addEventListener("click", addtodoItem);
todoInput.addEventListener("keypress", (event) => {
    if (event.key === "Enter") {
        addtodoItem();
    }
});

function addtodoItem() {
    const inputText = todoInput.value.trim();

    // Alert user if input is empty
    if (inputText === '') {
        alert(translations[currentLanguage]?.emptytodoinput || translations['en'].emptytodoinput);
        return;
    }

    const sanitizedText = sanitizeInput(inputText); // Prevent unsafe input

    // Create a new list item with the sanitized input
    let li = document.createElement('li');
    li.textContent = sanitizedText;

    // Add a remove button to the item
    const span = document.createElement("span");
    span.setAttribute("class", "todoremovebtn");
    span.textContent = "\u00d7";

    li.appendChild(span);
    li.addEventListener("click", SetTaskCheckEvent); // Attach event listener for item actions
    li.setAttribute("class", "todolistitem");

    // Generate a unique ID for the item using the current timestamp
    const t = "t" + Date.now();
    li.setAttribute("data-todoitem", t);

    // Store the new item in the todoList object
    todoList[t] = { title: sanitizedText, status: "pending" };
    todoulList.appendChild(li);

    todoInput.value = ''; // Clear the input field
    SaveToDoData(); // Persist the updated list in localStorage
}

// Event handler for marking items as completed or removing them
var SetTaskCheckEvent = (event) => {
    if (event.target.tagName === "LI") {
        // Toggle "checked" status for the item
        event.target.classList.toggle("checked");
        const id = event.target.dataset.todoitem;
        todoList[id].status = todoList[id].status === "completed" ? "pending" : "completed";
        SaveToDoData(); // Update localStorage
    } else if (event.target.tagName === "SPAN") {
        // Remove the item from the list and delete it from the object
        const id = event.target.parentElement.dataset.todoitem;
        event.target.parentElement.remove();
        delete todoList[id];
        SaveToDoData(); // Update localStorage
    }
};

// Save the current state of the To-Do list to localStorage
function SaveToDoData() {
    try {
        localStorage.setItem("todoList", JSON.stringify(todoList));
    } catch (error) {
        console.error("Error saving to localStorage:", error); // Log storage errors
    }
}

// Load and display the To-Do list from localStorage
function ShowToDoList() {
    try {
        todoList = JSON.parse(localStorage.getItem("todoList")) || {}; // Parse stored data or initialize empty

        for (let id in todoList) {
            const todo = todoList[id];

            // Create a list item for each saved To-Do
            let li = document.createElement('li');
            li.textContent = sanitizeInput(todo.title);

            const span = document.createElement("span");
            span.setAttribute("class", "todoremovebtn");
            span.textContent = "\u00d7";

            li.appendChild(span);
            li.addEventListener("click", SetTaskCheckEvent);
            li.setAttribute("class", "todolistitem");

            // Add "checked" class if the item is completed
            if (todo.status === 'completed') {
                li.classList.add("checked");
            }

            li.setAttribute("data-todoitem", id);
            todoulList.appendChild(li);
        }
    } catch (error) {
        console.error("Error loading from localStorage:", error);
        localStorage.setItem("todoList", '{}'); // Reset corrupted data
    }
}

// Initialize the To-Do list based on the date to separate daily tasks
let todoLastUpdateDate = localStorage.getItem("todoLastUpdateDate");
let todoCurrentDate = new Date().toLocaleDateString();

if (todoLastUpdateDate === todoCurrentDate) {
    ShowToDoList(); // Load existing tasks if the date matches
} else {
    // Reset list for a new day
    localStorage.setItem("todoLastUpdateDate", todoCurrentDate);
    localStorage.setItem("todoList", '{}');
    ShowToDoList();
}

// Toggle menu and tooltip visibility
todoListCont.addEventListener("click", function (event) {
    const isMenuVisible = todoContainer.style.display === 'grid';

    // Toggle menu visibility and adjust tooltip
    todoContainer.style.display = isMenuVisible ? 'none' : 'grid';
    if (!isMenuVisible) {
        todoListCont.classList.add('menu-open');
        todoInput.focus(); // Focus input when menu opens
    } else {
        todoListCont.classList.remove('menu-open');
    }
});

// Close menu when clicking outside the To-Do list or menu button
document.addEventListener("click", function (event) {
    const isClickInside = todoContainer.contains(event.target) ||
        todoListCont.contains(event.target) ||
        event.target.classList.contains('todoremovebtn');

    if (!isClickInside && todoContainer.style.display === 'grid') {
        // Hide menu and restore tooltip
        todoContainer.style.display = 'none';
        todoListCont.classList.remove('menu-open');
    }

    event.stopPropagation(); // Prevent event bubbling
});

// ------------------------------- End of To Do List -------------------------------------

@Thunder-Blaze
Copy link
Contributor Author

Thunder-Blaze commented Dec 15, 2024

thanks, this helped me learn new js functions
but there is a problem when we are sanitizing the text
image
this becomes this
image
after reloading the page

I think as long as we are getting the data using innerText there should be no XSS vulnerabilities, I even tried the methords of XSS attacks but there were no problems without even sanitizing the input
(I added screenshots in my previous comment)

What do you suggest ?

@prem-k-r
Copy link
Collaborator

prem-k-r commented Dec 15, 2024

Actually, most likely, this will give security warnings in firefox add-on update

@prem-k-r
Copy link
Collaborator

prem-k-r commented Dec 15, 2024

but there is a problem when we are sanitizing the text image this becomes this image after reloading the page

The problem occurs because the text is sanitized twice.. once during input storage and again when rendering from localStorage
chatgpt:

// Utility function to sanitize input for DOM rendering
function sanitizeInput(input) {
    const div = document.createElement('div');
    div.textContent = input;
    return div.innerHTML;
}

function addtodoItem() {
    const inputText = todoInput.value.trim();

    if (inputText === '') {
        alert(translations[currentLanguage]?.emptytodoinput || translations['en'].emptytodoinput);
        return;
    }

    const t = "t" + Date.now(); // Unique ID
    const rawText = inputText; // Store raw text

    // Store raw text in the todoList object
    todoList[t] = { title: rawText, status: "pending" };

    // Create and append DOM element with sanitized text
    createTodoItemDOM(t, rawText, "pending");

    todoInput.value = ''; // Clear input
    SaveToDoData(); // Save changes
}

function createTodoItemDOM(id, title, status) {
    let li = document.createElement('li');
    li.innerHTML = sanitizeInput(title); // Sanitize before rendering in DOM

    const span = document.createElement("span");
    span.setAttribute("class", "todoremovebtn");
    span.textContent = "\u00d7";

    li.appendChild(span);
    li.addEventListener("click", SetTaskCheckEvent);
    li.setAttribute("class", "todolistitem");

    if (status === 'completed') {
        li.classList.add("checked");
    }

    li.setAttribute("data-todoitem", id);
    todoulList.appendChild(li);
}

function ShowToDoList() {
    try {
        todoList = JSON.parse(localStorage.getItem("todoList")) || {};

        for (let id in todoList) {
            const todo = todoList[id];
            createTodoItemDOM(id, todo.title, todo.status);
        }
    } catch (error) {
        console.error("Error loading from localStorage:", error);
        localStorage.setItem("todoList", '{}');
    }
}

@prem-k-r
Copy link
Collaborator

Also it's a good practice to add minimal comments in code (script.js) :)

@Thunder-Blaze
Copy link
Contributor Author

Done :)

I thought of doing the same but didn't as you said no use of innerHTML
Its working fine now, I used the code you provided 👍🏻

@prem-k-r
Copy link
Collaborator

Thanks.
I said no direct use..., nvm now lol

The code I gave didn't have changes from last commit of that time
33bae92
Please check this part

@Thunder-Blaze
Copy link
Contributor Author

ah, I didn't knew what way was direct and what was indirect so don't mind me

and no need to worry about that
image
this line 357 will automatically deal with the problem when there is nothing set in local storage

@prem-k-r
Copy link
Collaborator

Ok perfect..

@prem-k-r
Copy link
Collaborator

This is last suggestion lol.
Current code is funtionality and security-wise perfect

Optimized version.. slightly reduces CPU and memory usage
This minimizes reflows for larger lists.

// ----------------------------------- To Do List ----------------------------------------

// DOM Variables
const todoContainer = document.getElementById("todoContainer");
const todoListCont = document.getElementById("todoListCont");
const todoulList = document.getElementById("todoullist");
const todoAdd = document.getElementById("todoAdd");
const todoInput = document.getElementById("todoInput");
let todoList = {}; // Initialize todoList JSON

// Add event listeners for Add button click or Enter key press
todoAdd.addEventListener("click", addtodoItem);
todoInput.addEventListener("keypress", (event) => {
    if (event.key === "Enter") {
        addtodoItem();
    }
});

// Utility function to sanitize input
function sanitizeInput(input) {
    const div = document.createElement('div');
    div.textContent = input;
    return div.innerHTML;
}

// Function to add items to the TODO list
function addtodoItem() {
    const inputText = todoInput.value.trim(); // Remove useless whitespaces
    if (inputText === '') {
        alert(translations[currentLanguage]?.emptytodoinput || translations['en'].emptytodoinput);
        return; // Return the function when the input is empty
    }
    const t = "t" + Date.now(); // Generate a Unique ID
    const rawText = inputText;
    todoList[t] = { title: rawText, status: "pending" }; // Add data to the JSON variable

    const li = createTodoItemDOM(t, rawText, "pending"); // Create List item
    todoulList.appendChild(li); // Append the new item to the DOM immediately

    todoInput.value = ''; // Clear Input
    SaveToDoData(); // Save changes
}

function createTodoItemDOM(id, title, status) {
    let li = document.createElement('li');
    li.innerHTML = sanitizeInput(title); // Sanitize before rendering in DOM
    const span = document.createElement("span"); // Create the Cross Icon
    span.setAttribute("class", "todoremovebtn");
    span.textContent = "\u00d7";
    li.appendChild(span); // Add the cross icon to the LI tag
    li.setAttribute("class", "todolistitem");
    if (status === 'completed') {
        li.classList.add("checked");
    }
    li.setAttribute("data-todoitem", id); // Set a data attribute to the li so that we can uniquely identify which li has been modified or deleted
    return li; // Return the created `li` element
}

// Event delegation for task check and remove
todoulList.addEventListener("click", (event) => {
    if (event.target.tagName === "LI") {
        event.target.classList.toggle("checked"); // Check the clicked LI tag
        let id = event.target.dataset.todoitem;
        todoList[id].status = ((todoList[id].status === "completed") ? "pending" : "completed"); // Update status
        SaveToDoData(); // Save Changes
    } else if (event.target.tagName === "SPAN") {
        let id = event.target.parentElement.dataset.todoitem;
        event.target.parentElement.remove(); // Remove the clicked LI tag
        delete todoList[id]; // Remove the deleted List item data
        SaveToDoData(); // Save Changes
    }
});

// Save JSON to local Storage
function SaveToDoData() {
    localStorage.setItem("todoList", JSON.stringify(todoList));
}

// Fetch saved JSON and create list items using it
function ShowToDoList() {
    try {
        todoList = JSON.parse(localStorage.getItem("todoList")) || {}; // Parse stored data or initialize empty
        const fragment = document.createDocumentFragment(); // Create a DocumentFragment
        for (let id in todoList) {
            const todo = todoList[id];
            const li = createTodoItemDOM(id, todo.title, todo.status); // Create `li` elements
            fragment.appendChild(li); // Add `li` to the fragment
        }
        todoulList.appendChild(fragment); // Append all `li` to the `ul` at once
    } catch (error) {
        console.error("Error loading from localStorage:", error);
        localStorage.setItem("todoList", '{}'); // Reset corrupted data
    }
}

// Code to reset the List on the Next Day
let todoLastUpdateDate = localStorage.getItem("todoLastUpdateDate"); // Get the date of last update
let todoCurrentDate = new Date().toLocaleDateString(); // Get current date
if (todoLastUpdateDate === todoCurrentDate) {
    ShowToDoList();
} else {
    // Reset the list when last update date and the current date does not match
    localStorage.setItem("todoLastUpdateDate", todoCurrentDate);
    localStorage.setItem("todoList", '{}');
    ShowToDoList();
}

// Toggle menu and tooltip visibility
todoListCont.addEventListener("click", function (event) {
    const isMenuVisible = todoContainer.style.display === 'grid';

    // Toggle menu visibility
    todoContainer.style.display = isMenuVisible ? 'none' : 'grid';

    // Add or remove the class to hide the tooltip
    if (!isMenuVisible) {
        todoListCont.classList.add('menu-open'); // Hide tooltip
        todoInput.focus();
    } else {
        todoListCont.classList.remove('menu-open'); // Restore tooltip
    }
});

// Close menu when clicking outside
document.addEventListener("click", function (event) {
    const isClickInside =
        todoContainer.contains(event.target) || todoListCont.contains(event.target) || event.target.classList.contains('todoremovebtn');

    if (!isClickInside && todoContainer.style.display === 'grid') {
        todoContainer.style.display = 'none'; // Hide menu
        todoListCont.classList.remove('menu-open'); // Restore tooltip
    }

    event.stopPropagation();
});

// ------------------------------- End of To Do List -------------------------------------

@prem-k-r
Copy link
Collaborator

@XengShi good to go, i think
You can review and merge it

Copy link
Collaborator

@itz-rj-here itz-rj-here left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The codes look fine to me :)
Later i will check on my computer.

@XengShi
Copy link
Owner

XengShi commented Dec 16, 2024

Great work, but you can remove this :
image

Just do nothing when clicking on "+" button if there is empty string

@Thunder-Blaze
Copy link
Contributor Author

thanks :)
Done 👍🏻

@XengShi XengShi merged commit dce23b9 into XengShi:main Dec 16, 2024
@prem-k-r
Copy link
Collaborator

An issue realised only now
image

when a long string is entered without space.. we get a bottom scrollbar

@Thunder-Blaze
Copy link
Contributor Author

Wait, I'll try to fix that
It shouldn't be much hard

@Thunder-Blaze
Copy link
Contributor Author

Thunder-Blaze commented Dec 16, 2024

And done, should I make a seperate PR for that as this one is closed ?

@prem-k-r
Copy link
Collaborator

Yeah

XengShi added a commit that referenced this pull request Dec 27, 2024
* Fixed the Centering of menu icon (#324)

* Fixed the Menu Icon

* Added Fix for Dark Mode

* Fixed slight white Outline in MenuIcon

* Fixed slight white Outline in MenuIcon

* Fixed Circle Width of Menu Icon

* Added solid bg behind userText, date & shortcut names

* Added Todo List Feature (#322)

* Added Todo List Feature

* Added a To Do List Toggle in Settings

* Fixed the To Do List loosing focus issue

* Fixed the Errors in Todo List

* Removed the Use of innerHTML to prevent XSS vulnerabilities

* Fixed the Blink Issue and Made the Alert Translatable and Added some Translations

* Removed todo Translations

* Made a few changes to Todo List translations

* Changed Todo Input Placeholder

* Fixed Silly Mistakes

* Switched to JSON Based Approach for To Do List

* Fixed Issue when todoList was not in Local Storage

* Sanitized User Input and Reduced redundancy in Todo code

* Added Comments

* Optimised Todo functions for Reduced Resource Usage

* Removed Alert for when no input is given to ToDo Input Box

* Firefox Reset Setting button width (#287)

* Update style.css

center align date

* Update script.js

shortcuts name text shadow

* Update style.css

fix firefox resetbtn width

* Update script.js

clearbutton color for dark theme

* Update style.css

restrict

* Update style.css

revert center

* Update script.js

replaced innnerhtml

* Update script.js

pasto

* Update script.js

reverted to avoid conflicts

* Update languages.js

Marathi numerals

* Update script.js

revert

* Update languages.js

revert

* Minor changes (#310)

* Update style.css

removed color palette hover text

* Update languages.js

removed page reload hint

* Update index.html

corrected size and icon of meta ai

* Update style.css

readjusted spacings

* Update style.css

+1

* Update languages.js

hindi translation update

* Update languages.js

* Update README.md

added french

* Update languages.js

meta ai trans

* Update style.css

* Update style.css

* Update style.css

savebtn click effect

* Update script.js

hover effect for upload and random wp

* Update languages.js

* Update script.js

* Update feedback.html

GITHUB LINK UPDATE

* Update github-shortcut.svg

opacity changed

* Update script.js

moved try, and cordinate fetching instead of city name from ipinfo

* Update README.md

fix conflicts

* Update script.js

removed shadow for dark mode

* Update script.js

solid bg

* Update style.css

revert from css

* Update script.js (#325)

innerhtml mutable

* Fixed the Todo Item Overflow (#326)

* Enhancement related to To-Do list (#330)

* Update style.css

limit scrollbar

* Update index.html

svg cleanup and scaling

* Update style.css

cleanup

* Update style.css

more cleanup

* Update style.css

+ symbol

* Update script.js

for dark

* Update style.css

cross color

* Update script.js

for dark

* Update languages.js

* Update languages.js

bn

* Update script.js

fix conflicts

* Fixed Search Suggestion for Chromium browsers (#345)

* Update manifest.json

added host permissions

* Update script.js

https

* Update languages.js

* Added ID translation for alert and to-do list (and sync translation for restore) (#340)

* Adding translation for ToDo List (#335)

* Adding translation for ToDo List

* Adding the translation for the rest strings

* l10n: Update Czech translation (#338)

* l10n: Add Czech translation of To Do list

* l10n: Add Czech translation of pick color button

* l10n: Add Czech translation for messages from dialog boxes

* Fixed the Flash Issue during Reload (#336)

* Added Color Changing Loading Screen

* Replaced Loading Image with Optimised one

* Removed Async from the Script Tag

* Added Preload.js

* Feature: Added Pinning Functionality to ToDo List (#337)

* Added Pinning Functionality to ToDo List

* Renamed Todo Span and Fixed Minor Indentation Issues

* Update script.js

darktheme removebtn hover

* Update style.css

minor adjustments

* Update style.css

* Update style.css

* Update style.css

font size 17 to 16

* Updated Todo SVGs

* Added No deletion of Pending Tasks and Resetting of Pinned Completed tasks

---------

Co-authored-by: Prem Kumar <60751338+prem-k-r@users.noreply.github.com>

* add Azerbaijani language (#348)

* add Azerbaijani language

* update README.md

* Azerbaijan language updated

* Azerbaijan language updated

* Azerbaijan language missing words added

* Azerbaijan language fixing problems

* Azerbaijan language last edit

* Azerbaijan language last edit

* Update pt-br translations (#341)

* Update pt-br translations

- Updated translations in pt-br

* Portuguese 100% updated

added "todoListHeading" because the logic that was there did not work to get the same text from "todoListText"

Portuguese is also fully implemented according to the latest update.

* Storing Images as Blobs Instead of Base64 (#351)

* Update script.js

base64 to blobs

* Update languages.js

delete removed alert

* Update languages.js

delete duplicate and unnecessary

* Update languages.js

* Introducing New Bookmark System for the Extention (#349)

* Introducing New Bookmark System for the Extention

* Reverted BG

* Error fixes...

* Mirror Changes

Fixed Icon issue on taking permission and fixed gapps right arrow being placed over.

* Enhanced Bookmarks UI

* Updated Bookmarks Bar

* Fixed Bookmarks Scrollbar

* Minor Fixes

* Used icons which doesn't have padding

Co-Authored-By: Prem Kumar <60751338+prem-k-r@users.noreply.github.com>

* Added Mobile Bookmarks

* Changed the Searchbar id

* Changed the space formats

* Removed all useless comments and added brave navigator

* Added comment back again and added navigator.brave.isBrave too

* Added z-index on rotating of the arrow key

* Maintained some space on the code

* Added Bookmarks Toggle

* Added All Folders View and Default Folders for Each Browser

* Update style.css

minor style update

* Update script.js

some functionalities

* Update script.js

* Update script.js

Ctrl+Click to Open in a New Tab

* Delete favicon/icon.png

* Add files via upload

* Delete favicon/icon.png

* Add files via upload

* Bangla translation for bookmark added

* Firefox icon fixed

* Update manifest(firefox).json

* Update script.js

* Added Grid View

* Update script.js

* Revert "Feature/bookmark enhancements"

* Update index.html

* Update languages.js

* Fixed gapps arrow got placed over

* Update script.js

* Update script.js

* Update style.css

* Update manifest.json

* Update manifest.json

removed bg.js

* Fixed Errors and Added Toggle

* Update script.js

fix delete in firefox

* Fixed Conflicts

* Fixed Unfolding Issue

* Update script.js

fix conflicts

* Update index.html

* Fixed Bookmark Search Issues

* Made Favicon Bigger and Replaced search icon url with SVG

* Made Bookmarks load only when arrow is clicked or right arrow key is pressed

* Fixed Issues

* Attempt to Fix All Issues

* API not defined error fixed

* Corrected Language in Bangla

* Fixed Arrow Error

* Fixed Bookmark Dark Mode and Added Support for Bookmark Translation

* Added Requested Changes

* Made the Arrow Smaller

* Update script.js

* Update style.css

* Delete svgs/bookmarksSearch.svg

* Add files via upload

* Update style.css

* Update languages.js

---------

Co-authored-by: ThunderBlaze <darkthunderstormshiva@gmail.com>
Co-authored-by: Prem Kumar <60751338+prem-k-r@users.noreply.github.com>
Co-authored-by: Shivansh <68265106+Thunder-Blaze@users.noreply.github.com>

* Added stylish rounded corner

* Style corners

* Bookmark strings translation (for hi and bn) (#361)

* Update index.html

* Update languages.js

* WeatherAPI api key update for main branch (#347)

* Update manifest.json

* Update script.js

api keys

* Update manifest(firefox).json

* Language organization (#357)

* Update pt-br translations

- Updated translations in pt-br

* Portuguese 100% updated

added "todoListHeading" because the logic that was there did not work to get the same text from "todoListText"

Portuguese is also fully implemented according to the latest update.

* Language organization

Fixed duplications in the code.
Languages ​​separated into their own files.

* Update pt.js

No necessary

* Refactor translation logic for improved maintainability

This commit refactors the translation logic to make it more concise and maintainable.

Key changes include:
- Replaced the `translationMap` array with a simpler array of strings representing the element IDs.
- Introduced a `placeholderMap` array for handling placeholder translations with custom keys.
- Created a new `applyTranslations` function to encapsulate the translation logic, reducing code duplication and increasing readability.
- Unified the logic for applying translations to placeholders and innerText into the new function.
- Improved the overall structure of the `applyLanguage` function, making it more straightforward and easier to understand.

These changes enhance code clarity, reduce redundancy, and facilitate future modifications related to internationalization.

* Updated language files

Updated according to merge conflicts;
New String translated into  Portuguese-BR;

#Tested.

* improved translation logic

Fixed keys with different keys;
Fixed Chinese variables (cn -> ch); (Tested)
Page updates language without reloading the entire page again; (Working but Google Translate tries to translate from the previous language (possible to see in the console));

* Conflicts fixed

* Add language key analysis tool

Introduces a language analysis tool in the `tools` directory.
This tool identifies complete and incomplete translations, displaying missing keys for incomplete languages.
Access is manual via the `tools` directory.

* Delete .DS_Store

* Delete teste

* Update languages.js

* Update en.js

* Update pt.js

* Update en.js

* Update script.js

removed proxy alert

* Update script.js

typo

* Update zh.js

* Update hi.js

* update 24/12/2024

updated language helper tool to show remaining strings;
page updated to correctly translate weather;
Languages ​​updated from ChengShi repository.

* Update cs.js

* Update it.js

* Update tr.js

* Update bn.js

* Update vi.js

* Update ru.js

* Update ru.js

paste error

* Update bn.js

paste error

* Update bn.js

* Update uz.js

* Update es.js

* Update ja.js

* Update ko.js

* Update idn.js

* Update idn.js

* Update mr.js

* Update fr.js

* Update az.js

* Update background.js

---------

Co-authored-by: Prem Kumar <60751338+prem-k-r@users.noreply.github.com>

* Update manifest(firefox).json (#373)

* Changed Bookmark Icon (#378)

* Changed Bookmark Icon

* Fixed Dark Mode Bookmark Icon

* Made Bookmark Tooltip Translatable

* Updating Bookmarks strings using fr.js in locales folder (#376)

* Added ID translation for bookmarks and invalid backup file message (#380)

* Fix color in firefox 2 (#371)

* Fix colour glithes

* returned isFireFox

* Request changes applied.

* Alert to consloe error.

* Request changes applied.

* Added Slovenian translations (#379)

* l10n: Update Czech translation (#367)

* l10n: Add Czech translation for bookmarks

* l10n: Add Czech translation of invalid backup file

* refactor: Reformat Czech translation file

* Fix/bookmark icon (#382)

* Changed Bookmark Icon

* Fixed Dark Mode Bookmark Icon

* Made Bookmark Tooltip Translatable

* Made Bookmark Icon move only when Google Apps is Enabled

* Fixed Some Things

* Reduced Redundancy in Language Page (#381)

* Requested Changes

* Updated Manifest

* Restored Manifest

* Version 3 to 3.0

---------

Co-authored-by: XengShi <48722764+XengShi@users.noreply.github.com>
Co-authored-by: Prem Kumar <60751338+prem-k-r@users.noreply.github.com>
Co-authored-by: Ayyas-RF <berrzert9@gmail.com>
Co-authored-by: 422.io <iamwinner422@gmail.com>
Co-authored-by: Michal Šmahel <48548230+ceskyDJ@users.noreply.github.com>
Co-authored-by: Hasan Bakhtiar <52384595+hasanbakhtiar@users.noreply.github.com>
Co-authored-by: Maycon Vitor Correa <105678497+MestreWalla@users.noreply.github.com>
Co-authored-by: It'z RJ <86042583+itz-rj-here@users.noreply.github.com>
Co-authored-by: giwi <107575390+giwih@users.noreply.github.com>
Co-authored-by: Aleks Marinič <37543086+Linux-Alex@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add To Do List
4 participants