From 70dc31bbe0396f6cd6fb4070d9e4d897bdcc51f9 Mon Sep 17 00:00:00 2001 From: flashwave Date: Sun, 27 Sep 2015 23:04:12 +0200 Subject: [PATCH] r20150927 Signed-off-by: Flashwave --- _sakura/changelog.json | 26 ++++++ _sakura/components/Main.php | 2 +- _sakura/sakura.php | 2 +- _sakura/templates/yuuno/global/chat.tpl | 30 ++++++ _sakura/templates/yuuno/global/master.tpl | 38 +------- _sakura/templates/yuuno/main/index.tpl | 3 + _sakura/templates/yuuno/profile/index.tpl | 2 +- public/content/data/yuuno/css/chat.css | 106 ++++++++++++++++++++++ public/content/data/yuuno/css/yuuno.css | 99 -------------------- public/content/data/yuuno/js/chat.js | 57 ++++++++++++ public/content/data/yuuno/js/yuuno.js | 46 ---------- 11 files changed, 227 insertions(+), 184 deletions(-) create mode 100644 _sakura/templates/yuuno/global/chat.tpl create mode 100644 public/content/data/yuuno/css/chat.css create mode 100644 public/content/data/yuuno/js/chat.js diff --git a/_sakura/changelog.json b/_sakura/changelog.json index 468f0c8..20d4228 100644 --- a/_sakura/changelog.json +++ b/_sakura/changelog.json @@ -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" + } + ] } diff --git a/_sakura/components/Main.php b/_sakura/components/Main.php index 5e5cd6c..48bc493 100644 --- a/_sakura/components/Main.php +++ b/_sakura/components/Main.php @@ -147,7 +147,7 @@ class Main [ 'backtrace' => [$backtrace, '=', true], 'error_string' => [$errstr, '='], - 'error_line' => [$errstr, '='], + 'error_line' => [$errline, '='], ] )) { // If so assign the errid diff --git a/_sakura/sakura.php b/_sakura/sakura.php index c897aae..f303585 100644 --- a/_sakura/sakura.php +++ b/_sakura/sakura.php @@ -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); diff --git a/_sakura/templates/yuuno/global/chat.tpl b/_sakura/templates/yuuno/global/chat.tpl new file mode 100644 index 0000000..34286f5 --- /dev/null +++ b/_sakura/templates/yuuno/global/chat.tpl @@ -0,0 +1,30 @@ +{% block content %} +
+
+
+
+ Online Users +
+
+
+
+
+
Hanyuu
+
Display actions
+
+
+
+
+
+{% endblock %} + +{% block style %} + +{% endblock %} + +{% block js %} + + +{% endblock %} diff --git a/_sakura/templates/yuuno/global/master.tpl b/_sakura/templates/yuuno/global/master.tpl index 1be95fa..cf67ce6 100644 --- a/_sakura/templates/yuuno/global/master.tpl +++ b/_sakura/templates/yuuno/global/master.tpl @@ -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 %}

{{ php.self }} is now printing!

{% endblock %} -{# -
-
-
- Online Users -
-
-
-
-
-
Hanyuu
-
Display actions
-
-
-
-
-
-
Flashwave
-
Display actions
-
-
-
-
-
-#} -
-{# - - #} - -
+ + {# include 'global/chat.tpl' #} +{% endblock %} + +{% block js %} {% endblock %} diff --git a/_sakura/templates/yuuno/profile/index.tpl b/_sakura/templates/yuuno/profile/index.tpl index 85817e7..4971798 100644 --- a/_sakura/templates/yuuno/profile/index.tpl +++ b/_sakura/templates/yuuno/profile/index.tpl @@ -46,7 +46,7 @@ {% endif %}
{{ profile.data.username }} has {% if not profile.forumStats.posts %}no{% else %}{{ profile.forumStats.posts }}{% endif %} forum post{% if profile.forumStats.posts != 1 %}s{% endif %}. - {% if profile.data.birthday != '0000-00-00' %} + {% if profile.data.birthday != '0000-00-00' and profile.data.birthday|split('-')[0] > 0 %}
Age {{ profile.elapsed(' old').birth }} {% endif %} {% if profile.profileFields %} diff --git a/public/content/data/yuuno/css/chat.css b/public/content/data/yuuno/css/chat.css new file mode 100644 index 0000000..631a043 --- /dev/null +++ b/public/content/data/yuuno/css/chat.css @@ -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; +} diff --git a/public/content/data/yuuno/css/yuuno.css b/public/content/data/yuuno/css/yuuno.css index 61bb2ae..6e520c4 100644 --- a/public/content/data/yuuno/css/yuuno.css +++ b/public/content/data/yuuno/css/yuuno.css @@ -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 */ diff --git a/public/content/data/yuuno/js/chat.js b/public/content/data/yuuno/js/chat.js new file mode 100644 index 0000000..54bdfb7 --- /dev/null +++ b/public/content/data/yuuno/js/chat.js @@ -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 += ''; + } + + // Attempt to connect to the server + this.accessButtons.innerHTML = '
'; + + // 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 = ''; + } else { + connectionIndicator.setAttribute('title', 'Failed to connect, try again later!'); + connectionIndicator.children[0].className = 'fa fa-chain-broken'; + var accessButtonsCont = ''; + } + 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' : ''; + } + +}; diff --git a/public/content/data/yuuno/js/yuuno.js b/public/content/data/yuuno/js/yuuno.js index 0e04c4b..c0e48db 100644 --- a/public/content/data/yuuno/js/yuuno.js +++ b/public/content/data/yuuno/js/yuuno.js @@ -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'; - - } - - } - -};