1(() => { 2 var __getOwnPropNames = Object.getOwnPropertyNames; 3 var __commonJS = (cb, mod) => function __require() { 4 return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; 5 }; 6 7 // app/javascript/packs/popbox.js 8 var require_popbox = __commonJS({ 9 "app/javascript/packs/popbox.js"(exports, module) { 10 window.Popbox = function() { 11 let current = null; 12 const template = function(options) { 13 const attributes = Object.keys(options).reduce(function(acc, key) { 14 return `${acc} ${key}="${options[key]}" `; 15 }, ""); 16 return ` 17 <dialog-modal ${attributes}> 18 <dialog-content> 19 <dialog-header></dialog-header> 20 <dialog-body></dialog-body> 21 <dialog-actions></dialog-actions> 22 </dialog-content> 23 </dialog-modal> 24 `; 25 }, setTitle = function(optionsOrTitle) { 26 let title; 27 if (typeof optionsOrTitle === "object" && optionsOrTitle.hasOwnProperty("title")) { 28 title = optionsOrTitle.title; 29 } else if (typeof optionsOrTitle === "string") { 30 title = optionsOrTitle; 31 } 32 if (title) { 33 let header = current.querySelector("dialog-header"); 34 let node = document.createElement("dialog-title"); 35 node.innerHTML = title; 36 header.appendChild(node); 37 } 38 }, setContent = function(content) { 39 let node = current.querySelector("dialog-body"); 40 if (typeof content.hasChildNodes === "function") { 41 node.innerHTML = ""; 42 node.appendChild(content); 43 } else if (typeof content === "string") { 44 node.innerHTML = content; 45 } 46 }, appendToBody = function(options) { 47 document.body.insertAdjacentHTML("beforeend", template(options)); 48 return document.body.lastElementChild; 49 }, launchScripts = function() { 50 if (current.hasAttribute("runscripts")) { 51 current.querySelectorAll("script").forEach((scrpt) => { 52 eval(scrpt.textContent); 53 }); 54 } 55 }, show = function() { 56 current.open(); 57 }, hide = function() { 58 current.setAttribute("closing", ""); 59 }, destroy = function() { 60 current.setAttribute("die", ""); 61 }, create = function(content, options = {}) { 62 if (!content && !options.hasOwnProperty("src") && !options.hasOwnProperty("encodedsrc")) { 63 return console.error("Popbox dialog content required"); 64 } else { 65 current = appendToBody(options); 66 setTitle(options); 67 setContent(content); 68 launchScripts(); 69 show(); 70 return { 71 setTitle, 72 setContent, 73 show, 74 hide, 75 destroy, 76 getNode: function(selector) { 77 return selector ? current.querySelector(selector) : current; 78 }, 79 getNodes: function(selector) { 80 return current.querySelectorAll(selector); 81 } 82 }; 83 } 84 }; 85 return { create }; 86 }; 87 window.Dialog = class { 88 constructor(...args) { 89 return Popbox().create(...args).getNode(); 90 } 91 }; 92 } 93 }); 94 require_popbox(); 95})(); 96//# sourceMappingURL=/assets/popbox-d55f59ef.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.