r20150927
Signed-off-by: Flashwave <me@flash.moe>
This commit is contained in:
parent
ab2c8df958
commit
70dc31bbe0
11 changed files with 227 additions and 184 deletions
|
@ -2924,6 +2924,32 @@
|
|||
"user": "Flashwave"
|
||||
}
|
||||
|
||||
],
|
||||
|
||||
"20150927": [
|
||||
|
||||
"eminence",
|
||||
{
|
||||
"type": "FIX",
|
||||
"change": "Fixed age being displayed on profile despite the user not having a year set.",
|
||||
"user": "Flashwave"
|
||||
},
|
||||
{
|
||||
"type": "FIX",
|
||||
"change": "Fixed the same error being logged multiple times.",
|
||||
"user": "Flashwave"
|
||||
},
|
||||
{
|
||||
"type": "REM",
|
||||
"change": "Removed the scroll to top button.",
|
||||
"user": "Flashwave"
|
||||
},
|
||||
{
|
||||
"type": "ADD",
|
||||
"change": "Added some fundamentals for the on-site chat.",
|
||||
"user": "Flashwave"
|
||||
}
|
||||
|
||||
]
|
||||
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ class Main
|
|||
[
|
||||
'backtrace' => [$backtrace, '=', true],
|
||||
'error_string' => [$errstr, '='],
|
||||
'error_line' => [$errstr, '='],
|
||||
'error_line' => [$errline, '='],
|
||||
]
|
||||
)) {
|
||||
// If so assign the errid
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
namespace Sakura;
|
||||
|
||||
// Define Sakura version
|
||||
define('SAKURA_VERSION', '20150926');
|
||||
define('SAKURA_VERSION', '20150927');
|
||||
define('SAKURA_VLABEL', 'Eminence');
|
||||
define('SAKURA_COLOUR', '#6C3082');
|
||||
define('SAKURA_STABLE', false);
|
||||
|
|
30
_sakura/templates/yuuno/global/chat.tpl
Normal file
30
_sakura/templates/yuuno/global/chat.tpl
Normal file
|
@ -0,0 +1,30 @@
|
|||
{% block content %}
|
||||
<div id="chat">
|
||||
<div id="chatAccessButtons"></div>
|
||||
<div id="chatOnlineUsers">
|
||||
<div class="chatOnlineListTitle">
|
||||
Online Users
|
||||
</div>
|
||||
<div id="chatUserList">
|
||||
<div>
|
||||
<div class="avatar" style="background-image: url('/a/1');"></div>
|
||||
<div class="options">
|
||||
<div class="username" style="color: #2B3F84;">Hanyuu</div>
|
||||
<div class="actions">Display actions</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block style %}
|
||||
<link rel="stylesheet" type="text/css" href="{{ sakura.resources }}/css/chat.css" />
|
||||
{% endblock %}
|
||||
|
||||
{% block js %}
|
||||
<script type="text/javascript" charset="utf-8" src="{{ sakura.resources }}/js/chat.js"></script>
|
||||
<script type="text/javascript">
|
||||
window.addEventListener("load", function(){ Chat.connect('127.0.0.1'); });
|
||||
</script>
|
||||
{% endblock %}
|
|
@ -62,11 +62,6 @@
|
|||
// Space for things that need to happen onload
|
||||
window.addEventListener("load", function() {
|
||||
|
||||
// Alter the go to top button
|
||||
var gotop = document.getElementById('scrollToTop');
|
||||
gotop.setAttribute('href', 'javascript:void(0);');
|
||||
gotop.setAttribute('onclick', 'scrollToTop();');
|
||||
|
||||
{% if session.checkLogin %}
|
||||
// Convert href to object in logout link
|
||||
prepareAjaxLink('headerLogoutLink', 'submitPost', ', true, "Logging out..."');
|
||||
|
@ -234,37 +229,8 @@
|
|||
{% block content %}
|
||||
<h1 class="stylised" style="text-align: center; margin: 2em auto;">{{ php.self }} is now printing!</h1>
|
||||
{% endblock %}
|
||||
{#
|
||||
<div id="chat">
|
||||
<div id="chatOnlineUsers">
|
||||
<div class="chatOnlineListTitle">
|
||||
Online Users
|
||||
</div>
|
||||
<div id="chatUserList">
|
||||
<div>
|
||||
<div class="avatar" style="background-image: url('/a/1');"></div>
|
||||
<div class="options">
|
||||
<div class="username" style="color: #2B3F84;">Hanyuu</div>
|
||||
<div class="actions">Display actions</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="avatar" style="background-image: url('/a/2');"></div>
|
||||
<div class="options">
|
||||
<div class="username" style="color: #C00;">Flashwave</div>
|
||||
<div class="actions">Display actions</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
#}
|
||||
<div id="actionBtns">
|
||||
{# <a id="showChatTicker" class="fa fa-list" href="#"></a>
|
||||
<a id="showOnlineUsers" class="fa fa-users" href="#"></a>
|
||||
<a id="openSiteChat" class="fa fa-comments-o" href="#"></a>#}
|
||||
<a id="scrollToTop" class="fa fa-angle-double-up larger hidden" onclick="scrollToTop();" href="#top"></a>
|
||||
</div>
|
||||
|
||||
{# include 'global/chat.tpl' #}
|
||||
</div>
|
||||
<div class="footer">
|
||||
<div class="ftsections">
|
||||
|
|
|
@ -13,5 +13,8 @@
|
|||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block js %}
|
||||
<script type="text/javascript" src="{{ sakura.resources }}/js/ybabstat.js"></script>
|
||||
{% endblock %}
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
{% endif %}
|
||||
<br />
|
||||
<b>{{ profile.data.username }} has {% if not profile.forumStats.posts %}no{% else %}{{ profile.forumStats.posts }}{% endif %} forum post{% if profile.forumStats.posts != 1 %}s{% endif %}.</b>
|
||||
{% if profile.data.birthday != '0000-00-00' %}
|
||||
{% if profile.data.birthday != '0000-00-00' and profile.data.birthday|split('-')[0] > 0 %}
|
||||
<br /><b>Age</b> <span title="{{ profile.data.birthday }}">{{ profile.elapsed(' old').birth }}</span>
|
||||
{% endif %}
|
||||
{% if profile.profileFields %}
|
||||
|
|
106
public/content/data/yuuno/css/chat.css
Normal file
106
public/content/data/yuuno/css/chat.css
Normal file
|
@ -0,0 +1,106 @@
|
|||
/*
|
||||
* Site chat styling
|
||||
*/
|
||||
#chat > #chatOnlineUsers {
|
||||
position: fixed;
|
||||
right: -300px;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 300px;
|
||||
background: rgba(0, 0, 0, .7);
|
||||
color: #FFF;
|
||||
z-index: 1;
|
||||
box-shadow: 0 0 2px #222;
|
||||
overflow: auto;
|
||||
transition: .5s;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
#chat > #chatOnlineUsers.open {
|
||||
right: 0;
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
#chat > #chatOnlineUsers > div {
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
#chat > #chatOnlineUsers > .chatOnlineListTitle {
|
||||
background: none;
|
||||
font-size: 2em;
|
||||
line-height: 1.2em;
|
||||
font-family: "SegoeUI-Light", sans-serif;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
#chatUserList > div {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background: rgba(0, 0, 0, .7);
|
||||
padding: 5px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
#chatUserList > div:not(:last-child) {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
#chatUserList > div > .avatar {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
background: transparent url("/content/pixel.png") no-repeat scroll left center / contain;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
#chatUserList > div > .options {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
#chatUserList > div > .options > .actions {
|
||||
list-style: none;
|
||||
font-size: .8em;
|
||||
line-height: 1.2em;
|
||||
}
|
||||
|
||||
#chatAccessButtons {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
#chatAccessButtons > a {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin: 5px 0;
|
||||
background: rgba(0, 0, 0, .5);
|
||||
color: #FFF;
|
||||
font-size: 2em;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
border-radius: 5px 0 0 5px;
|
||||
text-decoration: none;
|
||||
text-align: center;
|
||||
text-shadow: 0 0 2px #FFF;
|
||||
position: relative;
|
||||
transition: .5s;
|
||||
box-shadow: 0 0 2px #222;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#chatAccessButtons > a:hover {
|
||||
text-shadow: 0 0 5px #FFF;
|
||||
}
|
||||
|
||||
#chatAccessButtons > a:active {
|
||||
text-shadow: 0 0 7px #FFF;
|
||||
}
|
||||
|
||||
#chatAccessButtons > a.enter {
|
||||
animation: slideInFromRight 1 .6s, fadeIn 1 .6s;
|
||||
}
|
||||
|
||||
#chatAccessButtons > a.exit {
|
||||
animation: slideOutToBottom 1 .6s, fadeOut 1 .6s;
|
||||
}
|
|
@ -422,48 +422,6 @@ a.default:active {
|
|||
|
||||
}
|
||||
|
||||
#actionBtns {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
z-index: 4;
|
||||
}
|
||||
|
||||
#actionBtns > a {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin: 5px 0;
|
||||
background: rgba(0, 0, 0, .5);
|
||||
color: #FFF;
|
||||
font-size: 2em;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
border-radius: 5px 0 0 5px;
|
||||
text-decoration: none;
|
||||
text-align: center;
|
||||
text-shadow: 0 0 2px #FFF;
|
||||
position: relative;
|
||||
transition: .5s;
|
||||
box-shadow: 0 0 2px #222;
|
||||
}
|
||||
|
||||
#actionBtns > a:hover {
|
||||
text-shadow: 0 0 5px #FFF;
|
||||
}
|
||||
|
||||
#actionBtns > a:active {
|
||||
text-shadow: 0 0 7px #FFF;
|
||||
}
|
||||
|
||||
#actionBtns > a.enter {
|
||||
animation: slideInFromRight 1 .6s, fadeIn 1 .6s;
|
||||
}
|
||||
|
||||
#actionBtns > a.exit {
|
||||
animation: slideOutToBottom 1 .6s, fadeOut 1 .6s;
|
||||
}
|
||||
|
||||
#headerLoginForm {
|
||||
background: rgba(211, 191, 255, .8);
|
||||
border: 1px solid #9475B2;
|
||||
|
@ -548,63 +506,6 @@ a.default:active {
|
|||
text-shadow: 0 0 8px #8364A1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Site chat styling
|
||||
*/
|
||||
#chat > #chatOnlineUsers {
|
||||
position: fixed;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 300px;
|
||||
background: rgba(0, 0, 0, .7);
|
||||
color: #FFF;
|
||||
z-index: 3;
|
||||
box-shadow: 0 0 2px #222;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
#chat > #chatOnlineUsers > div {
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
#chat > #chatOnlineUsers > .chatOnlineListTitle {
|
||||
background: none;
|
||||
font-size: 2em;
|
||||
line-height: 1.2em;
|
||||
font-family: "SegoeUI-Light", sans-serif;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
#chatUserList > div {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background: rgba(0, 0, 0, .7);
|
||||
padding: 5px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
#chatUserList > div:not(:last-child) {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
#chatUserList > div > .avatar {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
background: transparent url("/content/pixel.png") no-repeat scroll left center / contain;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
#chatUserList > div > .options {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
#chatUserList > div > .options > .actions {
|
||||
list-style: none;
|
||||
font-size: .8em;
|
||||
line-height: 1.2em;
|
||||
}
|
||||
|
||||
/*
|
||||
* Site header styling
|
||||
*/
|
||||
|
|
57
public/content/data/yuuno/js/chat.js
Normal file
57
public/content/data/yuuno/js/chat.js
Normal file
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* On-site Sock Chat client
|
||||
*/
|
||||
|
||||
var Chat = {
|
||||
|
||||
server: null,
|
||||
chatContainer: null,
|
||||
accessButtons: null,
|
||||
onlineList: null,
|
||||
connected: false,
|
||||
|
||||
connect: function(server, force) {
|
||||
// Set server
|
||||
this.server = server;
|
||||
|
||||
// Set required variables
|
||||
this.chatContainer = document.getElementById('chat');
|
||||
this.accessButtons = document.getElementById('chatAccessButtons');
|
||||
this.onlineList = document.getElementById('chatOnlineUsers');
|
||||
|
||||
// Check if we haven't already established a connection
|
||||
if(this.connected && !force) {
|
||||
this.accessButtons.innerHTML += '<a id="chatConnecting" class="fa fa-exclamation-triangle" title="Force a reconnect." href="javascript:void(0);" onclick="Chat.connect('+ this.server +', true);"></a>';
|
||||
}
|
||||
|
||||
// Attempt to connect to the server
|
||||
this.accessButtons.innerHTML = '<a id="chatConnecting" title="Connecting to chat..."><div class="fa fa-spin fa-spinner" style="line-height: inherit;"></div></a>';
|
||||
|
||||
// Grab connection indicator
|
||||
var connectionIndicator = document.getElementById('chatConnecting');
|
||||
|
||||
setTimeout(function() {
|
||||
if(Chat.connected) {
|
||||
connectionIndicator.setAttribute('title', 'Connected!');
|
||||
connectionIndicator.children[0].className = 'fa fa-chain';
|
||||
var accessButtonsCont = '<a id="showOnlineUsers" class="fa fa-users" href="javascript:void(0);" onclick="Chat.toggleOnlineList();" title="Toggle online users list"></a><a id="openSiteChat" class="fa fa-comments-o" href="javascript:void(0);" title="View chat"></a>';
|
||||
} else {
|
||||
connectionIndicator.setAttribute('title', 'Failed to connect, try again later!');
|
||||
connectionIndicator.children[0].className = 'fa fa-chain-broken';
|
||||
var accessButtonsCont = '<a id="showChatTicker" class="fa fa-refresh" href="javascript:void(0);" onclick="Chat.connect('+ this.server +');"></a>';
|
||||
}
|
||||
setTimeout(function() {
|
||||
Chat.accessButtons.innerHTML = accessButtonsCont;
|
||||
}, 500);
|
||||
}, 500);
|
||||
},
|
||||
|
||||
toggleOnlineList: function() {
|
||||
this.onlineList.className = this.onlineList.className != 'open' ? 'open' : '';
|
||||
},
|
||||
|
||||
toggleTicker: function() {
|
||||
this.chatTicker.className = this.chatTicker.className != 'open' ? 'open' : '';
|
||||
}
|
||||
|
||||
};
|
|
@ -864,49 +864,3 @@ var n = this,
|
|||
j = (j = i.length) > 3 ? j % 3 : 0;
|
||||
return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
|
||||
};
|
||||
|
||||
// Event watcher for the scroll-to-top button
|
||||
window.onscroll = function() {
|
||||
|
||||
// Assign the gotop button to a variable
|
||||
var gotop = document.getElementById('scrollToTop');
|
||||
|
||||
// If the vertical offset of the page is below 112px (just below the header) keep the button hidden
|
||||
if(this.pageYOffset < 1) {
|
||||
|
||||
// Check if the "exit" is in the classes and if it isn't continue
|
||||
if(gotop.className.indexOf('exit') < 0) {
|
||||
|
||||
// Replace the enter with exit (for the animation)
|
||||
gotop.className = gotop.className.replace('enter', '');
|
||||
gotop.className = gotop.className + ' exit';
|
||||
|
||||
// Check if hidden is set and if not continue
|
||||
if(gotop.className.indexOf('hidden') < 0) {
|
||||
|
||||
// Set a timeout to add the hidden class after 600ms
|
||||
setTimeout(function() {
|
||||
if(this.pageYOffset < 1) {
|
||||
gotop.className = gotop.className + ' hidden';
|
||||
}
|
||||
}, 600);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Else show the button
|
||||
} else if(this.pageYOffset > 0) {
|
||||
|
||||
// Check if enter is set
|
||||
if(gotop.className.indexOf('enter') < 0) {
|
||||
|
||||
// Remove the hidden and exit classes and add the enter class
|
||||
gotop.className = gotop.className.replace('hidden', '');
|
||||
gotop.className = gotop.className.replace('exit', '');
|
||||
gotop.className = gotop.className + ' enter';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
|
Reference in a new issue