芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/.trash/cepali/message/output/popup/amd/build/notification_area_control_area.min.js
define(["jquery","core/templates","core/notification","core/custom_interaction_events","message_popup/notification_repository","message_popup/notification_area_events"],function(a,b,c,d,e,f){var g={CONTAINER:'[data-region="notification-area"]',CONTENT:'[data-region="content"]',NOTIFICATION:'[data-region="notification-content-item-container"]',CAN_RECEIVE_FOCUS:'input:not([type="hidden"]), a[href], button, textarea, select, [tabindex]'},h={NOTIFICATION:"message_popup/notification_content_item"},i=function(b,c){this.root=a(b),this.container=this.root.closest(g.CONTAINER),this.userId=c,this.content=this.root.find(g.CONTENT),this.offset=0,this.limit=20,this.initialLoad=!1,this.isLoading=!1,this.loadedAll=!1,this.notifications={},this.registerEventListeners()};return i.prototype.getRoot=function(){return this.root},i.prototype.getContainer=function(){return this.container},i.prototype.getUserId=function(){return this.userId},i.prototype.getContent=function(){return this.content},i.prototype.getOffset=function(){return this.offset},i.prototype.getLimit=function(){return this.limit},i.prototype.setOffset=function(a){this.offset=a},i.prototype.setLimit=function(a){this.limit=a},i.prototype.incrementOffset=function(){this.offset+=this.limit},i.prototype.startLoading=function(){this.isLoading=!0,this.getRoot().addClass("loading")},i.prototype.stopLoading=function(){this.isLoading=!1,this.getRoot().removeClass("loading")},i.prototype.hasDoneInitialLoad=function(){return this.initialLoad},i.prototype.hasLoadedAllContent=function(){return this.loadedAll},i.prototype.setLoadedAllContent=function(a){this.loadedAll=a},i.prototype.setCacheNotification=function(a){this.notifications[a.id]=a},i.prototype.getCacheNotification=function(a){return this.notifications[a]},i.prototype.getNotificationElement=function(a){var b=this.getRoot().find(g.NOTIFICATION+'[data-id="'+a+'"]');return 1==b.length?b:null},i.prototype.scrollNotificationIntoView=function(a){var b=a.position(),c=this.getRoot(),d=b.top-c.scrollTop();if(d>c.innerHeight()){var e=a.outerHeight();e=4*e;var f=b.top-e;c.scrollTop(f)}},i.prototype.showNotification=function(b){if("object"!=typeof b&&(b=this.getNotificationElement(b)),b&&b.length){this.getRoot().find(g.NOTIFICATION).removeClass("selected"),b.addClass("selected").find(g.CAN_RECEIVE_FOCUS).focus();var c=b.attr("data-id"),d=this.getCacheNotification(c);this.scrollNotificationIntoView(b),this.getContainer().trigger(f.showNotification,[a.extend({},d)])}},i.prototype.markNotificationAsRead=function(a){return e.markAsRead(a.attr("data-id")).done(function(){a.removeClass("unread")})},i.prototype.renderNotifications=function(c){var d=[],e=this.getContent();return a.each(c,function(a,c){var e=c.contexturl;delete c.contexturl;var f=b.render(h.NOTIFICATION,c).then(function(a,b){return c.contexturl=e,this.setCacheNotification(c),{html:a,js:b}}.bind(this));d.push(f)}.bind(this)),a.when.apply(a,d).then(function(){a.each(arguments,function(a,c){e.append(c.html),b.runTemplateJS(c.js)})})},i.prototype.loadMoreNotifications=function(){if(this.isLoading||this.hasLoadedAllContent())return a.Deferred().resolve();this.startLoading();var b={limit:this.getLimit(),offset:this.getOffset(),useridto:this.getUserId()};this.initialLoad||(b.limit=this.getOffset()+this.getLimit(),b.offset=0);var c=e.query(b).then(function(a){var b=a.notifications;return this.unreadCount=a.unreadcount,this.setLoadedAllContent(!b.length||b.length