From 93097228984d58e2f9431e2d190a816fdd3e4dd9 Mon Sep 17 00:00:00 2001 From: Baris Usakli Date: Thu, 20 Jun 2013 16:48:17 -0400 Subject: [PATCH] fixed indents --- public/src/ajaxify.js | 6 +- public/src/app.js | 6 +- public/src/forum/accountedit.js | 254 +++++++++++++------------- public/src/forum/followers.js | 32 ++-- public/src/forum/following.js | 36 ++-- public/src/forum/topic.js | 4 +- public/src/forum/users.js | 22 +-- public/src/modules/chat.js | 4 +- public/src/utils.js | 10 +- public/templates/account.tpl | 24 +-- public/templates/accountedit.tpl | 205 +++++++++++---------- public/templates/admin/categories.tpl | 2 +- public/templates/admin/header.tpl | 10 +- public/templates/following.tpl | 14 +- public/templates/header.tpl | 38 ++-- public/templates/topic.tpl | 2 +- public/templates/users.tpl | 14 +- src/webserver.js | 2 +- 18 files changed, 342 insertions(+), 343 deletions(-) diff --git a/public/src/ajaxify.js b/public/src/ajaxify.js index d5daa8d907..a56ac7611d 100644 --- a/public/src/ajaxify.js +++ b/public/src/ajaxify.js @@ -103,9 +103,9 @@ var ajaxify = {}; function evalScript(elem) { var data = (elem.text || elem.textContent || elem.innerHTML || "" ), - head = document.getElementsByTagName("head")[0] || - document.documentElement, - script = document.createElement("script"); + head = document.getElementsByTagName("head")[0] || + document.documentElement, + script = document.createElement("script"); script.type = "text/javascript"; try { diff --git a/public/src/app.js b/public/src/app.js index 3cb7d0aece..274f3d7c3f 100644 --- a/public/src/app.js +++ b/public/src/app.js @@ -82,10 +82,10 @@ var socket, // takes a string like 1000 and returns 1,000 app.addCommas = function(text) { - return text.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,"); - } + return text.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,"); + } - // Willingly stolen from: http://phpjs.org/functions/strip_tags/ + // Willingly stolen from: http://phpjs.org/functions/strip_tags/ app.strip_tags = function(input, allowed) { allowed = (((allowed || "") + "").toLowerCase().match(/<[a-z][a-z0-9]*>/g) || []).join(''); // making sure the allowed arg is a string containing only tags in lowercase () var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>/gi, diff --git a/public/src/forum/accountedit.js b/public/src/forum/accountedit.js index 817074ea9e..191eee262c 100644 --- a/public/src/forum/accountedit.js +++ b/public/src/forum/accountedit.js @@ -7,8 +7,8 @@ $(document).ready(function() { - $('#uploadForm').submit(function() { - status('uploading the file ...'); + $('#uploadForm').submit(function() { + status('uploading the file ...'); $('#upload-progress-bar').css('width', '0%'); $('#upload-progress-box').show(); @@ -18,16 +18,16 @@ $(document).ready(function() { return false; } - $(this).ajaxSubmit({ + $(this).ajaxSubmit({ error: function(xhr) { error('Error: ' + xhr.status); }, - - uploadProgress : function(event, position, total, percent) { - $('#upload-progress-bar').css('width', percent+'%'); - }, - + + uploadProgress : function(event, position, total, percent) { + $('#upload-progress-bar').css('width', percent+'%'); + }, + success: function(response) { if(response.error) { @@ -36,166 +36,166 @@ $(document).ready(function() { } var imageUrlOnServer = response.path; - - $('#user-current-picture').attr('src', imageUrlOnServer); - $('#user-uploaded-picture').attr('src', imageUrlOnServer); - + + $('#user-current-picture').attr('src', imageUrlOnServer); + $('#user-uploaded-picture').attr('src', imageUrlOnServer); + uploadedPicture = imageUrlOnServer; - + setTimeout(function() { hideAlerts(); - $('#upload-picture-modal').modal('hide'); + $('#upload-picture-modal').modal('hide'); }, 750); - + socket.emit('api:updateHeader', { fields: ['username', 'picture'] }); success('File uploaded successfully!'); - } + } }); return false; - }); + }); - function hideAlerts() { - $('#alert-status').hide(); + function hideAlerts() { + $('#alert-status').hide(); $('#alert-success').hide(); $('#alert-error').hide(); $('#upload-progress-box').hide(); - } + } - function status(message) { - hideAlerts(); + function status(message) { + hideAlerts(); $('#alert-status').text(message).show(); - } - - function success(message) { - hideAlerts(); + } + + function success(message) { + hideAlerts(); $('#alert-success').text(message).show(); - } - - function error(message) { - hideAlerts(); + } + + function error(message) { + hideAlerts(); $('#alert-error').text(message).show(); - } + } function changeUserPicture(type) { var userData = { - uid: $('#inputUID').val(), + uid: $('#inputUID').val(), type: type, _csrf:$('#csrf_token').val() - }; - + }; + $.post('/users/changepicture', - userData, - function(data) { - socket.emit('api:updateHeader', { fields: ['username', 'picture'] }); - } + userData, + function(data) { + socket.emit('api:updateHeader', { fields: ['username', 'picture'] }); + } ); } - + var selectedImageType = ''; - - $('#submitBtn').on('click',function(){ - - var userData = { - uid:$('#inputUID').val(), - email:$('#inputEmail').val(), - fullname:$('#inputFullname').val(), - website:$('#inputWebsite').val(), - birthday:$('#inputBirthday').val(), - location:$('#inputLocation').val(), - signature:$('#inputSignature').val(), - _csrf:$('#csrf_token').val() - }; - + + $('#submitBtn').on('click',function(){ + + var userData = { + uid:$('#inputUID').val(), + email:$('#inputEmail').val(), + fullname:$('#inputFullname').val(), + website:$('#inputWebsite').val(), + birthday:$('#inputBirthday').val(), + location:$('#inputLocation').val(), + signature:$('#inputSignature').val(), + _csrf:$('#csrf_token').val() + }; + $.post('/users/doedit', - userData, - function(data) { - if(data.error) { - app.alert({ - 'alert_id': 'user_profile_updated', - type: 'error', - title: 'Profile Update Error', - message: data.error, - timeout: 2000 - }); - return; - } - + userData, + function(data) { + if(data.error) { + app.alert({ + 'alert_id': 'user_profile_updated', + type: 'error', + title: 'Profile Update Error', + message: data.error, + timeout: 2000 + }); + return; + } + app.alert({ - 'alert_id': 'user_profile_updated', - type: 'success', - title: 'Profile Updated', - message: 'Your profile has been updated successfully', - timeout: 2000 - }); - } + 'alert_id': 'user_profile_updated', + type: 'success', + title: 'Profile Updated', + message: 'Your profile has been updated successfully', + timeout: 2000 + }); + } ); return false; - }); - - function updateImages() { + }); + + function updateImages() { var currentPicture = $('#user-current-picture').attr('src'); if(gravatarPicture) { - $('#user-gravatar-picture').attr('src', gravatarPicture); - $('#gravatar-box').show(); - } - else - $('#gravatar-box').hide(); + $('#user-gravatar-picture').attr('src', gravatarPicture); + $('#gravatar-box').show(); + } + else + $('#gravatar-box').hide(); - if(uploadedPicture) { - $('#user-uploaded-picture').attr('src', uploadedPicture); - $('#uploaded-box').show(); - } - else - $('#uploaded-box').hide(); - - - if(currentPicture == gravatarPicture) - $('#gravatar-box .icon-ok').show(); + if(uploadedPicture) { + $('#user-uploaded-picture').attr('src', uploadedPicture); + $('#uploaded-box').show(); + } + else + $('#uploaded-box').hide(); + + + if(currentPicture == gravatarPicture) + $('#gravatar-box .icon-ok').show(); else - $('#gravatar-box .icon-ok').hide(); - - if(currentPicture == uploadedPicture) - $('#uploaded-box .icon-ok').show(); + $('#gravatar-box .icon-ok').hide(); + + if(currentPicture == uploadedPicture) + $('#uploaded-box .icon-ok').show(); else - $('#uploaded-box .icon-ok').hide(); - } - - - $('#changePictureBtn').on('click', function() { + $('#uploaded-box .icon-ok').hide(); + } + + + $('#changePictureBtn').on('click', function() { selectedImageType = ''; updateImages(); - - $('#change-picture-modal').modal('show'); - - return false; - }); - - $('#gravatar-box').on('click', function(){ + + $('#change-picture-modal').modal('show'); + + return false; + }); + + $('#gravatar-box').on('click', function(){ $('#gravatar-box .icon-ok').show(); - $('#uploaded-box .icon-ok').hide(); - selectedImageType = 'gravatar'; + $('#uploaded-box .icon-ok').hide(); + selectedImageType = 'gravatar'; }); $('#uploaded-box').on('click', function(){ $('#gravatar-box .icon-ok').hide(); - $('#uploaded-box .icon-ok').show(); - selectedImageType = 'uploaded'; + $('#uploaded-box .icon-ok').show(); + selectedImageType = 'uploaded'; }); $('#savePictureChangesBtn').on('click', function() { - $('#change-picture-modal').modal('hide'); + $('#change-picture-modal').modal('hide'); - if(selectedImageType) { - changeUserPicture(selectedImageType); - - if(selectedImageType == 'gravatar') - $('#user-current-picture').attr('src', gravatarPicture); + if(selectedImageType) { + changeUserPicture(selectedImageType); + + if(selectedImageType == 'gravatar') + $('#user-current-picture').attr('src', gravatarPicture); else if(selectedImageType == 'uploaded') - $('#user-current-picture').attr('src', uploadedPicture); - } - + $('#user-current-picture').attr('src', uploadedPicture); + } + }); $('#upload-picture-modal').on('hide', function() { @@ -204,17 +204,17 @@ $(document).ready(function() { $('#uploadPictureBtn').on('click', function(){ - $('#change-picture-modal').modal('hide'); - $('#upload-picture-modal').modal('show'); + $('#change-picture-modal').modal('hide'); + $('#upload-picture-modal').modal('show'); - hideAlerts(); - - return false; + hideAlerts(); + + return false; }); $('#pictureUploadSubmitBtn').on('click', function() { $('#uploadForm').submit(); }); - - + + }); \ No newline at end of file diff --git a/public/src/forum/followers.js b/public/src/forum/followers.js index ee7e019562..d5457858cc 100644 --- a/public/src/forum/followers.js +++ b/public/src/forum/followers.js @@ -4,26 +4,26 @@ theirid = templates.get('theirid'), followersCount = templates.get('followersCount'); - $(document).ready(function() { - - if(parseInt(followersCount, 10) === 0) { - $('#no-followers-notice').show(); - } - var editLink = $('#editLink'); + $(document).ready(function() { + + if(parseInt(followersCount, 10) === 0) { + $('#no-followers-notice').show(); + } + var editLink = $('#editLink'); if(yourid !== theirid) { editLink.hide(); } - $('.reputation').each(function(index, element) { - $(element).html(app.addCommas($(element).html())); - }); - - $('.postcount').each(function(index, element) { - $(element).html(app.addCommas($(element).html())); - }); - - }); - + $('.reputation').each(function(index, element) { + $(element).html(app.addCommas($(element).html())); + }); + + $('.postcount').each(function(index, element) { + $(element).html(app.addCommas($(element).html())); + }); + + }); + }()); \ No newline at end of file diff --git a/public/src/forum/following.js b/public/src/forum/following.js index 4727696c92..d4b30fada6 100644 --- a/public/src/forum/following.js +++ b/public/src/forum/following.js @@ -4,12 +4,12 @@ theirid = templates.get('theirid'), followingCount = templates.get('followingCount'); - $(document).ready(function() { - - if(parseInt(followingCount, 10) === 0) { - $('#no-following-notice').show(); - } - var editLink = $('#editLink'); + $(document).ready(function() { + + if(parseInt(followingCount, 10) === 0) { + $('#no-following-notice').show(); + } + var editLink = $('#editLink'); if(yourid !== theirid) { editLink.hide(); @@ -22,23 +22,23 @@ var followingUid = $(this).attr('followingUid'); $.post('/users/unfollow', {uid: followingUid, _csrf:$('#csrf_token').val()}, - function(data) { - removeBtn.parent().remove(); + function(data) { + removeBtn.parent().remove(); } ); return false; }); } - $('.reputation').each(function(index, element) { - $(element).html(app.addCommas($(element).html())); - }); - - $('.postcount').each(function(index, element) { - $(element).html(app.addCommas($(element).html())); - }); - - }); - + $('.reputation').each(function(index, element) { + $(element).html(app.addCommas($(element).html())); + }); + + $('.postcount').each(function(index, element) { + $(element).html(app.addCommas($(element).html())); + }); + + }); + }()); \ No newline at end of file diff --git a/public/src/forum/topic.js b/public/src/forum/topic.js index ee51215675..7dddd0aa03 100644 --- a/public/src/forum/topic.js +++ b/public/src/forum/topic.js @@ -12,8 +12,8 @@ function addCommasToNumbers() { $('.formatted-number').each(function(index, element) { - $(element).html(app.addCommas($(element).html())); - }); + $(element).html(app.addCommas($(element).html())); + }); } jQuery('document').ready(function() { diff --git a/public/src/forum/users.js b/public/src/forum/users.js index 3b33869b02..36c34e58d7 100644 --- a/public/src/forum/users.js +++ b/public/src/forum/users.js @@ -1,15 +1,15 @@ (function() { - $(document).ready(function() { - - $('.reputation').each(function(index, element) { - $(element).html(app.addCommas($(element).html())); - }); - - $('.postcount').each(function(index, element) { - $(element).html(app.addCommas($(element).html())); - }); - - }); + $(document).ready(function() { + + $('.reputation').each(function(index, element) { + $(element).html(app.addCommas($(element).html())); + }); + + $('.postcount').each(function(index, element) { + $(element).html(app.addCommas($(element).html())); + }); + + }); }()); \ No newline at end of file diff --git a/public/src/modules/chat.js b/public/src/modules/chat.js index 7a103d56aa..f633c55d82 100644 --- a/public/src/modules/chat.js +++ b/public/src/modules/chat.js @@ -8,7 +8,7 @@ define(['taskbar'], function(taskbar) { $('.modal').each(function() { var thisZ = parseInt($(this).css('zIndex'), 10); if (thisZ > topZ) { - topZ = thisZ; + topZ = thisZ; } }); chatModal.css('zIndex', topZ+1); @@ -88,7 +88,7 @@ define(['taskbar'], function(taskbar) { var chatContent = chatModal.find('#chat-content'); chatContent.append(message); chatContent.scrollTop( - chatContent[0].scrollHeight - chatContent.height() + chatContent[0].scrollHeight - chatContent.height() ); } diff --git a/public/src/utils.js b/public/src/utils.js index 405a708b18..54988afe60 100644 --- a/public/src/utils.js +++ b/public/src/utils.js @@ -20,10 +20,10 @@ var main_dir = global.configuration.ROOT_DIRECTORY + '/public/templates/'; var results = []; fs.readdir(dir, function(err, list) { - if (err) return done(err); - var pending = list.length; - if (!pending) return done(null, results); - list.forEach(function(file) { + if (err) return done(err); + var pending = list.length; + if (!pending) return done(null, results); + list.forEach(function(file) { file = dir + '/' + file; fs.stat(file, function(err, stat) { if (stat && stat.isDirectory()) { @@ -34,7 +34,7 @@ } else { results.push(file.replace(main_dir, '').replace('.tpl', '')); if (!--pending) done(null, results); - } + } }); }); }); diff --git a/public/templates/account.tpl b/public/templates/account.tpl index f29a6b59de..7913a53a90 100644 --- a/public/templates/account.tpl +++ b/public/templates/account.tpl @@ -30,20 +30,20 @@
- {fullname} -
- - -
{website} -
+ {fullname} +
+ + + {website} +
- {location} -
- - - {age} -
+ {location} +
+ + + {age} +

{joindate} diff --git a/public/templates/accountedit.tpl b/public/templates/accountedit.tpl index 63efebca48..3dfe7850f9 100644 --- a/public/templates/accountedit.tpl +++ b/public/templates/accountedit.tpl @@ -1,66 +1,65 @@
- - + - diff --git a/public/templates/admin/categories.tpl b/public/templates/admin/categories.tpl index d1f6dd8ed4..0caf3eec9d 100644 --- a/public/templates/admin/categories.tpl +++ b/public/templates/admin/categories.tpl @@ -8,7 +8,7 @@ - +
    diff --git a/public/templates/admin/header.tpl b/public/templates/admin/header.tpl index 35c8421491..7e1cad357b 100644 --- a/public/templates/admin/header.tpl +++ b/public/templates/admin/header.tpl @@ -39,11 +39,11 @@
    - + -
    - - - -
    +
    + + + +
    {following.username} -
    +
    {following.reputation} diff --git a/public/templates/header.tpl b/public/templates/header.tpl index 10dd6dab26..96f1c086bb 100644 --- a/public/templates/header.tpl +++ b/public/templates/header.tpl @@ -71,29 +71,29 @@
    - +
    diff --git a/public/templates/topic.tpl b/public/templates/topic.tpl index f6c4d34333..63f88a2e88 100644 --- a/public/templates/topic.tpl +++ b/public/templates/topic.tpl @@ -12,7 +12,7 @@ - +
  • diff --git a/public/templates/users.tpl b/public/templates/users.tpl index 65d64dad22..66e2120d01 100644 --- a/public/templates/users.tpl +++ b/public/templates/users.tpl @@ -1,13 +1,13 @@

    Users

    - -
    - - - -
    + +
    + + + +
    {users.username} -
    +
    {users.reputation} diff --git a/src/webserver.js b/src/webserver.js index 66eb93ae9a..aa56536f5d 100644 --- a/src/webserver.js +++ b/src/webserver.js @@ -3,7 +3,7 @@ var express = require('express'), server = require('http').createServer(WebServer), RedisStore = require('connect-redis')(express), path = require('path'), - redis = require('redis'), + redis = require('redis'), redisServer = redis.createClient(global.config.redis.port, global.config.redis.host), marked = require('marked'), utils = require('../public/src/utils.js'),