Show More
Commit Description:
fix destroy button link...
Commit Description:
fix destroy button link
(grafted from b75d9cfe4ee0550d574de4c4836ecc36c9354c53)
References:
File last commit:
Show/Diff file:
Action:
app/assets/javascripts/announcement_refresh.js
| 41 lines
| 1.0 KiB
| application/javascript
| JavascriptLexer
|
|
r322 | |||
var Announcement = { | ||||
mostRecentId: 0, | ||||
refreshUrl: '/main/announcements', | ||||
setMostRecentId: function(id) { | ||||
Announcement.mostRecentId = id; | ||||
}, | ||||
updateRecentId: function(id) { | ||||
if(Announcement.mostRecentId < id) | ||||
Announcement.mostRecentId = id; | ||||
}, | ||||
refreshAnnouncement: function() { | ||||
var url = Announcement.refreshUrl; | ||||
new Ajax.Request(url, { | ||||
method: 'get', | ||||
parameters: { recent: Announcement.mostRecentId }, | ||||
onSuccess: function(transport) { | ||||
if((transport.status == 200) && | ||||
(transport.responseText.match(/\S/)!=null)) { | ||||
var announcementBody = $("announcementbox-body"); | ||||
announcementBody.insert({ top: transport.responseText }); | ||||
var announcementBoxes = $$(".announcementbox"); | ||||
if(announcementBoxes.length!=0) | ||||
announcementBoxes[0].show(); | ||||
Announcement.registerRefreshEventTimer(); | ||||
} | ||||
} | ||||
}); | ||||
}, | ||||
registerRefreshEventTimer: function() { | ||||
setTimeout(function () { | ||||
Announcement.refreshAnnouncement(); | ||||
}, 30000); | ||||
} | ||||
}; | ||||