This content originally appeared on DEV Community and was authored by volcareso
volcareso.js
A multi talented Javascript library
IMPORT:
<script src="https://volcareso.github.io/volcareso.js/volcareso.js"></script>
THATS IT! THE POWER IN YOUR HANDS NOW!
SELECTION:
$$('selected element').action();
// selected element means => .by_class | #by_id | by_tageName
DEMO:
$$('body').hide();
ADD AN EVENT LISTENER:
$$('element').on('eventName', function(){
alert('i have ears!');
})
APPEND OR PREPEND STUFF:
APPEND:
$$('element').append('appendedText');
PREPEND:
$$('element').prepend('prependedText')
ATTRIBUTES:
$$('element').attr('class')
// returns body (or the class specified)
$$('element').attr('class', 'foo_bar')
// sets properties to values
CHANGING CSS:
$$('element').css(propertie, value)
EX:
$$('element').css('text-align', 'center')
AJAX:
LOAD REMOTE FILE CONTENT:
$$("element").ajax("https://url-to-file.com/TXT.txt", "get")
// sets the innerHTML value to the remote file value (changed the text)
COOKIES:
SET COOKIE:
$$().setCookie("username", "hashtag", "session", "/"); //key, value, expires, path
GET COOKIES:
$$().getCookie("username");
//returns "hashtag"
ADD ELEMENT:
$$('elementToAppendTo').addElm('p', 'idAssigned')
// element added
ACCESS USING:
$$('#idAssigned').action();
LOCAL STORAGE:
$$().storage(action, key, value)
// action list:
// "clear" clears the local storage
// "get". Gets the iten with specified key
// "set" set the key with the respective value
// "remove" remove the item with the specified key
TOOGLE HIDE AND SHOW:
$$(".element").toogle();
READ MESSAGES AND TEXT IN ELEMENTS:
$$().read("message");
OR READ THE TEXT INSIDE AN ELEMENT
$$('body').read();
NOTE: THE ELEMENT SHOULDNT HAVE SOME HTML CODE ELSE THAT WOULS BE ALSO READ!
DATA COLLECTION (BASIC):
$$().data
.lang //en_US
.userAgent //Mozilla/5.0 (Linux; Android 6.0.1; Moto G (4)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Mobile Safari/537.36"
.os //linux x86_64
.cookies // true
.vender //Google.inc
.online // true id online
.version //5.0
.mobileType //4g
.doNotTrack //true is turned on
$$().data //returns all data in a json format
FINGERPRINTING (KIND OF):
$$().fingerprint(key); //sets the fingetprint on the user machine
$$().checkFingerprint(key); // trturns true id the fingerprints are matched (else false)
//example
if ($$().checkFingerprint('user1')) {
console.log('not a new user');
}else{
console.log('new user');
}
$$().fingerprint('user1');
REUSABLE COMPONENTS:
MAKE A COMPONENT:
$$().recycle('custom-element', '<p>an element </p>')
NOW WHEN YOU DECLARE <custom-element></custom-element>
IT WILL POPULATE WITH THE HTML MARKUP GIVEN IN THE SECOND SECTION
THIS WAY, YOU CAN REUSE THIS CODE FROM A SINGLE FILE
I know the name is quite egoistic but i couldnt think of any other, name it what you want.
:)
Other links: github
This content originally appeared on DEV Community and was authored by volcareso
volcareso | Sciencx (2021-09-07T09:10:23+00:00) volcareso.js- A multi talented Javascript library. Retrieved from https://www.scien.cx/2021/09/07/volcareso-js-a-multi-talented-javascript-library/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.