Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: nsht/tab_notes
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: semanticdata/notekeeper
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Able to merge. These branches can be automatically merged.
Loading
44 changes: 44 additions & 0 deletions .github/workflows/deploy-demo-site.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Deploy demo site to GitHub Pages

on:
workflow_dispatch:
# push: {branches: ["main"]}

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Copy src to demo
run: |
test -d demo && rm -rf demo/* || mkdir demo
cp -rf src/newtab.html demo/index.html
cp -rf src/styles.css demo/styles.css
test -d demo/icons && cp -r src/icons/* demo/icons || (mkdir demo/icons && cp -r src/icons/* demo/icons)
test -d demo/js && cp -r src/js/* demo/js || (mkdir demo/js && cp -r src/js/* demo/js)
- name: Setup Pages
uses: actions/configure-pages@v5

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: "demo"

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
43 changes: 43 additions & 0 deletions .github/workflows/web-ext-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Release new version

on:
push:
tags:
- 'v*.*.*'
# release:
# types: [published]

jobs:
build-release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Build
id: web-ext-build
uses: kewisch/action-web-ext@v1
with:
cmd: build
filename: '{name}-{version}.xpi'
ignoreFiles: '[ "package.json", "package-lock.json", "yarn.lock", ".github", ".gitattributes", "LICENSE", "README.md"]'

- name: Sign
id: web-ext-sign
uses: kewisch/action-web-ext@v1
with:
cmd: sign
channel: listed
source: ${{ steps.web-ext-build.outputs.target }}
apiKey: ${{ secrets.FIREFOX_JWT_ISSUER }}
apiSecret: ${{ secrets.FIREFOX_JWT_SECRET }}
timeout: 900000

- name: Release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: ${{ steps.web-ext-sign.outputs.target }}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Miguel Pimentel

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<h1><img src="./src/icons/icon32.png" height="28px" width="28px" /> NoteKeeper</h1>

![Mozilla Add-on](https://img.shields.io/amo/v/newtab-notes@semanticdata) ![Add-on rating](https://img.shields.io/amo/rating/newtab-notes@semanticdata) ![Add-on downloads](https://img.shields.io/amo/dw/newtab-notes@semanticdata) ![Add-on users](https://img.shields.io/amo/users/newtab-notes@semanticdata) ![License](https://img.shields.io/github/license/semanticdata/firefox-new-tab-notes)

NoteKeeper is a Firefox extension that transforms the new tab into a minimalist, auto-saving text editor. It now comes with a new sidebar companion! If you are curious, go check out the [demo](https://semanticdata.github.io/notekeeper/).

<a href="https://addons.mozilla.org/en-US/firefox/addon/notekeeper/">
<img src="https://raw.githubusercontent.com/semanticdata/text-revealer-firefox-extension/master/firefox.png" alt="firefox addon" /></a>

## ✨ Features

- ✅ Auto-saves content after every keystroke
- ✅ Integrated with Firefox Sync - access your notes across browser instances
- ✅ Integrated with [Web Storage API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API)
- ✅ Works offline with browser sync support ([Firefox Sync](https://www.mozilla.org/en-US/firefox/features/sync/), [Chrome Sync](https://support.google.com/chrome/answer/185277))
- ✅ Dark/Light themes with system preference detection
- ✅ Responsive design that works across devices
- ✅ Sidebar companion for quick access
- ✅ Comprehensive test coverage

## 🖼️ Screenshots

| ![light-mode](./screenshot.png) | ![dark-mode](./screenshot-dark.png) |
| :---: | :---: |

## 💜 Acknowledgments

This extension is based on [Tab Notes](https://github.com/nsht/tab_notes). It hadn't received updates in over 4 years when originally forked.

## © License

Source code in this repository is available under the [MIT License](./LICENSE).
Binary file removed icon48.png
Binary file not shown.
59 changes: 40 additions & 19 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,34 +1,55 @@
{
"manifest_version": 2,
"name": "Tab Notes",
"name": "NoteKeeper",
"version": "1.3.0",
"description": "NoteKeeper transforms your new tab into a minimalist, auto-saving text editor.",
"author": "semanticdata",
"browser_specific_settings": {
"gecko": {
"id": "tab-notes@ryux",
"strict_min_version": "60.0"
"id": "newtab-notes@semanticdata",
"strict_min_version": "100.0"
}
},
"version": "0.1.2",
"author": "Nishit",
"permissions": [
"storage"
],
"icons": {
"48": "icon48.png"
"48": "src/icons/icon48.png",
"96": "src/icons/icon96.png"
},
"browser_action": {
"default_title": "NoteKeeper",
"default_icon": {
"48": "src/icons/icon48.png",
"96": "src/icons/icon96.png"
}
},
"sidebar_action": {
"default_icon": {
"48": "src/icons/icon48.png",
"96": "src/icons/icon96.png"
},
"default_title": "NoteKeeper",
"default_panel": "src/sidebar/panel.html"
},
"description": "Allows you to take notes in the new tab page",
"permissions": ["storage"],
"chrome_url_overrides": {
"newtab": "newtab.html"
"newtab": "src/newtab.html"
},

"browser_action": {
"browser_style": true,
"default_title": "Tab notes",
"default_popup": "newtab.html"
"background": {
"scripts": [
"src/js/background.js"
]
},
"options_ui": {
"page": "src/options/options.html",
"browser_style": true
},

"commands": {
"_execute_browser_action": {
"_execute_sidebar_action": {
"suggested_key": {
"default": "Ctrl+Y"
}
"default": "Alt+Shift+N"
},
"description": "Toggle NoteKeeper in the sidebar."
}
}
}
}
34 changes: 0 additions & 34 deletions newtab.html

This file was deleted.

Binary file added screenshot-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/icons/icon32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/icons/icon48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/icons/icon96.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions src/js/background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Constant for sidebar toggle command name
const sidebarToggle = "_execute_sidebar_action";

// Update UI and set value of textbox
async function updateUI() {
let commands = await browser.commands.getAll();
for (command of commands) {
if (command.name === sidebarToggle) {
document.querySelector("#shortcut").value = command.shortcut;
}
}
}

// Toggles Sidebar with new Action Button
function openSidebar() {
browser.sidebarAction.toggle();
}

// Listen for clicks on the browser action (toolbar icon)
browser.browserAction.onClicked.addListener(openSidebar);

// Initialize UI when DOM is ready
document.addEventListener("DOMContentLoaded", updateUI);
25 changes: 17 additions & 8 deletions tabnotes.js → src/js/tabnotes.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
var timeoutId;
const notes = document.getElementById("notes");
// Add event listener for keyup to save notes automatically
document.addEventListener("keyup", logKey);

// Determine browser type and set appropriate browser object
const browser_type = getBrowser();
if (browser_type === "Chrome") {
var browser_obj = chrome;
let browser_obj;
if (typeof browser !== "undefined") {
browser_obj = browser;
} else {
var browser_obj = browser;
browser_obj = chrome; // Fallback to chrome for Chrome, Edge and other browsers
}

// Listen for tab and window focus changes
browser_obj.tabs.onActivated.addListener(tabOpen);
browser_obj.windows.onFocusChanged.addListener(tabOpen);

// Debounce the save operation to prevent too frequent storage updates
function logKey(e) {
clearTimeout(timeoutId);
timeoutId = setTimeout(function() {
timeoutId = setTimeout(function () {
saveToDB();
}, 10);
}

// Detect browser type for compatibility
function getBrowser() {
if (typeof chrome !== "undefined") {
if (typeof browser !== "undefined") {
@@ -31,33 +37,36 @@ function getBrowser() {
}
}

// Save notes to browser's sync storage
function saveToDB() {
data = {
tab_note: document.querySelector("#notes").value
tab_note: document.querySelector("#notes").value,
};
if (browser_type === "Chrome") {
chrome.storage.sync.set(data, function() {});
chrome.storage.sync.set(data, function () { });
} else {
browser_obj.storage.sync.set(data);
}
}

// Load notes when tab changes or window focuses
function tabOpen(tab) {
if (browser_type === "Chrome") {
chrome.storage.sync.get(["tab_note"], function(result) {
chrome.storage.sync.get(["tab_note"], function (result) {
if (typeof result.tab_note !== "undefined") {
document.querySelector("#notes").value = result.tab_note;
}
});
} else {
browser_obj.storage.sync.get(["tab_note"]).then(result => {
browser_obj.storage.sync.get(["tab_note"]).then((result) => {
if (typeof result.tab_note !== "undefined") {
document.querySelector("#notes").value = result.tab_note;
}
});
}
}

// Initialize notes when page loads
window.addEventListener("load", () => {
tabOpen();
});
13 changes: 13 additions & 0 deletions src/js/theme-init.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
(function () {
const localStorageTheme = localStorage.getItem("theme");
const systemSettingDark = window.matchMedia("(prefers-color-scheme: dark)").matches;

let theme = "light";
if (localStorageTheme) {
theme = localStorageTheme;
} else if (systemSettingDark) {
theme = "dark";
}

document.documentElement.setAttribute("data-theme", theme);
})();
Loading