-
-
Save Lait-au-Cafe/e9edef864b13826171add27cce343d5b to your computer and use it in GitHub Desktop.
みれなさん向けChatboxCSS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import url(https://fonts.googleapis.com/css?family=Roboto:700); | |
* { | |
box-sizing: border-box; | |
} | |
html, body { | |
height: 100%; | |
overflow: hidden; | |
} | |
body { | |
text-shadow: 0 0 1px #000, 0 0 2px #000; | |
background: {background_color}; | |
font-family: 'Roboto'; | |
font-weight: 700; | |
font-size: {font_size}; | |
line-height: 1.5em; | |
color: {text_color}; | |
} | |
#log>div { | |
animation: fadeInRight .3s ease forwards, fadeOut 0.5s ease {message_hide_delay} forwards; | |
-webkit-animation: fadeInRight .3s ease forwards, fadeOut 0.5s ease {message_hide_delay} forwards; | |
} | |
.colon { | |
display: none; | |
} | |
#log { | |
/* display: table; */ | |
position: absolute; | |
bottom: 0; | |
left: 0; | |
padding: 0 10px 10px; | |
width: 100%; | |
table-layout: fixed; | |
} | |
#log>div { | |
/* display: table-row; */ | |
position: relative; | |
background-color: white; | |
border: 3px solid {text_color}; | |
border-radius: 30px; | |
padding: 15px 30px; | |
margin-top: 60px; | |
text-align: center; | |
} | |
#log>div.deleted { | |
visibility: hidden; | |
} | |
#log .emote { | |
background-repeat: no-repeat; | |
background-position: center; | |
background-size: contain; | |
padding: 0.4em 0.2em; | |
position: relative; | |
} | |
#log .emote img { | |
display: inline-block; | |
height: 1em; | |
opacity: 0; | |
} | |
#log .message,#log .meta { | |
vertical-align: top; | |
padding-bottom: 0.1em; | |
} | |
#log .meta { | |
position: absolute; | |
top: -40px; | |
left: 80px; | |
/* width: 35%; */ | |
background-color: {text_color}; | |
border-radius: 20px; | |
text-align: right; | |
padding: 5px; | |
white-space: nowrap; | |
text-overflow: ellipsis; | |
/* overflow: hidden; */ | |
padding: 5px 10px; | |
} | |
#log .message { | |
word-wrap: break-word; | |
/* width: 65%; */ | |
} | |
.badge { | |
display: block; | |
height: 1.8em; | |
height: 2.0em; | |
margin-right: 0.2em; | |
position: absolute; | |
top: 50%; | |
left: -70px; | |
transform: rotate(-10deg) translateY(-50%); | |
vertical-align: middle; | |
} | |
.badge:not(.subscriber-icon) { | |
display: none; | |
} | |
.name { | |
position: relative; | |
margin-left: 0.2em; | |
color: white; | |
} | |
.inner-border { | |
display: block; | |
width: calc(100% - 10px); | |
height: calc(100% - 10px); | |
position: absolute; | |
top: 50%; | |
left: 50%; | |
transform: translate(-50%, -50%); | |
border: 3px dashed {text_color}; | |
border-radius: 25px; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- item will be appened to this layout --> | |
<div id="log" class="sl__chat__layout"> | |
</div> | |
<!-- chat item --> | |
<script type="text/template" id="chatlist_item"> | |
<div data-from="{from}" data-id="{messageId}"> | |
<span class="inner-border"></span> | |
<span class="meta" style="color: {color}"> | |
<span class="badges"></span> | |
<span class="name">{from}</span> | |
</span> | |
<span class="message">{message}</span> | |
</div> | |
</script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Please use event listeners to run functions. | |
document.addEventListener('onLoad', function(obj) { | |
// obj will be empty for chat widget | |
// this will fire only once when the widget loads | |
}); | |
document.addEventListener('onEventReceived', function(obj) { | |
// obj will contain information about the event | |
const latest_badges = document.querySelectorAll("#log>div:last-child .badge"); | |
for(const i in latest_badges) { | |
const small_srcpath = latest_badges[i].src; | |
const large_srcpath = small_srcpath.replace(/\/1$/, '/3'); | |
latest_badges[i].src = large_srcpath; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment