Skip to content

Node.js based forum software built for the modern web

fixed two bugs in admin, meta.buildTitle errors out because no notification icon is present; pagination element missing

psychobunny7666ed3010f5
diff --git a/public/css/style.less b/public/css/style.less
index 4d0f58edc3..266bdb2dcd 100644
--- a/public/css/style.less
+++ b/public/css/style.less
@@ -94,10 +94,10 @@ footer.footer {
i {
-webkit-transition: color 100ms linear;
- -moz-transition: color 100ms linear;
- -ms-transition: color 100ms linear;
- -o-transition: color 100ms linear;
- transition: color 100ms linear;
+ -moz-transition: color 100ms linear;
+ -ms-transition: color 100ms linear;
+ -o-transition: color 100ms linear;
+ transition: color 100ms linear;
&.icon-twitter-sign:hover {
color: #4099FF;
diff --git a/public/src/ajaxify.js b/public/src/ajaxify.js
index bbd5617669..370894927b 100644
--- a/public/src/ajaxify.js
+++ b/public/src/ajaxify.js
@@ -25,12 +25,17 @@ var ajaxify = {};
if (event !== null && event.state && event.state.url !== undefined) ajaxify.go(event.state.url, null, null, true);
};
+ var pagination;
+
ajaxify.go = function(url, callback, template, quiet) {
- // the following should be set like so: ajaxify.onchange(function(){}); where the code actually belongs
+ // start: the following should be set like so: ajaxify.onchange(function(){}); where the code actually belongs
$(window).off('scroll');
app.enter_room('global');
- document.getElementById('pagination').style.display = 'none';
+
+ pagination = pagination || document.getElementById('pagination');
+ if (pagination) pagination.style.display = 'none';
window.onscroll = null;
+ // end
var url = url.replace(/\/$/, "");
diff --git a/public/src/utils.js b/public/src/utils.js
index b3d3f756f4..106ade3662 100644
--- a/public/src/utils.js
+++ b/public/src/utils.js
@@ -1,5 +1,5 @@
(function (module) {
-
+
var utils, fs;
try {
@@ -39,15 +39,15 @@
});
});
},
-
+
relativeTime: function(timestamp, min) {
var now = +new Date(),
difference = now - Math.floor(parseFloat(timestamp));
difference = Math.floor(difference / 1000);
-
+
if (difference < 60) return difference + (min ? 's' : ' second') + (difference !== 1 && !min ? 's' : '');
-
+
difference = Math.floor(difference / 60);
if (difference < 60) return difference + (min ? 'm' : ' minute') + (difference !== 1 && !min ? 's' : '');
@@ -63,7 +63,7 @@
difference = Math.floor(difference / 12);
return difference + (min ? 'y' : ' year') + (difference !== 1 && !min ? 's' : '');
},
-
+
//http://dense13.com/blog/2009/05/03/converting-string-to-slug-javascript/
slugify: function(str) {
str = str.replace(/^\s+|\s+$/g, ''); // trim
@@ -93,7 +93,7 @@
isUserNameValid: function(name) {
return (name && name !== "" && (/^[a-zA-Z0-9 _-]{3,14}$/.test(name)));
},
-
+
isPasswordValid: function(password) {
return password && password.indexOf(' ') === -1 && password.length > 5;
},
@@ -132,10 +132,12 @@
a.href = document.location;
url = a.pathname.slice(1);
}
+ var notificationIcon;
socket.emit('api:meta.buildTitle', url, function(title, numNotifications) {
document.title = (numNotifications > 0 ? '(' + numNotifications + ') ' : '') + title;
- if (numNotifications > 0) document.querySelector('.notifications a i').className = 'icon-circle active';
+ notificationIcon = notificationIcon || document.querySelector('.notifications a i');
+ if (numNotifications > 0 && notificationIcon) notificationIcon.className = 'icon-circle active';
});
jQuery.getJSON(RELATIVE_PATH + '/api/unread/total', function(data) {
@@ -169,16 +171,16 @@
if (!String.prototype.ltrim) {
String.prototype.ltrim=function(){return this.replace(/^\s+/,'');};
}
-
+
if (!String.prototype.rtrim) {
- String.prototype.rtrim=function(){return this.replace(/\s+$/,'');};
+ String.prototype.rtrim=function(){return this.replace(/\s+$/,'');};
}
-
+
if (!String.prototype.fulltrim) {
- String.prototype.fulltrim=function(){return this.replace(/(?:(?:^|\n)\s+|\s+(?:$|\n))/g,'').replace(/\s+/g,' ');};
+ String.prototype.fulltrim=function(){return this.replace(/(?:(?:^|\n)\s+|\s+(?:$|\n))/g,'').replace(/\s+/g,' ');};
}
-
+
if ('undefined' !== typeof window) {
window.utils = module.exports;
}
diff --git a/public/templates/admin/header.tpl b/public/templates/admin/header.tpl
index a0908daf88..7bb37ade4a 100644
--- a/public/templates/admin/header.tpl
+++ b/public/templates/admin/header.tpl
@@ -28,7 +28,7 @@
<link rel="stylesheet" type="text/css" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">
<script type="text/javascript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script src="{relative_path}/src/utils.js"></script>
-
+
<link rel="stylesheet" type="text/css" href="{relative_path}/css/style.css" />
<link rel="stylesheet" type="text/css" href="{relative_path}/css/admin.css" />
</head>
@@ -64,7 +64,7 @@
</div>
<div id="alert_window"></div>
-
+
<div class="container">
<div class="row">
<div class="col-md-3">
@@ -102,4 +102,4 @@
</ul>
</div><!--/.well -->
</div><!--/span-->
- <div class="span9" id="content">
\ No newline at end of file
+ <div class="col-md-9" id="content">
\ No newline at end of file