12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- (function(){// During the rave-accessibility.js build, this file is added to the top.
- // Create an inner self-executing function that will be run with the global scope
- // On browsers, this is 'window'. Everywhere else should use 'this' if available.
- // Need to run eval('this') "indirectly" by having eval returned by (1,eval). OBVIOUSLY :)
- var _window = (1, eval)('this');
- (function (global, factory) {
- // dynamically determine how 'rave' variable should be loaded depeneding on loader type
- var _rave;
- if (typeof module === "object" && typeof module.exports === "object" && typeof require == "function") {
- // CommonJS/node.js
- var rave = require("rave-navigation");
- var _accessibility = factory(global,rave);
- module.exports = rave;
- } else if (typeof define === "function" && define.amd) {
- // AMD
- define(['rave-navigation'], function(rave) {
- return factory(global,rave);
- });
- } else {
- // probably loading via script tag. run as is, setting stuff on rave
- factory(global,global['rave']);
- }
- }(_window, function (_global, _rave) {function gb(){return function(ob){return ob}}function q(){return function(){}}function w(ob){return function(U){this[ob]=U}}function x(ob){return function(){return this[ob]}}function A(ob){return function(){return ob}}
- var a="undefined"!==typeof _global?_global:(0,eval)("this"),b="undefined"!==typeof _rave?_rave:a.rave,c=b._.rave_document,a={},d=b,e=b._.com_ibm_rave_core_nativeImpl_Declare,
- f=b.internal.Selector,g=b.internal.SelectorDelegate,h=b.navigation.internal.FocusController,k=b.internal.RaveContextManager,l=b.navigation,n=a.AccessibilityConstants={};n.SELECTOR_ID="raveAccessibility";n.ACCESSIBLE_INFO_KEY="__accessibleInfo__";n.SHADOW_TREE_BUILDER_KEY="__shadowTreeBuilder__";var t={extend:function(a){var b=a.appendChild;a.appendChild=function(a){b.call(this,a);d.configuration.extendRecursive(a);var c=p.bi(this);c&&(p.Ji(a,c),c.Uo(this,a))};var c=a.insertBefore;a.insertBefore=function(a,
- b){c.call(this,a,b);d.configuration.extendRecursive(a);var e=p.bi(this);e&&(p.Ji(a,e),e.CF(this,a,b))};var e=a.removeChild;a.removeChild=function(a){var b=this.rave_getChildNodes().indexOf(a);if(-1!=b){e.call(this,a);d.configuration.extendRecursive(a);var c=p.bi(a);c&&(c.DF(this,a,b),p.Ji(a,null));return!0}return!1};var f=a.rave_setProperty;a.rave_setProperty=function(a,b){f.call(this,a,b);if(n.ACCESSIBLE_INFO_KEY==a){var c=p.bi(this);c&&c.BF(this)}}},Df:function(){d.configuration.addSceneNodeExtensionFactory("http://www.w3.org/2000/svg",
- function(a,b){(b&&b.rave_hasProperty(n.SHADOW_TREE_BUILDER_KEY)||a.rave_hasProperty(n.SHADOW_TREE_BUILDER_KEY))&&t.extend(a)},0)}},p={bi:function(a){return a.rave_getProperty(n.SHADOW_TREE_BUILDER_KEY)},Pc:function(a){return null!=a.rave_getProperty(n.ACCESSIBLE_INFO_KEY)},Ji:function(a,b){a.rave_setProperty(n.SHADOW_TREE_BUILDER_KEY,b);if(a.rave_hasChildNodes())for(var c=0,d=a.rave_getChildNodes(),e=d.length;c<e;++c)p.Ji(d[c],b)},yG:function(){f.extension(n.SELECTOR_ID,function(){return new s})}},
- s=a.AccessibilitySelector=e(g,{constructor:q(),create:function(a){return(new s).setDelegate(a)},zB:function(){var a=this.node(),a=a?a.rave_getOwner():null;return!a?null:v.FC(a)},AB:function(a){this.each$0(function(){var b=this.rave_getOwner();if(b&&(v.Uu(b,a),null!=a)){var c=b.rave_getProperty(n.ACCESSIBLE_INFO_KEY);c||(c={},c.label=a,b.rave_setProperty(n.ACCESSIBLE_INFO_KEY,c))}});return this},BB:function(a){this.each$0(function(b,c,d){if(b=this.rave_getOwner())c=a.call(b,b.rave_getData(),c,d),c=
- null!=c?c+"":"",v.Uu(b,c),null!=c&&(d=b.rave_getProperty(n.ACCESSIBLE_INFO_KEY),d||(d={},d.label=c,b.rave_setProperty(n.ACCESSIBLE_INFO_KEY,d)))});return this},AD:function(){var a=this.node();return!a?null:a.rave_getProperty(n.ACCESSIBLE_INFO_KEY)},BD:function(a){this.each$0(function(){this.rave_setProperty(n.ACCESSIBLE_INFO_KEY,a)});return this},CD:function(a){this.each$0(function(b,c,d){this.rave_setProperty(n.ACCESSIBLE_INFO_KEY,a.call(this,b,c,d))});return this},description:function(a){var b=
- arguments;return 0==b.length?this.zB():1==b.length&&(null==a||"string"===typeof a)?this.AB(a):this.BB(a)},info:function(a){var b=arguments;return 0==b.length?this.AD():1==b.length&&"function"===typeof a?this.CD(a):this.BD(a)}}),u=function(){function a(b){b[h]&&(delete b[h][k],delete b[h]);b=b.childNodes;for(var c=0;c<b.length;c++)a(b[c])}function d(a,b){b.label?a.setAttribute("aria-label",b.label):a.removeAttribute("aria-label");b.hint?a.setAttribute("aria-hint",b.hint):a.removeAttribute("aria-hint");
- b.role?a.setAttribute("role",b.role):a.removeAttribute("role");for(var c in b)if(b.hasOwnProperty(c))switch(c){case "label":case "hint":case "role":break;default:b[c]?a.setAttribute(c,b[c]):a.removeAttribute(c)}}function f(a,b){b&&(b.label&&b.label.length)&&(a.textContent=b.label)}function g(a,e,l){var m=e.rave_getProperty(n.ACCESSIBLE_INFO_KEY);if(m){var p=e.rave_getProperty(h),r=b.select(a.rave_getProperty(h)),s=r.select("ul");if(!p&&(s.empty()&&(s=r.append("ul")),p=c.createElement("li"),p[k]=e,
- e.rave_setProperty(h,p),d(p,m),f(p,m),e.rave_hasChildNodes())){m=e.rave_getChildNodes();for(r=0;r<m.length;r++)this.Uo(e,m[r])}s=s.node();3==arguments.length?s.insertBefore(p,l.rave_getProperty(h)):s.appendChild(p)}}var h="__shadowDomNode__",k="__sceneNode__";return e({Uo:g,CF:g,DF:function(a,b){var c=b[h],d;c==this.Wd&&(d=c.previousElementSibling,d||(d=c.nextElementSibling,d||(d=c.parentNode.parentNode)));this.rv(b);d&&this.bz.fireFocus(d[k])},BF:function(a){var b=a.rave_getProperty(n.ACCESSIBLE_INFO_KEY),
- e=a.rave_getProperty(h);if(b)if(e){d(e,b);a=e.childNodes;for(var f=0;f<a.length;f++)3==a[f].nodeType&&e.removeChild(a[f]);b.label&&b.label.length&&e.insertBefore(c.createTextNode(b.label),e.firstChild)}else(b=a.parentNode)&&g(b,a);else e&&this.rv(a)},jH:function(a,e){this.bz=e;var g=a[h],l=a.rave_getProperty(n.ACCESSIBLE_INFO_KEY);l||(l={},a.rave_setProperty(n.ACCESSIBLE_INFO_KEY,l));if(!g){g=c.createElement("div");g[k]=a;g.setAttribute("class","rave-a11y");b.select(g).style({width:0,height:0,left:-1E4,
- top:-1E4,position:"absolute",overflow:"hidden"},"important");a.parentNode.insertBefore(g,a);a[h]=g;d(g,l);f(g,l);if(a.rave_hasChildNodes())for(var l=a.rave_getChildNodes(),m=0;m<l.length;m++)this.Uo(a,l[m]);this.lr=+a.getAttribute("tabindex");a.removeAttribute("tabindex");this.Wd=g;this.Wd.setAttribute("tabindex",this.lr)}},rv:function(b){if(shadowDomNode=b[h])shadowDomNode.parentNode.removeChild(shadowDomNode),a(b)},focus:function(a){var b;a&&(b=a[h]);this.Wd!=b&&(a=document.activeElement===this.Wd,
- this.Wd&&(this.Wd.removeAttribute("tabindex"),this.Wd.blur()),b&&(b.setAttribute("tabindex",this.lr),a&&b.focus()),this.Wd=b)}})}(),v={FC:function(a){return a.getAttribute("aria-label")},Uu:function(a,b){a.setAttribute("aria-label",b)},eB:function(){return new u}},g=e({keyboard:function(){return new B}});g.INSTANCE=new g;var z=a.Accessibility={};z.ho=function(){var a=k.INSTANCE.getRaveContext().getData("ACCESSIBILITY_EXTENSION_REGISTRATION_STATUS_KEY");a||(a=new z.Rm,k.INSTANCE.getRaveContext().putData("ACCESSIBILITY_EXTENSION_REGISTRATION_STATUS_KEY",
- a));return a};z.init=function(){var a=z.ho();a.Ki||(t.Df(),p.yG(),a.Ki=!0)};z.Rm=e({Ki:!1});z.ACCESSIBLE_INFO_KEY=n.ACCESSIBLE_INFO_KEY;z.SHADOW_TREE_BUILDER_KEY=n.SHADOW_TREE_BUILDER_KEY;z.SELECTOR_ID=n.SELECTOR_ID;z.navigation=g.INSTANCE;z.init();b.accessibility=z;var B=a.AccessibleKeyboard=e({_$functionClassMethod:function(){function a(b){if(null!==b||1<arguments.length)b=Array.prototype.slice.call(arguments,0);a.bind(b[0]);return null}return a},constructor:function(){this.of=l.keybinding();this.aa=
- d.behavior.focusEventHandler();this.vm=function(){return v.eB()};var a=this;this.next=function(c){if(null!==c||1<arguments.length)c=Array.prototype.slice.call(arguments,0);var d=a.aa.xa;if(d&&!B.Zb(d))for(;d=h.nextFocusableNode(d);)if(p.Pc(d)){a.aa.fireFocus(d);break}b.event.preventDefault();return null};this.previous=function(c){if(null!==c||1<arguments.length)c=Array.prototype.slice.call(arguments,0);var d=a.aa.xa;if(d&&!B.Zb(d))for(;d=h.previousFocusableNode(d);)if(p.Pc(d)){a.aa.fireFocus(d);break}b.event.preventDefault();
- return null};this.tF=function(c){if(null!==c||1<arguments.length)c=Array.prototype.slice.call(arguments,0);var d=a.aa.xa;if(d&&!B.Zb(d)){for(var e=0,f=d,g=d;20>e&&g;)if((g=h.nextFocusableNode(g))&&p.Pc(g))f=g,e++;f!=d&&a.aa.fireFocus(f)}b.event.preventDefault();return null};this.YF=function(c){if(null!==c||1<arguments.length)c=Array.prototype.slice.call(arguments,0);var d=a.aa.xa;if(d&&!B.Zb(d)){for(var e=0,f=d,g=d;20>e&&g;)if((g=h.previousFocusableNode(g))&&p.Pc(g))f=g,e++;f!=d&&a.aa.fireFocus(f)}b.event.preventDefault();
- return null};this.Zh=function(c){if(null!==c||1<arguments.length)c=Array.prototype.slice.call(arguments,0);var d=a.aa.xa;if(d&&!B.Zb(d)){var e=h.nextFocusableNodeFromStart(d);if(!p.Pc(e))for(;(e=h.nextFocusableNode(e))&&!p.Pc(e););e&&d!=e&&a.aa.fireFocus(e)}b.event.preventDefault();return null};this.$D=function(c){if(null!==c||1<arguments.length)c=Array.prototype.slice.call(arguments,0);var d=a.aa.xa;if(d&&!B.Zb(d)){var e=h.previousFocusableNodeFromEnd(d);if(!p.Pc(e))for(;(e=h.previousFocusableNode(e))&&
- !p.Pc(e););e&&d!=e&&a.aa.fireFocus(e)}b.event.preventDefault();return null};this.nextLevel=function(c){if(null!==c||1<arguments.length)c=Array.prototype.slice.call(arguments,0);var d=a.aa.xa;if(d&&d.rave_hasChildNodes()){d=h.nextLevelFocusableNode(d);if(!p.Pc(d))for(;(d=h.nextFocusableNode(d))&&!p.Pc(d););d&&a.aa.fireFocus(d)}b.event.preventDefault();return null};this.previousLevel=function(c){if(null!==c||1<arguments.length)c=Array.prototype.slice.call(arguments,0);var d=a.aa.xa;d&&!B.Zb(d)&&(d=
- h.previousLevelFocusableNode(d))&&a.aa.fireFocus(d);b.event.preventDefault();return null};this.of.on(40,this.next).on(38,this.previous).on(34,this.tF).on(33,this.YF).on(36,this.Zh).on(35,this.$D).on(39,this.nextLevel).on(37,this.previousLevel)},bind:function(a){var b=this;a.each(function(a,c,e){var f=d.select(this);a=b.vm.call(this,a,c,e);p.Ji(this,a);d.configuration.extendRecursive(this);a.jH(this,b.aa);f.on("ravefocus",B.Ow);d.select(this.rave_getOwner()).call(b.of);f.property(B.lh,!0);b.aa.xa=
- this})},gN:x("vm"),kH:function(a){this.vm=a;return this},keyBinding:x("of"),kC:x("aa"),Zn:function(a){this.aa=a;return this},shadowTreeBuilder:function(a){return 0==arguments.length?this.vm:this.kH(a)},focusEventHandler:function(a){return 0==arguments.length?this.aa:this.Zn(a)}});B.Zb=function(a){return null!=a.rave_getProperty(B.lh)};B.lh="__rave-kbnav-root__";B.Ey=20;B.Ow=function(a,b,c,d){a=p.bi(d.target);d.target?a.focus(d.target):a.focus(null)} // This is the end of the factory method defined in the header. Added only during a full compiled JS build.
- return rave;
- }));})();
|