MDL-63817 block_timeline: Persist page limits when sorting by dates
[moodle.git] / blocks / timeline / amd / build / view_dates.min.js
1 define(["jquery","core/str","block_timeline/event_list","core/pubsub","core/paged_content_events"],function(a,b,c,d,e){var f={EVENT_LIST_CONTAINER:'[data-region="event-list-container"]'},g=[5,10,25],h=function(a){var b=parseInt(a.data("limit"),10),c=!1,d=g.map(function(a){return b==a&&(c=!0),{value:a,active:b==a}});return c||(d[0].active=!0),d},i=function(b,c){var f=c+e.SET_ITEMS_PER_PAGE_LIMIT;d.subscribe(f,function(c){a(b).data("limit",c)})},j=function(d){var e=d.find(f.EVENT_LIST_CONTAINER),g=a(e).attr("id")+"user_block_timeline"+Math.random();i(d,g);var j=h(d),k={persistentLimitKey:"block_timeline_user_limit_preference",eventNamespace:g};b.get_string("ariaeventlistpaginationnavdates","block_timeline").then(function(a){return c.init(e,j,{},a,k),a})["catch"](function(){c.init(e,j,{},"",k)})},k=function(b){b=a(b),b.hasClass("active")&&(j(b),b.data("seen",!0))},l=function(a){a.removeAttr("data-seen"),a.hasClass("active")&&(j(a),a.data("seen",!0))},m=function(a){a.data("seen")||(j(a),a.data("seen",!0))};return{init:k,reset:l,shown:m}});