Archived
1
0

update all

This commit is contained in:
Jeff Becker 2016-07-18 07:51:15 -04:00
parent f4f2479b8a
commit 60f0c19a9f
4 changed files with 106 additions and 44 deletions

View File

@ -121,8 +121,9 @@ Captcha.prototype.show = function () {
var widget = this.widget.widget; var widget = this.widget.widget;
if ( widget.style ) { if ( widget.style ) {
widget.style.zIndex = 5; widget.style.zIndex = 5;
widget.style.visibility = "visible";
} else { } else {
widget.style = {zIndex: 5}; widget.style = {zIndex: 5, visibility: "visible"};
} }
} }
/** /**
@ -133,8 +134,9 @@ Captcha.prototype.hide = function () {
var widget = this.widget.widget; var widget = this.widget.widget;
if ( widget.style ) { if ( widget.style ) {
widget.style.zIndex = -1; widget.style.zIndex = -1;
widget.style.visibility = "hidden";
} else { } else {
widget.style = {zIndex: -1}; widget.style = {zIndex: -1, visibility: "hidden"};
} }
} }
@ -857,6 +859,7 @@ ConvoBar.prototype.show = function(msgid) {
*/ */
function Chat(domElem, channel, options) { function Chat(domElem, channel, options) {
var self = this; var self = this;
this.pph = 0;
this.name = channel.toLowerCase(); this.name = channel.toLowerCase();
this.domElem = domElem; this.domElem = domElem;
this.lastOp = null; this.lastOp = null;
@ -891,6 +894,10 @@ function Chat(domElem, channel, options) {
ajax.send(JSON.stringify({ID: id, Solution: solution})); ajax.send(JSON.stringify({ID: id, Solution: solution}));
}); });
this.captcha.hide(); this.captcha.hide();
setInterval(function() {
self.tickPPHCount();
self.tickUserCount();
}, 5000);
} }
Chat.prototype.clear = function () { Chat.prototype.clear = function () {
@ -1026,6 +1033,8 @@ Chat.prototype.sendInput = function(event) {
// reset shit // reset shit
inputElem.file.value = ""; inputElem.file.value = "";
inputElem.message.value = ''; inputElem.message.value = '';
} else if (jdata.error) {
console.log(jdata.error);
} }
} else if (ajax.readyState == 3 ) { } else if (ajax.readyState == 3 ) {
// processing // processing
@ -1039,7 +1048,8 @@ Chat.prototype.sendInput = function(event) {
data.set("name", name); data.set("name", name);
data.set("subject", subject); data.set("subject", subject);
data.set("message", message); data.set("message", message);
data.set("reference", convo); if (convo)
data.set("reference", convo);
if (inputElem.file.files[0]) if (inputElem.file.files[0])
data.set("attachment_0", inputElem.file.files[0]); data.set("attachment_0", inputElem.file.files[0]);
ajax.send(data); ajax.send(data);
@ -1185,13 +1195,57 @@ Chat.prototype.initOutput = function() {
var self = this; var self = this;
} }
Chat.prototype.tickUserCount = function () {
var self=this;
var ajax = new XMLHttpRequest();
ajax.open("GET", self.prefix + "livechan/api/online");
ajax.onreadystatechange = function () {
if (ajax.readyState == 4 && ajax.status == 200 ) {
var data = JSON.parse(ajax.responseText);
if (data && data.online) {
self.updateUserStats(data.online);
}
}
}
ajax.send();
}
Chat.prototype.tickPPHCount = function () {
var self=this;
var convo = self.chatElems.convobar.active;
var board;
if(convo)
board = self.chatElems.convobar.holder[convo].group;
if(!board) {
// no board selected?
var h = document.location.hash;
if (h.length > 1 ) {
board = "overchan." + h.substr(1);
}
}
if(board) {
var ajax = new XMLHttpRequest();
ajax.open("GET", self.prefix + "livechan/api/pph?newsgroup="+board);
ajax.onreadystatechange = function () {
if (ajax.readyState == 4 && ajax.status == 200 ) {
var data = JSON.parse(ajax.responseText);
if (data && data.pph !== undefined) {
self.pph = data.pph;
}
}
}
ajax.send();
}
}
/* @brief update the user counter for number of users online /* @brief update the user counter for number of users online
*/ */
Chat.prototype.updateUserCount = function(count) { Chat.prototype.updateUserStats = function(count) {
var elem = this.chatElems.navbar.userCount; var elem = this.chatElems.navbar.status;
elem.textContent = "Online: "+count; elem.textContent = "Online: "+count + " PPH: "+ this.pph;
} }
/* @brief Scrolls the chat to the bottom. /* @brief Scrolls the chat to the bottom.
*/ */
Chat.prototype.scroll = function() { Chat.prototype.scroll = function() {

View File

@ -2,7 +2,6 @@ input {
-moz-border-radius: 0px; -moz-border-radius: 0px;
-webkit-border-radius: 0px; -webkit-border-radius: 0px;
border-radius: 0px; border-radius: 0px;
color: white;
} }
.livechan_captcha_input { .livechan_captcha_input {
@ -19,12 +18,12 @@ textarea, select {
.livechan_chat_input { .livechan_chat_input {
padding: 0; padding: 0;
margin: 0; margin: 0;
position: absolute; position: fixed;
width: 100%; width: 100%;
bottom: 0; bottom: 0;
left: 0; left: 0;
right: 0; right: 0;
padding:none; background: #d6daf0;
} }
.livechan_chat_input_name, .livechan_chat_input_convo { .livechan_chat_input_name, .livechan_chat_input_convo {
@ -110,7 +109,7 @@ textarea, select {
top: 0px; top: 0px;
bottom: 0px; bottom: 0px;
right: 0px; right: 0px;
position: absolute; position: fixed;
opacity: 0.9; opacity: 0.9;
} }
@ -130,17 +129,20 @@ textarea, select {
background: black; background: black;
} }
.livechan_chat_output_chat {
background: #d6daf0;
}
.livechan_spoiler:hover { .livechan_spoiler:hover {
color: white; color: white;
} }
.livechan_convo_label { .livechan_convo_label {
padding: 5px; padding: 5px;
color: white;
} }
.livechan_convobar_root { .livechan_convobar_root {
position: absolute; position: fixed;
top: 20px; top: 20px;
right: 0; right: 0;
width: 10%; width: 10%;
@ -148,11 +150,13 @@ textarea, select {
.livechan_convobar_item { .livechan_convobar_item {
padding: 5px; padding: 5px;
margin: 5px;
background: #d6daf0;
} }
.livechan_navbar { .livechan_navbar {
z-index: 3; z-index: 3;
position: absolute; position: fixed;
top: 0; top: 0;
width: 100%; width: 100%;
height: 20px; height: 20px;
@ -161,8 +165,7 @@ textarea, select {
.livechan_navbar_mod_indicator_inactive, .livechan_navbar_mod_indicator_active, .livechan_navbar_status, .livechan_navbar_channel_label { .livechan_navbar_mod_indicator_inactive, .livechan_navbar_mod_indicator_active, .livechan_navbar_status, .livechan_navbar_channel_label {
padding-left: 10px; padding-left: 10px;
padding-right: 10px; padding-right: 10px;
background: #050505; background: #d6daf0;
color: white;
} }
@ -182,29 +185,14 @@ textarea, select {
visibility: visible; visibility: visible;
} }
.livechan_chat_output, .livechan_captcha, .livechan_convobar_root, #chat { .livechan_captcha, .livechan_convobar_root, #chat {
background: #050505; background: #EEF2FF;
}
.livechan_convobar_root {
background: #111;
color: white;
}
.livechan_chat_output_chat, .livechan_navbar {
background: #111;
}
.livechan_convobar_item {
background: #111;
} }
.livechan_chat_output_chat { .livechan_chat_output_chat {
font-family: monospace; font-family: monospace;
margin: 4px; margin: 4px;
padding: 4px; padding: 4px;
color: white;
} }
.livechan_chat_output_name { .livechan_chat_output_name {
@ -216,10 +204,6 @@ textarea, select {
color: red; color: red;
} }
.livechan_chat_input {
background: #111;
}
.livechan_greentext { .livechan_greentext {
color: #789922; color: #789922;
} }
@ -229,7 +213,7 @@ textarea, select {
} }
.livechan_internallink , a { .livechan_internallink , a {
color: cyan; color: blue;
} }
.livechan_internallink:hover , a { .livechan_internallink:hover , a {
@ -254,7 +238,7 @@ textarea, select {
.livechan_navbar_mod_indicator_inactive { .livechan_navbar_mod_indicator_inactive {
color: #aaaaaa; color: #aaaaaa;
background: #eef2ff; background: #EEF2FF;
} }

View File

@ -320,11 +320,14 @@ input, textarea {
display: inline-block; display: inline-block;
} }
.op , .reply {
float: left;
clear: both;
}
.op { .op {
margin-top: 5px; margin-top: 5px;
margin-bottom: 1px; margin-bottom: 1px;
float: left;
clear: both;
} }
.post:target { .post:target {

View File

@ -1,4 +1,23 @@
<div id="{{post.PostHash}}" class="{{post.CSSClass}}"> <div id="{{post.PostHash}}" class="{{post.CSSClass}}"
data-frontend="{{post.Frontend}}"
data-newsgroup="{{post.Board}}"
data-msgid="{{post.MessageID}}"
data-msgidhash="{{post.PostHash}}"
data-rootmsgid="{{post.Reference}}"
data-rootmsgidhash="{{post.ReferenceHash}}"
{{#post.Sage}}
data-sage="1"
{{/post.Sage}}
{{#post.IsI2P}}
data-origin="i2p"
{{/post.IsI2P}}
{{#post.IsTor}}
data-origin="tor"
{{/post.IsTor}}
{{#post.IsClearnet}}
data-origin="clearnet"
{{/post.IsClearnet}}
data-posturl="{{post.PostURL}}">
<legend class="postheader"> <legend class="postheader">
<span class="origin"> <span class="origin">
{{#post.IsI2P}} {{#post.IsI2P}}
@ -10,17 +29,19 @@
{{#post.IsClearnet}} {{#post.IsClearnet}}
<img src="{{post.Prefix}}static/clearnet.png" title="{{#i18n.Translations}}{{from_clearnet}}{{/i18n.Translations}}" /> <img src="{{post.Prefix}}static/clearnet.png" title="{{#i18n.Translations}}{{from_clearnet}}{{/i18n.Translations}}" />
{{/post.IsClearnet}} {{/post.IsClearnet}}
<span class="frontend">{{post.Frontend}}</span>
</span> </span>
<span class="subject">{{post.Subject}}</span> <span class="subject">{{post.Subject}}</span>
<span class="name">{{post.Name}}</span> <span class="name">{{post.Name}}</span>
<span class="msgid">{{post.MessageID}}</span>
<time datetime="{{post.DateRFC}}">{{post.Date}}</time> <time datetime="{{post.DateRFC}}">{{post.Date}}</time>
<a href="#" class="postnol">No.</a><a class="postno" onclick="nntpchan_reply(this, '{{post.ShortHash}}');" title="{{post.MessageID}}" root="{{post.Reference}}" boardname="{{post.Board}}">{{post.ShortHash}}</a> <a href="#" class="postnol">No. {{post.Index}}</a><a class="postno" onclick="nntpchan_reply(this, '{{post.ShortHash}}');" title="{{post.MessageID}}" root="{{post.Reference}}" boardname="{{post.Board}}"> &gt;&gt;{{post.ShortHash}}</a>
<a href="{{post.PostURL}}">[{{#i18n.Translations}}{{reply_label}}{{/i18n.Translations}}]</a> <a href="{{post.PostURL}}">[{{#i18n.Translations}}{{reply_label}}{{/i18n.Translations}}]</a>
<span class="tripcode">{{{post.Pubkey}}}</span> <span class="tripcode">{{{post.Pubkey}}}</span>
</legend> </legend>
<div class="attachments"> <div class="attachments">
{{#post.Attachments}} {{#post.Attachments}}
<figure> <figure data-sha512="{{Hash}}">
<figcaption> <figcaption>
<a class="download_link" href="{{Source}}" download="{{Filename}}">{{#i18n.Translations}}{{download_prompt}}{{/i18n.Translations}}</a> <a class="download_link" href="{{Source}}" download="{{Filename}}">{{#i18n.Translations}}{{download_prompt}}{{/i18n.Translations}}</a>
<a class="file" href="{{Source}}" title="{{Filename}}" target="_blank"><img src="{{Thumbnail}}" alt="{{Filename}}" class="thumbnail"/></a> <a class="file" href="{{Source}}" title="{{Filename}}" target="_blank"><img src="{{Thumbnail}}" alt="{{Filename}}" class="thumbnail"/></a>