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
2.5 KiB
1 lines
2.5 KiB
define(["jquery","core/custom_interaction_events","mod_forum/selectors"],function(a,b,c){var d=function(a){var b=a.prev(c.post.post);if(b.length){var d=b.find(c.post.post).last();d.length?d.focus():b.focus()}else a.parents(c.post.post).first().focus()},e=function(b){var d=b.find(c.post.post).first();if(d.length)d.focus();else{var e=b.next(c.post.post);e.length?e.focus():b.parents().toArray().forEach(function(b){var d=a(b).next(c.post.post);if(d.length)return void d.focus()})}},f=function(b){var d=a(b).closest(c.post.inpageReplyContent);return!!d.length},g=function(g){var h=g.find(c.post.post);h.each(function(b,d){var e=a(d).find(c.post.action),f=e.first();e.attr("tabindex","-1"),f.attr("tabindex",0)}),b.define(g,[b.events.up,b.events.down,b.events.next,b.events.previous,b.events.home,b.events.end]),g.on(b.events.up,function(b,e){var h=document.activeElement;if(!f(h)){var i=a(h).closest(c.post.post);i.length?d(i):g.find(c.post.post).first().focus(),e.originalEvent.preventDefault()}}),g.on(b.events.down,function(b,d){var h=document.activeElement;if(!f(h)){var i=a(h).closest(c.post.post);i.length?e(i):g.find(c.post.post).first().focus(),d.originalEvent.preventDefault()}}),g.on(b.events.home,function(a,b){f(document.activeElement)||(g.find(c.post.post).first().focus(),b.originalEvent.preventDefault())}),g.on(b.events.end,function(a,b){f(document.activeElement)||(g.find(c.post.post).last().focus(),b.originalEvent.preventDefault())}),g.on(b.events.next,c.post.action,function(b,d){var e=a(b.target),f=e.closest(c.post.actionsContainer),g=f.find(c.post.action),h=e.next(c.post.action);g.attr("tabindex","-1"),h.length||(h=g.first()),h.attr("tabindex",0),h.focus(),d.originalEvent.preventDefault()}),g.on(b.events.previous,c.post.action,function(b,d){var e=a(b.target),f=e.closest(c.post.actionsContainer),g=f.find(c.post.action),h=e.prev(c.post.action);g.attr("tabindex","-1"),h.length||(h=g.last()),h.attr("tabindex",0),h.focus(),d.originalEvent.preventDefault()}),g.on(b.events.home,c.post.action,function(b,d){var e=a(b.target),f=e.closest(c.post.actionsContainer),g=f.find(c.post.action),h=g.first();g.attr("tabindex","-1"),h.attr("tabindex",0),h.focus(),b.stopPropagation(),d.originalEvent.preventDefault()}),g.on(b.events.end,c.post.action,function(b,d){var e=a(b.target),f=e.closest(c.post.actionsContainer),g=f.find(c.post.action),h=g.last();g.attr("tabindex","-1"),h.attr("tabindex",0),h.focus(),b.stopPropagation(),d.originalEvent.preventDefault()})};return{init:function(a){g(a)}}});
|