Archived
1
0

add new livechan ui

This commit is contained in:
Jeff Becker 2016-07-04 10:12:03 -04:00
parent 6f5130d8fd
commit 28b1864841
No known key found for this signature in database
GPG Key ID: AB950234D6EA286B
5 changed files with 1562 additions and 74 deletions

View File

@ -21,11 +21,11 @@ if [ ! -f $GOPATH/bin/gopherjs ]; then
fi fi
# build cuckoo miner # build cuckoo miner
echo "Building cuckoo miner" #echo "Building cuckoo miner"
go get -v -u github.com/ZiRo-/cuckgo/miner_js #go get -v -u github.com/ZiRo-/cuckgo/miner_js
$GOPATH/bin/gopherjs -m -v build github.com/ZiRo-/cuckgo/miner_js #$GOPATH/bin/gopherjs -m -v build github.com/ZiRo-/cuckgo/miner_js
mv ./miner_js.js ./contrib/static/miner-js.js #mv ./miner_js.js ./contrib/static/miner-js.js
rm ./miner_js.js.map #rm ./miner_js.js.map
outfile=$PWD/contrib/static/nntpchan.js outfile=$PWD/contrib/static/nntpchan.js

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,65 @@
function livechan_got_post(widget, j) {
// do scroll
while (widget.children.length > 5) {
// remove top element
widget.removeChild(widget.children[0]);
}
nntpchan_buildpost(widget, j);
// scroll to bottom
widget.scrollTop = widget.scrollHeight;
}
// inject post form into an element
function inject_postform(prefix, parent) {
}
// inject livechan widget into parent
function inject_livechan_widget(prefix, parent) {
if ( "WebSocket" in window ) {
var url = "ws://"+document.location.host+prefix+"live";
if ( document.location.protocol == "https:" ) {
url = "wss://"+document.location.host+prefix+"live";
}
var socket = new WebSocket(url);
var progress = function(str) {
parent.innerHTML = "<pre>livechan: "+str+"</pre>";
};
progress("initialize");
socket.onopen = function () {
progress("streaming");
}
socket.onmessage = function(ev) {
var j = null;
try {
j = JSON.parse(ev.data);
} catch(e) {
// ignore
}
if (j) {
livechan_got_post(parent, j);
}
}
socket.onclose = function(ev) {
progress("connection closed");
setTimeout(function() {
inject_livechan_widget(prefix, parent);
}, 1000);
}
} else {
parent.innerHTML = "<pre>livechan mode requires websocket support</pre>";
setTimeout(function() {
parent.innerHTML = "";
}, 5000);
}
}
function ukko_livechan(prefix) {
var ukko = document.getElementById("ukko_threads");
if (ukko) {
// remove children
ukko.innerHTML = "";
inject_livechan_widget(prefix, ukko);
}
}

239
contrib/static/livechan.css Normal file
View File

@ -0,0 +1,239 @@
input, textarea, select {
-moz-border-radius: 0px;
-webkit-border-radius: 0px;
border-radius: 0px;
}
.livechan_chat_input {
padding: 0;
margin: 0;
position: absolute;
width: 100%;
bottom: 0;
height: 60px;
left: 0;
right: 0;
}
.livechan_chat_input_name, .livechan_chat_input_convo {
padding: 0;
padding-left: 2px;
margin: 0;
width: 50%;
}
.livechan_chat_input_left {
width: 30%;
}
.livechan_chat_input_file {
padding: 0;
margin: 0;
position: absolute;
left: 3px;
bottom: 3px;
border: none;
}
.livechan_chat_input_message_div {
padding:0;
margin:0;
position: absolute;
width: 70%;
left: 20%;
top: 3px;
bottom: 3px;
}
.livechan_chat_input_message {
padding: 0;
margin: 0;
border:none;
height: 100%;
width: 100%;
resize: none;
}
.livechan_chat_input_submit {
position: absolute;
width: 47px;
top: 3px;
right: 3px;
bottom: 3px;
border: none;
}
.livechan_chat_output {
position: absolute;
top: 20px;
left: 0;
right: 0;
bottom: 60px;
overflow: auto;
width: 90%;
-webkit-overflow-scrolling: touch;
}
.livechan_chat_output_chat {
max-height: 200px;
overflow: hidden;
}
.livechan_chat_output_date {
margin: 0 4px;
}
.livechan_chat_output_count:hover {
cursor: pointer;
}
.livechan_chat_capcode {
margin: 0 4px;
font-style: italic;
font-weight: lighter;
}
.livechan_image_thumb {
max-width: 300px;
max-height: 200px;
float: left;
margin: 10px;
}
.livechan_captcha {
left: 0px;
top: 0px;
bottom: 0px;
right: 0px;
position: absolute;
opacity: 0.9;
}
.livechan_captcha_inner {
padding: 200px;
}
.livechan_captcha_image {
}
.livechan_captcha_input {
float: down;
}
.livechan_spoiler {
color: black;
background: black;
}
.livechan_spoiler:hover {
color: white;
}
.livechan_convo_label {
padding: 5px;
}
.livechan_convobar_root {
position: absolute;
top: 20px;
right: 0;
width: 10%;
hieght: 90%;
}
.livechan_convobar_item {
margin: 5px;
padding: 5px;
}
.livechan_navbar {
z-index: 3;
position: absolute;
top: 0;
width: 100%;
height: 20px;
}
.livechan_navbar_mod_indicator_inactive, .livechan_navbar_mod_indicator_active, .livechan_navbar_status, .livechan_navbar_channel_label {
padding-left: 10px;
padding-right: 10px;
}
.hover , .hover > img {
z-index: 100;
position: absolute;
left: 10%;
max-width: 900px;
max-height: 900px;
}
.livechan_chat_output, .livechan_captcha, .livechan_convobar_root, #chat {
background: #EEF2FF;
}
.livechan_chat_output_chat, .livechan_navbar, .livechan_convobar_item {
background: #D6DAF0;
}
.livechan_chat_output_chat {
font-family: sans-serif;
margin: 4px;
padding: 4px;
}
.livechan_chat_output_name {
font-weight: bold;
color: green;
}
.livechan_chat_output_count:hover {
color: red;
}
.livechan_chat_input {
background: #98E;
}
.livechan_greentext {
color: #789922;
}
.livechan_boldtext {
font-weight: bold;
}
.livechan_internallink {
color: blue;
}
.livechan_internallink:hover {
color: red;
cursor: pointer;
}
.livechan_chat_selected {
background: blue;
}
.livechan_navbar_mod_indicator_active {
background: #4a4ad4;
color: #34d434;
}
.livechan_navbar_mod_indicator_admin {
background: #4a4ad4;
color: red;
}
.livechan_navbar_mod_indicator_inactive {
color: #aaaaaa;
background: #eef2ff;
}
.livechan_redtext {
color: #af0a0f;
font-weight: bold;
}

View File

@ -8,34 +8,28 @@
<head> <head>
<title> {{#i18n.Translations}}{{overboard_title}}{{/i18n.Translations}} </title> <title> {{#i18n.Translations}}{{overboard_title}}{{/i18n.Translations}} </title>
<meta charset="utf-8" /> <meta charset="utf-8" />
<link rel="stylesheet" href="{{prefix}}static/site.css" /> <meta name="viewport" content="initial-scale = 1.0,maximum-scale = 1.0" />
<link rel="stylesheet" href="{{prefix}}static/livechan.css" />
<link id="current_theme" rel="stylesheet" href="{{prefix}}static/user.css" /> <link id="current_theme" rel="stylesheet" href="{{prefix}}static/user.css" />
<style type="text/css" id="convo_filter">
</style>
<script type="text/javascript" src="{{prefix}}static/nntpchan.js"></script> <script type="text/javascript" src="{{prefix}}static/nntpchan.js"></script>
</head> </head>
<body> <body>
<center> <div id="chat" style="position:absolute;left:0;right:0;top:0;bottom:0;"></div>
<div id="nntpchan_banner">
</div>
</center>
<!-- begin navbar -->
{{{navbar}}}
<!-- end navbar -->
<div id="livechan">
</div>
<script type="text/javascript" > <script type="text/javascript" >
var prefix = "{{prefix}}"; e = document.getElementById("chat");
var e = document.getElementById("nntpchan_banner"); var board = "live";
nntpchan_inject_banners(e, prefix); if (location.hash != "" ) {
init(prefix); board = location.hash.substr(1);
e = document.getElementById("livechan");
if (e) {
inject_livechan_widget(prefix, e);
} }
new Chat(e, board, { prefix : "{{prefix}}" });
</script> </script>
<hr/> <!--
<footer> <footer>
<p class="legal">All posts on this site are the responsibility of the individual poster and not the administration, pursuant to 47 U.S.C. § 230.</p> <p class="legal">All posts on this site are the responsibility of the individual poster and not the administration, pursuant to 47 U.S.C. § 230.</p>
<p class="legal">To make a DMCA request or report illegal content, please contact the administration</p> <p class="legal">To make a DMCA request or report illegal content, please contact the administration</p>
</footer> </footer>
-->
</body> </body>
</html> </html>