Merge branch 'master' of github.com:designcreateplay/NodeBB

v1.18.x
Julian Lam 12 years ago
commit 31f08c49e7

@ -27,7 +27,7 @@ var fs = require('fs'),
meta = require('./src/meta.js'); meta = require('./src/meta.js');
// Runtime environment // Runtime environment
global.env = process.env.NODE_ENV || 'production', global.env = process.env.NODE_ENV || 'production';
@ -39,7 +39,7 @@ winston.add(winston.transports.Console, {
winston.add(winston.transports.File, { winston.add(winston.transports.File, {
filename:'error.log', filename:'error.log',
level:'error' level:'error'
}) });
// TODO: remove once https://github.com/flatiron/winston/issues/280 is fixed // TODO: remove once https://github.com/flatiron/winston/issues/280 is fixed
winston.err = function(err) { winston.err = function(err) {
@ -134,7 +134,7 @@ if(nconf.get('upgrade')) {
} else { } else {
// New install, ask setup questions // New install, ask setup questions
if (nconf.get('setup')) winston.info('NodeBB Setup Triggered via Command Line'); if (nconf.get('setup')) winston.info('NodeBB Setup Triggered via Command Line');
else winston.info('Configuration not found, starting NodeBB setup'); else winston.warn('Configuration not found, starting NodeBB setup');
var install = require('./src/install'); var install = require('./src/install');

@ -18,7 +18,7 @@
#pagination { .pagination-block {
position: absolute; position: absolute;
background: rgb(34, 34, 34); background: rgb(34, 34, 34);
right: 0px; right: 0px;

@ -33,7 +33,7 @@ var ajaxify = {};
app.enter_room('global'); app.enter_room('global');
pagination = pagination || document.getElementById('pagination'); pagination = pagination || document.getElementById('pagination');
if (pagination) pagination.style.display = 'none'; if (pagination) pagination.parentNode.style.display = 'none';
window.onscroll = null; window.onscroll = null;
// end // end

@ -374,6 +374,18 @@ var socket,
}); });
} }
app.scrollToTop = function() {
$('body,html').animate({
scrollTop: 0
});
};
app.scrollToBottom = function() {
$('body,html').animate({
scrollTop: $('html').height() - 100
});
}
app.scrollToPost = function(pid) { app.scrollToPost = function(pid) {
if(!pid) if(!pid)

@ -615,21 +615,30 @@
var postcount = templates.get('postcount'); var postcount = templates.get('postcount');
function updateHeader() { function updateHeader() {
if (pagination == null) {
jQuery('.pagination-block i:first').on('click', function() {
app.scrollToTop();
});
jQuery('.pagination-block i:last').on('click', function() {
app.scrollToBottom();
});
}
jQuery('.post-author-info').css('bottom', '0px'); jQuery('.post-author-info').css('bottom', '0px');
postAuthorImage = postAuthorImage || document.getElementById('post-author-image'); postAuthorImage = postAuthorImage || document.getElementById('post-author-image');
postAuthorInfo = postAuthorInfo || document.getElementById('post-author-info'); postAuthorInfo = postAuthorInfo || document.getElementById('post-author-info');
pagination = pagination || document.getElementById('pagination'); pagination = pagination || document.getElementById('pagination');
pagination.style.display = 'block'; pagination.parentNode.style.display = 'block';
var windowHeight = jQuery(window).height(); var windowHeight = jQuery(window).height();
var scrollTop = jQuery(window).scrollTop(); var scrollTop = jQuery(window).scrollTop();
var scrollBottom = scrollTop + windowHeight; var scrollBottom = scrollTop + windowHeight;
if (scrollTop < 50) { if (scrollTop < 50 && postcount > 1) {
postAuthorImage.src = (jQuery('.main-avatar img').attr('src')); postAuthorImage.src = (jQuery('.main-avatar img').attr('src'));
postAuthorInfo.innerHTML = 'Posted by ' + jQuery('.main-post').attr('data-username') + ', ' + jQuery('.main-post').find('.relativeTimeAgo').html(); postAuthorInfo.innerHTML = 'Posted by ' + jQuery('.main-post').attr('data-username') + ', ' + jQuery('.main-post').find('.relativeTimeAgo').html();
pagination.innerHTML = '0 / ' + postcount; pagination.innerHTML = '0 out of ' + postcount;
return; return;
} }
@ -651,15 +660,17 @@
if (inView) { if (inView) {
pagination.innerHTML = this.postnumber + ' / ' + postcount; pagination.innerHTML = this.postnumber + ' out of ' + postcount;
postAuthorImage.src = (jQuery(this).find('.profile-image-block img').attr('src')); postAuthorImage.src = (jQuery(this).find('.profile-image-block img').attr('src'));
postAuthorInfo.innerHTML = 'Posted by ' + jQuery(this).attr('data-username') + ', ' + jQuery(this).find('.relativeTimeAgo').html(); postAuthorInfo.innerHTML = 'Posted by ' + jQuery(this).attr('data-username') + ', ' + jQuery(this).find('.relativeTimeAgo').html();
} }
}); });
if(scrollTop + windowHeight == jQuery(document).height()) { setTimeout(function() {
pagination.innerHTML = postcount + ' / ' + postcount; if(scrollTop + windowHeight == jQuery(document).height()) {
} pagination.innerHTML = postcount + ' out of ' + postcount;
}
}, 100);
} }
window.onscroll = updateHeader; window.onscroll = updateHeader;

@ -82,7 +82,11 @@
</li> </li>
</ul> </ul>
<div id="pagination"></div> <div class="pagination-block">
<i class="icon-upload pointer"></i>
<span id="pagination"></span>
<i class="icon-upload pointer icon-rotate-180"></i>
</div>
</div> </div>
</div> </div>
</div> </div>

@ -33,7 +33,7 @@ var fs = require('fs'),
} else next(); } else next();
}, },
function(next) { function(next) {
winston.info('[plugins] Sorting hooks to fire in priority sequence'); if (global.env === 'development') winston.info('[plugins] Sorting hooks to fire in priority sequence');
Object.keys(_self.loadedHooks).forEach(function(hook) { Object.keys(_self.loadedHooks).forEach(function(hook) {
var hooks = _self.loadedHooks[hook]; var hooks = _self.loadedHooks[hook];
hooks = hooks.sort(function(a, b) { hooks = hooks.sort(function(a, b) {

Loading…
Cancel
Save