TvBox/jav/lib/notifications-global-40e14cc64ab7.js

2 lines
14 KiB
JavaScript
Raw Normal View History

2025-07-03 20:15:22 +08:00
"use strict";(globalThis.webpackChunk=globalThis.webpackChunk||[]).push([["notifications-global"],{70396:(e,t,o)=>{o.d(t,{a:()=>s,n:()=>n});var i=o(97797);function n(){let e=document.getElementById("ajax-error-message");e&&(e.hidden=!1)}function s(){let e=document.getElementById("ajax-error-message");e&&(e.hidden=!0)}(0,i.on)("deprecatedAjaxError","[data-remote]",function(e){let{error:t,text:o}=e.detail;e.currentTarget===e.target&&"abort"!==t&&"canceled"!==t&&(/<html/.test(o)?(n(),e.stopImmediatePropagation()):setTimeout(function(){e.defaultPrevented||n()},0))}),(0,i.on)("deprecatedAjaxSend","[data-remote]",function(){s()}),(0,i.on)("click",".js-ajax-error-dismiss",function(){s()})},35111:(e,t,o)=>{var i=o(39595),n=o(70396),s=o(97325),a=o(26559);function l(e,t,o,i){var n,s=arguments.length,a=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,i);else for(var l=e.length-1;l>=0;l--)(n=e[l])&&(a=(s<3?n(a):s>3?n(t,o,a):n(t,o))||a);return s>3&&a&&Object.defineProperty(t,o,a),a}let r=class NotificationsListSubscriptionFormElement extends HTMLElement{async submitCustomForm(e){await this.submitForm(e),this.closeMenu()}async submitForm(e){e.preventDefault(),(0,n.a)();let t=e.currentTarget,o=new FormData(t),i=await self.fetch(t.action,{method:t.method,body:o,headers:{...(0,a.kt)(),Accept:"application/json"}});if(!i.ok)return void(0,n.n)();let s=await i.json(),l=o.get("do");"string"==typeof l&&this.updateCheckedState(l),"string"==typeof l&&this.updateMenuButtonCopy(l),this.updateSocialCount(s.count),this.applyInputsCheckedPropertiesToAttributesForNextFormReset(),this.closeMenu()}updateMenuButtonCopy(e){this.unwatchButtonCopy.hidden="subscribed"!==e&&"custom"!==e,this.stopIgnoringButtonCopy.hidden="ignore"!==e,this.watchButtonCopy.hidden="subscribed"===e||"custom"===e||"ignore"===e}applyInputsCheckedPropertiesToAttributesForNextFormReset(){for(let e of[...this.threadTypeCheckboxes])e.toggleAttribute("checked",e.checked)}updateCheckedState(e){for(let t of this.subscriptionButtons)t.setAttribute("aria-checked",t.value===e?"true":"false");if("custom"===e)this.customButton.setAttribute("aria-checked","true");else{for(let e of(this.customButton.setAttribute("aria-checked","false"),[...this.threadTypeCheckboxes]))(0,s.m$)(e,!1);if(void 0!==this.subscriptionsContainer){for(let e=0;e<this.subscriptionsLabels.length;e++)this.subscriptionsLabels[e].remove();void 0!==this.subscriptionsSubtitle&&this.subscriptionsSubtitle.toggleAttribute("hidden",!1),this.subscriptionsContainer.textContent=""}}}updateSocialCount(e){this.socialCount&&(this.socialCount.textContent=e,this.socialCount.setAttribute("aria-label",`${this.pluralizeUsers(e)} watching this repository`))}pluralizeUsers(e){return 1===parseInt(e)?"1 user is":`${e} users are`}handleDialogLabelToggle(e){let t=e.detail.wasChecked,o=e.detail.toggledLabelId,i=e.detail.templateLabelElementClone;if(t){for(let e=0;e<this.subscriptionsLabels.length;e++)if(this.subscriptionsLabels[e].getAttribute("data-label-id")===o){this.subscriptionsLabels[e].remove();break}}else i.removeAttribute("hidden"),i.setAttribute("data-targets","notifications-list-subscription-form.subscriptionsLabels"),this.subscriptionsContainer.appendChild(i)}openCustomDialog(e){e.preventDefault(),e.stopPropagation(),this.menu.toggleAttribute("hidden",!0),this.enableApplyButtonAndCheckbox(),this.saveCurrentLabelsState(),this.customDialog.toggleAttribute("hidden",!1),setTimeout(()=>{this.customDialog.querySelector("input[type=checkbox][autofocus]")?.focus()},0)}enableApplyButtonAndCheckbox(){this.customDialog.querySelectorAll('[data-type="label"]:not([hidden])').length>0&&(this.customSubmit.removeAttribute("disabled"),this.threadTypeCheckboxes[0].checked=!0)}closeCustomDialog(e){e.preventDefault(),e.stopPropagation(),this.menu.toggleAttribute("hidden",!1),this.customDialog.toggleAttribute("hidden",!0),setTimeout(()=>{this.customButton.focus()},0)}resetFilterLabelsDialog(e){e.preventDefault(),e.stopPropagation();for(let e=0;e<this.subscriptions
//# sourceMappingURL=notifications-global-ac2d8805d636.js.map