Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replacing jQuery UI Dialog #311

Merged
merged 2 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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",
WardCunningham marked this conversation as resolved.
Show resolved Hide resolved
(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
Loading