Compare commits
1 Commits
main
...
global-sty
Author | SHA1 | Date | |
---|---|---|---|
![]() |
9089589d36 |
@ -1,3 +1,5 @@
|
|||||||
|
@import "shared.css";
|
||||||
|
|
||||||
* {
|
* {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
@ -20,7 +22,7 @@
|
|||||||
|
|
||||||
body {
|
body {
|
||||||
font-family: Arial, sans-serif;
|
font-family: Arial, sans-serif;
|
||||||
background-color: #000000;
|
background-color: #1a1a1a;
|
||||||
color: #e6e6e6;
|
color: #e6e6e6;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -36,7 +38,7 @@ main {
|
|||||||
}
|
}
|
||||||
|
|
||||||
header {
|
header {
|
||||||
background-color: #000000;
|
background-color: #0f0f0f;
|
||||||
padding: 10px 20px;
|
padding: 10px 20px;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
@ -78,13 +80,14 @@ a {
|
|||||||
flex: 1;
|
flex: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
background-color: #000000;
|
background-color: #1a1a1a;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-header {
|
.chat-header {
|
||||||
padding: 10px 20px;
|
padding: 10px 20px;
|
||||||
background-color: #000000;
|
background-color: #0f0f0f;
|
||||||
|
border-bottom: 1px solid #333;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,7 +111,7 @@ a {
|
|||||||
-ms-overflow-style: none;
|
-ms-overflow-style: none;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
height: 200px;
|
height: 200px;
|
||||||
background: #000000;
|
background: #1a1a1a;
|
||||||
}
|
}
|
||||||
|
|
||||||
.container {
|
.container {
|
||||||
@ -204,14 +207,15 @@ a {
|
|||||||
|
|
||||||
.chat-input {
|
.chat-input {
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
background-color: #000000;
|
background-color: #121212;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
border-top: 1px solid #333;
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type="text"], .chat-input textarea {
|
input[type="text"], .chat-input textarea {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
background-color: #000000;
|
background-color: #1a1a1a;
|
||||||
color: white;
|
color: white;
|
||||||
border: none;
|
border: none;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
@ -310,11 +314,10 @@ a {
|
|||||||
|
|
||||||
.sidebar {
|
.sidebar {
|
||||||
width: 250px;
|
width: 250px;
|
||||||
background-color: #000000;
|
background-color: #121212;
|
||||||
padding-left: 20px;
|
padding: 20px;
|
||||||
padding-right: 20px;
|
|
||||||
padding-top: 10px;
|
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
border-right: 1px solid #333;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar h2 {
|
.sidebar h2 {
|
||||||
@ -341,4 +344,3 @@ a {
|
|||||||
.sidebar ul li a:hover {
|
.sidebar ul li a:hover {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +21,24 @@
|
|||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
const getAdoptionStyles = () => {
|
||||||
|
return Array.from(document.styleSheets)
|
||||||
|
.filter((styleSheet) => styleSheet.href?.endsWith("shared.css"))
|
||||||
|
.map(x => {
|
||||||
|
const sheet = new CSSStyleSheet();
|
||||||
|
|
||||||
|
sheet.replaceSync(Array.from(x.cssRules).flatMap(rule => {
|
||||||
|
if (rule instanceof CSSImportRule) {
|
||||||
|
return Array.from(rule.styleSheet.cssRules).map(rule => rule.cssText);
|
||||||
|
} else {
|
||||||
|
return rule.cssText;
|
||||||
|
}
|
||||||
|
}).join(' '));
|
||||||
|
|
||||||
|
return sheet;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
class GenericField extends HTMLElement {
|
class GenericField extends HTMLElement {
|
||||||
form = null;
|
form = null;
|
||||||
field = null;
|
field = null;
|
||||||
@ -83,18 +101,6 @@ class GenericField extends HTMLElement {
|
|||||||
background-color: #1a1a1a;
|
background-color: #1a1a1a;
|
||||||
color: #e6e6e6;
|
color: #e6e6e6;
|
||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
|
|
||||||
&:focus {
|
|
||||||
outline: 2px solid #f05a28 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
&::placeholder {
|
|
||||||
transition: opacity 0.3s;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:focus::placeholder {
|
|
||||||
opacity: 0.4;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
button {
|
button {
|
||||||
@ -155,6 +161,9 @@ class GenericField extends HTMLElement {
|
|||||||
this.container.appendChild(this.styleElement);
|
this.container.appendChild(this.styleElement);
|
||||||
|
|
||||||
this.shadowRoot.appendChild(this.container);
|
this.shadowRoot.appendChild(this.container);
|
||||||
|
|
||||||
|
|
||||||
|
this.shadowRoot.adoptedStyleSheets = getAdoptionStyles();
|
||||||
}
|
}
|
||||||
|
|
||||||
connectedCallback() {
|
connectedCallback() {
|
||||||
|
15
src/snek/static/shared.css
Normal file
15
src/snek/static/shared.css
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
|
||||||
|
input, textarea {
|
||||||
|
&:focus {
|
||||||
|
outline: 2px solid #f05a28 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
&::placeholder {
|
||||||
|
transition: opacity 0.3s;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:focus::placeholder {
|
||||||
|
opacity: 0.4;
|
||||||
|
}
|
||||||
|
}
|
@ -1,55 +1,57 @@
|
|||||||
|
@import "shared.css";
|
||||||
|
|
||||||
* {
|
* {
|
||||||
|
box-sizing: border-box;
|
||||||
box-sizing: border-box;
|
}
|
||||||
|
|
||||||
|
.dialog {
|
||||||
|
background-color: #0f0f0f;
|
||||||
|
border-radius: 10px;
|
||||||
|
padding: 30px;
|
||||||
|
width: 800px;
|
||||||
|
margin: 30px;
|
||||||
|
box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 500px) {
|
||||||
|
.center {
|
||||||
|
width: 100%;
|
||||||
|
left: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dialog {
|
.dialog {
|
||||||
|
width: 100%;
|
||||||
background-color: #0f0f0f;
|
left: 0px;
|
||||||
border-radius: 10px;
|
|
||||||
padding: 30px;
|
|
||||||
width: 800px;
|
|
||||||
margin: 30px;
|
|
||||||
box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (max-width: 500px) {
|
|
||||||
.center {
|
|
||||||
width: 100%;
|
|
||||||
left: 0px;
|
|
||||||
}
|
|
||||||
.dialog {
|
|
||||||
width: 100%;
|
|
||||||
left: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
font-size: 2em;
|
font-size: 2em;
|
||||||
color: #f05a28;
|
color: #f05a28;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
h2 {
|
h2 {
|
||||||
font-size: 1.4em;
|
font-size: 1.4em;
|
||||||
color: #f05a28;
|
color: #f05a28;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
font-family: Arial, sans-serif;
|
font-family: Arial, sans-serif;
|
||||||
background-color: #1a1a1a;
|
background-color: #1a1a1a;
|
||||||
color: #e6e6e6;
|
color: #e6e6e6;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
div {
|
div {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
|
|
||||||
}
|
}
|
@ -20,6 +20,7 @@
|
|||||||
<script src="/html-frame.js"></script>
|
<script src="/html-frame.js"></script>
|
||||||
<script src="/generic-form.js"></script>
|
<script src="/generic-form.js"></script>
|
||||||
<link rel="stylesheet" href="/html-frame.css">
|
<link rel="stylesheet" href="/html-frame.css">
|
||||||
|
<link rel="stylesheet" href="/shared.css">
|
||||||
|
|
||||||
{% block head %}
|
{% block head %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
<div class="chat-header">
|
<div class="chat-header">
|
||||||
<h2>Search user</h2>
|
<h2>Search user</h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="container chat-area">
|
<div class="container">
|
||||||
<form method="get" action="/search-user.html">
|
<form method="get" action="/search-user.html">
|
||||||
<input type="text" placeholder="Username" name="query" value="{{query}}" REQUIRED></input>
|
<input type="text" placeholder="Username" name="query" value="{{query}}" REQUIRED></input>
|
||||||
<fancy-button size="auto" text="Search" url="submit"></fancy-button>
|
<fancy-button size="auto" text="Search" url="submit"></fancy-button>
|
||||||
|
@ -22,10 +22,6 @@
|
|||||||
<script>
|
<script>
|
||||||
const channelUid = "{{ channel.uid.value }}";
|
const channelUid = "{{ channel.uid.value }}";
|
||||||
|
|
||||||
function getInputField(){
|
|
||||||
return document.querySelector("textarea")
|
|
||||||
}
|
|
||||||
|
|
||||||
function initInputField(textBox) {
|
function initInputField(textBox) {
|
||||||
textBox.addEventListener('change', (e) => {
|
textBox.addEventListener('change', (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@ -45,29 +41,9 @@
|
|||||||
textBox.focus();
|
textBox.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
function replyMessage(message) {
|
|
||||||
const field = getInputField()
|
|
||||||
field.value = "```markdown\n> " + (message || '') + "\n```\n";
|
|
||||||
field.focus();
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateTimes() {
|
function updateTimes() {
|
||||||
document.querySelectorAll(".time").forEach((container) => {
|
document.querySelectorAll(".time").forEach((time) => {
|
||||||
const messageDiv = container.closest('.message');
|
time.innerText = app.timeDescription(time.dataset.created_at);
|
||||||
const userNick = messageDiv.dataset.user_nick;
|
|
||||||
const text = messageDiv.querySelector(".text").innerText;
|
|
||||||
const time = document.createElement("span");
|
|
||||||
time.innerText = app.timeDescription(container.dataset.created_at);
|
|
||||||
|
|
||||||
container.replaceChildren(time);
|
|
||||||
const reply = document.createElement("a");
|
|
||||||
reply.innerText = " reply";
|
|
||||||
reply.href = "#reply";
|
|
||||||
container.appendChild(reply);
|
|
||||||
reply.addEventListener('click', (e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
replyMessage(text);
|
|
||||||
})
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,7 +159,7 @@
|
|||||||
}, 1000);
|
}, 1000);
|
||||||
});
|
});
|
||||||
|
|
||||||
initInputField(getInputField());
|
initInputField(document.querySelector("textarea"));
|
||||||
updateLayout(true);
|
updateLayout(true);
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -28,6 +28,6 @@ class ThreadsView(BaseView):
|
|||||||
thread['last_message_user_color'] = user_last_message['color']
|
thread['last_message_user_color'] = user_last_message['color']
|
||||||
threads.append(thread)
|
threads.append(thread)
|
||||||
|
|
||||||
threads.sort(key=lambda x: x['last_message_on'] or '', reverse=True)
|
threads.sort(key=lambda x: x['last_message_on'], reverse=True)
|
||||||
|
|
||||||
return await self.render_template("threads.html", dict(threads=threads,user=user))
|
return await self.render_template("threads.html", dict(threads=threads,user=user))
|
||||||
|
@ -25,7 +25,6 @@ class UploadView(BaseView):
|
|||||||
drive_item = await self.services.drive_item.get(uid)
|
drive_item = await self.services.drive_item.get(uid)
|
||||||
response = web.FileResponse(drive_item["path"])
|
response = web.FileResponse(drive_item["path"])
|
||||||
response.headers['Cache-Control'] = f'public, max-age={1337*420}'
|
response.headers['Cache-Control'] = f'public, max-age={1337*420}'
|
||||||
response.headers['Content-Disposition'] = f'attachment; filename="{drive_item["name"]}"'
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
async def post(self):
|
async def post(self):
|
||||||
@ -58,10 +57,8 @@ class UploadView(BaseView):
|
|||||||
filename = field.filename
|
filename = field.filename
|
||||||
if not filename:
|
if not filename:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
name = str(uuid.uuid4()) + pathlib.Path(filename).suffix
|
|
||||||
|
|
||||||
file_path = pathlib.Path(UPLOAD_DIR).joinpath(name)
|
file_path = pathlib.Path(UPLOAD_DIR).joinpath(filename.strip("/").strip("."))
|
||||||
files.append(file_path)
|
files.append(file_path)
|
||||||
|
|
||||||
async with aiofiles.open(str(file_path.absolute()), 'wb') as f:
|
async with aiofiles.open(str(file_path.absolute()), 'wb') as f:
|
||||||
|
Loading…
Reference in New Issue
Block a user