Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion js/files_downloadlimit-public.mjs
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
import{l as w,b as f,t as m,a as p}from"./logger-Bt8zOUpV.chunk.mjs";const{limit:a,downloads:c}=w("files_downloadlimit","download_limit",{limit:-1,downloads:0});f.debug("Download limit",{limit:a,downloads:c});let t=a-c,r=0;function s(e,o){o===0?e.innerText=m("files_downloadlimit","You have reached the maximum amount of downloads allowed"):e.innerText=p("files_downloadlimit","1 remaining download allowed","{count} remaining downloads allowed",o,{count:o})}window.addEventListener("DOMContentLoaded",()=>{if(a<1)return;const e=document.getElementById("header-primary-action");if(!e)return;const o=document.createElement("span");o.setAttribute("style","color: var(--color-primary-text); padding: 0 10px;"),s(o,t),e.prepend(o);const i=document.querySelector("#files-public-content");if(!i)return;i.oncontextmenu=n=>(n.preventDefault(),n.stopPropagation(),!1);const d=Array.from(document.querySelectorAll('a[href*="/download/"]'));new Set(d).forEach(n=>{n.addEventListener("click",l=>{if(r>0&&!confirm(m("files_downloadlimit","This share has a limited number of downloads. Are you sure you want to trigger a new download?"))){l.preventDefault(),l.stopPropagation();return}t--,r++,s(o,t),t===0&&[...d].forEach(u=>u.remove())})})});
import{l as w,b as f,t as m,a as p}from"./logger-Bt8zOUpV.chunk.mjs";const{limit:a,downloads:c}=w("files_downloadlimit","download_limit",{limit:-1,downloads:0});f.debug("Download limit",{limit:a,downloads:c});let t=a-c,r=0;function s(e,o){o===0?e.innerText=m("files_downloadlimit","You have reached the maximum amount of downloads allowed"):e.innerText=p("files_downloadlimit","1 remaining download allowed","{count} remaining downloads allowed",o,{count:o})}window.addEventListener("DOMContentLoaded",()=>{if(a<1)return;const e=document.getElementById("header-primary-action");if(!e)return;const o=document.createElement("span");o.setAttribute("style","color: var(--color-background-plain-text, var(--color-primary-text)); padding: 0 10px;"),s(o,t),e.prepend(o);const i=document.querySelector("#files-public-content");if(!i)return;i.oncontextmenu=n=>(n.preventDefault(),n.stopPropagation(),!1);const l=Array.from(document.querySelectorAll('a[href*="/download/"]'));new Set(l).forEach(n=>{n.addEventListener("click",d=>{if(r>0&&!confirm(m("files_downloadlimit","This share has a limited number of downloads. Are you sure you want to trigger a new download?"))){d.preventDefault(),d.stopPropagation();return}t--,r++,s(o,t),t===0&&[...l].forEach(u=>u.remove())})})});
//# sourceMappingURL=files_downloadlimit-public.mjs.map
2 changes: 1 addition & 1 deletion js/files_downloadlimit-public.mjs.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/public.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ window.addEventListener('DOMContentLoaded', () => {
}

const span = document.createElement('span')
span.setAttribute('style', 'color: var(--color-primary-text); padding: 0 10px;')
span.setAttribute('style', 'color: var(--color-background-plain-text, var(--color-primary-text)); padding: 0 10px;')
updateCounter(span, count)
container.prepend(span)

Expand Down
Loading