JSHint unused and undefined variables
This commit is contained in:
parent
a9a480da0a
commit
5fa6b8253e
54 changed files with 164 additions and 141 deletions
|
|
@ -72,7 +72,7 @@ app.models.Post.Interactions = Backbone.Model.extend({
|
|||
|
||||
unlike : function() {
|
||||
var self = this;
|
||||
this.userLike().destroy({success : function(model, resp) {
|
||||
this.userLike().destroy({success : function() {
|
||||
self.trigger('change');
|
||||
self.set({"likes_count" : self.get("likes_count") - 1});
|
||||
}});
|
||||
|
|
@ -84,7 +84,7 @@ app.models.Post.Interactions = Backbone.Model.extend({
|
|||
var self = this;
|
||||
|
||||
this.comments.make(text).fail(function () {
|
||||
flash = new Diaspora.Widgets.FlashMessages();
|
||||
var flash = new Diaspora.Widgets.FlashMessages();
|
||||
flash.render({
|
||||
success: false,
|
||||
notice: Diaspora.I18n.t("failed_to_post_message")
|
||||
|
|
@ -104,13 +104,13 @@ app.models.Post.Interactions = Backbone.Model.extend({
|
|||
, flash = new Diaspora.Widgets.FlashMessages();
|
||||
|
||||
reshare.save({}, {
|
||||
success : function(resp){
|
||||
success : function(){
|
||||
flash.render({
|
||||
success: true,
|
||||
notice: Diaspora.I18n.t("reshares.successful")
|
||||
});
|
||||
},
|
||||
error: function(resp){
|
||||
error: function(){
|
||||
flash.render({
|
||||
success: false,
|
||||
notice: Diaspora.I18n.t("reshares.duplicate")
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ app.pages.Contacts = Backbone.View.extend({
|
|||
$(".header > #aspect_name_form").show();
|
||||
},
|
||||
|
||||
updateAspectName: function(evt,data,status,xhr){
|
||||
updateAspectName: function(evt,data){
|
||||
$(".header #aspect_name").text(data['name']);
|
||||
$("#aspect_nav [data-aspect-id='"+data['id']+"'] .name").text(data['name']);
|
||||
$(".header > #aspect_name_form").hide();
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ app.pages.Profile = app.views.Base.extend({
|
|||
return new view({model: app.stream});
|
||||
},
|
||||
|
||||
blockPerson: function(evt) {
|
||||
blockPerson: function() {
|
||||
if( !confirm(Diaspora.I18n.t('ignore_user')) ) return;
|
||||
|
||||
var block = this.model.block();
|
||||
|
|
@ -106,7 +106,7 @@ app.pages.Profile = app.views.Base.extend({
|
|||
return false;
|
||||
},
|
||||
|
||||
unblockPerson: function(evt) {
|
||||
unblockPerson: function() {
|
||||
var block = this.model.unblock();
|
||||
block.fail(function() {
|
||||
Diaspora.page.flashMessages.render({
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ app.Router = Backbone.Router.extend({
|
|||
|
||||
//below here is oldness
|
||||
|
||||
stream : function(page) {
|
||||
stream : function() {
|
||||
app.stream = new app.models.Stream();
|
||||
app.stream.fetch();
|
||||
app.page = new app.views.Stream({model : app.stream});
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
app.views.Base = Backbone.View.extend({
|
||||
|
||||
initialize : function(options) {
|
||||
initialize : function() {
|
||||
this.setupRenderEvents();
|
||||
},
|
||||
|
||||
|
|
@ -76,8 +76,6 @@ app.views.Base = Backbone.View.extend({
|
|||
},
|
||||
|
||||
setFormAttrs : function(){
|
||||
this.model.set(_.inject(this.formAttrs, _.bind(setValueFromField, this), {}));
|
||||
|
||||
function setValueFromField(memo, attribute, selector){
|
||||
if(attribute.slice("-2") === "[]") {
|
||||
memo[attribute.slice(0, attribute.length - 2)] = _.pluck(this.$el.find(selector).serializeArray(), "value");
|
||||
|
|
@ -86,6 +84,8 @@ app.views.Base = Backbone.View.extend({
|
|||
}
|
||||
return memo;
|
||||
}
|
||||
|
||||
this.model.set(_.inject(this.formAttrs, _.bind(setValueFromField, this), {}));
|
||||
},
|
||||
|
||||
report: function(evt) {
|
||||
|
|
@ -104,13 +104,13 @@ app.views.Base = Backbone.View.extend({
|
|||
|
||||
var report = new app.models.Report();
|
||||
report.save(data, {
|
||||
success: function(model, response) {
|
||||
success: function() {
|
||||
Diaspora.page.flashMessages.render({
|
||||
success: true,
|
||||
notice: Diaspora.I18n.t('report.status.created')
|
||||
});
|
||||
},
|
||||
error: function(model, response) {
|
||||
error: function() {
|
||||
Diaspora.page.flashMessages.render({
|
||||
success: false,
|
||||
notice: Diaspora.I18n.t('report.status.exists')
|
||||
|
|
@ -142,7 +142,7 @@ app.views.Base = Backbone.View.extend({
|
|||
},
|
||||
|
||||
avatars: {
|
||||
fallback: function(evt) {
|
||||
fallback: function() {
|
||||
$(this).attr("src", ImagePaths.get("user/default.png"));
|
||||
},
|
||||
selector: "img.avatar"
|
||||
|
|
|
|||
|
|
@ -30,18 +30,18 @@ app.views.Bookmarklet = Backbone.View.extend({
|
|||
return contents;
|
||||
},
|
||||
|
||||
_postSubmit: function(evt) {
|
||||
_postSubmit: function() {
|
||||
this.$('h4').text(Diaspora.I18n.t('bookmarklet.post_submit'));
|
||||
},
|
||||
|
||||
_postSuccess: function(evt) {
|
||||
_postSuccess: function() {
|
||||
this.$('h4').text(Diaspora.I18n.t('bookmarklet.post_success'));
|
||||
app.publisher.close();
|
||||
this.$("#publisher").addClass("hidden");
|
||||
_.delay(window.close, 2000);
|
||||
},
|
||||
|
||||
_postError: function(evt) {
|
||||
_postError: function() {
|
||||
this.$('h4').text(Diaspora.I18n.t('bookmarklet.post_something'));
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ app.views.CommentStream = app.views.Base.extend({
|
|||
}).render().el);
|
||||
},
|
||||
|
||||
commentTextareaFocused: function(evt){
|
||||
commentTextareaFocused: function(){
|
||||
this.$("form").removeClass('hidden').addClass("open");
|
||||
},
|
||||
|
||||
|
|
@ -83,8 +83,7 @@ app.views.CommentStream = app.views.Base.extend({
|
|||
|
||||
expandComments: function(evt){
|
||||
if(evt){ evt.preventDefault(); }
|
||||
|
||||
self = this;
|
||||
var self = this;
|
||||
|
||||
this.model.comments.fetch({
|
||||
success : function(resp){
|
||||
|
|
|
|||
|
|
@ -44,10 +44,10 @@ app.views.Contact = app.views.Base.extend({
|
|||
'person_id': this.model.get('person_id'),
|
||||
'aspect_id': app.aspect.get('id')
|
||||
},{
|
||||
success: function(model,response){
|
||||
success: function(){
|
||||
self.render();
|
||||
},
|
||||
error: function(model,response){
|
||||
error: function(){
|
||||
var msg = Diaspora.I18n.t('contacts.error_add', { 'name': self.model.get('person').name });
|
||||
Diaspora.page.flashMessages.render({ 'success':false, 'notice':msg });
|
||||
}
|
||||
|
|
@ -59,10 +59,10 @@ app.views.Contact = app.views.Base.extend({
|
|||
this.model.aspect_memberships
|
||||
.find(function(membership){ return membership.get('aspect').id == app.aspect.id; })
|
||||
.destroy({
|
||||
success: function(model,response){
|
||||
success: function(){
|
||||
self.render();
|
||||
},
|
||||
error: function(model,response){
|
||||
error: function(){
|
||||
var msg = Diaspora.I18n.t('contacts.error_remove', { 'name': self.model.get('person').name });
|
||||
Diaspora.page.flashMessages.render({ 'success':false, 'notice':msg });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,9 +95,9 @@ app.views.OEmbed = app.views.Base.extend({
|
|||
},
|
||||
|
||||
presenter:function () {
|
||||
o_embed_cache = this.model.get("o_embed_cache");
|
||||
var o_embed_cache = this.model.get("o_embed_cache");
|
||||
if(o_embed_cache) {
|
||||
typemodel = { rich: false, photo: false, video: false, link: false };
|
||||
var typemodel = { rich: false, photo: false, video: false, link: false };
|
||||
typemodel[o_embed_cache.data.type] = true;
|
||||
o_embed_cache.data.types = typemodel;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@ app.views.FaqQuestionView = app.views.Base.extend({
|
|||
},
|
||||
|
||||
toggled: function(e) {
|
||||
el = $(e.target);
|
||||
parent = el.parents('.question');
|
||||
var el = $(e.target);
|
||||
var parent = el.parents('.question');
|
||||
|
||||
parent.children('.answer').toggle();
|
||||
parent.toggleClass('opened').toggleClass('collapsed');
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ app.views.Header = app.views.Base.extend({
|
|||
"focusout #q": "toggleSearchActive"
|
||||
},
|
||||
|
||||
initialize : function(options) {
|
||||
initialize : function() {
|
||||
$(document.body).click($.proxy(this.hideDropdown, this));
|
||||
return this;
|
||||
},
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@ app.views.HelpSectionView = app.views.StaticContentView.extend({
|
|||
},
|
||||
|
||||
toggled: function(e) {
|
||||
el = $(e.target);
|
||||
parent = el.parents('.question');
|
||||
var el = $(e.target);
|
||||
var parent = el.parents('.question');
|
||||
|
||||
parent.children('.answer.hideable').toggle();
|
||||
parent.toggleClass('opened').toggleClass('collapsed');
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ app.views.Help = app.views.StaticContentView.extend({
|
|||
"click .faq-link-keyboard-shortcuts" : "keyboardShortcuts",
|
||||
},
|
||||
|
||||
initialize : function(options) {
|
||||
initialize : function() {
|
||||
this.GETTING_HELP_SUBS = {
|
||||
getting_started_a: { tutorial_series: this.linkHtml("http://diasporafoundation.org/getting_started/sign_up", Diaspora.I18n.t( 'getting_started_tutorial' )) },
|
||||
get_support_a_website: { link: this.linkHtml("https://diasporafoundation.org/", Diaspora.I18n.t( 'foundation_website' ))},
|
||||
|
|
@ -124,8 +124,8 @@ app.views.Help = app.views.StaticContentView.extend({
|
|||
|
||||
renderStaticSection: function(section, template, subs) {
|
||||
this.clearItems();
|
||||
data = $.extend(Diaspora.I18n.resolve(section), { className: section });
|
||||
help_section = new app.views.HelpSectionView({
|
||||
var data = $.extend(Diaspora.I18n.resolve(section), { className: section });
|
||||
var help_section = new app.views.HelpSectionView({
|
||||
template: template,
|
||||
data: data,
|
||||
subs: subs
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ app.views.Hovercard = app.views.Base.extend({
|
|||
$.get(href, function(response) {
|
||||
self.dropdown_container.html(response);
|
||||
});
|
||||
var aspect_membership = new app.views.AspectMembership({el: self.dropdown_container});
|
||||
new app.views.AspectMembership({el: self.dropdown_container});
|
||||
},
|
||||
|
||||
_positionHovercard: function() {
|
||||
|
|
|
|||
|
|
@ -13,10 +13,10 @@ app.views.Location = Backbone.View.extend({
|
|||
$(this.el).append('<img alt="delete location" src="'+ImagePaths.get('ajax-loader.gif')+'">');
|
||||
},
|
||||
|
||||
getLocation: function(e){
|
||||
element = this.el;
|
||||
getLocation: function(){
|
||||
var element = this.el;
|
||||
|
||||
locator = new OSM.Locator();
|
||||
var locator = new OSM.Locator();
|
||||
locator.getAddress(function(address, latlng){
|
||||
$(element).html('<input id="location_address" type="text" class="input-block-level" value="' + address + '"/>');
|
||||
$('#location_coords').val(latlng.latitude + "," + latlng.longitude);
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ app.views.Notifications = Backbone.View.extend({
|
|||
},
|
||||
|
||||
toggleUnread: function(evt) {
|
||||
note = $(evt.target).closest(".stream_element");
|
||||
unread = note.hasClass("unread");
|
||||
var note = $(evt.target).closest(".stream_element");
|
||||
var unread = note.hasClass("unread");
|
||||
|
||||
if (unread) {
|
||||
this.setRead(note.data("guid"));
|
||||
|
|
@ -44,17 +44,17 @@ app.views.Notifications = Backbone.View.extend({
|
|||
},
|
||||
|
||||
clickSuccess: function(data) {
|
||||
type = $('.stream_element[data-guid=' + data["guid"] + ']').data('type');
|
||||
var type = $('.stream_element[data-guid=' + data["guid"] + ']').data('type');
|
||||
this.updateView(data["guid"], type, data["unread"]);
|
||||
},
|
||||
|
||||
updateView: function(guid, type, unread) {
|
||||
change = unread ? 1 : -1;
|
||||
all_notes = $('ul.nav > li:eq(0) .badge');
|
||||
type_notes = $('ul.nav > li[data-type=' + type + '] .badge');
|
||||
header_badge = $('#notification_badge .badge_count');
|
||||
var change = unread ? 1 : -1,
|
||||
all_notes = $('ul.nav > li:eq(0) .badge'),
|
||||
type_notes = $('ul.nav > li[data-type=' + type + '] .badge'),
|
||||
header_badge = $('#notification_badge .badge_count'),
|
||||
note = $('.stream_element[data-guid=' + guid + ']');
|
||||
|
||||
note = $('.stream_element[data-guid=' + guid + ']');
|
||||
if(unread) {
|
||||
note.removeClass("read").addClass("unread");
|
||||
$(".unread-toggle .entypo", note)
|
||||
|
|
@ -93,4 +93,3 @@ app.views.Notifications = Backbone.View.extend({
|
|||
}
|
||||
});
|
||||
// @license-end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later
|
||||
|
||||
app.views.Photos = app.views.InfScroll.extend({
|
||||
initialize : function(options) {
|
||||
initialize : function() {
|
||||
this.stream = this.model;
|
||||
this.collection = this.stream.items;
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ app.views.Poll = app.views.Base.extend({
|
|||
"click .toggle_result" : "toggleResult"
|
||||
},
|
||||
|
||||
initialize: function(options) {
|
||||
initialize: function() {
|
||||
this.model.bind('change', this.render, this);
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
// Provides the ability to specify the visibility of posted content as public
|
||||
// or limited to selected aspects
|
||||
app.views.PublisherAspectSelectorBlueprint = Backbone.View.extend({
|
||||
/* global AspectsDropdown */
|
||||
|
||||
events: {
|
||||
"click .dropdown_list > li": "toggleAspect"
|
||||
|
|
@ -21,7 +22,6 @@ app.views.PublisherAspectSelectorBlueprint = Backbone.View.extend({
|
|||
// event handler for aspect selection
|
||||
toggleAspect: function(evt) {
|
||||
var el = $(evt.target);
|
||||
var btn = el.parent('.dropdown').find('.button');
|
||||
|
||||
// visually toggle the aspect selection
|
||||
if( el.is('.radio') ) {
|
||||
|
|
|
|||
|
|
@ -66,8 +66,7 @@ app.views.PublisherPollCreator = app.views.Base.extend({
|
|||
this.$('input').val('');
|
||||
},
|
||||
|
||||
validate: function(evt){
|
||||
var input = $(evt.target);
|
||||
validate: function(){
|
||||
this.validatePoll();
|
||||
this.trigger('change');
|
||||
},
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ app.views.PublisherUploader = Backbone.View.extend({
|
|||
.width(progress + '%');
|
||||
},
|
||||
|
||||
submitHandler: function(id, fileName) {
|
||||
submitHandler: function() {
|
||||
this.$el.addClass('loading');
|
||||
this._addPhotoPlaceholder();
|
||||
},
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ app.views.Publisher = Backbone.View.extend({
|
|||
// standalone means single-shot posting (until further notice)
|
||||
if( self.standalone ) self.setEnabled(false);
|
||||
},
|
||||
error: function(model, resp, options) {
|
||||
error: function(model, resp) {
|
||||
if( app.publisher ) app.publisher.trigger('publisher:error');
|
||||
self.setInputEnabled(true);
|
||||
Diaspora.page.flashMessages.render({ 'success':false, 'notice':resp.responseText });
|
||||
|
|
@ -271,9 +271,10 @@ app.views.Publisher = Backbone.View.extend({
|
|||
);
|
||||
});
|
||||
|
||||
var mentioned_people = [];
|
||||
var regexp = new RegExp("@{\(\[\^\;\]\+\); \(\[\^\}\]\+\)}", "g");
|
||||
while(user=regexp.exec(serializedForm["status_message[text]"])){
|
||||
var mentioned_people = [],
|
||||
regexp = new RegExp("@{\(\[\^\;\]\+\); \(\[\^\}\]\+\)}", "g"),
|
||||
user;
|
||||
while( (user = regexp.exec(serializedForm["status_message[text]"])) ){
|
||||
// user[1]: name, user[2]: handle
|
||||
var mentioned_user = Mentions.contacts.filter(function(item) { return item.handle == user[2];})[0];
|
||||
if(mentioned_user){
|
||||
|
|
|
|||
|
|
@ -9,11 +9,11 @@ app.views.SinglePostCommentStream = app.views.CommentStream.extend({
|
|||
|
||||
highlightPermalinkComment: function() {
|
||||
if(document.location.hash){
|
||||
element=$(document.location.hash);
|
||||
headerSize=50;
|
||||
var element = $(document.location.hash);
|
||||
var headerSize = 50;
|
||||
$(".highlighted").removeClass("highlighted");
|
||||
element.addClass("highlighted");
|
||||
pos=element.offset().top-headerSize;
|
||||
var pos = element.offset().top - headerSize;
|
||||
$("html").animate({scrollTop:pos});
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -8,8 +8,6 @@ app.views.SinglePostModeration = app.views.Feedback.extend({
|
|||
},
|
||||
|
||||
presenter: function() {
|
||||
var interactions = this.model.interactions;
|
||||
|
||||
return _.extend(this.defaultPresenter(), {
|
||||
authorIsCurrentUser : this.authorIsCurrentUser(),
|
||||
});
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
app.views.Stream = app.views.InfScroll.extend(_.extend(
|
||||
app.views.StreamShortcuts, {
|
||||
|
||||
initialize: function(options) {
|
||||
initialize: function() {
|
||||
this.stream = this.model;
|
||||
this.collection = this.stream.items;
|
||||
|
||||
|
|
@ -26,11 +26,10 @@ app.views.Stream = app.views.InfScroll.extend(_.extend(
|
|||
},
|
||||
|
||||
setupNSFW : function(){
|
||||
app.currentUser.bind("nsfwChanged", reRenderPostViews, this);
|
||||
|
||||
function reRenderPostViews() {
|
||||
_.map(this.postViews, function(view){ view.render() });
|
||||
}
|
||||
app.currentUser.bind("nsfwChanged", reRenderPostViews, this);
|
||||
},
|
||||
|
||||
markNavSelected : function() {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ app.views.TagFollowingAction = app.views.Base.extend({
|
|||
return !this.model.isNew();
|
||||
},
|
||||
|
||||
getTagFollowing : function(tagFollowing) {
|
||||
getTagFollowing : function() {
|
||||
this.model = app.tagFollowings.where({"name":this.tagText})[0] ||
|
||||
new app.models.TagFollowing({"name":this.tagText});
|
||||
this.model.bind("change", this.render, this);
|
||||
|
|
|
|||
|
|
@ -62,7 +62,6 @@ app.views.TagFollowingList = app.views.Base.extend({
|
|||
|
||||
createTagFollowing: function(evt) {
|
||||
if(evt){ evt.preventDefault(); }
|
||||
var name = this.$(".tag_input").val();
|
||||
|
||||
this.collection.create({"name":this.$(".tag_input").val()});
|
||||
this.$(".tag_input").val("");
|
||||
|
|
@ -80,4 +79,3 @@ app.views.TagFollowingList = app.views.Base.extend({
|
|||
},
|
||||
});
|
||||
// @license-end
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,8 @@
|
|||
|
||||
app.views.Tags = Backbone.View.extend({
|
||||
|
||||
initialize: function(opts) {
|
||||
initialize: function() {
|
||||
app.publisher.setText("#"+ this.tagName + " ");
|
||||
}
|
||||
});
|
||||
// @license-end
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@
|
|||
};
|
||||
|
||||
Diaspora.BaseWidget = {
|
||||
instantiate: function(Widget, element) {
|
||||
instantiate: function(Widget) {
|
||||
// Mobile version loads only some widgets
|
||||
if (typeof Diaspora.Widgets[Widget] === 'undefined') return;
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ Diaspora.I18n = {
|
|||
updateLocale: function(locale, data) {
|
||||
locale.data = $.extend(locale.data, data);
|
||||
|
||||
rule = this._resolve(locale, ['pluralization_rule']);
|
||||
var rule = this._resolve(locale, ['pluralization_rule']);
|
||||
if (rule !== "") {
|
||||
eval("locale.pluralizationKey = "+rule);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ $(document).ready(function(){
|
|||
dataType: 'json',
|
||||
type: 'DELETE',
|
||||
beforeSend: showLoader(link),
|
||||
complete: function(data){
|
||||
complete: function(){
|
||||
removeLoader(link);
|
||||
link.attr("href", href.replace(/\/\d+$/, ''));
|
||||
|
||||
|
|
@ -110,10 +110,10 @@ $(document).ready(function(){
|
|||
dataType: 'json',
|
||||
type: 'POST',
|
||||
beforeSend: showLoader(link),
|
||||
success: function(data){
|
||||
success: function(){
|
||||
removeLoader(link);
|
||||
},
|
||||
error: function(data){
|
||||
error: function(){
|
||||
removeLoader(link);
|
||||
alert("Failed to reshare!");
|
||||
}
|
||||
|
|
@ -128,7 +128,7 @@ $(document).ready(function(){
|
|||
evt.preventDefault();
|
||||
var link = $(this),
|
||||
parent = link.closest(".bottom_bar").first(),
|
||||
commentsContainer = function(){ return parent.find(".comment_container").first(); };
|
||||
commentsContainer = function(){ return parent.find(".comment_container").first(); },
|
||||
existingCommentsContainer = commentsContainer();
|
||||
|
||||
if( link.hasClass('active') ) {
|
||||
|
|
@ -217,9 +217,9 @@ $(document).ready(function(){
|
|||
|
||||
$(".stream").delegate("a.cancel_new_comment", "tap click", function(evt){
|
||||
evt.preventDefault();
|
||||
var link = $(this);
|
||||
var link = $(this),
|
||||
form = link.closest("form"),
|
||||
commentActionLink = link.closest(".bottom_bar").find("a.comment_action").first();
|
||||
commentActionLink = link.closest(".bottom_bar").find("a.comment_action").first(),
|
||||
container = link.closest('.bottom_bar').find('.add_comment_bottom_link_container');
|
||||
|
||||
if(container.length > 0 ){
|
||||
|
|
@ -237,7 +237,7 @@ $(document).ready(function(){
|
|||
$.post(form.attr('action')+"?format=mobile", form.serialize(), function(data){
|
||||
var bottomBar = form.closest('.bottom_bar').first(),
|
||||
container = bottomBar.find('.add_comment_bottom_link_container'),
|
||||
commentActionLink = bottomBar.find("a.comment_action").first();
|
||||
commentActionLink = bottomBar.find("a.comment_action").first(),
|
||||
reactionLink = bottomBar.find(".show_comments").first(),
|
||||
commentCount = bottomBar.find(".comment_count");
|
||||
|
||||
|
|
@ -264,7 +264,7 @@ $(document).ready(function(){
|
|||
});
|
||||
|
||||
|
||||
$(".service_icon").bind("tap click", function(evt) {
|
||||
$(".service_icon").bind("tap click", function() {
|
||||
var service = $(this).toggleClass("dim"),
|
||||
selectedServices = $("#new_status_message .service_icon:not(.dim)"),
|
||||
provider = service.attr("id"),
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ function createUploader(){
|
|||
|
||||
var aspectIds = gon.preloads.aspect_ids;
|
||||
|
||||
var uploader = new qq.FileUploaderBasic({
|
||||
new qq.FileUploaderBasic({
|
||||
element: document.getElementById('file-upload-publisher'),
|
||||
params: {'photo' : {'pending' : 'true', 'aspect_ids' : aspectIds},},
|
||||
allowedExtensions: ['jpg', 'jpeg', 'png', 'gif', 'tiff'],
|
||||
|
|
@ -25,7 +25,7 @@ function createUploader(){
|
|||
emptyError: Diaspora.I18n.t("photo_uploader.new_photo.empty")
|
||||
},
|
||||
|
||||
onSubmit: function(id, fileName){
|
||||
onSubmit: function(){
|
||||
$('#file-upload-publisher').addClass("loading");
|
||||
$('#publisher_textarea_wrapper').addClass("with_attachments");
|
||||
$('#photodropzone').append(
|
||||
|
|
@ -53,8 +53,7 @@ function createUploader(){
|
|||
"<div class='circle'></div>");
|
||||
////
|
||||
|
||||
var publisher = $('#publisher'),
|
||||
textarea = publisher.find('textarea');
|
||||
var publisher = $('#publisher');
|
||||
|
||||
publisher.find("input[type='submit']").removeAttr('disabled');
|
||||
|
||||
|
|
@ -76,7 +75,7 @@ function createUploader(){
|
|||
});
|
||||
},
|
||||
|
||||
onAllComplete: function(completed_files){
|
||||
onAllComplete: function(){
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -6,15 +6,15 @@ OSM.Locator = function(){
|
|||
|
||||
var geolocalize = function(callback){
|
||||
navigator.geolocation.getCurrentPosition(function(position) {
|
||||
lat=position.coords.latitude;
|
||||
lon=position.coords.longitude;
|
||||
var display_name =$.getJSON("https://nominatim.openstreetmap.org/reverse?format=json&lat="+lat+"&lon="+lon+"&addressdetails=3", function(data){
|
||||
var lat=position.coords.latitude,
|
||||
lon=position.coords.longitude;
|
||||
$.getJSON("https://nominatim.openstreetmap.org/reverse?format=json&lat="+lat+"&lon="+lon+"&addressdetails=3", function(data){
|
||||
return callback(data.display_name, position.coords);
|
||||
});
|
||||
},errorGettingPosition);
|
||||
};
|
||||
|
||||
function errorGettingPosition(err) {
|
||||
function errorGettingPosition() {
|
||||
$("#location").remove();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,12 +7,12 @@ Diaspora.Pages.UsersGettingStarted = function() {
|
|||
self.peopleSearch = self.instantiate("Search", body.find("form.people.search_form"));
|
||||
self.tagSearch = self.instantiate("Search", body.find("form.tag_input.search_form"));
|
||||
|
||||
$('#edit_profile').bind('ajax:success', function(evt, data, status, xhr){
|
||||
$('#edit_profile').bind('ajax:success', function(){
|
||||
$('#gs-name-form-spinner').addClass("hidden");
|
||||
});
|
||||
|
||||
// It seems that the default behavior of rails ujs is to clear the remote form
|
||||
$('#edit_profile').bind('ajax:complete', function(evt, xhr, status){
|
||||
$('#edit_profile').bind('ajax:complete', function(){
|
||||
var firstNameField = $("#profile_first_name");
|
||||
firstNameField.val(firstNameField.data("cachedValue"));
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ Diaspora.Pages.UsersGettingStarted = function() {
|
|||
$(this).addClass("active_input");
|
||||
});
|
||||
|
||||
$("#awesome_button").bind("click", function(evt){
|
||||
$("#awesome_button").bind("click", function(){
|
||||
var confirmMessage = Diaspora.I18n.t("getting_started.no_tags");
|
||||
var message = Diaspora.I18n.t("getting_started.preparing_your_stream");
|
||||
var confirmation = true;
|
||||
|
|
|
|||
|
|
@ -45,13 +45,13 @@ var View = {
|
|||
});
|
||||
};
|
||||
|
||||
$(document).on('ajax:success', 'form[data-remote]', function (e) {
|
||||
$(document).on('ajax:success', 'form[data-remote]', function () {
|
||||
$(this).clearForm();
|
||||
$(this).focusout();
|
||||
});
|
||||
|
||||
/* tag following */
|
||||
$("#new_tag_following .tag_input").bind('focus', function(evt){
|
||||
$("#new_tag_following .tag_input").bind('focus', function(){
|
||||
$(this).siblings("#tag_following_submit").removeClass('hidden');
|
||||
});
|
||||
|
||||
|
|
@ -62,7 +62,7 @@ var View = {
|
|||
Diaspora.page.directionDetector.updateBinds();
|
||||
});
|
||||
|
||||
$("a.new_aspect").click(function(e){
|
||||
$("a.new_aspect").click(function(){
|
||||
$("input#aspect_name").focus();
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ jQuery.fn.center = (function() {
|
|||
imageSelector: 'img.stream-photo'
|
||||
};
|
||||
|
||||
this.subscribe("widget/ready", function(evt) {
|
||||
this.subscribe("widget/ready", function() {
|
||||
$.extend(self, {
|
||||
lightbox: $("#lightbox"),
|
||||
navigation: $("#lightbox-navigation"),
|
||||
|
|
|
|||
|
|
@ -85,10 +85,10 @@
|
|||
});
|
||||
self.dropdownNotifications.find("time.timeago").timeago();
|
||||
|
||||
self.dropdownNotifications.find('.unread').each(function(index) {
|
||||
self.dropdownNotifications.find('.unread').each(function() {
|
||||
Diaspora.page.header.notifications.setUpUnread( $(this) );
|
||||
});
|
||||
self.dropdownNotifications.find('.read').each(function(index) {
|
||||
self.dropdownNotifications.find('.read').each(function() {
|
||||
Diaspora.page.header.notifications.setUpRead( $(this) );
|
||||
});
|
||||
$('.notifications').perfectScrollbar('destroy');
|
||||
|
|
@ -97,7 +97,7 @@
|
|||
isLoading = false;
|
||||
$('.notifications').removeClass("loading");
|
||||
//Infinite Scrolling
|
||||
$('.notifications').scroll(function(e) {
|
||||
$('.notifications').scroll(function() {
|
||||
var bottom = $('.notifications').prop('scrollHeight') - $('.notifications').height();
|
||||
var currentPosition = $('.notifications').scrollTop();
|
||||
isLoading = ($('.loading').length == 1);
|
||||
|
|
@ -113,4 +113,3 @@
|
|||
Diaspora.Widgets.NotificationsDropdown = NotificationDropdown;
|
||||
})();
|
||||
// @license-end
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
type: "GET",
|
||||
dataType:'json',
|
||||
success: function(){
|
||||
self.notificationMenu.find('.unread').each(function(index) {
|
||||
self.notificationMenu.find('.unread').each(function() {
|
||||
self.setUpRead( $(this) );
|
||||
});
|
||||
self.resetCount();
|
||||
|
|
@ -83,7 +83,7 @@
|
|||
this.clickSuccess = function( data ) {
|
||||
var itemID = data["guid"];
|
||||
var isUnread = data["unread"];
|
||||
self.notificationMenu.find('.read,.unread').each(function(index) {
|
||||
self.notificationMenu.find('.read,.unread').each(function() {
|
||||
if ( $(this).data("guid") == itemID ) {
|
||||
if ( isUnread ) {
|
||||
self.notificationMenu.find('a#mark_all_read_link').removeClass('disabled');
|
||||
|
|
@ -128,7 +128,7 @@
|
|||
self.badge.removeClass("hidden");
|
||||
}
|
||||
};
|
||||
this.resetCount = function(change) {
|
||||
this.resetCount = function() {
|
||||
self.count = 0;
|
||||
this.changeNotificationCount(0);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -6,8 +6,6 @@
|
|||
*/
|
||||
(function() {
|
||||
Diaspora.Widgets.TimeAgo = function() {
|
||||
var self = this;
|
||||
|
||||
this.subscribe("widget/ready", function() {
|
||||
if(Diaspora.I18n.language !== "en") {
|
||||
$.timeago.settings.lang = Diaspora.I18n.language;
|
||||
|
|
|
|||
|
|
@ -15,22 +15,26 @@ options:
|
|||
freeze: true
|
||||
immed: true
|
||||
indent: 2
|
||||
latedef: nofunc
|
||||
latedef: true
|
||||
newcap: false
|
||||
noarg: true
|
||||
noempty: true
|
||||
nonbsp: true
|
||||
nonew: false
|
||||
notypeof: true
|
||||
undef: false
|
||||
unused: false
|
||||
undef: true
|
||||
unused: true
|
||||
|
||||
# relaxing options
|
||||
asi: false
|
||||
boss: true
|
||||
browser: true
|
||||
devel: true
|
||||
eqnull: true
|
||||
evil: true
|
||||
expr: true
|
||||
jasmine: true
|
||||
jquery: true
|
||||
lastsemic: true
|
||||
laxbreak: true
|
||||
laxcomma: true
|
||||
|
|
@ -40,5 +44,29 @@ options:
|
|||
supernew: true
|
||||
|
||||
globals:
|
||||
jQuery: true
|
||||
"$": true
|
||||
"_": true
|
||||
"Backbone": true
|
||||
"gon": true
|
||||
"Handlebars": true
|
||||
"HandlebarsTemplates": true
|
||||
"ImagePaths": true
|
||||
"jsxc": true
|
||||
"MBP": true
|
||||
"Routes": true
|
||||
"OSM": true
|
||||
"parse_url": true
|
||||
"punycode": true
|
||||
"qq": true
|
||||
|
||||
"loginAs": true
|
||||
"logout": true
|
||||
"spec": true
|
||||
"context": true
|
||||
"factory": true
|
||||
"stubView": true
|
||||
"exports": true
|
||||
|
||||
"app": true
|
||||
"Diaspora": true
|
||||
"Mentions": true
|
||||
"PosixBracketExpressions": true
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later
|
||||
|
||||
// information for jshint
|
||||
/* exported PosixBracketExpressions */
|
||||
|
||||
var PosixBracketExpressions = {
|
||||
alnum : '\\u0030-\\u0039'
|
||||
+ '\\u0041-\\u005a'
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ describe('app.Router', function () {
|
|||
|
||||
it('decodes name before passing it into TagFollowingAction', function () {
|
||||
var followed_tags = spyOn(app.router, 'followed_tags').and.callThrough();
|
||||
var tag_following_action = spyOn(app.views, 'TagFollowingAction').and.callFake(function(data) {
|
||||
var tag_following_action = spyOn(app.views, 'TagFollowingAction').and.callFake(function() {
|
||||
return {render: function() { return {el: ""}}};
|
||||
});
|
||||
|
||||
|
|
@ -17,7 +17,7 @@ describe('app.Router', function () {
|
|||
|
||||
it('navigates to the downcase version of the corresponding tag', function () {
|
||||
var followed_tags = spyOn(app.router, 'followed_tags').and.callThrough();
|
||||
var tag_following_action = spyOn(app.views, 'TagFollowingAction').and.callFake(function(data) {
|
||||
var tag_following_action = spyOn(app.views, 'TagFollowingAction').and.callFake(function() {
|
||||
return {render: function() { return {el: ""}}};
|
||||
});
|
||||
|
||||
|
|
@ -63,7 +63,7 @@ describe('app.Router', function () {
|
|||
|
||||
describe("bookmarklet", function() {
|
||||
it('routes to bookmarklet even if params have linefeeds', function() {
|
||||
router = new app.Router();
|
||||
var router = new app.Router();
|
||||
var route = jasmine.createSpy('bookmarklet route');
|
||||
router.on('route:bookmarklet', route);
|
||||
router.navigate("/bookmarklet?\n\nfeefwefwewef\n", {trigger: true});
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ describe("app.views.CommentStream", function(){
|
|||
});
|
||||
|
||||
it("fires an AJAX request", function() {
|
||||
params = JSON.parse(this.request.params);
|
||||
var params = JSON.parse(this.request.params);
|
||||
// TODO: use this, once jasmine-ajax is updated to latest version
|
||||
//params = this.request.data();
|
||||
|
||||
|
|
|
|||
|
|
@ -40,8 +40,8 @@ describe("app.views.Notifications", function(){
|
|||
});
|
||||
|
||||
it('changes the "all notifications" count', function() {
|
||||
badge = $('ul.nav > li:eq(0) .badge');
|
||||
count = parseInt(badge.text());
|
||||
var badge = $('ul.nav > li:eq(0) .badge');
|
||||
var count = parseInt(badge.text());
|
||||
|
||||
this.view.updateView(this.guid, this.type, true);
|
||||
expect(parseInt(badge.text())).toBe(count + 1);
|
||||
|
|
@ -51,8 +51,8 @@ describe("app.views.Notifications", function(){
|
|||
});
|
||||
|
||||
it('changes the notification type count', function() {
|
||||
badge = $('ul.nav > li[data-type=' + this.type + '] .badge');
|
||||
count = parseInt(badge.text());
|
||||
var badge = $('ul.nav > li[data-type=' + this.type + '] .badge');
|
||||
var count = parseInt(badge.text());
|
||||
|
||||
this.view.updateView(this.guid, this.type, true);
|
||||
expect(parseInt(badge.text())).toBe(count + 1);
|
||||
|
|
|
|||
|
|
@ -417,7 +417,7 @@ describe("app.views.Publisher", function() {
|
|||
describe('#avoidEnter', function(){
|
||||
it("Avoid submitting the form when pressing enter", function(){
|
||||
// simulates the event object
|
||||
evt = {};
|
||||
var evt = {};
|
||||
evt.keyCode = 13;
|
||||
|
||||
// should return false in order to avoid the form submition
|
||||
|
|
@ -443,7 +443,7 @@ describe("app.views.Publisher", function() {
|
|||
|
||||
it('initializes the file uploader plugin', function() {
|
||||
spyOn(qq, 'FileUploaderBasic');
|
||||
var publisher = new app.views.Publisher();
|
||||
new app.views.Publisher();
|
||||
|
||||
expect(qq.FileUploaderBasic).toHaveBeenCalled();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ describe("app.views.StreamPost", function(){
|
|||
|
||||
describe("events", function(){
|
||||
var _PostViewClass,
|
||||
author_id;
|
||||
authorId;
|
||||
|
||||
beforeEach(function(){
|
||||
_PostViewClass = this.PostViewClass;
|
||||
|
|
@ -20,7 +20,7 @@ describe("app.views.StreamPost", function(){
|
|||
describe("remove posts for blocked person", function(){
|
||||
it("setup remove:author:posts:#{id} to #remove", function(){
|
||||
spyOn(_PostViewClass.prototype, 'remove');
|
||||
view = new _PostViewClass({model : this.statusMessage});
|
||||
new _PostViewClass({model : this.statusMessage});
|
||||
app.events.trigger('person:block:'+authorId);
|
||||
expect(_PostViewClass.prototype.remove).toHaveBeenCalled();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -57,8 +57,8 @@ describe("Diaspora", function() {
|
|||
describe("subscribe", function() {
|
||||
it("will subscribe to multiple events", function() {
|
||||
var firstEventCalled = false,
|
||||
secondEventCalled = false;
|
||||
events = Diaspora.EventBroker.extend({});
|
||||
secondEventCalled = false,
|
||||
events = Diaspora.EventBroker.extend({});
|
||||
|
||||
events.subscribe("first/event second/event", function() {
|
||||
if (firstEventCalled) {
|
||||
|
|
@ -78,8 +78,8 @@ describe("Diaspora", function() {
|
|||
describe("publish", function() {
|
||||
it("will publish multiple events", function() {
|
||||
var firstEventCalled = false,
|
||||
secondEventCalled = false;
|
||||
events = Diaspora.EventBroker.extend({});
|
||||
secondEventCalled = false,
|
||||
events = Diaspora.EventBroker.extend({});
|
||||
|
||||
events.subscribe("first/event second/event", function() {
|
||||
if (firstEventCalled) {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ var realXMLHttpRequest = window.XMLHttpRequest;
|
|||
|
||||
// matches flash messages with success/error and contained text
|
||||
var flashMatcher = function(flash, id, text) {
|
||||
textContained = true;
|
||||
var textContained = true;
|
||||
if( text ) {
|
||||
textContained = (flash.text().indexOf(text) !== -1);
|
||||
}
|
||||
|
|
@ -14,10 +14,13 @@ var flashMatcher = function(flash, id, text) {
|
|||
textContained;
|
||||
};
|
||||
|
||||
// information for jshint
|
||||
/* exported context */
|
||||
var context = describe;
|
||||
|
||||
var spec = {};
|
||||
var customMatchers = {
|
||||
toBeSuccessFlashMessage: function(util) {
|
||||
toBeSuccessFlashMessage: function() {
|
||||
return {
|
||||
compare: function(actual, expected) {
|
||||
var result = {};
|
||||
|
|
@ -26,7 +29,7 @@ var customMatchers = {
|
|||
}
|
||||
};
|
||||
},
|
||||
toBeErrorFlashMessage: function(util) {
|
||||
toBeErrorFlashMessage: function() {
|
||||
return {
|
||||
compare: function(actual, expected) {
|
||||
var result = {};
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
factory = {
|
||||
var factory = {
|
||||
id : {
|
||||
current : 0,
|
||||
next : function(){
|
||||
|
|
@ -149,12 +149,12 @@ factory = {
|
|||
},
|
||||
|
||||
post : function(overrides) {
|
||||
defaultAttrs = _.extend(factory.postAttrs(), {"author" : this.author()});
|
||||
var defaultAttrs = _.extend(factory.postAttrs(), {"author" : this.author()});
|
||||
return new app.models.Post(_.extend(defaultAttrs, overrides));
|
||||
},
|
||||
|
||||
postWithPoll : function(overrides) {
|
||||
defaultAttrs = _.extend(factory.postAttrs(), {"author" : this.author()});
|
||||
var defaultAttrs = _.extend(factory.postAttrs(), {"author" : this.author()});
|
||||
defaultAttrs = _.extend(defaultAttrs, {"already_participated_in_poll" : false});
|
||||
defaultAttrs = _.extend(defaultAttrs, {"poll" : factory.poll()});
|
||||
return new app.models.Post(_.extend(defaultAttrs, overrides));
|
||||
|
|
@ -165,7 +165,7 @@ factory = {
|
|||
return new app.models.StatusMessage(_.extend(factory.postAttrs(), overrides));
|
||||
},
|
||||
|
||||
poll: function(overrides){
|
||||
poll: function(){
|
||||
return {
|
||||
"question" : "This is an awesome question",
|
||||
"created_at" : "2012-01-03T19:53:13Z",
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
onload: function() {
|
||||
},
|
||||
|
||||
onreadystatechange: function(isTimeout) {
|
||||
onreadystatechange: function() {
|
||||
},
|
||||
|
||||
status: null,
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
describe("Locator", function(){
|
||||
navigator.geolocation = {};
|
||||
navigator.geolocation.getCurrentPosition = function(myCallback){
|
||||
lat = 1;
|
||||
lon = 2;
|
||||
position = { coords: { latitude: lat, longitude: lon} };
|
||||
var lat = 1;
|
||||
var lon = 2;
|
||||
var position = { coords: { latitude: lat, longitude: lon} };
|
||||
return myCallback(position);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
*/
|
||||
|
||||
describe("List", function() {
|
||||
/* global List */
|
||||
describe("runDelayedSearch", function() {
|
||||
beforeEach( function(){
|
||||
spec.loadFixture('empty_people_search');
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ describe("Diaspora.Widgets.Lightbox", function() {
|
|||
imageClass: 'stream-photo'
|
||||
};
|
||||
|
||||
classes = _.extend(defaults, opts);
|
||||
var classes = _.extend(defaults, opts);
|
||||
|
||||
var output = $('<div/>').addClass(classes.imageParent);
|
||||
_.each(photos, function(photo){
|
||||
|
|
@ -48,7 +48,7 @@ describe("Diaspora.Widgets.Lightbox", function() {
|
|||
});
|
||||
|
||||
context("opens the lightbox correctly", function() {
|
||||
var lightbox, page, photoElement;
|
||||
var lightbox, photoElement;
|
||||
|
||||
beforeEach(function() {
|
||||
$("#jasmine_content").append(createDummyMarkup());
|
||||
|
|
@ -67,7 +67,7 @@ describe("Diaspora.Widgets.Lightbox", function() {
|
|||
});
|
||||
|
||||
context("opens lightbox for differently named elements", function(){
|
||||
var lightbox, page, photoElement;
|
||||
var lightbox, photoElement;
|
||||
|
||||
beforeEach(function() {
|
||||
$("#jasmine_content").append(createDummyMarkup({
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ describe("Diaspora.Widgets.Search", function() {
|
|||
|
||||
var search = Diaspora.BaseWidget.instantiate("Search", $("#jasmine_content > #searchForm"));
|
||||
var person = {"name": "</script><script>alert('xss');</script"};
|
||||
result = search.parse([$.extend({}, person)]);
|
||||
var result = search.parse([$.extend({}, person)]);
|
||||
expect(result[0].data.name).not.toEqual(person.name);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue