Files
neorelay/files/glowing-bear/neodrop-plugin.js.inc
T
NIA Sanitized Release Publisher 7141326ea0 Sanitized public release v1.0.3
Source-Tag: v1.0.3
Manifest-SHA256: b7b09bf48f9e092ed8ad82f99c0319d6c3837d0a1549bd0cc4a374276c0f3896
2026-07-20 22:35:36 +00:00

28 lines
1.3 KiB
PHP

function neoDropFrame(url, kind) {
return function() {
var element = this.getElement();
var frame = document.createElement('iframe');
frame.src = url.replace('?k=', '?embed=1&k=');
frame.title = 'Encrypted NeoDrop ' + kind + ' preview';
frame.width = '100%';
frame.height = kind === 'audio' ? '80' : kind === 'text' ? '420' : '520';
frame.loading = 'lazy';
frame.referrerPolicy = 'no-referrer';
frame.setAttribute('sandbox', 'allow-scripts allow-same-origin allow-downloads');
frame.setAttribute('frameborder', '0');
element.replaceChildren(frame);
};
}
var neoDropMediaPlugin = new UrlPlugin('NeoDrop media', function(url) {
var match = url.match(/^https:\/\/{{DROPS_HOST_REGEX}}\/d\/([A-Za-z0-9_-]{32})\?k=(image|audio|video)#d1\.([A-Za-z0-9_-]{43})$/);
return match ? neoDropFrame(url, match[2]) : null;
});
neoDropMediaPlugin.exclusive = true;
var neoDropTextPlugin = new UrlPlugin('NeoDrop preview', function(url) {
var match = url.match(/^https:\/\/{{DROPS_HOST_REGEX}}\/d\/([A-Za-z0-9_-]{32})\?k=text#d1\.([A-Za-z0-9_-]{43})$/);
return match ? neoDropFrame(url, 'text') : null;
});
neoDropTextPlugin.exclusive = true;