Changeset e27b8db in Klonkt for src/assets/js
- Timestamp:
- 07/29/2026 10:04:36 AM (6 weeks ago)
- Branches:
- main
- Children:
- 329873e
- Parents:
- 88d7c8f
- File:
-
- 1 edited
-
src/assets/js/guardian.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/assets/js/guardian.js
r88d7c8f re27b8db 213 213 panel.appendChild(h); 214 214 return h; 215 } 216 217 function gateButton(w, feature, current, proposeLabel, onLabel, offLabel) { 218 var known = current === true || current === false; 219 var btn = el('button', 'quiet small', (known ? (current ? onLabel : offLabel) : proposeLabel) || feature); 220 btn.addEventListener('click', function () { 221 btn.disabled = true; 222 fetch('/guardian/wards/embeds', { 223 method: 'POST', headers: { 'Content-Type': 'application/json' }, 224 body: JSON.stringify({ uri: w.other_uri, feature: feature, allow: known ? !current : true }), 225 }).then(function (r) { return r.json(); }) 226 .then(function (j) { 227 if (j && j.state === 'open') { 228 btn.textContent = (T.embeds_waiting || 'waiting for the other guardians'); 229 btn.disabled = true; 230 return; 231 } 232 refresh(); 233 }) 234 .catch(function () { btn.disabled = false; }); 235 }); 236 return btn; 215 237 } 216 238 … … 337 359 set.appendChild(el('h3', null, T.settings_title || 'Settings')); 338 360 var setRow = el('div', 'row'); 339 setRow.appendChild(embedsButton(w)); 361 setRow.appendChild(gateButton(w, 'shaer:externalEmbeds', w.embeds, T.embeds_propose, T.embeds_on, T.embeds_off)); 362 // The heavier sibling (5.6): seeing that a video exists is one decision, 363 // letting a third party's player run inside the app is another. Only 364 // offered once previews are on: you cannot play what you may not see. 365 if (w.embeds === true) { 366 setRow.appendChild(gateButton(w, 'shaer:externalPlayback', w.playback, T.play_propose, T.play_on, T.play_off)); 367 } 340 368 set.appendChild(setRow); 341 369 panel.appendChild(set);
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)