diff --git a/config/assets.yml b/config/assets.yml
index 34d5db119..4f32378f3 100644
--- a/config/assets.yml
+++ b/config/assets.yml
@@ -22,8 +22,8 @@ javascripts:
- public/javascripts/vendor/charCount.js
- public/javascripts/jquery.autocomplete-custom.js
- public/javascripts/jquery.infieldlabel-custom.js
- - public/javascripts/fileuploader-custom.js
- public/javascripts/keycodes.js
+ - public/javascripts/fileuploader-custom.js
- public/javascripts/diaspora.js
- public/javascripts/widgets/i18n.js
- public/javascripts/widgets/alert.js
diff --git a/public/javascripts/apiconsole.js b/public/javascripts/apiconsole.js
index e9a4c7a48..1a51d56a4 100644
--- a/public/javascripts/apiconsole.js
+++ b/public/javascripts/apiconsole.js
@@ -3,13 +3,13 @@ var ApiConsole = {
prettyPrint: function(obj, indent)
{
var result = "";
- if (indent == null) indent = "";
+ if (indent === null) { indent = ""; }
for (var property in obj)
{
var value = obj[property];
if (typeof value == 'string')
- value = "'" + value + "'";
+ { value = "'" + value + "'"; }
else if (typeof value == 'object')
{
if (value instanceof Array)
@@ -46,7 +46,7 @@ var ApiConsole = {
});
});
}
-}
+};
$(document).ready(function(){
diff --git a/public/javascripts/aspect-edit.js b/public/javascripts/aspect-edit.js
index 0833d2635..02c3ceb5c 100644
--- a/public/javascripts/aspect-edit.js
+++ b/public/javascripts/aspect-edit.js
@@ -60,9 +60,9 @@ var AspectEdit = {
});
}
- if (person.attr('data-aspect_id') != undefined && // a request doesn't have a data-aspect_id, but an existing contact does
+ if (person.attr('data-aspect_id') !== undefined && // a request doesn't have a data-aspect_id, but an existing contact does
dropzone.attr('data-aspect_id') != person.attr('data-aspect_id')) {
- var aspect_id = person.attr('data-aspect_id')
+ var aspect_id = person.attr('data-aspect_id');
$.ajax({
type: "PUT",
url: "/aspect_memberships/garbage",
diff --git a/public/javascripts/aspect-filters.js b/public/javascripts/aspect-filters.js
index 4a363cca6..19557ca1c 100644
--- a/public/javascripts/aspect-filters.js
+++ b/public/javascripts/aspect-filters.js
@@ -35,10 +35,10 @@ var AspectFilters = {
if( !link.hasClass('aspect_selector') ){
AspectFilters.switchToAspect(link);
}
-
+
// remove focus
this.blur();
-
+
$('html, body').animate({scrollTop:0}, 'fast');
},
switchToAspect: function(aspectLi){
@@ -77,7 +77,7 @@ var AspectFilters = {
}
listElement.removeClass('selected');
- if(AspectFilters.selectedGUIDS.length == 0){
+ if(AspectFilters.selectedGUIDS.length === 0){
homeListElement.addClass('selected');
}
@@ -117,7 +117,7 @@ var AspectFilters = {
// update the open aspects in the user
updateURL = "/user";
updateURL += '?';
- if(AspectFilters.selectedGUIDS.length == 0){
+ if(AspectFilters.selectedGUIDS.length === 0){
updateURL += 'user[a_ids][]=home';
} else {
for(i=0; i < AspectFilters.selectedGUIDS.length; i++){
@@ -127,7 +127,7 @@ var AspectFilters = {
$.ajax({
url : updateURL,
- type: "PUT",
+ type: "PUT"
});
},
performAjax: function(newURL) {
@@ -157,9 +157,9 @@ var AspectFilters = {
// (not cached because this element changes)
var textarea = $("#publisher textarea");
- var photozone = $('#photodropzone')
+ var photozone = $('#photodropzone');
- if( post != "" ) {
+ if( post !== "" ) {
textarea.val(post);
textarea.focus();
}
@@ -175,7 +175,7 @@ var AspectFilters = {
Diaspora.widgets.publish("stream/reloaded");
// fade contents back in
- if(AspectFilters.requests == 0){
+ if(AspectFilters.requests === 0){
AspectFilters.fadeIn();
AspectFilters.performAspectUpdate();
}
diff --git a/public/javascripts/contact-list.js b/public/javascripts/contact-list.js
index 1a1d38a57..134f9b351 100644
--- a/public/javascripts/contact-list.js
+++ b/public/javascripts/contact-list.js
@@ -43,12 +43,12 @@ $(document).ready(function() {
$(this).fadeTo(200,0.4);
});
- $('.added').live('ajax:success', function(data, json, xhr) {
- var json = $.parseJSON(json);
+ $('.added').live('ajax:success', function(data, jsonString, xhr) {
+ var json = $.parseJSON(jsonString);
var contactPictures = $(".contact_pictures");
if( contactPictures.length > 0 ) {
- if( contactPictures[0].childElementCount == 0 ) {
+ if( contactPictures[0].childElementCount === 0 ) {
$("#no_contacts").fadeIn(200);
}
}
@@ -79,8 +79,8 @@ $(document).ready(function() {
$(this).fadeTo(200,0.4);
});
- $('.add').live('ajax:success', function(data, json, xhr) {
- var json = $.parseJSON(json);
+ $('.add').live('ajax:success', function(data, jsonString, xhr) {
+ var json = $.parseJSON(jsonString);
if( $("#no_contacts").is(':visible') ) {
$("#no_contacts").fadeOut(200);
}
@@ -90,8 +90,10 @@ $(document).ready(function() {
if($('#aspects_list').length == 1) {
$('.aspect_list').attr('data-contact_id', json.contact_id);
- $('.aspect_list ul').find('.add').each(function(a,b){$(b).attr('href', $(b).attr('href').replace('contacts','aspect_memberships'));})
- };
+ $('.aspect_list ul').find('.add').each(function(a,b){
+ $(b).attr('href', $(b).attr('href').replace('contacts','aspect_memberships'));
+ });
+ }
$(this).fadeTo(200,1);
});
@@ -104,8 +106,8 @@ $(document).ready(function() {
$(this).children("img").attr("src","/images/icons/monotone_check_yes.png");
});
- $('.new_aspect').live('ajax:success', function(data, json, xhr){
- var json = JSON.parse(json);
+ $('.new_aspect').live('ajax:success', function(data, jsonString, xhr){
+ var json = JSON.parse(jsonString);
$('#aspects_list ul').append(json.html);
$("#aspects_list ul li[data-guid='" + json.aspect_id + "'] .add.button").click();
});
diff --git a/public/javascripts/diaspora.js b/public/javascripts/diaspora.js
index 9b8080dd7..4c30ed7d0 100644
--- a/public/javascripts/diaspora.js
+++ b/public/javascripts/diaspora.js
@@ -9,6 +9,7 @@
}
var Diaspora = { };
+ vara = 5;
Diaspora.WidgetCollection = function() {
this.initialized = false;
@@ -29,7 +30,7 @@
Diaspora.WidgetCollection.prototype.init = function() {
this.initialized = true;
-
+
for(var widgetId in this.collection) {
if(this.collection[widgetId].hasOwnProperty("start")) {
this.collection[widgetId].start();
@@ -46,7 +47,7 @@
};
Diaspora.widgets = new Diaspora.WidgetCollection();
-
+
window.Diaspora = Diaspora;
})();
diff --git a/public/javascripts/fileuploader-custom.js b/public/javascripts/fileuploader-custom.js
index 7b9b044d9..4fc1ad643 100644
--- a/public/javascripts/fileuploader-custom.js
+++ b/public/javascripts/fileuploader-custom.js
@@ -28,12 +28,12 @@ qq.extend = function(first, second){
* @param {Number} [from] The index at which to begin the search
*/
qq.indexOf = function(arr, elt, from){
- if (arr.indexOf) return arr.indexOf(elt, from);
+ if (arr.indexOf) { return arr.indexOf(elt, from); }
from = from || 0;
var len = arr.length;
- if (from < 0) from += len;
+ if (from < 0) { from += len; }
for (; from < len; from++){
if (from in arr && arr[from] === elt){
@@ -89,7 +89,7 @@ qq.remove = function(element){
qq.contains = function(parent, descendant){
// compareposition returns false in this case
- if (parent == descendant) return true;
+ if (parent == descendant) { return true; }
if (parent.contains){
return parent.contains(descendant);
@@ -120,7 +120,7 @@ qq.toElement = (function(){
* Fixes opacity in IE6-8.
*/
qq.css = function(element, styles){
- if (styles.opacity != null){
+ if (styles.opacity !== null){
if (typeof element.style.opacity != 'string' && typeof(element.filters) != 'undefined'){
styles.filter = 'alpha(opacity=' + Math.round(100 * styles.opacity) + ')';
}
diff --git a/public/javascripts/inbox.js b/public/javascripts/inbox.js
index 6320659a5..637b6480d 100644
--- a/public/javascripts/inbox.js
+++ b/public/javascripts/inbox.js
@@ -16,7 +16,7 @@ $(document).ready(function(){
if(conv.hasClass('unread') ){
conv.removeClass('unread');
}
- if(cBadge.html() != null) {
+ if(cBadge.html() !== null) {
cBadge.html().replace(/\d+/, function(num){
num = parseInt(num);
cBadge.html(parseInt(num)-1);
@@ -30,7 +30,7 @@ $(document).ready(function(){
});
$(window).bind("popstate", function(){
- if (location.href.match(/conversations\/\d+/) != null) {
+ if (location.href.match(/conversations\/\d+/) !== null) {
$.getScript(location.href, function() {
Diaspora.widgets.directionDetector.updateBinds();
});
@@ -72,7 +72,7 @@ $(document).ready(function(){
// remove the paginator when we're done.
$(document).ajaxError(function(e,xhr,opt){
- if (xhr.status == 404) $('a.next_page').remove();
+ if (xhr.status == 404) { $('a.next_page').remove(); }
});
$('#reply_to_conversation').live('click', function(evt) {
@@ -84,7 +84,7 @@ $(document).ready(function(){
});
var resize = function(){
- var inboxSidebar = $('#conversation_inbox');
+ var inboxSidebar = $('#conversation_inbox'),
inboxSidebarOffset = inboxSidebar.offset().top,
windowHeight = $(window).height();
diff --git a/public/javascripts/keycodes.js b/public/javascripts/keycodes.js
index ca275d1ce..ae6c143db 100644
--- a/public/javascripts/keycodes.js
+++ b/public/javascripts/keycodes.js
@@ -112,5 +112,5 @@ isInsertion : function(keyCode){
}else {
return true;
}
-},
}
+};
diff --git a/public/javascripts/notifications.js b/public/javascripts/notifications.js
index 12aa5263b..b91e5ddd5 100644
--- a/public/javascripts/notifications.js
+++ b/public/javascripts/notifications.js
@@ -1,7 +1,7 @@
$('.stream_element').live('mousedown', function(evt){
var note = $(this).closest('.stream_element'),
note_id = note.attr('data-guid'),
- nBadge = $("#notification_badge .badge_count")
+ nBadge = $("#notification_badge .badge_count");
if(note.hasClass('unread') ){
note.removeClass('unread');
@@ -10,7 +10,7 @@ $('.stream_element').live('mousedown', function(evt){
type: 'PUT'
});
}
- if(nBadge.html() != null) {
+ if(nBadge.html() !== null) {
nBadge.html().replace(/\d+/, function(num){
num = parseInt(num);
nBadge.html(parseInt(num)-1);
diff --git a/public/javascripts/publisher.js b/public/javascripts/publisher.js
index 680b9cbf3..621935201 100644
--- a/public/javascripts/publisher.js
+++ b/public/javascripts/publisher.js
@@ -28,13 +28,6 @@ var Publisher = {
}
return Publisher.cachedInput;
},
- cachedSubmit : false,
- submit: function(){
- if(!Publisher.cachedSubmit){
- Publisher.cachedSubmit = Publisher.form().find('#status_message_submit');
- }
- return Publisher.cachedSubmit;
- },
cachedHiddenInput : false,
hiddenInput: function(){
@@ -107,7 +100,7 @@ var Publisher = {
},
generateHiddenInput : function(visibleString){
var resultString = visibleString;
- for(i in this.sortedMentions()){
+ for(var i in this.sortedMentions()){
var mention = this.mentions[i];
var start = resultString.slice(0, mention.visibleStart);
var insertion = mention.mentionString;
@@ -165,14 +158,14 @@ var Publisher = {
},
updateMentionLocations : function(effectiveCursorIndex, offset){
var changedMentions = this.mentionsAfter(effectiveCursorIndex);
- for(i in changedMentions){
+ for(var i in changedMentions){
var mention = changedMentions[i];
mention.visibleStart += offset;
mention.visibleEnd += offset;
}
},
mentionAt : function(visibleCursorIndex){
- for(i in this.mentions){
+ for(var i in this.mentions){
var mention = this.mentions[i];
if(visibleCursorIndex > mention.visibleStart && visibleCursorIndex < mention.visibleEnd){
return i;
@@ -182,14 +175,14 @@ var Publisher = {
},
mentionsAfter : function(visibleCursorIndex){
var resultMentions = [];
- for(i in this.mentions){
+ for(var i in this.mentions){
var mention = this.mentions[i];
if(visibleCursorIndex <= mention.visibleStart){
resultMentions.push(mention);
}
}
return resultMentions;
- },
+ }
},
repopulateHiddenInput: function(){
var newHiddenVal = Publisher.autocompletion.mentionList.generateHiddenInput(Publisher.input().val());
@@ -207,8 +200,8 @@ var Publisher = {
var input = Publisher.input();
var selectionStart = input[0].selectionStart;
var selectionEnd = input[0].selectionEnd;
- var isDeletion = (event.keyCode == KEYCODES.DEL && selectionStart < input.val().length) || (event.keyCode == KEYCODES.BACKSPACE && (selectionStart > 0 || selectionStart != selectionEnd))
- var isInsertion = (KEYCODES.isInsertion(event.keyCode) && event.keyCode != KEYCODES.RETURN )
+ var isDeletion = (event.keyCode == KEYCODES.DEL && selectionStart < input.val().length) || (event.keyCode == KEYCODES.BACKSPACE && (selectionStart > 0 || selectionStart != selectionEnd));
+ var isInsertion = (KEYCODES.isInsertion(event.keyCode) && event.keyCode != KEYCODES.RETURN );
if(isDeletion){
Publisher.autocompletion.mentionList.deletionAt(selectionStart, selectionEnd, event.keyCode);
@@ -226,15 +219,15 @@ var Publisher = {
var stringEnd = inputContent.slice(stringLoc[1]);
input.val(stringStart + formatted + stringEnd);
- var offset = formatted.length - (stringLoc[1] - stringLoc[0])
+ var offset = formatted.length - (stringLoc[1] - stringLoc[0]);
Publisher.autocompletion.mentionList.updateMentionLocations(stringStart.length, offset);
- return [stringStart.length, stringStart.length + formatted.length]
+ return [stringStart.length, stringStart.length + formatted.length];
},
findStringToReplace: function(value, cursorIndex){
var atLocation = value.lastIndexOf('@', cursorIndex);
if(atLocation == -1){return [0,0];}
- var nextAt = cursorIndex
+ var nextAt = cursorIndex;
if(nextAt == -1){nextAt = value.length;}
return [atLocation, nextAt];
@@ -247,7 +240,7 @@ var Publisher = {
if(stringLoc[0] <= 2){
stringLoc[0] = 0;
}else{
- stringLoc[0] -= 2
+ stringLoc[0] -= 2;
}
var relevantString = value.slice(stringLoc[0], stringLoc[1]).replace(/\s+$/,"");
@@ -270,9 +263,9 @@ var Publisher = {
}
},
determineSubmitAvailability: function(){
- var onlyWhitespaces = (Publisher.input().val().trim() == '');
+ var onlyWhitespaces = (Publisher.input().val().trim() === '');
var isSubmitDisabled = Publisher.submit().attr('disabled');
- var isPhotoAttached = ($("#photodropzone").children().length > 0)
+ var isPhotoAttached = ($("#photodropzone").children().length > 0);
if ((onlyWhitespaces && !isPhotoAttached) && !isSubmitDisabled) {
Publisher.submit().attr('disabled', true);
} else if ((!onlyWhitespaces || isPhotoAttached) && isSubmitDisabled) {
@@ -295,40 +288,40 @@ var Publisher = {
$(this).toggleClass("dim");
var public_field= $("#publisher #status_message_public");
- (public_field.val() == 'false')?(public_field.val('true')):(public_field.val('false'));
+ (public_field.val() == 'false') ? (public_field.val('true')) : (public_field.val('false'));
});
},
toggleServiceField: function(service){
Publisher.createCounter(service);
var provider = service.attr('id');
- var hidden_field = $('#publisher [name="services[]"][value="'+provider+'"]')
+ var hidden_field = $('#publisher [name="services[]"][value="'+provider+'"]');
if(hidden_field.length > 0){
hidden_field.remove();
} else {
$("#publisher .content_creation form").append(
'');
- };
+ }
},
toggleAspectIds: function(aspectId) {
- var hidden_field = $('#publisher [name="aspect_ids[]"][value="'+aspectId+'"]')
+ var hidden_field = $('#publisher [name="aspect_ids[]"][value="'+aspectId+'"]');
if(hidden_field.length > 0){
hidden_field.remove();
} else {
$("#publisher .content_creation form").append(
'');
- };
+ }
},
createCounter: function(service){
var counter = $("#publisher .counter");
counter.remove();
-
+
var min = 40000;
var a = $('.service_icon:not(.dim)');
if(a.length > 0){
$.each(a, function(index, value){
var num = parseInt($(value).attr('maxchar'));
- if (min > num) { min = num}
+ if (min > num) { min = num; }
});
$('#status_message_fake_text').charCount({allowed: min, warning: min/10 });
}
@@ -338,22 +331,22 @@ var Publisher = {
$('#publisher .aspect_badge').bind("click", function(){
var unremovedAspects = $(this).parent().children('.aspect_badge').length - $(this).parent().children(".aspect_badge.removed").length;
if(!$(this).hasClass('removed') && ( unremovedAspects == 1 )){
- alert(Diaspora.widgets.i18n.t('publisher.at_least_one_aspect'))
+ alert(Diaspora.widgets.i18n.t('publisher.at_least_one_aspect'));
}else{
Publisher.toggleAspectIds($(this).children('a').attr('data-guid'));
$(this).toggleClass("removed");
- };
+ }
});
},
initialize: function() {
- Publisher.cachedForm = Publisher.cachedSubmit =
+ Publisher.cachedForm = Publisher.cachedSubmit =
Publisher.cachedInput = Publisher.cachedHiddenInput = false;
-
+
Publisher.bindServiceIcons();
Publisher.bindPublicIcon();
Publisher.bindAspectToggles();
- if ($("#status_message_fake_text").val() == "") {
+ if ($("#status_message_fake_text").val() === "") {
Publisher.close();
}