+ <h2 class="settings-heading"><a href="javascript:;">{{$h_not}}</a></h2>
+ <div class="settings-content-block">
+ <div id="settings-notifications">
+
+ <div id="settings-notification-desc">{{$lbl_not}}</div>
+
+ <div class="group">
+ {{include file="field_intcheckbox.tpl" field=$notify1}}
+ {{include file="field_intcheckbox.tpl" field=$notify2}}
+ {{include file="field_intcheckbox.tpl" field=$notify3}}
+ {{include file="field_intcheckbox.tpl" field=$notify4}}
+ {{include file="field_intcheckbox.tpl" field=$notify5}}
+ {{include file="field_intcheckbox.tpl" field=$notify6}}
+ {{include file="field_intcheckbox.tpl" field=$notify7}}
+ {{include file="field_intcheckbox.tpl" field=$notify8}}
+ </div>
+
+ <div id="settings-notify-desc">{{$lbl_notify}}</div>
+
+ <div class="group">
+ {{include file="field_checkbox.tpl" field=$notify_like}}
+ {{include file="field_checkbox.tpl" field=$notify_announce}}
+ </div>
+
+ {{include file="field_checkbox.tpl" field=$email_textonly}}
+ {{include file="field_checkbox.tpl" field=$detailed_notif}}
+
+ {{include file="field_checkbox.tpl" field=$notify_ignored}}
+
+ {{include file="field_checkbox.tpl" field=$desktop_notifications}}
+ <script>
+ (function () {
+ let $notificationField = $("#div_id_{{$desktop_notifications.0}}");
+ let $notificationCheckbox = $("#id_{{$desktop_notifications.0}}");
+
+ if (getNotificationPermission() === 'granted') {
+ $notificationCheckbox.prop('checked', true);
+ }
+ if (getNotificationPermission() === null) {
+ $notificationField.hide();
+ }
+
+ $notificationCheckbox.on('change', function (e) {
+ if (Notification.permission === 'granted') {
+ localStorage.setItem('notification-permissions', $notificationCheckbox.prop('checked') ? 'granted' : 'denied');
+ } else if (Notification.permission === 'denied') {
+ localStorage.setItem('notification-permissions', 'denied');
+
+ $notificationCheckbox.prop('checked', false);
+ } else if (Notification.permission === 'default') {
+ Notification.requestPermission(function (choice) {
+ if (choice === 'granted') {
+ localStorage.setItem('notification-permissions', $notificationCheckbox.prop('checked') ? 'granted' : 'denied');
+ } else {
+ localStorage.setItem('notification-permissions', 'denied');
+ $notificationCheckbox.prop('checked', false);
+ }
+ });
+ }
+ })
+ })();
+ </script>