Fossil SCM

Made chat drop zone smaller by replacing its text with a helplet button. Added 'chat' table to the list of those NOT nuked by rebuild.

stephan 2020-12-23 14:21 chatroom-dev
Commit 85939ffcbe54d8562c6e2286eb32bed13bbc546ff6978cff78f6f5a2512fd77f
+1 -3
--- src/chat.c
+++ src/chat.c
@@ -103,11 +103,11 @@
103103
@ opacity: 0.8;
104104
@ }
105105
@ #chat-drop-zone {
106106
@ box-sizing: content-box;
107107
@ background-color: #e0e0e0;
108
- @ flex: 2 1 auto;
108
+ @ flex: 1 1 auto;
109109
@ padding: 0.5em 1em;
110110
@ border: 1px solid #808080;
111111
@ border-radius: 0.25em;
112112
@ }
113113
@ #chat-drop-zone.dragover {
@@ -126,12 +126,10 @@
126126
@ <input type="submit" value="Send">
127127
@ </div>
128128
@ <div id='chat-input-file'>
129129
@ <input type="file" name="file">
130130
@ <div id="chat-drop-zone">
131
- @ Drag/drop a file into this spot, or paste an image from
132
- @ the clipboard if supported by your environment.
133131
@ <div id="chat-drop-details"></div>
134132
@ </div>
135133
@ </div>
136134
@ </div>
137135
@ </form>
138136
--- src/chat.c
+++ src/chat.c
@@ -103,11 +103,11 @@
103 @ opacity: 0.8;
104 @ }
105 @ #chat-drop-zone {
106 @ box-sizing: content-box;
107 @ background-color: #e0e0e0;
108 @ flex: 2 1 auto;
109 @ padding: 0.5em 1em;
110 @ border: 1px solid #808080;
111 @ border-radius: 0.25em;
112 @ }
113 @ #chat-drop-zone.dragover {
@@ -126,12 +126,10 @@
126 @ <input type="submit" value="Send">
127 @ </div>
128 @ <div id='chat-input-file'>
129 @ <input type="file" name="file">
130 @ <div id="chat-drop-zone">
131 @ Drag/drop a file into this spot, or paste an image from
132 @ the clipboard if supported by your environment.
133 @ <div id="chat-drop-details"></div>
134 @ </div>
135 @ </div>
136 @ </div>
137 @ </form>
138
--- src/chat.c
+++ src/chat.c
@@ -103,11 +103,11 @@
103 @ opacity: 0.8;
104 @ }
105 @ #chat-drop-zone {
106 @ box-sizing: content-box;
107 @ background-color: #e0e0e0;
108 @ flex: 1 1 auto;
109 @ padding: 0.5em 1em;
110 @ border: 1px solid #808080;
111 @ border-radius: 0.25em;
112 @ }
113 @ #chat-drop-zone.dragover {
@@ -126,12 +126,10 @@
126 @ <input type="submit" value="Send">
127 @ </div>
128 @ <div id='chat-input-file'>
129 @ <input type="file" name="file">
130 @ <div id="chat-drop-zone">
 
 
131 @ <div id="chat-drop-details"></div>
132 @ </div>
133 @ </div>
134 @ </div>
135 @ </form>
136
+13 -2
--- src/chat.js
+++ src/chat.js
@@ -5,21 +5,20 @@
55
const _me = F.user.name;
66
/* State for paste and drag/drop */
77
const BlobXferState = {
88
dropZone: document.querySelector('#chat-drop-zone'),
99
dropDetails: document.querySelector('#chat-drop-details'),
10
- imgTag: document.querySelector('#chat-drop-details img'),
1110
blob: undefined
1211
};
1312
/** Updates the paste/drop zone with details of the pasted/dropped
1413
data. */
1514
const updateDropZoneContent = function(blob){
1615
const bx = BlobXferState, dd = bx.dropDetails;
1716
bx.blob = blob;
1817
D.clearElement(dd);
1918
if(!blob) return;
20
- D.append(dd, D.br(), "Name: ", blob.name,
19
+ D.append(dd, "Name: ", blob.name,
2120
D.br(), "Size: ",blob.size);
2221
if(blob.type && blob.type.startsWith("image/")){
2322
const img = D.img();
2423
D.append(dd, D.br(), img);
2524
const reader = new FileReader();
@@ -105,10 +104,22 @@
105104
updateDropZoneContent(items[0].getAsFile());
106105
}else if('string'===item.kind){
107106
item.getAsString((v)=>form.msg.value = v);
108107
}
109108
};
109
+ if(true){/* Add help button for drag/drop/paste zone */
110
+ const help = D.div();
111
+ BlobXferState.dropDetails.parentNode.insertBefore(
112
+ help,BlobXferState.dropDetails
113
+ );
114
+ F.helpButtonlets.create(
115
+ help,
116
+ "Drag/drop a file into this spot, or paste an image "+
117
+ "from the clipboard if supported by your environment."
118
+ );
119
+ }
120
+
110121
/* Injects element e as a new row in the chat, at the top of the list */
111122
const injectMessage = function f(e){
112123
if(!f.injectPoint){
113124
f.injectPoint = document.querySelector('#message-inject-point');
114125
}
115126
--- src/chat.js
+++ src/chat.js
@@ -5,21 +5,20 @@
5 const _me = F.user.name;
6 /* State for paste and drag/drop */
7 const BlobXferState = {
8 dropZone: document.querySelector('#chat-drop-zone'),
9 dropDetails: document.querySelector('#chat-drop-details'),
10 imgTag: document.querySelector('#chat-drop-details img'),
11 blob: undefined
12 };
13 /** Updates the paste/drop zone with details of the pasted/dropped
14 data. */
15 const updateDropZoneContent = function(blob){
16 const bx = BlobXferState, dd = bx.dropDetails;
17 bx.blob = blob;
18 D.clearElement(dd);
19 if(!blob) return;
20 D.append(dd, D.br(), "Name: ", blob.name,
21 D.br(), "Size: ",blob.size);
22 if(blob.type && blob.type.startsWith("image/")){
23 const img = D.img();
24 D.append(dd, D.br(), img);
25 const reader = new FileReader();
@@ -105,10 +104,22 @@
105 updateDropZoneContent(items[0].getAsFile());
106 }else if('string'===item.kind){
107 item.getAsString((v)=>form.msg.value = v);
108 }
109 };
 
 
 
 
 
 
 
 
 
 
 
 
110 /* Injects element e as a new row in the chat, at the top of the list */
111 const injectMessage = function f(e){
112 if(!f.injectPoint){
113 f.injectPoint = document.querySelector('#message-inject-point');
114 }
115
--- src/chat.js
+++ src/chat.js
@@ -5,21 +5,20 @@
5 const _me = F.user.name;
6 /* State for paste and drag/drop */
7 const BlobXferState = {
8 dropZone: document.querySelector('#chat-drop-zone'),
9 dropDetails: document.querySelector('#chat-drop-details'),
 
10 blob: undefined
11 };
12 /** Updates the paste/drop zone with details of the pasted/dropped
13 data. */
14 const updateDropZoneContent = function(blob){
15 const bx = BlobXferState, dd = bx.dropDetails;
16 bx.blob = blob;
17 D.clearElement(dd);
18 if(!blob) return;
19 D.append(dd, "Name: ", blob.name,
20 D.br(), "Size: ",blob.size);
21 if(blob.type && blob.type.startsWith("image/")){
22 const img = D.img();
23 D.append(dd, D.br(), img);
24 const reader = new FileReader();
@@ -105,10 +104,22 @@
104 updateDropZoneContent(items[0].getAsFile());
105 }else if('string'===item.kind){
106 item.getAsString((v)=>form.msg.value = v);
107 }
108 };
109 if(true){/* Add help button for drag/drop/paste zone */
110 const help = D.div();
111 BlobXferState.dropDetails.parentNode.insertBefore(
112 help,BlobXferState.dropDetails
113 );
114 F.helpButtonlets.create(
115 help,
116 "Drag/drop a file into this spot, or paste an image "+
117 "from the clipboard if supported by your environment."
118 );
119 }
120
121 /* Injects element e as a new row in the chat, at the top of the list */
122 const injectMessage = function f(e){
123 if(!f.injectPoint){
124 f.injectPoint = document.querySelector('#message-inject-point');
125 }
126
+1 -1
--- src/default.css
+++ src/default.css
@@ -1494,10 +1494,10 @@
14941494
/* User name for the post (a LEGEND element) */
14951495
.message-row .message-user {
14961496
border-radius: 0.25em 0.25em 0 0;
14971497
padding: 0 0.5em;
14981498
/*text-align: left; Firefox requires the 'align' attribute */
1499
- margin-left: 0.15em;
1499
+ margin: 0 0.15em;
15001500
padding: 0 0.5em 0em 0.5em;
15011501
margin-bottom: 0.4em;
15021502
cursor: pointer;
15031503
}
15041504
--- src/default.css
+++ src/default.css
@@ -1494,10 +1494,10 @@
1494 /* User name for the post (a LEGEND element) */
1495 .message-row .message-user {
1496 border-radius: 0.25em 0.25em 0 0;
1497 padding: 0 0.5em;
1498 /*text-align: left; Firefox requires the 'align' attribute */
1499 margin-left: 0.15em;
1500 padding: 0 0.5em 0em 0.5em;
1501 margin-bottom: 0.4em;
1502 cursor: pointer;
1503 }
1504
--- src/default.css
+++ src/default.css
@@ -1494,10 +1494,10 @@
1494 /* User name for the post (a LEGEND element) */
1495 .message-row .message-user {
1496 border-radius: 0.25em 0.25em 0 0;
1497 padding: 0 0.5em;
1498 /*text-align: left; Firefox requires the 'align' attribute */
1499 margin: 0 0.15em;
1500 padding: 0 0.5em 0em 0.5em;
1501 margin-bottom: 0.4em;
1502 cursor: pointer;
1503 }
1504
+1 -1
--- src/rebuild.c
+++ src/rebuild.c
@@ -394,11 +394,11 @@
394394
" WHERE type='table'"
395395
" AND name NOT IN ('admin_log', 'blob','delta','rcvfrom','user','alias',"
396396
"'config','shun','private','reportfmt',"
397397
"'concealed','accesslog','modreq',"
398398
"'purgeevent','purgeitem','unversioned',"
399
- "'subscriber','pending_alert','alert_bounce')"
399
+ "'subscriber','pending_alert','alert_bounce','chat')"
400400
" AND name NOT GLOB 'sqlite_*'"
401401
" AND name NOT GLOB 'fx_*'"
402402
);
403403
while( db_step(&q)==SQLITE_ROW ){
404404
blob_appendf(&sql, "DROP TABLE IF EXISTS \"%w\";\n", db_column_text(&q,0));
405405
--- src/rebuild.c
+++ src/rebuild.c
@@ -394,11 +394,11 @@
394 " WHERE type='table'"
395 " AND name NOT IN ('admin_log', 'blob','delta','rcvfrom','user','alias',"
396 "'config','shun','private','reportfmt',"
397 "'concealed','accesslog','modreq',"
398 "'purgeevent','purgeitem','unversioned',"
399 "'subscriber','pending_alert','alert_bounce')"
400 " AND name NOT GLOB 'sqlite_*'"
401 " AND name NOT GLOB 'fx_*'"
402 );
403 while( db_step(&q)==SQLITE_ROW ){
404 blob_appendf(&sql, "DROP TABLE IF EXISTS \"%w\";\n", db_column_text(&q,0));
405
--- src/rebuild.c
+++ src/rebuild.c
@@ -394,11 +394,11 @@
394 " WHERE type='table'"
395 " AND name NOT IN ('admin_log', 'blob','delta','rcvfrom','user','alias',"
396 "'config','shun','private','reportfmt',"
397 "'concealed','accesslog','modreq',"
398 "'purgeevent','purgeitem','unversioned',"
399 "'subscriber','pending_alert','alert_bounce','chat')"
400 " AND name NOT GLOB 'sqlite_*'"
401 " AND name NOT GLOB 'fx_*'"
402 );
403 while( db_step(&q)==SQLITE_ROW ){
404 blob_appendf(&sql, "DROP TABLE IF EXISTS \"%w\";\n", db_column_text(&q,0));
405

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button