Naphthalene Possum Management
Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

the-book-of-hermes

0.0.60 • Public • Published

The Book Of Hermes

Lightweight Javascript DOM manipulation library

The Hermetic documentation can be veiwed below. Anyone is welcome to fork and extend this library, or if you have any feature requests just submit an issue!


To add this sacred book to your library simply clone this REPO or you can use Bower (recommended) or NPM (also recommended):



bower install the-book-of-hermes


npm install the-book-of-hermes


DOM selector


h('#myID'); //gets selector


For Loop


Hermes.ouroboros(myArray, function(cb){

console.log(cb);

});


Event listener


Hermes can listen to any type of Event - "mouseover", "click", "mouseout", "mousemove"


h('.selector').listen(eventName, function(e){console.log(e)})


GET Call


Hermes.theft(url, function(data){

console.log(data);

});


POST JSON Data


Hermes.give = function(url, data, cb) {

console.log(cb)

}


Effects


This will fade your element in, just pass in your element as a paramater.


Basic DOM manipulation:



Hide your element


h('.selector').conceal();


Show your element


h('.selector').reveal();


Show & Hide your element


h('.selector').switch();


Remove element from DOM


h('.selector').vanquish();


Add multiple child elements to DOM


var html = [{

 "node": "div",

 "class": "row-Dyad",

"text": "I'm a child node"

}, {

 "node": "div",

"class": "col-Dyad tetrad-four",

"text": "I'm a child node of a child node"

}]

h('.selector').multiply(html);


Add a class to your element


h('.selector').addClass('class2add');



Read the text of your element


h('.selector').readText();



Erase the text of your element


h('.selector').eraseText();



Add an element with a class


h('.selector').add(elementType, elementClass);


Inject HTML to DOM


h('.selector').manifestAll('< div >Hermetic Dyanmic Element< /div >')

Check if your element has a particular class


h('.selector').hasClass('classNameToTest');


Get CSS value of element, won't return inline styles


h('.selector').setCSS('inlineCSSstring');


Hermes has access to cookies


Set a Cookie


Hermes.stealCookie(cookieName, cookieValue, daysTillExp);


Get a Cookie


Hermes.getCookieJar(cookieName);


Check for a Cookie


Hermes.checkCookieJar(checkForCookie);


Delete a cookie


Hermes.eatCookie(cookieToDelete);


Hermes also has access to Local Storage



Set Local Storage


Hermes.meetsYourBrowser(name, value);


Get Local Storage


Hermes.remembersYou(localstorageKeyName);


Delete Local Storage Key


Hermes.forgotYou(localStorageName);

Install

npm i the-book-of-hermes

DownloadsWeekly Downloads

56

Version

0.0.60

License

MIT

Last publish

Collaborators

  • avatar