Skip to content

Commit 15e6459

Browse files
committed
fix: alt update button
1 parent 18b658c commit 15e6459

1 file changed

Lines changed: 30 additions & 2 deletions

File tree

src/base/updates.js

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,41 @@ wrap(() => {
7474
return false;
7575
}
7676
latest.set(data);
77+
const path = `underscript@${data.version}/${data.unpkg}`;
7778
updateToast = fn.toast({
7879
title: '[UnderScript] Update Available!',
7980
text: `Version ${data.version}.`,
80-
footer: 'Click to update',
81+
className: 'dismissable',
82+
buttons: [{
83+
text: 'Update',
84+
className: 'dismiss',
85+
css: {
86+
border: '',
87+
height: '',
88+
background: '',
89+
'font-size': '',
90+
margin: '',
91+
'border-radius': '',
92+
},
93+
}, {
94+
text: 'Update (Alt)',
95+
className: 'dismiss',
96+
css: {
97+
border: '',
98+
height: '',
99+
background: '',
100+
'font-size': '',
101+
margin: '',
102+
'border-radius': '',
103+
},
104+
onclick: (e) => {
105+
location.href = `https://cdn.jsdelivr.net/npm/${path}`;
106+
this.close('update');
107+
},
108+
}],
81109
onClose(reason) {
82110
if (reason !== 'dismissed') return;
83-
location.href = `${baseURL}/underscript@${data.version}/${data.unpkg}`;
111+
location.href = `${baseURL}/${path}`;
84112
},
85113
});
86114
return true;

0 commit comments

Comments
 (0)