Skip to content

Commit

Permalink
Merge pull request #311 from fedwiki/paul90/dialog
Browse files Browse the repository at this point in the history
Replacing jQuery UI Dialog
  • Loading branch information
paul90 authored Feb 27, 2024
2 parents 245b3a6 + bbdcaff commit 321199f
Show file tree
Hide file tree
Showing 19 changed files with 85 additions and 36 deletions.
23 changes: 23 additions & 0 deletions client/dialog/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<title></title>
<link id="favicon" href="/favicon.png" rel="icon" type="image/png" />
<link href="/dialog/style.css" rel="stylesheet" />
<script>
window.addEventListener(
"message",
(event) => {
const data = event.data
console.log('data', data)
document.title = data.title
document.querySelector('.page').innerHTML = data.body
}
)
</script>
</head>
<body>
<div class="page">
</div>
</body>
</html>
48 changes: 48 additions & 0 deletions client/dialog/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
body {
inset: 0;
position: absolute;
background: #eee url('/images/crosses.png');
padding: 0;
margin: 0;
line-height: 1.3;
color: #333;
}
.page {
margin: 8px;
outline: none;
box-shadow: 2px 1px 4px rgba(0,0,0,0.2);
background: #eee;
padding: 8px;
position: absolute;
inset: 0px;
overflow: auto;
scrollbar-gutter: stable;
scrollbar-width: thin;
scrollbar-color: #ccc #eee;
}
p {
margin: 8px;
}
.remote {
vertical-align: text-top;
width: 16px;
height: 16px
}
a {
text-decoration: none;
}

:is(#authors,#provenance) a {
margin-left: 16px;
}

.page:has(>img,svg) {
overflow: hidden;
scrollbar-gutter: auto;
}

.page > img,svg{
width: auto !important;
max-width: 100%;
max-height: 100%;
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
7 changes: 0 additions & 7 deletions client/js/jquery-ui/1.11.4/jquery-ui.min.css

This file was deleted.

13 changes: 0 additions & 13 deletions client/js/jquery-ui/1.11.4/jquery-ui.min.js

This file was deleted.

29 changes: 14 additions & 15 deletions lib/dialog.coffee
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
# Dialog manages a single <div> that is used to present a
# jQuery UI dialog used for detail display, usually on
# double click.
# Dialog manages a single popup window that is used to present a
# dialog used for detail display, usually on double click.

resolve = require './resolve'

$dialog = null
open = (title, html) ->
body = html
if typeof html is 'object'
body = html[0].outerHTML

emit = ->
$dialog = $('<div></div>')
.html('This dialog will show every time!')
.dialog { autoOpen: false, title: 'Basic Dialog', height: 600, width: 800 }
dialogWindow = window.open('/dialog/#', 'dialog', 'popup,height=600,width=800')

open = (title, html) ->
$dialog.html html
$dialog.dialog "option", "title", resolve.resolveLinks(title)
$dialog.dialog 'open'
if dialogWindow.location.pathname isnt '/dialog/'
# this will only happen when popup is first opened.
dialogWindow.addEventListener 'load', (event) ->
dialogWindow.postMessage({ title, body }, window.origin)
else
dialogWindow.postMessage({ title, body }, window.origin)

module.exports = {emit, open}
module.exports = { open }
1 change: 0 additions & 1 deletion lib/legacy.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ wiki.origin.get 'system/factories.json', (error, data) ->
preLoadEditors data

$ ->
dialog.emit()

# FUNCTIONS used by plugins and elsewhere

Expand Down

0 comments on commit 321199f

Please sign in to comment.