dismiss-admin-notice.js
811 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
(function($) {
$(function() {
$('.revaddon-dismiss-notice').off().each(function() {
var noticeId = this.dataset.noticeid,
storedNoticeId;
try {
storedNoticeId = localStorage.getItem(this.dataset.addon);
}
catch(e) {
storedNoticeId = false;
}
if(noticeId !== storedNoticeId) {
$(this).closest('.revaddon-notice').show();
}
else {
$(this).closest('.revaddon-notice').hide();
}
// localStorage.removeItem(this.dataset.addon);
}).on('click', function() {
var $this = $(this);
$this.closest('.revaddon-notice').fadeOut(400, function() {$this.hide();});
try {
localStorage.setItem(this.dataset.addon, this.dataset.noticeid);
}
catch(e) {}
});
});
})(jQuery);