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;