8 lines
2.6 KiB
JavaScript
8 lines
2.6 KiB
JavaScript
//>>built
|
|
define("dojo/_base/connect","./kernel ../on ../topic ../aspect ./event ../mouse ./sniff ./lang ../keys".split(" "),function(m,f,n,v,z,r,h,k){function w(a,c,l,b,t){b=k.hitch(l,b);if(!a||!a.addEventListener&&!a.attachEvent)return v.after(a||m.global,c,b,!0);"string"==typeof c&&"on"==c.substring(0,2)&&(c=c.substring(2));a||(a=m.global);if(!t)switch(c){case "keypress":c=p;break;case "mouseenter":c=r.enter;break;case "mouseleave":c=r.leave}return f(a,c,b,t)}function u(a){a.keyChar=a.charCode?String.fromCharCode(a.charCode):
|
|
"";a.charOrCode=a.keyChar||a.keyCode}h.add("events-keypress-typed",function(){var a={charCode:0};try{a=document.createEvent("KeyboardEvent"),(a.initKeyboardEvent||a.initKeyEvent).call(a,"keypress",!0,!0,null,!1,!1,!1,!1,9,3)}catch(c){}return 0==a.charCode&&!h("opera")});var x={106:42,111:47,186:59,187:43,188:44,189:45,190:46,191:47,192:96,219:91,220:92,221:93,222:39,229:113},y=h("mac")?"metaKey":"ctrlKey",q=function(a,c){c=k.mixin({},a,c);u(c);c.preventDefault=function(){a.preventDefault()};c.stopPropagation=
|
|
function(){a.stopPropagation()};return c},p;p=h("events-keypress-typed")?function(a,c){var l=f(a,"keydown",function(a){var d=a.keyCode,b=13!=d&&32!=d&&(27!=d||!h("ie"))&&(48>d||90<d)&&(96>d||111<d)&&(186>d||192<d)&&(219>d||222<d)&&229!=d;if(b||a.ctrlKey){b=b?0:d;if(a.ctrlKey){if(3==d||13==d)return c.call(a.currentTarget,a);b=95<b&&106>b?b-48:!a.shiftKey&&65<=b&&90>=b?b+32:x[b]||b}d=q(a,{type:"keypress",faux:!0,charCode:b});c.call(a.currentTarget,d);if(h("ie"))try{a.keyCode=d.keyCode}catch(g){}}}),
|
|
b=f(a,"keypress",function(a){var b=a.charCode;a=q(a,{charCode:32<=b?b:0,faux:!0});return c.call(this,a)});return{remove:function(){l.remove();b.remove()}}}:h("opera")?function(a,c){return f(a,"keypress",function(a){var b=a.which;3==b&&(b=99);b=32>b&&!a.shiftKey?0:b;a.ctrlKey&&!a.shiftKey&&65<=b&&90>=b&&(b+=32);return c.call(this,q(a,{charCode:b}))})}:function(a,c){return f(a,"keypress",function(a){u(a);return c.call(this,a)})};var e={_keypress:p,connect:function(a,c,l,b,h){var d=arguments,e=[],g=
|
|
0;e.push("string"==typeof d[0]?null:d[g++],d[g++]);var f=d[g+1];e.push("string"==typeof f||"function"==typeof f?d[g++]:null,d[g++]);for(f=d.length;g<f;g++)e.push(d[g]);return w.apply(this,e)},disconnect:function(a){a&&a.remove()},subscribe:function(a,c,e){return n.subscribe(a,k.hitch(c,e))},publish:function(a,c){return n.publish.apply(n,[a].concat(c))},connectPublisher:function(a,c,f){var b=function(){e.publish(a,arguments)};return f?e.connect(c,f,b):e.connect(c,b)},isCopyKey:function(a){return a[y]}};
|
|
e.unsubscribe=e.disconnect;k.mixin(m,e);return e});
|
|
//# sourceMappingURL=connect.js.map
|