<!DOCTYPE html> <html lang="en" xmlns="http://www.w3.org/1999/html"> <head> <meta charset="UTF-8"> <title>Title</title> <style> #drop-area { border: 2px dashed #ccc; border-radius: 20px; font-family: sans-serif; margin: 10px auto; padding: 20px; } #drop-area.highlight { border-color: purple; opacity: 1; } p { margin-top: 0; text-align: center; } .my-form { margin-bottom: 10px; } #fileElem { display: none; } </style> </head> <body> <div id="drop-area"> <form class="my-form"> <p>Drag Image Here</p> <input type="file" id="fileElem" multiple accept="image/*" onchange="handleFiles(this.files)"> </form> </div>
<input type="file" id="fileElem" multiple accept="image/*" onchange="handleFiles(this.files)">5. Script (ScriptTxt variable):
let dropArea = document.getElementById(''drop-area''); dropArea.addEventListener(''dragenter'', highlight, false); dropArea.addEventListener(''dragover'', highlight, false); dropArea.addEventListener(''dragleave'', unhighlight, false); dropArea.addEventListener(''drop'', unhighlight, false); dropArea.addEventListener(''dragenter'', preventDefaults, false); dropArea.addEventListener(''dragover'', preventDefaults, false); dropArea.addEventListener(''dragleave'', preventDefaults, false); dropArea.addEventListener(''drop'', preventDefaults, false); function preventDefaults (e) { e.preventDefault(); e.stopPropagation(); }; function highlight(e) { dropArea.classList.add(''highlight'') }; function unhighlight(e) { dropArea.classList.remove(''highlight'') }; dropArea.addEventListener(''drop'', handleDrop, false); function handleDrop(e) { let file = e.dataTransfer.files[0]; reader = new FileReader(); reader.onload = function (event) { window.parent.WebPageViewerHelper.TriggerCallback(file.name + ''$$'' + event.target.result.split('','')[1]) }; reader.readAsDataURL(file); }
CurrPage.PictureViewer.SetContent(PageTxt, scriptTxt)and send our HTML and Script to the WebPageViewer AddIn