Very minor changes of some JS files

This commit is contained in:
Spanti Nicola (RyDroid) 2015-07-08 02:06:23 +02:00 committed by Spanti Nicola (RyDroid)
parent c703cadf9b
commit df440ed8d8
27 changed files with 38 additions and 49 deletions

View file

@ -63,7 +63,7 @@ var app = {
},
parsePreload : function(prop) {
if(!app.hasPreload(prop)) { return }
if(!app.hasPreload(prop)) { return; }
var preload = window.gon.preloads[prop];
delete window.gon.preloads[prop]; //prevent dirty state across navigates
@ -112,7 +112,7 @@ var app = {
/* mixpanel wrapper function */
instrument : function(type, name, object, callback) {
if(!window.mixpanel) { return }
if(!window.mixpanel) { return; }
window.mixpanel[type](name, object, callback);
},

View file

@ -2,22 +2,22 @@
app.collections.Comments = Backbone.Collection.extend({
model: app.models.Comment,
url: function() { return _.result(this.post, 'url') + '/comments'; },
url: function() {
return _.result(this.post, "url") + "/comments";
},
initialize : function(models, options) {
this.post = options.post;
},
make : function(text){
var self = this;
var comment = new app.models.Comment({text: text });
make : function(text) {
var comment = new app.models.Comment({ "text": text });
var deferred = comment.save({}, {
url: '/posts/'+this.post.id+'/comments',
url: "/posts/"+ this.post.id +"/comments",
success: function() {
comment.set({author: app.currentUser.toJSON(), parent: self.post });
self.add(comment);
comment.set({author: app.currentUser.toJSON(), parent: this.post });
this.add(comment);
}
});

View file

@ -5,4 +5,3 @@ app.collections.Posts = Backbone.Collection.extend({
url : "/posts"
});
// @license-end

View file

@ -5,4 +5,3 @@ app.collections.Reshares = Backbone.Collection.extend({
url : "/reshares"
});
// @license-end

View file

@ -5,7 +5,6 @@
// Requires:
// this = model with "created_at" attribute
app.models.formatDateMixin = {
timeOf: function(field) {
return app.helpers.dateFormatter.parse(this.get(field)) / 1000;
},
@ -13,7 +12,5 @@ app.models.formatDateMixin = {
createdAt: function() {
return this.timeOf("created_at");
}
};
// @license-end

View file

@ -8,4 +8,3 @@ app.models.AspectMembership = Backbone.Model.extend({
urlRoot: "/aspect_memberships"
});
// @license-end

View file

@ -4,4 +4,3 @@ app.models.Comment = Backbone.Model.extend({
urlRoot: "/comments"
});
// @license-end

View file

@ -32,7 +32,7 @@ app.models.Post.Interactions = Backbone.Model.extend({
},
likesCount : function(){
return (this.get("fetched") ? this.likes.models.length : this.get("likes_count") );
return this.get("fetched") ? this.likes.models.length : this.get("likes_count");
},
resharesCount : function(){
@ -44,12 +44,15 @@ app.models.Post.Interactions = Backbone.Model.extend({
},
userLike : function(){
return this.likes.select(function(like){ return like.get("author").guid === app.currentUser.get("guid")})[0];
return this.likes.select(function(like){
return like.get("author").guid === app.currentUser.get("guid");
})[0];
},
userReshare : function(){
return this.reshares.select(function(reshare){
return reshare.get("author") && reshare.get("author").guid === app.currentUser.get("guid")})[0];
return reshare.get("author") && reshare.get("author").guid === app.currentUser.get("guid");
})[0];
},
toggleLike : function() {

View file

@ -21,4 +21,3 @@ app.models.StatusMessage = app.models.Post.extend({
}
});
// @license-end

View file

@ -17,7 +17,7 @@ app.models.StreamAspects = app.models.Stream.extend({
},
fetch: function() {
if(this.isFetching()){ return false }
if(this.isFetching()) { return false; }
var url = this.url();
var ids = this.aspects_ids;
this.deferred = this.items.fetch(this._fetchOpts({url : url, data : { 'a_ids': ids }}))
@ -32,4 +32,3 @@ app.models.StreamAspects = app.models.Stream.extend({
}
});
// @license-end

View file

@ -98,4 +98,3 @@ app.pages.Contacts = Backbone.View.extend({
}
});
// @license-end

View file

@ -127,4 +127,3 @@ app.pages.Profile = app.views.Base.extend({
}
});
// @license-end

View file

@ -37,7 +37,6 @@ app.pages.SinglePostViewer = app.views.Base.extend({
//... and converts html to plain text
document.title = $('<div>').html(html_title).text();
}
},
}
});
// @license-end

View file

@ -170,9 +170,11 @@ app.Router = Backbone.Router.extend({
},
profile: function() {
this.renderPage(function() { return new app.pages.Profile({
this.renderPage(function() {
return new app.pages.Profile({
el: $("body > #profile_container")
}); });
});
});
}
});
// @license-end

View file

@ -150,7 +150,6 @@ app.views.Base = Backbone.View.extend({
});
app.views.StaticContentView = app.views.Base.extend({
initialize : function(options) {
this.templateName = options.templateName;
this.data = options.data;

View file

@ -6,4 +6,3 @@ jQuery.browser.webkit = /webkit/.test(navigator.userAgent.toLowerCase());
jQuery.browser.opera = /opera/.test(navigator.userAgent.toLowerCase());
jQuery.browser.msie = /msie/.test(navigator.userAgent.toLowerCase());
// @license-end

View file

@ -25,4 +25,3 @@ var List = {
}
};
// @license-end

View file

@ -87,7 +87,7 @@
Diaspora.page = new Page();
}
if(!$.mobile)//why does this need this?
if(!$.mobile) // why does this need this?
$.extend(Diaspora.page, new Diaspora.BasePage($(document.body)));
Diaspora.page.publish("page/ready", [$(document.body)]);
};

View file

@ -46,4 +46,3 @@ var Mentions = {
}
};
// @license-end

View file

@ -26,6 +26,7 @@ $(document).ready(function() {
showComments(toggleReactionsLink);
}
}
function hideComments(toggleReactionsLink) {
var bottomBar = toggleReactionsLink.closest(".bottom_bar").first(),
commentsContainer = commentsContainerLazy(bottomBar),
@ -33,6 +34,7 @@ $(document).ready(function() {
existingCommentsContainer.hide();
toggleReactionsLink.removeClass("active");
}
function showComments(toggleReactionsLink) {
var bottomBar = toggleReactionsLink.closest(".bottom_bar").first(),
commentsContainer = commentsContainerLazy(bottomBar),
@ -44,12 +46,14 @@ $(document).ready(function() {
showUnloadedComments(toggleReactionsLink, bottomBar, commentActionLink);
}
}
function showLoadedComments(toggleReactionsLink, existingCommentsContainer, commentActionLink) {
existingCommentsContainer.show();
showCommentBox(commentActionLink);
toggleReactionsLink.addClass("active");
existingCommentsContainer.find("time.timeago").timeago();
}
function showUnloadedComments(toggleReactionsLink, bottomBar, commentActionLink) {
var commentsContainer = commentsContainerLazy(bottomBar);
$.ajax({
@ -62,6 +66,7 @@ $(document).ready(function() {
}
});
}
function commentsContainerLazy(bottomBar) {
return function() {
return bottomBar.find(".comment_container").first();
@ -140,6 +145,7 @@ $(document).ready(function() {
return parseInt(match) + 1;
}));
}
// Fix for no reactions
function updateReactionCount(bottomBar) {
var toggleReactionsLink = bottomBar.find(".show_comments").first();

View file

@ -81,4 +81,3 @@ $(document).ready(function(){
$(this).change(profileAspectDropDown_onchange);
});
});

View file

@ -36,4 +36,3 @@
Diaspora.Widgets.FlashMessages = FlashMessages;
})();
// @license-end

View file

@ -1,9 +1,9 @@
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later
/* Copyright (c) 2010-2011, Diaspora Inc. This file is
* licensed under the Affero General Public License version 3 or later. See
* the COPYRIGHT file.
*/
* licensed under the Affero General Public License version 3 or later. See
* the COPYRIGHT file.
*/
(function() {
var InfiniteScroll = function() {
@ -59,4 +59,3 @@
Diaspora.Widgets.InfiniteScroll = InfiniteScroll;
})();
// @license-end

View file

@ -190,4 +190,3 @@ jQuery.fn.center = (function() {
Diaspora.Widgets.Lightbox = Lightbox;
})();
// @license-end

View file

@ -1,5 +1,4 @@
describe("app.helpers.dateFormatter", function(){
beforeEach(function(){
this.statusMessage = factory.post();
this.formatter = app.helpers.dateFormatter;

View file

@ -1,4 +1,3 @@
describe("bookmarklet", function(){
var fakeUrl = "http://pod.example.com/bookmarklet";

View file

@ -1,7 +1,7 @@
/* Copyright (c) 2010-2011, Diaspora Inc. This file is
* licensed under the Affero General Public License version 3 or later. See
* the COPYRIGHT file.
*/
* licensed under the Affero General Public License version 3 or later. See
* the COPYRIGHT file.
*/
describe("View", function() {
it("is the object that helps the UI", function() {