-<h3 class="settings-heading"><a href="javascript:;">{{$h_not}}</a></h3>
-<div class="settings-content-block">
-<div id="settings-notifications">
-
-<div id="settings-notify-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>
-
-{{include file="field_checkbox.tpl" field=$email_textonly}}
-{{include file="field_checkbox.tpl" field=$detailed_notif}}
-
-
-<!--
-<div class="field">
- <button onclick="javascript:Notification.requestPermission(function(perm){if(perm === 'granted')alert('{{$desktop_notifications_success_message}}');});return false;">{{$desktop_notifications}}</button>
- <span class="field_help">{{$desktop_notifications_note}}</span>
-</div>
--->
-{{include file="field_yesno.tpl" field=$desktop_notifications}}
-<script>
-(function(){
- var elm = $("#id_{{$desktop_notifications.0}}_onoff");
- var ckbox = $("#id_{{$desktop_notifications.0}}");
-
- if (getNotificationPermission() === 'granted') {
- ckbox.val(1);
- elm.find(".off").addClass("hidden");
- elm.find(".on").removeClass("hidden");
- }
- if (getNotificationPermission() === null) {
- elm.parent(".field.yesno").hide();
- }
-
- $("#id_{{$desktop_notifications.0}}_onoff").on("click", function(e){
-
- if (Notification.permission === 'granted') {
- localStorage.setItem('notification-permissions', ckbox.val()==1 ? 'granted' : 'denied');
- } else if (Notification.permission === 'denied') {
- localStorage.setItem('notification-permissions', 'denied');
-
- ckbox.val(0);
- elm.find(".on").addClass("hidden");
- elm.find(".off").removeClass("hidden");
-
- } else if (Notification.permission === 'default') {
- Notification.requestPermission(function(choice) {
- if (choice === 'granted') {
- localStorage.setItem('notification-permissions', ckbox.val()==1 ? 'granted' : 'denied');
-
- } else {
- localStorage.setItem('notification-permissions', 'denied');
- ckbox.val(0);
- elm.find(".on").addClass("hidden");
- elm.find(".off").removeClass("hidden");
- }
- });
- }
-
- //console.log(getNotificationPermission());
-
-
- })
-})();
-</script>
-
-</div>
-
-<div class="settings-submit-wrapper" >
-<input type="submit" name="submit" class="settings-submit" value="{{$submit|escape:'html'}}" />
-</div>
-</div>
+ <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>