CDN for production:-
<script src="https://rawcdn.githack.com/rao123dk/Rao.js/49a0ee053b07522d1ca875c7748e003ac724bc8f/rao.js"> </script>
CDN for development :-
<script src="https://raw.githack.com/rao123dk/Rao.js/master/rao.js"> </script>
Code:-
r.browser();
Example:-
console.log(r.browser());
Output :- Chrome 62(Broweser Name, Version)
Code:-
r.deviceType();
Example:-
console.log(r.deviceType());
Output :- Desktop
Outputs :- Desktop/Mobile/iPad/iPod
Code:-
r.ES6()
r.ES7()
r.ES8()
Example:-
console.log(r.ES6());
console.log(r.ES7());
console.log(r.ES8());
Output :- true/false
Code:-
r.reload();
Example:-
r.reload();
Output :- Reloads the current page from the cache.
Code:-
r.hardReload();
Example:-
r.hardReload();
Output :- Reloads the current page from the server.
Code:-
r.duplicate(Array_name);
Example:-
const array = ["a", "f", "e", "w", "r", "e", "o", "j", "j","w"];
console.log(r.duplicate(array));
Output :- ["e", "w", "j"]
Code:-
r.duplicate(arrayName);
Example:-
var array = ["a", "f", "e", "w", "r", "e", "o", "j", "j","w"];
console.log(r.removeDuplicate(array));
Output :- ["a", "f", "e", "w", "r", "o", "j"]
Code:-
r.isArray(value);
Example:-
var value = [1,2,3];
console.log(r.isArray(value));
Output :- true
Code:-
r.cleanArray(value);
Example:-
var value = [1, false, "", undefined, 2, null, NaN,5];
console.log(r.cleanArray(value));
Output :- [1,2,5]
Code:-
r.removeFromArray(array, item); // Remove first found item from array
r.removeFromArrayAll(array, item); // Remove all target item in array
Example:-
var numarray = [3,55,66,55,234,61,99,100,55,055];
var strarray = ['dheeraj',"rao", "kumar", "rao","Rao"];
console.log(r.removeFromArray(numarray,3));
Output :- [55,66,55,234,61,99,100,55,055];
console.log(r.removeFromArray(strarray,"rao"));
Output :- ['dheeraj',"kumar", "rao","Rao"];
var numarray = [3,55,66,55,234,61,99,100,55,055];
var strarray = ['dheeraj',"rao", "kumar", "rao","Rao"];
console.log(r.removeFromArrayAll(numarray,55));
Output :- [3, 66, 234, 61, 99, 100, 45]
console.log(r.removeFromArrayAll(strarray,"rao"));
Output :- ["dheeraj", "kumar", "Rao"]
Code:-
r.insertIntoArray(Array_name, indexAt, Item);
Example:-
var numarray = [3,55,66,55,234,61,99,100,55,055];
r.insertIntoArray(numarray, 4, "Rao.js");
console.log(numarray);
Output :- [3,55,66,55,"Rao.js",234,61,99,100,55,055];
Code:-
r.deepCopyArray(arrayName);
Example:-
var numarray = [3,55,66,55,234,61,99,100,55,055];
var newArray = r.deepCopyArray(numarray);
numarray.push("Hello");
console.log(newArray);
Output :- [3,55,66,55,234,61,99,100,55,055];
Code:-
r.isObject(value);
Example:-
var value = {};
console.log(r.isObject(value));
Output :- true
var value = "hello";
console.log(r.isObject(value));
Output :- false
Code:-
r.mergeObject(object1, object2);
Example:-
var object1 = { "a" : 10, "c" : 22, d : { "k" : "hello"} };
var object2 = { "q" : 10 };
console.log(r.mergeObject(object1, object2););
Output :- {a: 10, c: 22, d: {k: "hello"}, q: 10}
Code:-
r.isJSON(value);
Example:-
console.log(r.isJSON('{"name" : "dheerraj", "Age" : 22}'););
Output:- true
console.log(r.isJSON('{"name" : "dheerraj", Age : 22}'););
Output:- false
Code:-
r.showWatch('#showwatchid',"h","m","s",hour12=true/false);
Example:-
console.log(r.showWatch('#showwatchid',"h","m","s",hour12=true));
Output:- 1:8:58 PM
console.log(r.showWatch('#showwatchid',"h","m","s",hour12=false));
Output:- 13:8:58
console.log(r.showWatch('#showwatchid',"h","m",hour12=true));
Output:- 1:08 PM
Code:-
r.countDown(01,01,2018)
Example:-
console.log(r.countDown(01,01,2018)); // Format will be DD/MM/YYYY
Output :- {total: 896620000, days: 10, hours: 9, minutes: 3, seconds: 40}
Code:-
r.dayDiff("Start_date","end_date")); // Format will be DD/MM/YYYY
r.dayDiffSatSun("Start_date","end_date"));
r.dayDiffHoliday("Start_date","end_date",array_of_list));
Example:-
- Get difference between two date {General}
r.dayDiff("Start_date","end_date")); // Format will be DD/MM/YYYY
console.log(r.dayDiff("21/12/2017","30/12/2017"));
Output :- 9
- Get difference between two date{ escape Saturday and Sunday i.e. count only working days}
r.dayDiffSatSun("Start_date","end_date")); // Format will be DD/MM/YYYY
console.log(r.dayDiffSatSun("21/12/2017","30/12/2017"));
Output :- 7
- Get difference between two date{ escape Saturday, Sunday and holiday festival also}
console.log("Coming soon.....");
Code:-
r.randomString(length_of_string)
Example:-
console.log(r.randomString(8));
Output :- g485edgn
Code:-
r.upper(str,"1");
r.upper(str,"1++");
r.upper(str,">1");
Example:-
var str = "thanks for using Rao.js";
(A) console.log(r.upper(str,"1"));
Output:- Thanks for using Rao.js
(B) console.log(r.upper(str,"1++"));
Output:- Thanks For Using Rao.js
(C) console.log(r.upper(str,">1"));
Output:- Thanks For Using Rao.js
Preserve the case of the original word when you are replacing it. For example if you mean to replace the word "Book" with the word "pen", it should be replaced as "Pen". Code:-
r.rao_replace(str, to, with)
Example:-
let org_str = "This is my Book.",
console.log(r.rao_replace(org_str, "Book", "pen"));
Output :- This is my Pen.
Code:-
r.isString(value);
Example:-
var value = "Thanks for using Rao.js";
console.log(r.isString(value));
Output :- true
Code:-
rao("#id");
Example:-
<input type ="text" id="f_name" value="Dheeraj">
var exp = rao("#f_name");
console.log(exp.val());
Output :- Dheeraj
Code:-
rao(".class");
Example:-
<input type ="text" class="name" value="Dheeraj">
<input type ="text" class="name" value="rao">
var exp = rao(".name");
console.log(exp[0].val());
Output :- Dheeraj
Code:-
rao("input[type='text']");
Example:-
<input type ="text" class="name" value="Rao">
var exp = rao("input[type='text']");
console.log(exp[0].val());
Output :- Rao
Code:-
var ht = rao('#htm');
ht.html();
ht.html('<p>Thanks for using Rao.js</p>');
Example:-
<div id="htm"> </div>
var ht = rao('#htm');
ht.html("<p>Thanks for using Rao.js</p>"); //Set
Output :- <div id="htm"> <p>Thanks for using Rao.js</p> </div>
ht.html(); //Get
Output :- <p>Thanks for using Rao.js</p>
Code:-
var tx = rao('#txt');
tx.text();
tx.text('Thanks for using Rao.js');
Example:-
<p id="txt"> </p>
var tx = rao('#htm');
tx.text("Thanks for using Rao.js"); //Set
Output :- <p id="htm">Thanks for using Rao.js</p>
tx.text(); //Get
Output :- Thanks for using Rao.js
Code:-
rao('#id').append("<div>Hello append</div>");
rao('#id').prepend("<div>Hello prepend</div>");
Example:-
<div class="parent">
<div id="id"> Hello</div>
</div>
rao('#id').append("<div>Hello append</div>");
Output :-
<div class="parent">
<div id="id"> Hello</div>
<div>Hello append</div>
</div>
rao('#id').prepend("<div>Hello prepend</div>");
Output :-
<div class="parent">
<div>Hello prepend</div>
<div id="id"> Hello</div>
</div>
Code:-
rao('#id').mychild();
Example:-
<div id="todolist">
<p>Item 1</p>
<p>Item 2</p>
<p>Item 3</p>
<p>Item 3</p>
</div>
rao('#todolist').mychild();
Output :-
<p>Item 1</p>
<p>Item 2</p>
<p>Item 3</p>
<p>Item 3</p>
Code:-
rao('#id').on('click', function(){
//code here....
});
rao('#id').off('click');
Example:-
rao('#id').on('click', function(){
alert("Thanks For using Rao.js");
});
rao('#id').off('click');
Set own attribute
rao('#sr').attri("attribue","value");
Ex:-
rao('#sr').attri("custom_id","12CU100");
output :-
<span id="sr" custom_id ="12CU100"> </span>
Get attribue
rao('#sr').attri("nameofattribue")
Ex:-
console.log(rao('#sr').attri("class"));
Output:-
It will return classname of element which is is 'sr'
Hide
rao('#id').out();
show
rao('#id').in();
toggle
rao('#id').inOut();
console.log(rao("#id").Data("customAttribute"));
ex:-
<span id="myid" data-myperonalId="177466"></span>
console.log(rao("#myid").Data("myperonalId"));
This method is helpful for those who manually update copyright year on webiste
rao("#copyrightYear").currentYear();
rao("#id").addClass("newclass");
rao("#id").removeClass("alreadyThere");
// r.random(first_digit, last_digit)
console.log(r.random(10, 111));
Output :- 29 or different
console.log("Thanks!");
📧📧 @ -> [email protected]