npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

hashedit

v2.1.0

Published

A visual editor for websites.

Downloads

71

Readme

Hashedit (or #edit)

What if you could append #edit to the end of a URL to edit it?

Hashedit aims to make that notion a reality. It is a framework agnostic WYSIWYG editor for static web sites. Hashedit supports inline rich text editing; the creation and destruction of HTML blocks (and elements); editing of links and images; and drag-and-drop reordering powered by the fantastic Sortable Library. Hashedit is built in plain JS with just the Sortable and Dropzone dependency.

Using Hashedit

1. Install Hashedit
bower install hashedit
2. Add a reference to the CSS/JS
<link type="text/css" href="/bower_components/hashedit/dist/hashedit-min.css" rel="stylesheet">
<script src="/bower_components/hashedit/dist/hashedit-min.js"></script>
3. Add the following JS snippet before any other script

This script looks for the #edit in the URL and then writes the annotated (e.g. HTML modified with data-ref attributes) HTML from localStorage to the browser.

<!-- #edit -->
<script>function write(){html=localStorage.getItem(key),document.body.innerHTML=html}if(-1!=window.location.href.indexOf("#edit")){var key=window.location.href;null!=localStorage.getItem(key)&&write()}window.onhashchange=function(){-1!=window.location.href.indexOf("#edit")&&location.reload()};</script>
4. Specify which elements are editable

You specify which elements are editable using the hashedit attribute. You must also specify a hashedit-selector attribute so the app knows which HTML to replace when the save button is clicked.

<div id="editable-div" hashedit hashedit-selector="#editable-div">
5. Setup Hashedit

The JS looks for the #edit in the URL and then calls setup on the hashedit singleton. You must specify a path to the library and an array of selectors to make sortable.

<script>
	
  // setup hashedit
  hashedit.setup({
    path: '/node_modules/hashedit/',
    stylesheet: ['/node_modules/hashedit/dist/hashedit-min.css'],
    sortable: ['.column']  
  });

</script>

Building Hashedit

1. Install dependencies (via Bower)
bower install Sortable
bower install dropzone
bower install fetch
2. Install gulp tools
npm install --global gulp
npm install --save-dev gulp
npm install --save-dev gulp-concat
npm install --save-dev gulp-minify-css
npm install --save-dev gulp-rename
npm install --save-dev gulp-minify
3. Run Gulp
gulp

Acknowledgements

Sorting by Sortable

http://rubaxa.github.io/Sortable/

File uploads by Dropzone

http://www.dropzonejs.com/

Fetch Polyfill

https://github.com/github/fetch

Polymer Iron Iconset

https://elements.polymer-project.org/elements/iron-icons?view=demo:demo/index.html