Mercurial Hosting > chat
comparison src/index.html.luan @ 35:27c41f22d2a9
improve fixPosts
| author | Franklin Schmidt <fschmidt@gmail.com> |
|---|---|
| date | Tue, 12 Nov 2024 17:17:59 -0700 |
| parents | 62d04ca486dd |
| children | 436216d17a1b |
comparison
equal
deleted
inserted
replaced
| 34:62d04ca486dd | 35:27c41f22d2a9 |
|---|---|
| 83 with[user.email] = true | 83 with[user.email] = true |
| 84 if size(with) > 1 then | 84 if size(with) > 1 then |
| 85 selected = get_chat(with) | 85 selected = get_chat(with) |
| 86 end | 86 end |
| 87 end | 87 end |
| 88 local user_id = user.id | |
| 88 Io.stdout = Http.response.text_writer() | 89 Io.stdout = Http.response.text_writer() |
| 89 %> | 90 %> |
| 90 <!doctype html> | 91 <!doctype html> |
| 91 <html> | 92 <html> |
| 92 <head> | 93 <head> |
| 93 <% head() %> | 94 <% head() %> |
| 94 <style> | 95 <style> |
| 95 @import "chat.css?s=<%=started%>"; | 96 @import "chat.css?s=<%=started%>"; |
| 96 | |
| 97 div[who="<%=user.id%>"] span[pulldown] { | |
| 98 visibility: visible; | |
| 99 } | |
| 100 </style> | 97 </style> |
| 101 <style online></style> | 98 <style online></style> |
| 102 <script src="chat.js?s=<%=started%>"></script> | 99 <script src="chat.js?s=<%=started%>"></script> |
| 103 </head> | 100 </head> |
| 104 <body> | 101 <body> |
| 108 <% chats_html() %> | 105 <% chats_html() %> |
| 109 </div> | 106 </div> |
| 110 <div posts> | 107 <div posts> |
| 111 <h3 intro>Choose a chat on the left</h3> | 108 <h3 intro>Choose a chat on the left</h3> |
| 112 </div> | 109 </div> |
| 110 </div> | |
| 111 <div hidden> | |
| 112 <span pulldown> | |
| 113 <img onclick="clickMenu(this)" src="/images/more_vert.svg"> | |
| 114 <div> | |
| 115 <span onclick="editPost('<%=user_id%>')">Edit</span> | |
| 116 <span onclick="deletePost('<%=user_id%>')">Delete</span> | |
| 117 </div> | |
| 118 </span> | |
| 113 </div> | 119 </div> |
| 114 <dialog delete_chat> | 120 <dialog delete_chat> |
| 115 <h2>Delete Chat</h2> | 121 <h2>Delete Chat</h2> |
| 116 <p>Are you sure that you want to delete this chat?</p> | 122 <p>Are you sure that you want to delete this chat?</p> |
| 117 <div buttons> | 123 <div buttons> |
| 134 <button cancel onclick="closeModal(this)">Cancel</button> | 140 <button cancel onclick="closeModal(this)">Cancel</button> |
| 135 <button go onclick="savePost(this)">Save</button> | 141 <button go onclick="savePost(this)">Save</button> |
| 136 </div> | 142 </div> |
| 137 </dialog> | 143 </dialog> |
| 138 <script> | 144 <script> |
| 145 'use strict'; | |
| 146 | |
| 139 <% | 147 <% |
| 140 if selected ~= nil then | 148 if selected ~= nil then |
| 141 %> | 149 %> |
| 142 let div = document.querySelector('div[chat="<%=selected.id%>"]'); | 150 let div = document.querySelector('div[chat="<%=selected.id%>"]'); |
| 143 selectChat(div); | 151 selectChat(div); |
| 144 <% | 152 <% |
| 145 end | 153 end |
| 146 %> | 154 %> |
| 147 setUserEventSource(<%=user.id%>); | 155 setUserEventSource(<%=user_id%>); |
| 148 lastUpdate = <%=user.last_update()%>; | 156 lastUpdate = <%=user.last_update()%>; |
| 157 userId = '<%=user_id%>'; | |
| 149 </script> | 158 </script> |
| 150 </body> | 159 </body> |
| 151 </html> | 160 </html> |
| 152 <% | 161 <% |
| 153 end | 162 end |
