diff --git a/.gitignore b/.gitignore index 6c0c33d689..d3b77831d4 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,6 @@ provision.sh *.komodoproject feeds/recent.rss + +# winston? +error.log diff --git a/app.js b/app.js index 8defae9ab2..e1201f1bd1 100644 --- a/app.js +++ b/app.js @@ -25,6 +25,7 @@ var fs = require('fs'), async = require('async'), + semver = require('semver'), winston = require('winston'), pkg = require('./package.json'), path = require('path'), @@ -48,6 +49,12 @@ winston.error(err.stack); }; + require('child_process').exec('/usr/bin/which convert', function(err, stdout, stderr) { + if(err || !stdout) { + winston.warn('Couldn\'t find convert. Did you install imagemagick?'); + } + }); + // Log GNU copyright info along with server info winston.info('NodeBB v' + pkg.version + ' Copyright (C) 2013 DesignCreatePlay Inc.'); winston.info('This program comes with ABSOLUTELY NO WARRANTY.'); @@ -73,6 +80,10 @@ winston.info('Base Configuration OK.'); } + if (semver.gt(pkg.dependencies['nodebb-theme-cerulean'], require('./node_modules/nodebb-theme-cerulean/package.json').version)) { + winston.error('nodebb-theme-cerulean is out of date - please run npm install.') + } + require('./src/database').init(function(err) { meta.configs.init(function () { diff --git a/package.json b/package.json index c7ba9b9586..84aa875645 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "dependencies": { "socket.io": "~0.9.16", "redis": "0.8.3", - "mongodb": "1.3.20", + "mongodb": "~1.3.19", "express": "3.2.0", "express-namespace": "~0.1.1", "emailjs": "0.3.4", @@ -43,10 +43,11 @@ "uglify-js": "~2.4.0", "validator": "~1.5.1", "nodebb-plugin-mentions": "~0.1.15", - "nodebb-plugin-markdown": "~0.2.0", + "nodebb-plugin-markdown": "~0.2.1", "nodebb-theme-vanilla": "~0.0.9", "nodebb-theme-cerulean": "0.0.10", - "cron": "~1.0.1" + "cron": "~1.0.1", + "semver": "~2.2.1" }, "optionalDependencies": { "hiredis": "~0.1.15" diff --git a/public/language/de/topic.json b/public/language/de/topic.json index e882660101..198fb414d9 100644 --- a/public/language/de/topic.json +++ b/public/language/de/topic.json @@ -36,5 +36,8 @@ "loading": "Lade", "more_posts": "Mehr Posts", "move_topic": "Thema verschieben", - "topic_will_be_moved_to": "Dieses Thema wird verschoben nach" + "topic_will_be_moved_to": "Dieses Thema wird verschoben nach", + + "reputation": "Reputation", + "posts": "Posts" } diff --git a/public/language/de/user.json b/public/language/de/user.json index 492307f50d..9ca07d5433 100644 --- a/public/language/de/user.json +++ b/public/language/de/user.json @@ -7,7 +7,7 @@ "location": "Wohnort", "age": "Alter", "joined": "Beigetreten", - "profil_views": "Profilaufrufe", + "profile_views": "Profilaufrufe", "reputation": "Reputation", "posts": "Posts", "followers": "Follower", @@ -18,7 +18,7 @@ "change_picture": "Ändere Profilbild", "edit": "Ändern", - "uploaded_pictures": "Hochgeladene Bilder", + "uploaded_picture": "Hochgeladene Bilder", "upload_new_picture": "Neues Bild hochladen", "change_password": "Ändere Passwort", "confirm_password": "Passwort wiederholen", @@ -29,7 +29,7 @@ "image_spec": "Du solltest nur Dateien die PNG, JPG, oder GIF kleiner als 256kb hochladen.", "settings": "Einstellungen", - "show_my_email": "Zeige meine E-Mail Adresse an.", + "show_email": "Zeige meine E-Mail Adresse an.", "has_no_follower": "Dieser User hat noch keine Follower.", "follows_no_one": "Dieser User folgt noch niemanden." diff --git a/public/language/en/topic.json b/public/language/en/topic.json index 2584436a22..9df5829bea 100644 --- a/public/language/en/topic.json +++ b/public/language/en/topic.json @@ -32,8 +32,11 @@ "favourites.has_no_favourites": "You don't have any favourites, favourite some posts to see them here!", "posted_by": "posted by", - "loading": "Lade", + "loading": "Loading", "more_posts": "More Posts", "move_topic": "Move Topic", - "topic_will_be_moved_to": "This topic will be moved to the category" + "topic_will_be_moved_to": "This topic will be moved to the category", + + "reputation": "Reputation", + "posts": "Posts" } diff --git a/public/language/en/user.json b/public/language/en/user.json index 512fad96c3..1b58f198de 100644 --- a/public/language/en/user.json +++ b/public/language/en/user.json @@ -1,35 +1,35 @@ { "banned": "Banned", - "offline": "offline", - "email": "email", - "fullname": "full name", - "website": "website", - "location": "location", - "age": "age", - "joined": "joined", - "profil_views": "profil views", - "reputation": "reputation", - "posts": "posts", - "followers": "followers", - "following": "following", - "signature": "signature", - "gravatar": "gravatar", - "birthday": "birthday", + "offline": "Offline", + "email": "Email", + "fullname": "Full Name", + "website": "Website", + "location": "Location", + "age": "Age", + "joined": "Joined", + "profile_views": "Profile views", + "reputation": "Reputation", + "posts": "Posts", + "followers": "Followers", + "following": "Following", + "signature": "Signature", + "gravatar": "Gravatar", + "birthday": "Birthday", - "change_picture": "change picture", - "edit": "edit", - "uploaded_pictures": "uploaded pictures", - "upload_new_picture": "upload new picture", - "change_password": "change password", - "confirm_password": "confirm password", - "password": "password", + "change_picture": "Change Picture", + "edit": "Edit", + "uploaded_picture": "Uploaded Picture", + "upload_new_picture": "Upload New Picture", + "change_password": "Change Password", + "confirm_password": "Confirm Password", + "password": "Password", "upload_picture": "Upload picture", "upload_a_picture": "Upload a picture", "image_spec": "You may only upload PNG, JPG, or GIF files under 256kb.", "settings": "settings", - "show_my_email": "show my email", + "show_email": "Show My Email", "has_no_follower": "This user doesn't have any followers :(", "follows_no_one": "This user isn't following anyone :(" diff --git a/public/language/es/topic.json b/public/language/es/topic.json index 865c80a59b..97f5291258 100644 --- a/public/language/es/topic.json +++ b/public/language/es/topic.json @@ -35,5 +35,8 @@ "loading": "Cargando", "more_posts": "Más posts", "move_topic": "Mover Tema", - "topic_will_be_moved_to": "Este tema sera movido a la categoría" + "topic_will_be_moved_to": "Este tema sera movido a la categoría", + + "reputation": "Reputación", + "posts": "Posts" } \ No newline at end of file diff --git a/public/language/es/user.json b/public/language/es/user.json index f1bfdf4ed0..ab0783255c 100644 --- a/public/language/es/user.json +++ b/public/language/es/user.json @@ -1,35 +1,35 @@ { "banned": "Banneado", - "offline": "desconectado", - "email": "email", - "fullname": "nombre completo", - "website": "website", - "location": "ubicación", - "age": "edad", - "joined": "registro", - "profil_views": "visitas en su perfil", - "reputation": "reputación", - "posts": "posts", - "followers": "seguidores", - "following": "siguiendo", - "signature": "firma", - "gravatar": "gravatar", - "birthday": "cumpleaños", + "offline": "Desconectado", + "email": "Email", + "fullname": "Nombre Completo", + "website": "Website", + "location": "Ubicación", + "age": "Edad", + "joined": "Registro", + "profile_views": "Visitas en su perfil", + "reputation": "Reputación", + "posts": "Posts", + "followers": "Seguidores", + "following": "Siguiendo", + "signature": "Firma", + "gravatar": "Gravatar", + "birthday": "Cumpleaños", - "change_picture": "cambiar foto", - "edit": "editar", - "uploaded_pictures": "fotos cargadas", - "upload_new_picture": "cargar nueva foto", - "change_password": "cambiar contraseña", - "confirm_password": "confirmar contraseña", - "password": "contraseña", + "change_picture": "Cambiar Foto", + "edit": "Editar", + "uploaded_picture": "Fotos Cargadas", + "upload_new_picture": "Cargar Nueva Foto", + "change_password": "Cambiar Contraseña", + "confirm_password": "Confirmar Contraseña", + "password": "Contraseña", "upload_picture": "Cargar foto", "upload_a_picture": "Cargar una foto", "image_spec": "Solo puedes usar PNG, JPG, o GIF hasta 256kb.", - "settings": "opciones", - "show_my_email": "mostrar mi email", + "settings": "Opciones", + "show_email": "Mostrar mi Email", "has_no_follower": "Este miembro no tiene seguidores :(", "follows_no_one": "Este miembro no sigue a nadie, que pena :(" diff --git a/public/language/fr/category.json b/public/language/fr/category.json new file mode 100644 index 0000000000..29c8c492b6 --- /dev/null +++ b/public/language/fr/category.json @@ -0,0 +1,14 @@ +{ + "new_topic_button": "Nouveau Sujet", + "no_topics": "Il n'y a aucun topic dans cette catégorie.
Pourquoi ne pas en créer un?", + "sidebar.recent_replies": "Réponses Récentes", + "sidebar.active_participants": "Participants Actifs", + "sidebar.moderators": "Modérateurs", + "posts": "messages", + "views": "vues", + "posted": "posté", + "browsing": "naviguer", + "no_replies": "Personne n'a répondu", + "replied": "répondu", + "last_edited_by": "dernière édition par" +} diff --git a/public/language/fr/footer.json b/public/language/fr/footer.json new file mode 100644 index 0000000000..27a4d0e1a9 --- /dev/null +++ b/public/language/fr/footer.json @@ -0,0 +1,10 @@ +{ + "chat.chatting_with": "Chat avec ", + "chat.placeholder": "taper le message ici, presser entrer pour envoyer", + "chat.send": "Envoyer", + "stats.online": "Online", + "stats.users": "Utilisateurs", + "stats.topics": "Sujets", + "stats.posts": "Message", + "success": "succès" +} diff --git a/public/language/fr/global.json b/public/language/fr/global.json new file mode 100644 index 0000000000..e454103779 --- /dev/null +++ b/public/language/fr/global.json @@ -0,0 +1,31 @@ +{ + "home": "Accueil", + "search": "Recherche", + "buttons.close": "Fermer", + "403.title": "Accès Refusé", + "403.message": "Il semble que vous vous soyez retrouvé sur une page dont vous n'avez pas accès. Peut-être devriez vous essayez de vous connecter?", + "404.title": "Introuvable", + "404.message": "Il semble que vous vous soyez retrouvé sur une page qui n'existe pas. Retourner à l'accueil.", + "500.title": "Erreur Interne.", + "500.message": "Oops! Il semblerait que quelque chose se soit mal passé!", + + "register": "S'inscrire", + "login": "Connecter", + + "logout": "Déconnection", + "logout.title": "Vous êtes maintenant déconnecté.", + "logout.message": "Vous vous êtes déconnecté de NodeBB avec succès", + + "save_changes": "Enregistrer les changements", + "close": "Fermer", + + "header.admin": "Admin", + "header.recent": "Récent", + "header.unread": "Non Lu", + "header.users": "Utilisateurs", + "header.search": "Recherche", + "header.profile": "Profile", + + "notifications.loading": "Chargement des Notifications", + "chats.loading": "Chargement des Chats" +} diff --git a/public/language/fr/login.json b/public/language/fr/login.json new file mode 100644 index 0000000000..d892409f69 --- /dev/null +++ b/public/language/fr/login.json @@ -0,0 +1,10 @@ +{ + "login": "Connexion", + "username": "Identifiant", + "password": "Mot de passe", + "remember_me": "Se souvenir de moi?", + "forgot_password": "Mot de passe oublié?", + "alternative_logins": "Connexion Alternative", + "failed_login_attempt": "Echèc d'authentification, veuillez réessayer.", + "login_successful": "Vous êtes maintenant connecté!" +} diff --git a/public/language/fr/notifications.json b/public/language/fr/notifications.json new file mode 100644 index 0000000000..7a4ef3e3c3 --- /dev/null +++ b/public/language/fr/notifications.json @@ -0,0 +1,9 @@ +{ + "title": "Notifications", + "back_to_home": "retour à NodeBB", + "mark_all_as_read": "Tout marquer comme lu", + "outgoing_link": "Lien Sortant", + "outgoing_link_message": "Vous quitter NodeBB", + "continue_to": "Continuer vers", + "return_to": "Retour vers" +} diff --git a/public/language/fr/recent.json b/public/language/fr/recent.json new file mode 100644 index 0000000000..4f7d7c96cc --- /dev/null +++ b/public/language/fr/recent.json @@ -0,0 +1,5 @@ +{ + "day": "Jour", + "week": "Semaine", + "month": "Mois" +} diff --git a/public/language/fr/register.json b/public/language/fr/register.json new file mode 100644 index 0000000000..bfb58f76e9 --- /dev/null +++ b/public/language/fr/register.json @@ -0,0 +1,16 @@ +{ + "register": "S'inscrire", + "help.email": "Par défault, votre email est masqué du public.", + "help.username_restrictions": "Un identifiant unique entre %1 et %2 charactères. Les autres utilisateurs peuvent vous citer avec @username.", + "help.minimum_password_length": "Votre mot de passe doit avoir au moins %1 charactères.", + "email_address": "Adresse Email", + "email_address_placeholder": "Entrer l'addresse Email", + "username": "Nom d'utilisateur", + "username_placeholder": "Entré le Nom d'utilisateur", + "password": "Mot de passe", + "password_placeholder": "Entrer le Mot de passe", + "confirm_password": "Confirmer le Mot de passe", + "confirm_password_placeholder": "Confirmer le Mot de passe", + "register_now_button": "S'enregistrer maintenant", + "alternative_registration": "Enregistrement Alternatif" +} diff --git a/public/language/fr/reset_password.json b/public/language/fr/reset_password.json new file mode 100644 index 0000000000..76b5724528 --- /dev/null +++ b/public/language/fr/reset_password.json @@ -0,0 +1,13 @@ +{ + "reset_password": "Réinitialiser le Mot de passe", + "update_password": "Mettre à jour le Mot de passe", + "password_changed.title": "Mot de passe modifié", + "password_changed.message": "

Mot de passe réinitialisé avec succès, veuillez vous reconnecter.", + "wrong_reset_code.title": "Code de Réinisialisation Incorrect", + "wrong_reset_code.message": "Le Code de Réinisialisation est Incorrect. Veillez réessayer, ou demander un nouveau Code de Réinisialisation.", + "new_password": "Nouveau Mot de passe", + "repeat_password": "Confirmer le Mot de passe", + "enter_email": "Veuillez entrer votre adresse email et vous recevrez un email avec les instruction pour réinitialiser votre compte.", + "password_reset_sent": "Réinitialisation de Mot de Passe Envoyée", + "invalid_email": "Email Invalide / L'Email n'existe pas!" +} diff --git a/public/language/fr/topic.json b/public/language/fr/topic.json new file mode 100644 index 0000000000..d874927c33 --- /dev/null +++ b/public/language/fr/topic.json @@ -0,0 +1,42 @@ +{ + "topic": "Sujet", + "topics": "Sujets", + + "no_topics_found": "Aucun sujet trouvé!", + + "profile": "Profile", + "posted_by": "Envoyé by", + "chat": "Chat", + "notify_me": "Être notifié des réponses dans ce sujet", + "quote": "Citer", + "reply": "Répondre", + "edit": "Editer", + "delete": "Supprimer", + "banned": "bannir", + "link": "Lien", + + "thread_tools.title": "Outils du Fil", + "thread_tools.pin": "Epingler le fil", + "thread_tools.lock": "Verrouiller le fil", + "thread_tools.move": "Déplacer le fil", + "thread_tools.delete": "Supprimer le fil", + + "load_categories": "Chargement des Categories", + "disabled_categories_note": "Les Catégories Désactivées sont grisées", + "confirm_move": "Déplacer", + + "favourite": "Favoris", + "favourites": "Favoris", + "favourites.not_logged_in.title": "Non Connecté", + "favourites.not_logged_in.message": "Veuillez vous connecter avant de mettre ce message en Favoris", + "favourites.has_no_favourites": "Vous n'avez aucun Favoris, mettre en favoris des messages pour les voir apparaître ici!", + + "posted_by": "posté par", + "loading": "Chargement", + "more_posts": "d'autres Messages", + "move_topic": "Déplacer le Sujet", + "topic_will_be_moved_to": "Ce sujet sera déplacé vers la catégorie", + + "reputation": "réputation", + "posts": "messages" +} diff --git a/public/language/fr/unread.json b/public/language/fr/unread.json new file mode 100644 index 0000000000..78f51ce820 --- /dev/null +++ b/public/language/fr/unread.json @@ -0,0 +1,5 @@ +{ + "no_unread_topics": "Aucun sujet non lu.", + "mark_all_read": "Marquer tout comme lu", + "load_more": "Charger la suite" +} diff --git a/public/language/fr/user.json b/public/language/fr/user.json new file mode 100644 index 0000000000..faa9883d47 --- /dev/null +++ b/public/language/fr/user.json @@ -0,0 +1,36 @@ +{ + "banned": "Banni", + "offline": "Hors-ligne", + "email": "email", + "fullname": "Nom", + "website": "Site Web", + "location": "Emplacement", + "age": "age", + "joined": "adhésion", + "profil_views": "vues du profil", + "reputation": "réputation", + "posts": "messages", + "followers": "suiveurs", + "following": "suivis", + "signature": "signature", + "gravatar": "gravatar", + "birthday": "anniversaire", + + "change_picture": "changer d'image", + "edit": "editer", + "uploaded_picture": "images uploadées", + "upload_new_picture": "uploader une nouvelle image", + "change_password": "chnger le mot de passe", + "confirm_password": "confirmer le mot de passe", + "password": "mot de passe", + + "upload_picture": "Uploader un image", + "upload_a_picture": "Uploader un image", + "image_spec": "Vous pouvez uploader seulement des fichiers de types PNG, JPG, ou GIF en dessous de 256kb.", + + "settings": "paramètres", + "show_my_email": "montrer mon email", + + "has_no_follower": "Cet utilisateur n'a aucun suiver :(", + "follows_no_one": "Cet utilisateur ne suit personne :(" +} diff --git a/public/language/fr/users.json b/public/language/fr/users.json new file mode 100644 index 0000000000..8cab0e5298 --- /dev/null +++ b/public/language/fr/users.json @@ -0,0 +1,9 @@ +{ + "latest_users": "Derniers Utilisateurs", + "top_posters": "Meilleurs Publieur", + "most_reputation": "Meilleur Réputation", + "online": "En Ligne", + "search": "Rechercher", + "enter_username": "Entrer un nom d'utilisateur pour rechercher", + "load_more": "Charger la suite" +} diff --git a/public/src/ajaxify.js b/public/src/ajaxify.js index bba039ea66..e0c69687f6 100644 --- a/public/src/ajaxify.js +++ b/public/src/ajaxify.js @@ -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 + '/', ''); diff --git a/public/src/app.js b/public/src/app.js index c7fe7835e7..537d0103bd 100644 --- a/public/src/app.js +++ b/public/src/app.js @@ -1,16 +1,16 @@ var socket, config, app = { - 'username': null, - 'uid': null + "username": null, + "uid": null, + "isFocused": true, + "currentRoom": null }; (function () { var showWelcomeMessage = false; - app.loadConfig = function() { - $.ajax({ url: RELATIVE_PATH + '/api/config', success: function (data) { @@ -135,7 +135,7 @@ var socket, }, async: false }); - } + }; app.logout = function() { $.post(RELATIVE_PATH + '/logout', { @@ -143,12 +143,12 @@ var socket, }, function() { window.location.href = RELATIVE_PATH + '/'; }); - } + }; // takes a string like 1000 and returns 1,000 app.addCommas = function (text) { return text.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,"); - } + }; // Willingly stolen from: http://phpjs.org/functions/strip_tags/ app.strip_tags = function (input, allowed) { @@ -159,7 +159,7 @@ var socket, return input.replace(commentsAndPhpTags, '').replace(tags, function ($0, $1) { return allowed.indexOf('<' + $1.toLowerCase() + '>') > -1 ? $0 : ''; }); - } + }; // use unique alert_id to have multiple alerts visible at a time, use the same alert_id to fade out the current instance // type : error, success, info, warning/notify @@ -222,7 +222,7 @@ var socket, }); } } - } + }; app.alertSuccess = function (message, timeout) { if (!timeout) @@ -234,7 +234,7 @@ var socket, type: 'success', timeout: timeout }); - } + }; app.alertError = function (message, timeout) { if (!timeout) @@ -246,9 +246,8 @@ var socket, type: 'danger', timeout: timeout }); - } + }; - app.currentRoom = null; app.enterRoom = function (room) { if (socket) { if (app.currentRoom === room) { @@ -272,7 +271,7 @@ var socket, }); socket.emit('api:user.get_online_users', uids); - } + }; function highlightNavigationLink() { var path = window.location.pathname, @@ -291,7 +290,7 @@ var socket, } }); } - } + }; app.createUserTooltips = function() { $('img[title].teaser-pic,img[title].user-img').each(function() { @@ -300,13 +299,13 @@ var socket, title: $(this).attr('title') }); }); - } + }; app.makeNumbersHumanReadable = function(elements) { elements.each(function() { $(this).html(utils.makeNumberHumanReadable($(this).attr('title'))); }); - } + }; app.processPage = function () { app.populateOnlineUsers(); @@ -323,7 +322,7 @@ var socket, setTimeout(function () { window.scrollTo(0, 1); // rehide address bar on mobile after page load completes. }, 100); - } + }; app.showLoginMessage = function () { function showAlert() { @@ -343,13 +342,13 @@ var socket, showAlert(); } } - } + }; app.addCommasToNumbers = function () { $('.formatted-number').each(function (index, element) { $(element).html(app.addCommas($(element).html())); }); - } + }; app.openChat = function (username, touid) { if (username === app.username) { @@ -384,7 +383,7 @@ var socket, chat.load(chatModal.attr('UUID')); chat.center(chatModal); }); - } + }; app.scrollToTop = function () { $('body,html').animate({ @@ -442,6 +441,14 @@ var socket, input.val(''); return false; }); + + $(window).blur(function(){ + app.isFocused = false; + }); + + $(window).focus(function(){ + app.isFocused = true; + }); }); showWelcomeMessage = location.href.indexOf('loggedin') !== -1; diff --git a/public/src/forum/accountedit.js b/public/src/forum/accountedit.js index 5e4eb0fcc3..f4c86f3ba4 100644 --- a/public/src/forum/accountedit.js +++ b/public/src/forum/accountedit.js @@ -84,7 +84,9 @@ define(['forum/accountheader', 'uploader'], function(header, uploader) { $('#uploadPictureBtn').on('click', function() { $('#change-picture-modal').modal('hide'); - uploader.open(config.relative_path + '/user/uploadpicture', function(imageUrlOnServer) { + uploader.open(RELATIVE_PATH + '/user/uploadpicture', function(imageUrlOnServer) { + imageUrlOnServer = imageUrlOnServer + '?' + new Date().getTime(); + $('#user-current-picture').attr('src', imageUrlOnServer); $('#user-uploaded-picture').attr('src', imageUrlOnServer); diff --git a/public/src/forum/admin/categories.js b/public/src/forum/admin/categories.js index d94eb9434b..0874ffa878 100644 --- a/public/src/forum/admin/categories.js +++ b/public/src/forum/admin/categories.js @@ -1,4 +1,4 @@ -define(function() { +define(['uploader'], function(uploader) { var Categories = {}; Categories.init = function() { @@ -82,7 +82,8 @@ define(function() { description: $('#inputDescription').val(), icon: $('#new-category-modal i').val(), bgColor: '#0059b2', - color: '#fff' + color: '#fff', + order: $('.admin-categories #entry-container').children().length + 1 }; socket.emit('api:admin.categories.create', category, function(err, data) { @@ -147,7 +148,6 @@ define(function() { var btn = $(this); var categoryRow = btn.parents('li'); var cid = categoryRow.attr('data-cid'); - console.log(this.getAttribute('data-disabled')); var disabled = this.getAttribute('data-disabled') === '0' ? '1' : '0'; categoryRow.remove(); @@ -179,6 +179,31 @@ define(function() { var cid = $(this).parents('li[data-cid]').attr('data-cid'); Categories.launchPermissionsModal(cid); }); + + + $('.upload-button').on('click', function() { + var inputEl = this; + + uploader.open(RELATIVE_PATH + '/admin/category/uploadpicture', function(imageUrlOnServer) { + inputEl.value = imageUrlOnServer; + $(inputEl).parents('li[data-cid]').find('.preview-box').css('background', 'url(' + imageUrlOnServer + '?' + new Date().getTime() + ')'); + modified(inputEl); + }); + }); + + $('.admin-categories').delegate('.delete-image', 'click', function() { + var parent = $(this).parents('li[data-cid]'), + inputEl = parent.find('.upload-button'), + preview = parent.find('.preview-box'), + bgColor = parent.find('.category_bgColor').val(); + + inputEl.value = ''; + modified(inputEl); + + preview.css('background', bgColor); + + $(this).hide(); + }); }); }; diff --git a/public/src/forum/admin/settings.js b/public/src/forum/admin/settings.js index 989e94a79c..8e8fc359df 100644 --- a/public/src/forum/admin/settings.js +++ b/public/src/forum/admin/settings.js @@ -76,7 +76,7 @@ define(['uploader'], function(uploader) { $('#uploadLogoBtn').on('click', function() { - uploader.open(config.relative_path + '/admin/uploadlogo', function(image) { + uploader.open(RELATIVE_PATH + '/admin/uploadlogo', function(image) { $('#logoUrl').val(image); }); diff --git a/public/src/forum/category.js b/public/src/forum/category.js index 44a11eaea9..6b25a85701 100644 --- a/public/src/forum/category.js +++ b/public/src/forum/category.js @@ -83,36 +83,39 @@ define(function () { Category.onNewTopic = function(data) { var html = templates.prepare(templates['category'].blocks['topics']).parse({ topics: [data] - }), - topic = $(html), - container = $('#topics-container'), - topics = $('#topics-container').children('.category-item'), - numTopics = topics.length; + }); + + translator.translate(html, function(translatedHTML) { + var topic = $(translatedHTML), + container = $('#topics-container'), + topics = $('#topics-container').children('.category-item'), + numTopics = topics.length; - jQuery('#topics-container, .category-sidebar').removeClass('hidden'); - jQuery('#category-no-topics').remove(); + jQuery('#topics-container, .category-sidebar').removeClass('hidden'); + jQuery('#category-no-topics').remove(); - if (numTopics > 0) { - for (var x = 0; x < numTopics; x++) { - if ($(topics[x]).find('.fa-thumb-tack').length) { - if(x === numTopics - 1) { - topic.insertAfter(topics[x]); + if (numTopics > 0) { + for (var x = 0; x < numTopics; x++) { + if ($(topics[x]).find('.fa-thumb-tack').length) { + if(x === numTopics - 1) { + topic.insertAfter(topics[x]); + } + continue; } - continue; + topic.insertBefore(topics[x]); + break; } - topic.insertBefore(topics[x]); - break; + } else { + container.append(topic); } - } else { - container.append(topic); - } - topic.hide().fadeIn('slow'); - socket.emit('api:categories.getRecentReplies', templates.get('category_id')); + topic.hide().fadeIn('slow'); + socket.emit('api:categories.getRecentReplies', templates.get('category_id')); - addActiveUser(data); + addActiveUser(data); - $('#topics-container span.timeago').timeago(); + $('#topics-container span.timeago').timeago(); + }); } function addActiveUser(data) { @@ -131,20 +134,22 @@ define(function () { } Category.onTopicsLoaded = function(topics) { - var html = templates.prepare(templates['category'].blocks['topics']).parse({ topics: topics - }), - container = $('#topics-container'); + }); + + translator.translate(html, function(translatedHTML) { + var container = $('#topics-container'); - jQuery('#topics-container, .category-sidebar').removeClass('hidden'); - jQuery('#category-no-topics').remove(); + jQuery('#topics-container, .category-sidebar').removeClass('hidden'); + jQuery('#category-no-topics').remove(); - html = $(html); - container.append(html); + html = $(translatedHTML); + container.append(html); - $('#topics-container span.timeago').timeago(); - app.makeNumbersHumanReadable(html.find('.human-readable-number')); + $('#topics-container span.timeago').timeago(); + app.makeNumbersHumanReadable(html.find('.human-readable-number')); + }); } Category.loadMoreTopics = function(cid) { diff --git a/public/src/forum/footer.js b/public/src/forum/footer.js index eb8d0f3e20..dc89b15f01 100644 --- a/public/src/forum/footer.js +++ b/public/src/forum/footer.js @@ -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); @@ -208,7 +213,7 @@ }); }); - socket.on('chatMessage', function(data) { + socket.on('event:chats.receive', function(data) { require(['chat'], function(chat) { var modal = null; if (chat.modalExists(data.fromuid)) { @@ -219,6 +224,9 @@ chat.load(modal.attr('UUID')); } else { chat.toggleNew(modal.attr('UUID'), true); + } + + if (!modal.is(":visible") || !app.isFocused) { app.alternatingTitle(data.username + ' has messaged you'); } } else { diff --git a/public/src/forum/recent.js b/public/src/forum/recent.js index 6b162db34f..c883c9c54b 100644 --- a/public/src/forum/recent.js +++ b/public/src/forum/recent.js @@ -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() { diff --git a/public/src/forum/topic.js b/public/src/forum/topic.js index fd77d2084f..3a47ce901c 100644 --- a/public/src/forum/topic.js +++ b/public/src/forum/topic.js @@ -802,8 +802,8 @@ define(function() { pagination.parentNode.style.display = 'block'; progressBarContainer.css('display', ''); - - if (scrollTop < 50 && Topic.postCount > 1) { + + if (scrollTop < jQuery('.posts > .post-row:first-child').height() && Topic.postCount > 1) { localStorage.removeItem("topic:" + tid + ":bookmark"); pagination.innerHTML = '1 out of ' + Topic.postCount; progressBar.width(0); diff --git a/public/src/forum/unread.js b/public/src/forum/unread.js index 6debeeba84..e0dd1dd7d7 100644 --- a/public/src/forum/unread.js +++ b/public/src/forum/unread.js @@ -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() { diff --git a/public/src/modules/chat.js b/public/src/modules/chat.js index 2aeb2f02bf..490f6e571b 100644 --- a/public/src/modules/chat.js +++ b/public/src/modules/chat.js @@ -103,6 +103,7 @@ define(['taskbar'], function(taskbar) { module.bringModalToTop(chatModal); checkOnlineStatus(chatModal); taskbar.updateActive(uuid); + chatModal.find('#chat-message-input').focus(); } module.minimize = function(uuid) { @@ -114,7 +115,7 @@ define(['taskbar'], function(taskbar) { } function getChatMessages(chatModal, callback) { - socket.emit('getChatMessages', {touid:chatModal.touid}, function(messages) { + socket.emit('api:chats.get', {touid:chatModal.touid}, function(messages) { for(var i = 0; i/gi, '')); } else { - template = template.replace(matches[i], conditionalBlock[0]); + template = template.replace(matches[i], conditionalBlock[0].replace(//gi, '')); } } else { // regular if statement if (!value) { template = template.replace(matches[i], ''); + } else { + template = template.replace(matches[i], matches[i].replace(//gi, '')); } } } @@ -350,7 +345,11 @@ if (namespace) { var regex = new RegExp("{" + namespace + "[\\s\\S]*?}", 'g'); template = template.replace(regex, ''); + namespace = ''; } + + // clean up all undefined conditionals + template = template.replace(//gi, ''); return template; diff --git a/public/templates/account.tpl b/public/templates/account.tpl index da0014b0fe..200fd854c2 100644 --- a/public/templates/account.tpl +++ b/public/templates/account.tpl @@ -53,7 +53,7 @@
- + {profileviews}
diff --git a/public/templates/accountedit.tpl b/public/templates/accountedit.tpl index e9b970a1be..fa0e64d055 100644 --- a/public/templates/accountedit.tpl +++ b/public/templates/accountedit.tpl @@ -10,17 +10,17 @@

diff --git a/public/templates/admin/categories.tpl b/public/templates/admin/categories.tpl index 4cc65d8bca..a8da120e82 100644 --- a/public/templates/admin/categories.tpl +++ b/public/templates/admin/categories.tpl @@ -14,12 +14,15 @@
  • -
    @@ -80,17 +80,7 @@ - +
  • diff --git a/public/templates/admin/settings.tpl b/public/templates/admin/settings.tpl index da88d2003e..a5e6192b1b 100644 --- a/public/templates/admin/settings.tpl +++ b/public/templates/admin/settings.tpl @@ -26,6 +26,11 @@

    Use privilege thresholds to manage how much reputation a user must gain to receive moderator access.


    Manage Thread

    Manage Content

    +
    + +
    @@ -55,6 +60,17 @@ +
    +

    Profile Settings

    +
    +
    + +
    +
    +
    +

    User Settings

    diff --git a/public/templates/footer.tpl b/public/templates/footer.tpl index a9f51f2242..4434336ed8 100644 --- a/public/templates/footer.tpl +++ b/public/templates/footer.tpl @@ -59,7 +59,7 @@
    -