- 浏览: 1745005 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (641)
- vb2005xu自己动手系列 (174)
- vb2005xu开发文章转摘 (47)
- vb2005xu发发牢骚 (99)
- vb2005xu新技术灌水 (12)
- vb2005xu网络资源集锦 (21)
- vb2005xu软件学习 (60)
- 英语学习 (3)
- JavaScript 学习 (54)
- JAVA OOP 巩固 之 CustomDatabase 的开发 (5)
- 2013年9月之前所在公司 记事 (7)
- FleaPHP/QEEPHP 资料 (87)
- JAVA MAIL 学习篇 (4)
- Python turbogears (5)
- Rails 个人开发四部曲 (3)
- 名人传 (8)
- iwp framework (5)
- 高考零分作文 (5)
- startos (8)
- lua (0)
- 职场 (1)
最新评论
-
hellotieye:
自己 评论 自己 挺嗨呀
Mysql sql查询时 if 的用法 -
igevin:
转载请标明出处,转自Gevin的博客http://blog.i ...
RESTful API 编写指南 -
Theobob:
...
实现简单的ACL -
vb2005xu:
比如 对于 curl 调用就不再需要 加各种if 判断了,
$ ...
搞一个简单的数据打印工具AsDebug の Laravel -
vb2005xu:
http://geekplux.com/wiki/
YII2 模块内自定义错误页
新年里 把 自己写的 js基础代码 做个了结..... 死机了吧,悲剧了吧 ... 打不开了吧...编辑器bug出现了吧 ff不能黏贴,复制,换组织就不修正么?
- 博客分类:
- JavaScript 学习
新年里 把 自己写的 js基础代码 做个了结..... 死机了吧,悲剧了吧 ... 打不开了吧...编辑器bug出现了吧 ff不能黏贴,复制,换组织就不修正么?
var __doc=document,__undef="undefined",__proto="prototype";function $C(a){return __doc.createElement(a)}function $TagN(a){return __doc.getElementsByTagName(a)}function $N(a){return __doc.getElementsByName(a)}function $ID(a){return __doc.getElementById(a)}function loadscript(b){var a=$C("script");a.type="text/javascript";a.src=b;$TagN("head")[0].appendChild(a)}function loadcss(b){var a=$C("link");a.rel="stylesheet";a.type="text/css";a.href=b;$TagN("head")[0].appendChild(s)}function $clsN(g,h){var b=[];var f=new RegExp("(^| )"+h+"( |$)");var e=g.getElementsByTagName("*");for(var d=0,c=e.length;d<c;d++){if(e[d]&&(e[d].nodeType==1)&&(f.test(e[d].className))){b.push(e[d])}}return b}(function(){if(typeof Moogens==__undef){Moogens={meta:{author:"kenxu",version:"0.01"}}}if(typeof console==__undef){console={log:function(){}}}if(typeof Object.create!=="function"){Object.create=function(c){function b(){}b[__proto]=c;return new b()}}Object.extend=function(b,d){for(var c in d){b[c]=d[c]}return b};Object.extend(String[__proto],{trim:function(){return this.replace(/^\s+|\s+$/g,"")},nocamelize:function(b){return this.replace(/(?=[A-Z])/g,b||"-").toLowerCase()},camelize:function(){return this.replace(/-([a-z])/g,function(c,b){return b.toUpperCase()})}});Function[__proto].bind=function(c){var b=this;return function(){return b.apply(c,arguments)}};Moogens.Class={create:function(){return function(){this.initialize.apply(this,arguments)}}};Moogens.Utilities={arrayMap:function(f,d){var e=[];for(var c=0;c<f.length;c++){var b=d(f[c],c);if(b!==null){e.push(b)}}return e},each:function(d,c){if(d&&d.length){for(var b=0;b<d.length;b++){if(c.call(d[b],b)=="#end#"){break}}}},toArray:function(d){if(typeof d==__undef){return[]}if(Object[__proto].toString.call(d)==="[object Array]"){return d}var c=[];if(typeof d.length!=__undef){for(var b=0;b<d.length;b++){c.push(d[b])}}else{c.push(d)}return c}};Moogens.Browser=new function(){var c={webkit:/(webkit)[ \/]([\w.]+)/,opera:/(opera)(?:.*version)?[ \/]([\w.]+)/,msie:/(msie) ([\w.]+)/,mozilla:/(mozilla)(?:.*? rv:([\w.]+))?/};this.userAgent=navigator.userAgent;this.uaMatch=function(e){e=e.toLowerCase();var d=c.webkit.exec(e)||c.opera.exec(e)||c.msie.exec(e)||e.indexOf("compatible")<0&&c.mozilla.exec(e)||[];return{browser:d[1]||"",version:d[2]||"0"}};var b=this.uaMatch(this.userAgent);this[b.browser]=true;this.version=b.version;if(this.webkit){this.safari=true}c=null};Moogens.Cookie=new function(){this.get=function(c){var b=document.cookie.match(new RegExp("(^| )"+c+"=([^;]*)(;|$)"));if(b!=null){return decodeURIComponent(b[2])}return null};this.set=function(f,i,g,e,j,d){var h=f+"="+encodeURIComponent(i);if(g){var c=new Date();var b=g*3600*1000;c.setTime(c.getTime()+b);h+=";expires="+c.toGMTString()}if(e){h+=";path="+e}if(j){h+=";domain="+j}if(d){h+=";secure"}document.cookie=h};this.clear=function(e,c,b,d){this.set(e,"",0,c,b,d)}};Moogens.Dom={onReady:function(f,b){var e,g;var d=function(h){if(h&&h.type=="DOMContentLoaded"){c()}else{if(h&&h.type=="load"){c()}else{if(__doc.readyState){if((/loaded|complete/).test(__doc.readyState)){c()}else{if(!!__doc.documentElement.doScroll){try{e||__doc.documentElement.doScroll("left")}catch(h){return}c()}}}}}};var c=function(){if(!e){e=true;f.call(b||window);if(__doc.removeEventListener){__doc.removeEventListener("DOMContentLoaded",d,false)}__doc.onreadystatechange=null;window.onload=null;clearInterval(g);g=null}};if(__doc.addEventListener){__doc.addEventListener("DOMContentLoaded",d,false)}__doc.onreadystatechange=d;g=setInterval(d,5);window.onload=d}};var a=(function(){var t=/(?:[\w\-\\.#]+)+(?:\[\w+?=([\'"])?(?:\\\1|.)+?\1\])?|\*|>/ig,n=/^(?:[\w\-_]+)?\.([\w\-_]+)/,o=/^(?:[\w\-_]+)?#([\w\-_]+)/,k=/^([\w\*\-_]+)/,m=[null,null];function q(e,g){g=g||document;var i=/^[\w\-_#]+$/.test(e);if(!i&&g.querySelectorAll){return r(g.querySelectorAll(e))}if(e.indexOf(",")>-1){var z=e.split(/,/g),B=[],C=0,b=z.length;for(;C<b;++C){B=B.concat(q(z[C],g))}return p(B)}var d=e.match(t),f=d.pop(),h=(f.match(o)||m)[1],A=!h&&(f.match(n)||m)[1],y=!h&&(f.match(k)||m)[1],c;if(A&&!y&&g.getElementsByClassName){c=r(g.getElementsByClassName(A))}else{c=!h&&r(g.getElementsByTagName(y||"*"));if(A){c=l(c,"className",RegExp("(^|\\s)"+A+"(\\s|$)"))}if(h){var j=g.getElementById(h);return j?[j]:[]}}return d[0]&&c[0]?u(d,c):c}function r(e){try{return Array[__proto].slice.call(e)}catch(f){var c=[],b=0,d=e.length;for(;b<d;++b){c[b]=e[b]}return c}}function u(j,c,e){var b=j.pop();if(b===">"){return u(j,c,true)}var B=[],h=-1,g=(b.match(o)||m)[1],A=!g&&(b.match(n)||m)[1],y=!g&&(b.match(k)||m)[1],z=-1,f,i,d;y=y&&y.toLowerCase();while((f=c[++z])){i=f.parentNode;do{d=!y||y==="*"||y===i.nodeName.toLowerCase();d=d&&(!g||i.id===g);d=d&&(!A||RegExp("(^|\\s)"+A+"(\\s|$)").test(i.className));if(e||d){break}}while((i=i.parentNode));if(d){B[++h]=f}}return j[0]&&B[0]?u(j,B):B}var p=(function(){var c=+new Date();var b=(function(){var d=1;return function(e){var f=e.k,g=d++;if(!f){e.k=g;return true}return false}})();return function(d){var e=d.length,i=[],f=-1,h=0,g;for(;h<e;++h){g=d[h];if(b(g)){i[++f]=g}}c+=1;return i}})();function l(e,d,f){var b=-1,g,h=-1,c=[];while((g=e[++b])){if(f.test(g[d])){c[++h]=g}}return c}return q})();Moogens.Dom.get=function(b,c){return typeof b=="string"?a(b,c):typeof b=="[object Array]"?b:new Array(b)};Moogens.Dom.Node=function(b){this.setElement=function(c){this.ele=c&&c.nodeType?c:null;return this};this.getElement=function(c){return this.ele};this.getElementTag=function(){return this.ele.nodeName};this.getElementType=function(){return this.ele.nodeType};this.setElement(b||null);this.hasClass=function(c){var d=new RegExp("(^| )"+c+"( |$)");return d.test(this.ele.className)};this.addClass=function(c){return this.toggleClass(c,true)};this.removeClass=function(c){return this.toggleClass(c,false)};this.toggleClass=function(c,e){if(typeof c==__undef){this.ele.className=""}else{var d=new RegExp("(^| )"+c+"( |$)");var f=d.test(this.ele.className);if(typeof e!=__undef){if(e){if(!f){this.ele.className+=" "+c}}else{if(f){this.ele.className=this.ele.className.replace(d," ")}}}else{this.ele.className=f?this.ele.className.replace(d," "):this.ele.className+" "+c}d=f=null}return this};this.css=function(c,d){if(typeof c=="object"){for(var e in c){if(typeof e=="string"){this.ele.style[e.camelize()]=c[e]}}}else{if(typeof c=="string"){if(typeof d==__undef){return this.ele.style[c.camelize()]}this.ele.style[c.camelize()]=(typeof d=="function")?d(this.ele):d}}return this};this.attr=function(c,d){if(typeof c=="object"){for(var g in c){if(typeof g=="string"){try{this.ele[g]=c[g]}catch(f){console.log(this.ele.nodeName+" "+g+" readonly")}}}}else{if(typeof c=="string"){if(typeof d==__undef){return this.ele[c]}if(typeof d=="function"){d=d(this.ele)}try{this.ele[c]=d}catch(f){console.log(this.ele.nodeName+" "+c+" readonly")}}}return this};this.removeAttr=function(c){try{this.ele[c]=null}catch(d){console.log(this.ele.nodeName+" "+c+" readonly")}return this};this.val=function(c){if(typeof c==__undef){return this.ele.value}this.ele.value=c;return this};this.text=function(c){if(typeof c==__undef){if(typeof console._1dct==__undef){console._1dct=function(f){var d="";if(f&&f.nodeType){if(f.nodeType!=8){Moogens.Utilities.each(f.childNodes,function(){d+=this.nodeType==1?console._1dct(this):this.nodeValue})}}return d}}return console._1dct(this.ele)}this.empty().ele.appendChild(__doc.createTextNode(c));return this};this.html=function(c){if(typeof c==__undef){return this.ele.innerHTML}try{this.ele.innerHTML=c.replace(/<script[^>]*>[\S\s]*?<\/script[^>]*>/ig,"")}catch(d){console.log(this.ele.nodeName+" innerHTML readonly")}return this};this.offset=function(){if(this.css("display")=="none"){return{}}var e=this.ele;var d=e.offsetTop;var c=e.offsetLeft;while(e=e.offsetParent){d+=e.offsetTop+(Moogens.Browser.msie?e.clientTop:0);c+=e.offsetLeft+(Moogens.Browser.msie?e.clientLeft:0)}return{left:c,top:d}};this.show=function(){return this.css({display:""})};this.hide=function(){return this.css({display:"none"})};this.toggle=function(){this.ele.style.display=this.ele.style.display==""?"none":"";return this};this.resizeTo=function(c,d){return this.css({width:c+"px",height:d+"px"})};this.remove=function(){this.ele.parentNode.removeChild(this.ele)};this.empty=function(){while(this.ele.firstChild){this.ele.removeChild(this.ele.firstChild)}return this};this.focus=function(){if(this.ele.focus){this.ele.focus()}return this};this.on=function(d,c){if(typeof c=="function"){Moogens.Dom.Event.add(this.ele,d,c)}return this};this.un=function(d,c){if(typeof c=="function"){Moogens.Dom.Event.remove(this.ele,d,c)}return this};this.click=function(c){if(typeof c==__undef){return this.fireEvent("click")}return this.on("click",c)};this.dbclick=function(c){if(typeof c==__undef){return this.fireEvent("dblclick")}return this.on("dblclick",c)};this.fireEvent=function(c){if(typeof c=="string"){c="on"+c;if(typeof this.ele.fireEvent=="function"){this.ele.fireEvent(c)}else{if(typeof this.ele[c]=="function"){this.ele[c]()}}}return this}};Moogens.Dom.NodeList=function(d){var b=new Moogens.Dom.Node();var c=Moogens.Utilities.arrayMap(d,function(e){return e&&e.nodeType?e:null});this.get=function(e){return(typeof e!=__undef)&&c[e]?b.setElement(c[e]):null};this.count=function(){return c.length};this.each=function(f){for(var e=0;e<c.length;e++){f.call(this.get(e),e)}return this}};Moogens.Dom.$=function(b,c){return new Moogens.Dom.NodeList(Moogens.Dom.get(b,c))};Moogens.Dom.Event={add:function(d,c,b){d["e"+c+b]=b;if(d.addEventListener){d.addEventListener(c,b,false)}else{if(d.attachEvent){d[c+b]=function(){d["e"+c+b](window.event)};d.attachEvent("on"+c,d[c+b])}}},remove:function(d,c,b){if(d.removeEventListener){d.removeEventListener(c,d["e"+c+b],false)}else{if(d.detachEvent){d.detachEvent("on"+c,d[c+b])}}d[c+b]=null;d["e"+c+b]=null},preventDefault:function(b){b=b||window.event;if(b.preventDefault){b.preventDefault()}else{b.returnValue=false}},preventBubble:function(b){b=b||window.event;if(b.stopPropagation){b.stopPropagation()}else{b.cancelBubble=true}},keyCode:function(b){b=b||window.event;return b.keyCode||b.charCode||0},addProxy:function(b,d,c,g){var e=d+"_handle";var f=this;b[e]=function(h){h=h||window.event;var i=h.target||h.srcElement;c(i);if(g){f.preventDefault(h)}};this.add(b,d,b[e])},removeProxy:function(b,c){var d=c+"_handle";this.remove(b,c,b[d])}}})();
大约10k , 自我感觉良好 ....
console.log(Moogens.Dom.get('div > ul'));
评论
var queue = new Moogens.Queue(1,"gsg",$Get('div > ul')); queue.push(imgBox); while(queue.size) console.log(queue.shift(),queue.size);
// Queue 队列: 先进先出 Moogens.Queue = function(){ var vol = Moogens.Utilities.toArray(arguments); this.size = vol.length; this.push = function(item){ vol.push(item); this.size ++ ; }; this.shift = function(){ if (!this.size) return null; this.size -- ; return vol.shift(); }; this.empty = function(){ vol = []; this.size = 0; }; };
发表评论
-
常用的 js 代码梳理
2016-06-16 12:00 1858/** * 格式化时间函数 * @param {form ... -
fineuploader 跨子域上传文件 cookie丢失问题的解决
2015-10-14 13:30 4742目前的项目中,使用到了fineuploader 这个纯htm ... -
2014 I Love You!
2014-02-14 15:40 1219保存成 html文件后打开 写道 <html> ... -
阻止checkbox的父元素事件冒泡
2014-01-15 20:33 8634今天在开发后台权限管理时使用了tinyaccordion ... -
整理下之前的js代码 moogens.js 记录下
2013-11-26 11:49 1160moogens.jshttps://github.com/v ... -
AOP 在js中的应用
2013-08-29 19:21 0http://www.alloyteam.com/2013/ ... -
自己动手增强 jquery.multiselect2side 调用
2012-11-13 17:50 8570最近用到一个jq插件 jquery.multiselect ... -
坑爹的HTML5应用集锦
2012-11-06 16:23 12021. 3D的俄罗斯方块 http://alteredquali ... -
小旭改的分页代码
2012-10-22 15:54 1304/** * 说明: 在页面指定元素中构建分页条 * ... -
一道js题 的分析历程
2012-08-10 11:14 1265var a = {n:1};a.x=a={n:2}; a.x ... -
修复 artDialog 双击遮罩层就会自动关闭的bug.... 自己动手....
2012-05-24 21:21 5997今天使用的时候发现 双击遮罩层 就会自动关闭 ,我用的版本是 ... -
jquery 也不给力啊 unbind 你让我情何以堪!
2012-05-09 19:36 1481发现一个问题$a = jQuery('img[src=&q ... -
使用 nodejs 形式的语法来规整 js
2012-04-21 10:20 1929/* * 使用 nodejs 形式的语法来规整 js ... -
注册了2个域名 希望能给nodejs一点集合
2011-06-22 12:37 1288NODEJS-OPEN.COM NODEJS-OPEN.I ... -
css 文本折行
2011-05-12 10:27 8326word-wrap:break-word; overflow: ... -
IE 中document.getElementsByName
2011-05-06 10:40 2406IE 中使用 document.getElementsByNa ... -
考考你们的JS 我只作对了一半 你们试试
2011-02-11 10:40 2095alert(typeof(NaN)); alert( ... -
为自己的JS库 moogens 增加 facebox 组件
2011-01-17 20:16 2022之前的JS慢慢积累下来慢慢也就自己完善了个,比之前的__ini ... -
高级js教程,转国外一个教程
2010-11-22 10:10 3353http://www.sergiopereira.com/ar ... -
Kenxu Events.js 使用
2010-10-19 18:38 1569之前写过 iamseseJS和__xu_init jS简易框架 ...
相关推荐
Linux 操作系统基础教程 清华大学信息学院计算机系 目 录 前言..........................................................................................................................................
这次更新比较完整,一个BBS该有的功能基本上都有了。 因为用了PEAR缓存,PHP 5.3版本会提示错误,config.php里把debug关了就好了。 安装帮助在upload/help目录。 P.S. 这个程序基本上是09年写的,因为当时非常...
这次更新比较完整,一个BBS该有的功能基本上都有了。因为用了PEAR缓存,PHP 5.3版本会提示错误,config.php里把debug关了就好了。安装帮助在upload/help目录。P.S.这个程序基本上是09年写的,因为当时非常喜欢PB,但...
有色产品每日报告:资金获利了结驱动有色板块普跌,供需偏紧或限制深跌.pdf
有色产品每日报告:资金获利了结驱动有色板块普跌,供需偏紧或限制深跌.rar
东吴策略·市场温度计:绝对收益获利了结,短期更重结构(26页).pdf
20210705-建信期货-MEG半年报:去库行情逐步了结,基本面转弱预期较强.pdf
虽然说能写出什么样的代码这是需要长久的训练和琢磨的,但是今天讲的,是写代码人该有的心态以及一些可能是必须的 关于软件或代码,其实之前我已经写过一篇写代码的四个境界。虽然说能写出什么样的代码这是需要...
关于工作室的介绍,这个页面部分不能后台管理 7,服务 没有后台管理功能,需手动更改 8,其他 fckeditor编辑器,UTF-8编码,复制自动加版权,详情请自己研究。。。 管理资料: 后台管理地址:域名/admin/ 用户名:...
众所周知软件测试这个职业有一个为从业者不悦的一个特点就是有时特别烦琐,要经常做重复性的东西,相信同行或多或少都会有这个感慨,而罪魁祸首就是回归测试.如果每次测试的功能 众所周知软件测试这个职业有一个为...
这是一个控制和管理订单的风控软件,可用于监控交易员的成交手数,也避免忘记设置止损和止盈的错误。 很多风控技术工作者在该软件系统的帮助下,节约了大量的工作时间,同时也避免了很多严重性的错误。 同时它可以...
适合新手了结
完成端口,下载文件的代码。用vs2015实现,想了解完成端口的可以学习了结一下。下载步骤包括:登录-》版本验证-》有新版本就下载,没有新版本就不下载,已经下载了也不下载,登录失败也不下载。
每到春节、清明或忌日,人们都要到逝者的墓前扫墓、祭奠,以了结自己的一份心愿。随着网络社会的逐步到来,逝者也将拥有网络上的天堂:一个完全数字化的网上公墓--这就是母亲安息网公墓。 在传统公墓里,逝者所拥有...
Angular.js 鲍尔 Postgres 数据映射器规格RubyTwilio API 辛纳特拉赫鲁库我的贡献在 4 到 5 个小时的时间里,我与 [Tatiana] 进行了结对编程,她整夜都在研究大部分基本代码。 我构建了后端,包括数据库模型、...
其实锁单本人是不建议大家去操作的,严格设立止损或者及时获利了结即可,有言说道:锁单容易解单难,解单难,难于上青天!可见解单的难度与麻烦程度。如若操作不当小损失极有可能变成大损失。下面分别来讲一下锁损和...
尽管与R应用程序相比,该代码可以工作并且确实复制了结果(),但它仍在开发中,可以大大改进。 该程序的一个特殊限制是,使用Geoerge Vega的的并行计算实现尚未为命题2中的$ \ sum_i \ widehat {V} _ {C,i}...
思考良久,我想除了前些年C语言自身的停滞不前,没有与时俱进,其次就得归功于中国IT行业的浮躁和急功近利,和底层硬件的缺失(因为C语言常被用来做一些基础建设,例如硬件驱动和系统应用),当然还少不了资本的...
介绍逻辑门最直观的电路,专业的仿真文件,最快的对逻辑门电路做个了结
h264标准负责人写的overview。是videocoding领域引用次数最高的文章。应该阅读下,了结关键技术,发展历史,面向的应用环境。