You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
3.3 KiB
1 lines
3.3 KiB
define(["jquery","core/key_codes"],function(a,b){var c={activate:"cie:activate",keyboardActivate:"cie:keyboardactivate",escape:"cie:escape",down:"cie:down",up:"cie:up",home:"cie:home",end:"cie:end",next:"cie:next",previous:"cie:previous",asterix:"cie:asterix",scrollLock:"cie:scrollLock",scrollTop:"cie:scrollTop",scrollBottom:"cie:scrollBottom",ctrlPageUp:"cie:ctrlPageUp",ctrlPageDown:"cie:ctrlPageDown",enter:"cie:enter"},d={},e=function(a,b){return b=b||[],!(!b.length||b.indexOf(a)===-1)},f=function(a){return a.shiftKey||a.metaKey||a.altKey||a.ctrlKey},g=function(b,c){var e="";return c.hasOwnProperty("originalEvent")?(e="triggeredCustom_"+b,c.originalEvent.hasOwnProperty(e)?void 0:(c.originalEvent[e]=!0,void a(c.target).trigger(b,[{originalEvent:c}]))):(e=""+b+c.type+c.timeStamp,void(d.hasOwnProperty(e)||(d[e]=!0,a(c.target).trigger(b,[{originalEvent:c}]))))},h=function(a,b,c){a.off("keydown."+b).on("keydown."+b,function(a){f(a)||a.keyCode==c&&g(b,a)})},i=function(a){a.off("click.cie.activate").on("click.cie.activate",function(a){g(c.activate,a)}),a.off("keydown.cie.activate").on("keydown.cie.activate",function(a){f(a)||a.keyCode!=b.enter&&a.keyCode!=b.space||g(c.activate,a)})},j=function(a){a.off("keydown.cie.keyboardactivate").on("keydown.cie.keyboardactivate",function(a){f(a)||a.keyCode!=b.enter&&a.keyCode!=b.space||g(c.keyboardActivate,a)})},k=function(a){h(a,c.escape,b.escape)},l=function(a){h(a,c.down,b.arrowDown)},m=function(a){h(a,c.up,b.arrowUp)},n=function(a){h(a,c.home,b.home)},o=function(a){h(a,c.end,b.end)},p=function(d){var e="rtl"==a("html").attr("dir")?b.arrowLeft:b.arrowRight;h(d,c.next,e)},q=function(d){var e="rtl"==a("html").attr("dir")?b.arrowRight:b.arrowLeft;h(d,c.previous,e)},r=function(a){h(a,c.asterix,b.asterix)},s=function(a){a.off("scroll.cie.scrollTop").on("scroll.cie.scrollTop",function(b){var d=a.scrollTop();0===d&&g(c.scrollTop,b)})},t=function(a){a.off("scroll.cie.scrollBottom").on("scroll.cie.scrollBottom",function(b){var d=a.scrollTop(),e=a.innerHeight(),f=a[0].scrollHeight;d+e>=f&&g(c.scrollBottom,b)})},u=function(a){a.off("DOMMouseScroll.cie.DOMMouseScrollLock mousewheel.cie.mousewheelLock").on("DOMMouseScroll.cie.DOMMouseScrollLock mousewheel.cie.mousewheelLock",function(b){var d=a.scrollTop(),e=a[0].scrollHeight,f=a.height(),h="DOMMouseScroll"==b.type?b.originalEvent.detail*-40:b.originalEvent.wheelDelta,i=h>0;return!i&&-h>e-f-d?(a.scrollTop(e),b.stopPropagation(),b.preventDefault(),b.returnValue=!1,g(c.scrollLock,b),!1):!(i&&h>d)||(a.scrollTop(0),b.stopPropagation(),b.preventDefault(),b.returnValue=!1,g(c.scrollLock,b),!1)})},v=function(a){a.off("keydown.cie.ctrlpageup").on("keydown.cie.ctrlpageup",function(a){a.ctrlKey&&a.keyCode==b.pageUp&&g(c.ctrlPageUp,a)})},w=function(a){a.off("keydown.cie.ctrlpagedown").on("keydown.cie.ctrlpagedown",function(a){a.ctrlKey&&a.keyCode==b.pageDown&&g(c.ctrlPageDown,a)})},x=function(a){h(a,c.enter,b.enter)},y=function(){var a={};return a[c.activate]=i,a[c.keyboardActivate]=j,a[c.escape]=k,a[c.down]=l,a[c.up]=m,a[c.home]=n,a[c.end]=o,a[c.next]=p,a[c.previous]=q,a[c.asterix]=r,a[c.scrollLock]=u,a[c.scrollTop]=s,a[c.scrollBottom]=t,a[c.ctrlPageUp]=v,a[c.ctrlPageDown]=w,a[c.enter]=x,a},z=function(b,c){b=a(b),c=c||[],b.length&&c.length&&a.each(y(),function(a,d){e(a,c)&&d(b)})};return{define:z,events:c}});
|