Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* <!--KQute--> */
- var d, db, h, $, $$;
- d = document;
- db = document.body;
- h = document.getElementsByTagName('head')[0];
- $ = function(s, p){
- if(!p || p == null){
- p = db;
- }
- return p.querySelector(s);
- }
- $$ = function(s, p){
- if(!p || p == null){
- p = db;
- }
- return p.querySelectorAll(s);
- }
- $.getVal = function(k, v){
- if(typeof(Storage) !=="undefined"){
- if(!v || v == null){
- return localStorage.k || 'undefined';
- }else{
- return localStorage.k || v;
- }
- }else{
- return 'storage unavailable';
- }
- }
- $.setVal = function(k, v){
- if(typeof(Storage) !=="undefined"){
- if(!v || v == null){
- return 'undefined';
- }else{
- localStorage.k = v;
- return false;
- }
- }else{
- return 'storage unavailable';
- }
- }
- $.delVal = function(k){
- localStorage.removeItem(k);
- return false;
- }
- $.htm = function(s, v){
- if(!v || v == null){
- return s.innerHTML;
- }else{
- s.innerHTML = v;
- }
- return false;
- }
- $$.htm = function(s, v, n){
- if(!v || v == null){
- return s.innerHTML;
- }else{
- if(!n || n == null){
- for (var i = 0; i < s.length; i++) {
- s[i].innerHTML = v;
- }
- }else{
- s[n].innerHTML = v;
- }
- }
- return s;
- }
- $.val = function(s, v){
- if(!v || v == null){
- return s.value;
- }else{
- s.value = v;
- }
- return s;
- }
- $.att = function(s, a, v){
- if(!v || v == null){
- return s.getAttribute(a);
- }else{
- s.setAttribute(a, v);
- return s;
- }
- }
- $$.att = function(s, a, v, n){
- if(!v || v == null){
- if(!n && n != 0 || n == null && n != 0){
- var x = [];
- for (var i = 0; i < $$(s).length; i++) {
- x.push(s[i].getAttribute(a));
- }
- return x;
- }else{
- return s[n].getAttribute(a);
- }
- }else{
- if(!n || n == null){
- for (var i = 0; i < $$(s).length; i++) {
- s[i].setAttribute(a, v);
- }
- }else{
- s[n].setAttribute(a, v);
- }
- return s;
- }
- }
- $.elm = function(t, a, s){
- var e = d.createElement(t);
- if(a){
- for (key in a){
- e.setAttribute(key, a[key]);
- }
- }
- if(s){
- s.appendChild(e);
- }
- return e;
- }
- $.css = function(s) {
- var e = d.createElement('style');
- e.type = 'text/css';
- if (e.styleSheet){
- e.styleSheet.cssText = s;
- } else {
- e.appendChild(d.createTextNode(s));
- }
- h.appendChild(e);
- return e;
- }
- /* <!--/KQute--> */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement