<div style="display: none;">
<div id="advanced-expire-popup" style="width:auto;height:auto;overflow:auto;">
<h3>{{$expire.advanced}}</h3>
- {{include file="field_yesno.tpl" field=$expire.items}}
- {{include file="field_yesno.tpl" field=$expire.notes}}
- {{include file="field_yesno.tpl" field=$expire.starred}}
- {{include file="field_yesno.tpl" field=$expire.network_only}}
+ {{include file="field_checkbox.tpl" field=$expire.items}}
+ {{include file="field_checkbox.tpl" field=$expire.notes}}
+ {{include file="field_checkbox.tpl" field=$expire.starred}}
+ {{include file="field_checkbox.tpl" field=$expire.network_only}}
</div>
</div>
<div class="settings-content-block">
<div id="settings-notifications">
-<div id="settings-notify-desc">{{$lbl_not}}</div>
+<div id="settings-notification-desc">{{$lbl_not}}</div>
<div class="group">
{{include file="field_intcheckbox.tpl" field=$notify1}}
{{include file="field_checkbox.tpl" field=$email_textonly}}
{{include file="field_checkbox.tpl" field=$detailed_notif}}
-{{include file="field_yesno.tpl" field=$desktop_notifications}}
+{{include file="field_checkbox.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");
- }
+ let $notificationField = $("#div_id_{{$desktop_notifications.0}}");
+ let $notificationCheckbox = $("#id_{{$desktop_notifications.0}}");
+
+ if (getNotificationPermission() === 'granted') {
+ $notificationCheckbox.prop('checked', true);
+ }
if (getNotificationPermission() === null) {
- elm.parent(".field.yesno").hide();
+ $notificationField.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());
-
-
- })
+ $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>