GithubHelp home page GithubHelp logo

philg-dev / tm_settings_template Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 22 KB

Tampermonkey template for persistent settings

License: MIT License

CSS 3.48% JavaScript 96.52%
example-project javascript persistence tampermonkey tampermonkey-script template userscript userstyle

tm_settings_template's Introduction

Tampermonkey template for persistent settings

This is a little template project for anybody who is interested in having persistent settings for their Tampermonkey scripts.

It's made as an example project and stores values to the local storage of Tampermonkey using the GM.setValue and GM.getValue functionality. It also comes with a very basic GUI to change and save those settings. The settings are loaded when the script runs after page load. If no settings have been saved, it will use hard-coded default values.

Usage

In order to properly use the example project, you will need either the Tampermonkey or the Greasemonkey browser extension. If you want to have the CSS separate from the Javascript, you might also want the Stylus browser extension.

  • ./src/settings_template_standalone.user.js
    • can be used with Tampermonkey and contains everything you need
    • when using this file, you don't need any of the other files
    • for more details what the files do read below
  • ./src/settings_template.user.css
    • can be imported in the Stylus extension
    • includes basic styles for a modular settings dialog and a fixed position for the cog wheel icon
  • ./src/settings_template.user.js
    • can be used with Tampermonkey
    • includes a well documented example for a basic infrastructure to save and load values from Tampermonkey's local storage
    • creates and adds the necessary DOM elements to display the settings
    • adds event handlers to interact with the settings panel
  • both will be applied on google.com for test / demonstration purposes
    • a magenta colored cog wheel icon will appear in the top left of google.com
    • the settings panel will resize to it's content
    • the modular dialog can be quit by clicking the background outside or the 'cancel' button

tm_settings_template's People

Contributors

philg-dev avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.