| 1 |
(function() { |
| 2 |
var cfg = document.getElementById('page-item-1-cfg'); |
| 3 |
var itemId = cfg.dataset.itemId; |
| 4 |
var content = document.getElementById('license-text-content'); |
| 5 |
if (!content) return; |
| 6 |
var details = content.closest('details'); |
| 7 |
if (!details) return; |
| 8 |
var loaded = false; |
| 9 |
details.addEventListener('toggle', function() { |
| 10 |
if (details.open && !loaded) { |
| 11 |
loaded = true; |
| 12 |
fetch('/api/items/' + itemId + '/license.txt') |
| 13 |
.then(function(r) { return r.text(); }) |
| 14 |
.then(function(t) { content.textContent = t; }) |
| 15 |
.catch(function() { content.textContent = 'Failed to load license text.'; }); |
| 16 |
} |
| 17 |
}); |
| 18 |
})(); |
| 19 |
|