var GLOBAL = {};
GLOBAL.namespace = function(str) {
  var arr = str.split("."), o = GLOBAL,i;
  for (i = (arr[0] = "GLOBAL") "Dom");

GLOBAL.Dom.getNextNode = function (node) {
  node = typeof node == "string" "string" "string" "*";
  var els = root.getElementsByTagName(tag), arr = [];
  for (var i = 0, n = els.length; i < n; i++) {
    for (var j = 0, k = els[i].className.split(" "), l = k.length; j < l; j++) {
      if (k[j] == str) {
        arr.push(els[i]);
        break;
      }
    }
  }
  return arr;
}
GLOBAL.namespace("Event");
GLOBAL.Event.stopPropagation = function(e) {
  e = window.event || e;
  if (document.all) {
    e.cancelBubble = true;
  } else {
    e.stopPropagation();
  }
};
GLOBAL.Event.getEventTarget = function(e) {
  e = window.event || e;
  return e.srcElement || e.target;
};

GLOBAL.Event.on = function(node, eventType, handler) {
  node = typeof node == "string" "on" + eventType, handler);
  } else {
    node.addEventListener(eventType, handler, false);
  }
};

//Lang相关
GLOBAL.namespace("Lang");
GLOBAL.Lang.trim = function(ostr) {
  return ostr.replace(/^\s+|\s+$/g, "");
};

GLOBAL.Lang.isNumber = function(s) {
  return !isNaN(s);
};

function isString(s) {
  return typeof s === "string";
}



function isBoolean(s) {
  return typeof s === "boolean";
}

function isFunction(s) {
  return typeof s === "function";
}

function isNull(s) {
  return s === null;
}

function isUndefined(s) {
  return typeof s === "undefined";
}

function isEmpty(s) {
  return /^\s*$/.test(s);
}

function isArray(s) {
  return s instanceof Array;
}

GLOBAL.Dom.get = function (node) {
  node = typeof node === "string" "string" "Cookie");
GLOBAL.Cookie = {
  read: function (name) {
    var cookieStr = ";" + document.cookie + ";";
    var index = cookieStr.indexOf(";" + name + "=");
    if (index != -1) {
      var s = cookieStr.substring(index + name.length + 3, cookieStr.length);
      return unescape(s.substring(0, s.indexOf(";")));
    } else {
      return null;
    }
  },
  set: function (name, value, expires) {
    var expDays = expires * 24 * 60 * 60 * 1000;
    var expDate = new Date();
    expDate.setTime(expDate.getTime() + expDays);
    var expString = expires ";expires=" + expDate.toGMTString() : "";
    var pathString = ";path=/";
    document.cookie = name + "=" + escape(value) + expString + pathString;
  },
  del: function (name, value, expires) {
    var exp = new Date(new Date().getTime() - 1);
    var s = this.read(name);
    if (s != null) {
      document.cookie = name + "=" + s + ";expires=" + exp.toGMTString() + ";path=/";
    }
  }
};

标签:
global.js,源码

免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
狼山资源网 Copyright www.pvsay.com

评论“本人自用的global.js库源码分享”

暂无“本人自用的global.js库源码分享”评论...

P70系列延期,华为新旗舰将在下月发布

3月20日消息,近期博主@数码闲聊站 透露,原定三月份发布的华为新旗舰P70系列延期发布,预计4月份上市。

而博主@定焦数码 爆料,华为的P70系列在定位上已经超过了Mate60,成为了重要的旗舰系列之一。它肩负着重返影像领域顶尖的使命。那么这次P70会带来哪些令人惊艳的创新呢?

根据目前爆料的消息来看,华为P70系列将推出三个版本,其中P70和P70 Pro采用了三角形的摄像头模组设计,而P70 Art则采用了与上一代P60 Art相似的不规则形状设计。这样的外观是否好看见仁见智,但辨识度绝对拉满。