PageSourceSearch

https://www.mom.gov.sg/html/mom/js/notifications.js

js mom.gov.sg collected 2026-09-24 08:26:54 UTC 1,893 bytes, 78 lines download raw bytes

1
2(function(MOM, $, window, document) {
3
4    "use strict";
5    /**
6     * Dependency
7     * MOM.cookies
8     */
9
10    var nNameSpace = "mom-n-";
11
12
13    MOM.notifications = {
14        init: function() {
15
16            /**
17             * Bind alert__close to notifications
18             */
19
20            MOM.$body.on("click.closenotification",
21                ".notification-close",
22                function(e) {
23
24                    var $notice = $(this).closest(".notification"),
25                        id = $notice.data("notification-id");
26
27
28                    $notice.slideUp(function() {
29                        $(this).remove();
30
31                        /* Refresh notification */
32
33                        MOM.$body.trigger("refresh.notification");
34                    });
35
36                    MOM.cookies.set(nNameSpace + id, true, 1000);
37
38                    e.preventDefault();
39                });
40
41            /**
42             * Check if notifications should be shown
43             */
44
45            this.$notifications = MOM.$body.find(".notification");
46
47            $.each(this.$notifications,
48                function(idx, el) {
49
50                    var $this = $(this),
51                        notificationID = $this.data("notification-id");
52
53                    if (!MOM.cookies.get(nNameSpace + notificationID)) {
54
55                        /* Notificaiton hasnt been shown */
56
57                        $this.removeClass("js-hide");
58
59                        /* Refresh notification */
60
61                        MOM.$body.trigger("refresh.notification");
62                    }
63
64                });
65        }
66    };
67
68    /**
69     * Initialize Notifications on Page Load
70     */
71    $(window).on("load",
72        function() {
73
74            MOM.notifications.init();
75        });
76
77
78})(MOM || {}, jQuery, window, document);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.