Skip to content

Instantly share code, notes, and snippets.

@eyy
Created September 15, 2013 15:41
Show Gist options
  • Select an option

  • Save eyy/6571857 to your computer and use it in GitHub Desktop.

Select an option

Save eyy/6571857 to your computer and use it in GitHub Desktop.
hash.js
(function() {
'use strict';
window.hash = {
add: function(p) {
if (-1 == window.location.hash.indexOf(p))
window.location.hash += p + ',';
},
remove: function(p) {
window.location.hash = window.location.hash.replace(p + ',', '');
},
has: function(p) {
return !p ? false : window.location.hash.indexOf(p + ',') !== -1;
}
};
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment