xJS – Javascript Library

xJS – Javascript Library

 

How to Use

<script src="xjs.js"></script>
<script src="xjs.min.js"></script>

ou

<script src="https://raw.githubusercontent.com/x0uter/xJS/master/xjs.js"></script>
<script src="https://raw.githubusercontent.com/x0uter/xJS/master/xjs.min.js"></script>

 

Examples

 

Attr

<a id="url">github<a>

x('url').attr('href', 'https://www.github.com')

CSS

x('test').css('color', 'red');
x('div').css('color', 'blue');

 

CSS as Object

const {
    'color': 'blue',
    'text-align': 'center'
}
                        
x('test').css(decor);

 

JSON GET

x().jsonGet('https://jsonplaceholder.typicode.com/todos/1').then(x('test').add)
x('test').jsonGet('https://jsonplaceholder.typicode.com/todos/1');

JSON POST

x().jsonPost('URI', {'id': 1, 'xjs': 'nice'})

SUM

<h1 id="val1">4</h1>
<h1 id="val2">4</h1>
<h1 id="val3">5</h1>
<h1 id="val4">2</h1>
<h1 id="val5">1</h1>
<div>4<div>

<h1 id="res">Result: </h1>
x('res').sum(['val1', 'val2', 'val3', 'val4', 'val5', 'div'])
<h1 id="res">Result: 20</h1>