PageSourceSearch

https://prattcenter.net/assets/gray_matter/utility/dialog-d2e39460…bf9645b0ead8a3ef9edf498ee956fcb51798d677.js

js prattcenter.net collected 2026-09-24 18:05:00 UTC 1,804 bytes, 51 lines download raw bytes

1// Copyright (c) 2021-2025 GrayBits LLC
2
3import * as Cancellator from 'gray_matter/utility/cancellator'
4import * as Builder from 'gray_matter/utility/builder'
5import * as EventHelpers from 'gray_matter/utility/event_helpers'
6
7export default class Dialog{
8  constructor(element, content){
9    this.createDialog(element, content);
10  }
11
12  async response(resolver){
13    return new Promise((resolve, reject) => {
14      this.resolve = resolve;
15    });
16  }
17
18  createDialog(element, content, confirm, cancel, right){
19    this.dialog = Builder.createElement('div', {class: ['dialog', 'prepop']});
20    this.close = Builder.createElement('button', {class: ['button', 'close', 'cancel_dialog', 'icon_only']});
21    this.close.innerHTML = 'Close';
22    this.content = content.call(this);
23    this.dialog.appendChild(this.content);
24    this.dialog.appendChild(this.close);
25    this.parent = element.closest('.scrollable') || document.body;
26    this.dialog.interface = this;
27    let rect_parent = this.parent.getBoundingClientRect();
28    let rect_element = element.getBoundingClientRect();
29    if (right){
30      this.dialog.style.right = (rect_parent.x + rect_parent.width - rect_element.width - rect_element.x) + 'px';
31    } else {
32      this.dialog.style.left = (rect_element.x - rect_parent.x) + 'px';
33    }
34    this.dialog.style.top = (rect_element.y - rect_parent.y + this.parent.scrollTop) + 'px';
35    this.parent.appendChild(this.dialog);
36    EventHelpers.add(this.dialog.querySelectorAll('.cancel_dialog'), 'click', (e) => { this.cancelEntry(); });    
37    this.dialog.offsetHeight;
38    this.dialog.classList.remove('prepop');
39  }
40
41  cancelEntry(){
42    this.resolve(false);
43    this.destroyDialog();
44  }
45  destroyDialog(){
46    this.dialog.remove();
47  }
48  static init(){
49    Cancellator.register('dialog');
50  }
51};

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.