Baris Soner Usakli 11 years ago
commit 0bcc1642c7

@ -31,6 +31,8 @@ var ajaxify = {};
var pagination, paginator_bar;
ajaxify.currentPage = null;
ajaxify.go = function (url, callback, template, quiet) {
// start: the following should be set like so: ajaxify.onchange(function(){}); where the code actually belongs
$(window).off('scroll');
@ -69,6 +71,8 @@ var ajaxify = {};
}
if (templates.is_available(tpl_url) && !templates.force_refresh(tpl_url)) {
ajaxify.currentPage = tpl_url;
if (window.history && window.history.pushState) {
window.history[!quiet ? 'pushState' : 'replaceState']({
url: url
@ -90,7 +94,7 @@ var ajaxify = {};
translator.load(tpl_url);
jQuery('#footer, #content').addClass('ajaxifying');
jQuery('#footer, #content').removeClass('hide').addClass('ajaxifying');
templates.flush();
templates.load_template(function () {
@ -129,6 +133,10 @@ var ajaxify = {};
return false;
};
ajaxify.refresh = function() {
ajaxify.go(ajaxify.currentPage);
};
$('document').ready(function () {
if (!window.history || !window.history.pushState) {
return; // no ajaxification for old browsers
@ -154,7 +162,7 @@ var ajaxify = {};
return;
}
if (!e.ctrlKey && e.which === 1) {
if ((!e.ctrlKey && !e.shiftKey) && e.which === 1) {
if (this.host === window.location.host) {
// Internal link
var url = this.href.replace(rootUrl + '/', '');

@ -67,6 +67,7 @@
notifTrigger = notifContainer.querySelector('a'),
notifList = document.getElementById('notif-list'),
notifIcon = $('.notifications a');
notifTrigger.addEventListener('click', function(e) {
e.preventDefault();
if (notifContainer.className.indexOf('open') === -1) {
@ -169,6 +170,10 @@
});
app.refreshTitle();
if (ajaxify.currentPage === 'notifications') {
ajaxify.refresh();
}
// Update the favicon + local storage
var savedCount = parseInt(localStorage.getItem('notifications:count'),10) || 0;
localStorage.setItem('notifications:count', savedCount+1);

@ -81,18 +81,20 @@ define(function() {
}
Recent.onTopicsLoaded = function(topics) {
var html = templates.prepare(templates['recent'].blocks['topics']).parse({
topics: topics
}),
container = $('#topics-container');
});
translator.translate(html, function(translatedHTML) {
var container = $('#topics-container');
$('#category-no-topics').remove();
$('#category-no-topics').remove();
html = $(html);
container.append(html);
$('span.timeago').timeago();
app.makeNumbersHumanReadable(html.find('.human-readable-number'));
html = $(html);
container.append(html);
$('span.timeago').timeago();
app.makeNumbersHumanReadable(html.find('.human-readable-number'));
});
}
Recent.loadMoreTopics = function() {

@ -71,18 +71,20 @@ define(function() {
});
function onTopicsLoaded(topics) {
var html = templates.prepare(templates['unread'].blocks['topics']).parse({
topics: topics
}),
container = $('#topics-container');
});
$('#category-no-topics').remove();
translator.translate(html, function(translatedHTML) {
var container = $('#topics-container');
html = $(html);
container.append(html);
$('span.timeago').timeago();
app.makeNumbersHumanReadable(html.find('.human-readable-number'));
$('#category-no-topics').remove();
html = $(translatedHTML);
container.append(html);
$('span.timeago').timeago();
app.makeNumbersHumanReadable(html.find('.human-readable-number'));
});
}
function loadMoreTopics() {

@ -10,17 +10,17 @@
<div class="modal-body">
<div id="gravatar-box">
<img id="user-gravatar-picture" src="" class="img-thumbnail user-profile-picture">
<span class="user-picture-label">[[user: gravatar]]</span>
<span class="user-picture-label">[[user:gravatar]]</span>
<i class='fa fa-check fa-2x'></i>
</div>
<br/>
<div id="uploaded-box">
<img id="user-uploaded-picture" src="" class="img-thumbnail user-profile-picture">
<span class="user-picture-label">[[user: uploaded_picture]]</span>
<span class="user-picture-label">[[user:uploaded_picture]]</span>
<i class='fa fa-check fa-2x'></i>
</div>
<a id="uploadPictureBtn" href="#">[[user: upload_new_picture]]</a>
<a id="uploadPictureBtn" href="#">[[user:upload_new_picture]]</a>
</div>
<div class="modal-footer">
<button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>

@ -59,7 +59,7 @@
<div id="alert_window"></div>
<footer id="footer" class="container footer">
<footer id="footer" class="container footer hide">
{footerHTML}
<div class="copyright">
Copyright &copy; 2013 <a target="_blank" href="http://www.nodebb.com">NodeBB Forums</a> | <a target="_blank" href="//github.com/designcreateplay/NodeBB/graphs/contributors">Contributors</a>

Loading…
Cancel
Save