prateek3255 / scrroll-in

An extension to save the scroll position of a webpage
https://chrome.google.com/webstore/detail/scrroll-in/cjgjbjogfodppempgdlppgefojbcmjom?hl=en&gl=IN
MIT License
66 stars 99 forks source link
chrome-extension hacktoberfest javascript

Scrroll In


[![All Contributors](https://img.shields.io/badge/all_contributors-11-orange.svg?style=flat-square)](#contributors) Never forget where you left a page.

Scrroll In - An extension to save scroll position of any webpage | Product Hunt Embed Scrroll In - An extension to save scroll position of any webpage | Product Hunt Embed

> Contribute to this project during hacktoberfest and get exclusive limited edition Devfolio schwag if your pull requests gets merged. [Read more](https://devfolio.co/blog/hacktoberfest-2019-devfolio/) ## Motivation πŸ’‘ You must have been in a situation wherein you are reading a long article, but you don't have enough time to finish it, so you close the tab, and the next time you open the article again, you have no idea where you left it. So this extension lets you save the scroll position of the webpage, so you can continue from exactly where you left. I know there are a few extensions that already serve this purpose, but most of them either didn't work correctly or lacked the features that I needed, so I ended up creating my own. ## How it works? πŸ€” Under the hood, this extension uses the [chrome localStorage API](https://developer.mozilla.org/en/DOM/Storage#localStorage) to store the scroll positions for different webpages. I avoided using sync storage due to its storage limitations ([read more](https://developer.chrome.com/apps/storage)). This extension creates an object which stores the URL as keys and the scroll position as values. The functions for adding or updating, reading and deleting are in the files `save.js`, `get.js`, `update.js` and `delete.js` respectively, which are executed as content scripts from popup whenever the respective button is clicked. The `background.js` handles switching icon color whenever a tab is changed, or the URL is updated. The popup sheet is a Svelte app in the `popup` folder that controls the UI and the behaviour of the extension popup. ## Features πŸš€ - You can **save** the scroll position of the page and then revisit the page at any time to continue where you left. - The extension also allows you to save **multiple scrolls** for the page. - You can **fetch** the last saved scroll. - If you dont want a scroll you can **delete** it. - Extension allows you to see all the saved scrolls arranged in the newly first order where you can **delete** any specific scroll or **clear all** the scrolls at once. - You can use **update** the scroll which will update the last saved scroll with the current one. - You can add customizable keyboard shortcuts to **save**, **fetch** or **delete** scrolls without having to open the extension popup. - The extension **auto fetches** the last saved scroll position on page load, if page has any saved scroll. ## Development πŸ’» The JavaScript files in the extension are compiled using [rollup](https://rollupjs.org), and as of now the extension popup is written with Svelte which is also compiled via rollup. To run the extension locally follow these steps: - Run `yarn` or `npm install` to install the dependencies. - Then run `yarn dev` or `npm run dev` to build the extension in watch mode, you'll see a build folder created with all the necessary files for the extension to run. - Visit `chrome://extensions` and turn on developer mode. - Click on `Load unpacked` at the top left and select the `build` folder that was created with the `dev` command. - Now you can go ahead and modify the js files and the Svelte app, the dev command would automatically build the updated files accordingly. You would be able to view the changes in the extension directly. - If you change something in `background.js` you'll need to reload the extension for the changes to appear. For other files like `manifest.json` you would need to restart the dev server as well so that a fresh copy can be created. ## Contributing 🌏 All you need to know for contributing to this project is basic **JavaScript**, **HTML**, and **CSS**. You can visit the issues page to find some relevant issues to contribute to or feel free to open a new issue for something that you think can be improved. Also, if you have any doubts regarding any of the concepts or how to get started, feel free to drop me a message on [Twitter](https://twitter.com/psuranas) or the [Devfolio community Telegram group](https://t.me/devfolio). ## License [![NPM](https://img.shields.io/github/license/devfolioco/scrroll-in)](https://github.com/devfolioco/scrroll-in/blob/master/LICENSE) ## Contributors ✨ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):

Prateek Surana

πŸ’» 🎨 πŸ–‹ πŸ“–

Layla Hedges

πŸ’»

shikharsaxena98

πŸ’»

Aditya Ketkar

🎨

DEBSUBHRA ROY

🎨

Aashis kumar

πŸ’»

Rohit Kaushal

πŸ’» 🎨

Aditya Agarwal

πŸ’»

Mitch Moore

πŸ’»

Anuj Singh

πŸ’»

Gabe

πŸ’»

alucard17

πŸ’»

Sharvari Raut

πŸ“–

Samiran Konwar

πŸ’»

Parshwa52

πŸ’»

Biswajeet Sahoo

πŸ”§
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind are welcome!