Add JSHint javascript linter
This commit is contained in:
parent
e6d38db365
commit
6b0a5823e3
38 changed files with 166 additions and 109 deletions
5
Gemfile
5
Gemfile
|
|
@ -217,6 +217,9 @@ group :development do
|
||||||
gem 'rb-fsevent', '0.9.4', :require => false
|
gem 'rb-fsevent', '0.9.4', :require => false
|
||||||
gem 'rb-inotify', '0.9.5', :require => false
|
gem 'rb-inotify', '0.9.5', :require => false
|
||||||
|
|
||||||
|
# Linters
|
||||||
|
gem 'jshint', '1.3.1'
|
||||||
|
|
||||||
# Preloading environment
|
# Preloading environment
|
||||||
|
|
||||||
gem 'spring', '1.2.0'
|
gem 'spring', '1.2.0'
|
||||||
|
|
@ -261,5 +264,5 @@ group :development, :test do
|
||||||
# Jasmine (client side application tests (JS))
|
# Jasmine (client side application tests (JS))
|
||||||
gem 'jasmine', '2.1.0'
|
gem 'jasmine', '2.1.0'
|
||||||
gem 'jasmine-jquery-rails', '2.0.3'
|
gem 'jasmine-jquery-rails', '2.0.3'
|
||||||
gem 'sinon-rails', '1.10.3'
|
gem 'sinon-rails', '1.10.3'
|
||||||
end
|
end
|
||||||
|
|
|
||||||
10
Gemfile.lock
10
Gemfile.lock
|
|
@ -308,12 +308,17 @@ GEM
|
||||||
sprockets-rails
|
sprockets-rails
|
||||||
js_image_paths (0.0.1)
|
js_image_paths (0.0.1)
|
||||||
rails (~> 4.0)
|
rails (~> 4.0)
|
||||||
|
jshint (1.3.1)
|
||||||
|
execjs (>= 1.4.0)
|
||||||
|
multi_json (~> 1.0)
|
||||||
|
therubyracer (~> 0.12.1)
|
||||||
json (1.8.1)
|
json (1.8.1)
|
||||||
jwt (1.0.0)
|
jwt (1.0.0)
|
||||||
kaminari (0.16.1)
|
kaminari (0.16.1)
|
||||||
actionpack (>= 3.0.0)
|
actionpack (>= 3.0.0)
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
kgio (2.9.2)
|
kgio (2.9.2)
|
||||||
|
libv8 (3.16.14.7)
|
||||||
listen (2.8.3)
|
listen (2.8.3)
|
||||||
celluloid (>= 0.15.2)
|
celluloid (>= 0.15.2)
|
||||||
rb-fsevent (>= 0.9.3)
|
rb-fsevent (>= 0.9.3)
|
||||||
|
|
@ -488,6 +493,7 @@ GEM
|
||||||
redis (3.1.0)
|
redis (3.1.0)
|
||||||
redis-namespace (1.5.1)
|
redis-namespace (1.5.1)
|
||||||
redis (~> 3.0, >= 3.0.4)
|
redis (~> 3.0, >= 3.0.4)
|
||||||
|
ref (1.0.5)
|
||||||
remotipart (1.2.1)
|
remotipart (1.2.1)
|
||||||
request_store (1.1.0)
|
request_store (1.1.0)
|
||||||
responders (1.1.2)
|
responders (1.1.2)
|
||||||
|
|
@ -569,6 +575,9 @@ GEM
|
||||||
systemu (2.6.4)
|
systemu (2.6.4)
|
||||||
test_after_commit (0.4.0)
|
test_after_commit (0.4.0)
|
||||||
activerecord (>= 3.2)
|
activerecord (>= 3.2)
|
||||||
|
therubyracer (0.12.1)
|
||||||
|
libv8 (~> 3.16.14.0)
|
||||||
|
ref
|
||||||
thor (0.19.1)
|
thor (0.19.1)
|
||||||
thread_safe (0.3.4)
|
thread_safe (0.3.4)
|
||||||
tilt (1.4.1)
|
tilt (1.4.1)
|
||||||
|
|
@ -658,6 +667,7 @@ DEPENDENCIES
|
||||||
jquery-rails (= 3.1.2)
|
jquery-rails (= 3.1.2)
|
||||||
js-routes (= 0.9.9)
|
js-routes (= 0.9.9)
|
||||||
js_image_paths (= 0.0.1)
|
js_image_paths (= 0.0.1)
|
||||||
|
jshint (= 1.3.1)
|
||||||
json (= 1.8.1)
|
json (= 1.8.1)
|
||||||
markerb (= 1.0.2)
|
markerb (= 1.0.2)
|
||||||
messagebus_ruby_api (= 1.0.3)
|
messagebus_ruby_api (= 1.0.3)
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ var app = {
|
||||||
},
|
},
|
||||||
|
|
||||||
setupDummyPreloads: function() {
|
setupDummyPreloads: function() {
|
||||||
if (window.gon == undefined) {
|
if (window.gon === undefined) {
|
||||||
window.gon = {preloads:{}};
|
window.gon = {preloads:{}};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
(function() {
|
(function() {
|
||||||
app.helpers.truncate = function(passedString, length) {
|
app.helpers.truncate = function(passedString, length) {
|
||||||
if (passedString == null || passedString == undefined) {
|
if (passedString === null || passedString === undefined) {
|
||||||
return passedString;
|
return passedString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ app.models.Post.Interactions = Backbone.Model.extend({
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
this.comments.make(text).fail(function () {
|
this.comments.make(text).fail(function () {
|
||||||
flash = new Diaspora.Widgets.FlashMessages;
|
flash = new Diaspora.Widgets.FlashMessages();
|
||||||
flash.render({
|
flash.render({
|
||||||
success: false,
|
success: false,
|
||||||
notice: Diaspora.I18n.t("failed_to_post_message")
|
notice: Diaspora.I18n.t("failed_to_post_message")
|
||||||
|
|
@ -101,7 +101,7 @@ app.models.Post.Interactions = Backbone.Model.extend({
|
||||||
reshare : function(){
|
reshare : function(){
|
||||||
var interactions = this
|
var interactions = this
|
||||||
, reshare = this.post.reshare()
|
, reshare = this.post.reshare()
|
||||||
, flash = new Diaspora.Widgets.FlashMessages;
|
, flash = new Diaspora.Widgets.FlashMessages();
|
||||||
|
|
||||||
reshare.save({}, {
|
reshare.save({}, {
|
||||||
success : function(resp){
|
success : function(resp){
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ app.models.Stream = Backbone.Collection.extend({
|
||||||
this.trigger("fetched", this);
|
this.trigger("fetched", this);
|
||||||
// all loaded?
|
// all loaded?
|
||||||
var respItems = this.items.parse(resp);
|
var respItems = this.items.parse(resp);
|
||||||
if(respItems && (respItems.author || respItems.length == 0)) {
|
if(respItems && (respItems.author || respItems.length === 0)) {
|
||||||
this.trigger("allItemsLoaded", this);
|
this.trigger("allItemsLoaded", this);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -132,7 +132,7 @@ app.views.Base = Backbone.View.extend({
|
||||||
})
|
})
|
||||||
.fail(function() {
|
.fail(function() {
|
||||||
self.$el.removeClass('deleting');
|
self.$el.removeClass('deleting');
|
||||||
var flash = new Diaspora.Widgets.FlashMessages;
|
var flash = new Diaspora.Widgets.FlashMessages();
|
||||||
flash.render({
|
flash.render({
|
||||||
success: false,
|
success: false,
|
||||||
notice: Diaspora.I18n.t('failed_to_remove')
|
notice: Diaspora.I18n.t('failed_to_remove')
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ app.views.AspectMembershipBlueprint = Backbone.View.extend({
|
||||||
|
|
||||||
// the user didn't have this person in any aspects before, congratulate them
|
// the user didn't have this person in any aspects before, congratulate them
|
||||||
// on their newly found friendship ;)
|
// on their newly found friendship ;)
|
||||||
if( this.dropdown.find('li.selected').length == 0 ) {
|
if( this.dropdown.find('li.selected').length === 0 ) {
|
||||||
var msg = Diaspora.I18n.t('aspect_dropdown.started_sharing_with', { 'name': this._name() });
|
var msg = Diaspora.I18n.t('aspect_dropdown.started_sharing_with', { 'name': this._name() });
|
||||||
Diaspora.page.flashMessages.render({ 'success':true, 'notice':msg });
|
Diaspora.page.flashMessages.render({ 'success':true, 'notice':msg });
|
||||||
}
|
}
|
||||||
|
|
@ -121,7 +121,7 @@ app.views.AspectMembershipBlueprint = Backbone.View.extend({
|
||||||
|
|
||||||
// we just removed the last aspect, inform the user with a flash message
|
// we just removed the last aspect, inform the user with a flash message
|
||||||
// that he is no longer sharing with that person
|
// that he is no longer sharing with that person
|
||||||
if( this.dropdown.find('li.selected').length == 0 ) {
|
if( this.dropdown.find('li.selected').length === 0 ) {
|
||||||
var msg = Diaspora.I18n.t('aspect_dropdown.stopped_sharing_with', { 'name': this._name() });
|
var msg = Diaspora.I18n.t('aspect_dropdown.stopped_sharing_with', { 'name': this._name() });
|
||||||
Diaspora.page.flashMessages.render({ 'success':true, 'notice':msg });
|
Diaspora.page.flashMessages.render({ 'success':true, 'notice':msg });
|
||||||
}
|
}
|
||||||
|
|
@ -143,7 +143,7 @@ app.views.AspectMembershipBlueprint = Backbone.View.extend({
|
||||||
var aspects_cnt = this.dropdown.find('li.selected').length;
|
var aspects_cnt = this.dropdown.find('li.selected').length;
|
||||||
var txt;
|
var txt;
|
||||||
|
|
||||||
if( aspects_cnt == 0 ) {
|
if( aspects_cnt === 0 ) {
|
||||||
btn.removeClass('in_aspects');
|
btn.removeClass('in_aspects');
|
||||||
txt = Diaspora.I18n.t('aspect_dropdown.toggle.zero');
|
txt = Diaspora.I18n.t('aspect_dropdown.toggle.zero');
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ app.views.AspectMembership = app.views.AspectsDropdown.extend({
|
||||||
|
|
||||||
// the user didn't have this person in any aspects before, congratulate them
|
// the user didn't have this person in any aspects before, congratulate them
|
||||||
// on their newly found friendship ;)
|
// on their newly found friendship ;)
|
||||||
if( this.dropdown.find('li.selected').length == 0 ) {
|
if( this.dropdown.find('li.selected').length === 0 ) {
|
||||||
var msg = Diaspora.I18n.t('aspect_dropdown.started_sharing_with', { 'name': this._name() });
|
var msg = Diaspora.I18n.t('aspect_dropdown.started_sharing_with', { 'name': this._name() });
|
||||||
Diaspora.page.flashMessages.render({ 'success':true, 'notice':msg });
|
Diaspora.page.flashMessages.render({ 'success':true, 'notice':msg });
|
||||||
}
|
}
|
||||||
|
|
@ -120,7 +120,7 @@ app.views.AspectMembership = app.views.AspectsDropdown.extend({
|
||||||
|
|
||||||
// we just removed the last aspect, inform the user with a flash message
|
// we just removed the last aspect, inform the user with a flash message
|
||||||
// that he is no longer sharing with that person
|
// that he is no longer sharing with that person
|
||||||
if( this.dropdown.find('li.selected').length == 0 ) {
|
if( this.dropdown.find('li.selected').length === 0 ) {
|
||||||
var msg = Diaspora.I18n.t('aspect_dropdown.stopped_sharing_with', { 'name': this._name() });
|
var msg = Diaspora.I18n.t('aspect_dropdown.stopped_sharing_with', { 'name': this._name() });
|
||||||
Diaspora.page.flashMessages.render({ 'success':true, 'notice':msg });
|
Diaspora.page.flashMessages.render({ 'success':true, 'notice':msg });
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ app.views.Aspect = app.views.Base.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleAspect: function(evt) {
|
toggleAspect: function(evt) {
|
||||||
if (evt) { evt.preventDefault(); };
|
if (evt) { evt.preventDefault(); }
|
||||||
this.model.toggleSelected();
|
this.model.toggleSelected();
|
||||||
|
|
||||||
app.router.aspects_stream();
|
app.router.aspects_stream();
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ app.views.AspectsDropdown = app.views.Base.extend({
|
||||||
selectedAspects = this.$(".dropdown-menu > li.selected").length,
|
selectedAspects = this.$(".dropdown-menu > li.selected").length,
|
||||||
buttonText;
|
buttonText;
|
||||||
|
|
||||||
if (selectedAspects == 0) {
|
if (selectedAspects === 0) {
|
||||||
button.removeClass(inAspectClass).addClass('btn-default');
|
button.removeClass(inAspectClass).addClass('btn-default');
|
||||||
buttonText = Diaspora.I18n.t("aspect_dropdown.select_aspects");
|
buttonText = Diaspora.I18n.t("aspect_dropdown.select_aspects");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ app.views.AspectsList = app.views.Base.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleAll: function(evt) {
|
toggleAll: function(evt) {
|
||||||
if (evt) { evt.preventDefault(); };
|
if (evt) { evt.preventDefault(); }
|
||||||
|
|
||||||
if (this.collection.allSelected()) {
|
if (this.collection.allSelected()) {
|
||||||
this.collection.deselectAll();
|
this.collection.deselectAll();
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ app.views.Contact = app.views.Base.extend({
|
||||||
postRenderTemplate: function() {
|
postRenderTemplate: function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
var dropdownEl = this.$('.aspect_membership_dropdown.placeholder');
|
var dropdownEl = this.$('.aspect_membership_dropdown.placeholder');
|
||||||
if( dropdownEl.length == 0 ) {
|
if( dropdownEl.length === 0 ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ app.views.Content = app.views.Base.extend({
|
||||||
|
|
||||||
largePhoto : function() {
|
largePhoto : function() {
|
||||||
var photos = this.model.get("photos")
|
var photos = this.model.get("photos")
|
||||||
if(!photos || photos.length == 0) { return }
|
if(!photos || photos.length === 0) { return }
|
||||||
return photos[0]
|
return photos[0]
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -49,10 +49,10 @@ app.views.Content = app.views.Base.extend({
|
||||||
, oembed = elem.find(".oembed")
|
, oembed = elem.find(".oembed")
|
||||||
, opengraph = elem.find(".opengraph")
|
, opengraph = elem.find(".opengraph")
|
||||||
, addHeight = 0;
|
, addHeight = 0;
|
||||||
if($.trim(oembed.html()) != "") {
|
if($.trim(oembed.html()) !== "") {
|
||||||
addHeight += oembed.height();
|
addHeight += oembed.height();
|
||||||
}
|
}
|
||||||
if($.trim(opengraph.html()) != "") {
|
if($.trim(opengraph.html()) !== "") {
|
||||||
addHeight += opengraph.height();
|
addHeight += opengraph.height();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ app.views.Hovercard = app.views.Base.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
_mouseenterHandler: function(event) {
|
_mouseenterHandler: function(event) {
|
||||||
if( this.active == false ||
|
if( this.active === false ||
|
||||||
$.contains(this.el, event.target) ) { return false; }
|
$.contains(this.el, event.target) ) { return false; }
|
||||||
|
|
||||||
var el = $(event.target);
|
var el = $(event.target);
|
||||||
|
|
@ -60,7 +60,7 @@ app.views.Hovercard = app.views.Base.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
_mouseleaveHandler: function(event) {
|
_mouseleaveHandler: function(event) {
|
||||||
if( this.active == false ||
|
if( this.active === false ||
|
||||||
$.contains(this.el, event.relatedTarget) ) { return false; }
|
$.contains(this.el, event.relatedTarget) ) { return false; }
|
||||||
|
|
||||||
this.show_me = false;
|
this.show_me = false;
|
||||||
|
|
@ -95,7 +95,7 @@ app.views.Hovercard = app.views.Base.extend({
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
$.get(href, function(person){
|
$.get(href, function(person){
|
||||||
if( !person || person.length == 0 ) {
|
if( !person || person.length === 0 ) {
|
||||||
throw new Error("received data is not a person object");
|
throw new Error("received data is not a person object");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -123,7 +123,7 @@ app.views.Hovercard = app.views.Base.extend({
|
||||||
// TODO render me client side!!!
|
// TODO render me client side!!!
|
||||||
var href = this.href();
|
var href = this.href();
|
||||||
href += "/aspect_membership_button";
|
href += "/aspect_membership_button";
|
||||||
if(gon.bootstrap == true){
|
if(gon.bootstrap === true){
|
||||||
href += "?bootstrap=true";
|
href += "?bootstrap=true";
|
||||||
}
|
}
|
||||||
$.get(href, function(response) {
|
$.get(href, function(response) {
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ app.views.ProfileHeader = app.views.Base.extend({
|
||||||
postRenderTemplate: function() {
|
postRenderTemplate: function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
var dropdownEl = this.$('.aspect_membership_dropdown.placeholder');
|
var dropdownEl = this.$('.aspect_membership_dropdown.placeholder');
|
||||||
if( dropdownEl.length == 0 ) {
|
if( dropdownEl.length === 0 ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ app.views.PublisherPollCreator = app.views.Base.extend({
|
||||||
// Validate the input unless it is the last one, or there are only the
|
// Validate the input unless it is the last one, or there are only the
|
||||||
// question field and two options
|
// question field and two options
|
||||||
if( i !== inputs.length - 1 || inputs.length <= 3) {
|
if( i !== inputs.length - 1 || inputs.length <= 3) {
|
||||||
if(_this.validateInput($(input)) == false) pollValid = false;
|
if(_this.validateInput($(input)) === false) pollValid = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ app.views.PublisherUploader = Backbone.View.extend({
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
uploadCompleteHandler: function(id, fileName, response) {
|
uploadCompleteHandler: function(_id, fileName, response) {
|
||||||
if (response.success){
|
if (response.success){
|
||||||
this.el_info.text(Diaspora.I18n.t('photo_uploader.completed', {file: fileName})).fadeTo(2000, 0);
|
this.el_info.text(Diaspora.I18n.t('photo_uploader.completed', {file: fileName})).fadeTo(2000, 0);
|
||||||
|
|
||||||
|
|
@ -110,7 +110,7 @@ app.views.PublisherUploader = Backbone.View.extend({
|
||||||
.find('div.progress').remove();
|
.find('div.progress').remove();
|
||||||
|
|
||||||
// no more placeholders? enable buttons
|
// no more placeholders? enable buttons
|
||||||
if( publisher.el_photozone.find('li.loading').length == 0 ) {
|
if( publisher.el_photozone.find('li.loading').length === 0 ) {
|
||||||
this.$el.removeClass('loading');
|
this.$el.removeClass('loading');
|
||||||
publisher.setButtonsEnabled(true);
|
publisher.setButtonsEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
@ -139,7 +139,7 @@ app.views.PublisherUploader = Backbone.View.extend({
|
||||||
$.when(photo.fadeOut(400)).then(function(){
|
$.when(photo.fadeOut(400)).then(function(){
|
||||||
photo.remove();
|
photo.remove();
|
||||||
|
|
||||||
if( self.publisher.$('.publisher_photo').length == 0 ) {
|
if( self.publisher.$('.publisher_photo').length === 0 ) {
|
||||||
// no more photos left...
|
// no more photos left...
|
||||||
self.publisher.el_wrapper.removeClass('with_attachments');
|
self.publisher.el_wrapper.removeClass('with_attachments');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,10 +53,10 @@ app.views.Publisher = Backbone.View.extend({
|
||||||
$(window).on('beforeunload', _.bind(this._beforeUnload, this));
|
$(window).on('beforeunload', _.bind(this._beforeUnload, this));
|
||||||
|
|
||||||
// sync textarea content
|
// sync textarea content
|
||||||
if( this.el_hiddenInput.val() == "" ) {
|
if( this.el_hiddenInput.val() === "" ) {
|
||||||
this.el_hiddenInput.val( this.el_input.val() );
|
this.el_hiddenInput.val( this.el_input.val() );
|
||||||
}
|
}
|
||||||
if( this.el_input.val() == "" ) {
|
if( this.el_input.val() === "" ) {
|
||||||
this.el_input.val( this.el_hiddenInput.val() );
|
this.el_input.val( this.el_hiddenInput.val() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -222,7 +222,7 @@ app.views.Publisher = Backbone.View.extend({
|
||||||
|
|
||||||
// creates the location
|
// creates the location
|
||||||
showLocation: function(){
|
showLocation: function(){
|
||||||
if($('#location').length == 0){
|
if($('#location').length === 0){
|
||||||
$('#location_container').append('<div id="location"></div>');
|
$('#location_container').append('<div id="location"></div>');
|
||||||
this.el_wrapper.addClass('with_location');
|
this.el_wrapper.addClass('with_location');
|
||||||
this.view_locator = new app.views.Location();
|
this.view_locator = new app.views.Location();
|
||||||
|
|
@ -257,7 +257,7 @@ app.views.Publisher = Backbone.View.extend({
|
||||||
|
|
||||||
var serializedForm = $(evt.target).closest("form").serializeObject();
|
var serializedForm = $(evt.target).closest("form").serializeObject();
|
||||||
|
|
||||||
var photos = new Array();
|
var photos = [];
|
||||||
$('li.publisher_photo img').each(function(){
|
$('li.publisher_photo img').each(function(){
|
||||||
var file = $(this).attr('src').substring("/uploads/images/".length);
|
var file = $(this).attr('src').substring("/uploads/images/".length);
|
||||||
photos.push(
|
photos.push(
|
||||||
|
|
@ -271,7 +271,7 @@ app.views.Publisher = Backbone.View.extend({
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
var mentioned_people = new Array();
|
var mentioned_people = [];
|
||||||
var regexp = new RegExp("@{\(\[\^\;\]\+\); \(\[\^\}\]\+\)}", "g");
|
var regexp = new RegExp("@{\(\[\^\;\]\+\); \(\[\^\}\]\+\)}", "g");
|
||||||
while(user=regexp.exec(serializedForm["status_message[text]"])){
|
while(user=regexp.exec(serializedForm["status_message[text]"])){
|
||||||
// user[1]: name, user[2]: handle
|
// user[1]: name, user[2]: handle
|
||||||
|
|
@ -289,7 +289,7 @@ app.views.Publisher = Backbone.View.extend({
|
||||||
|
|
||||||
var date = (new Date()).toISOString();
|
var date = (new Date()).toISOString();
|
||||||
|
|
||||||
var poll = undefined;
|
var poll;
|
||||||
var poll_question = serializedForm["poll_question"];
|
var poll_question = serializedForm["poll_question"];
|
||||||
var poll_answers_arry = _.flatten([serializedForm["poll_answers[]"]]);
|
var poll_answers_arry = _.flatten([serializedForm["poll_answers[]"]]);
|
||||||
var poll_answers = _.map(poll_answers_arry, function(answer){
|
var poll_answers = _.map(poll_answers_arry, function(answer){
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ app.views.SinglePostModeration = app.views.Feedback.extend({
|
||||||
document.location.href = "/stream";
|
document.location.href = "/stream";
|
||||||
})
|
})
|
||||||
.fail(function() {
|
.fail(function() {
|
||||||
var flash = new Diaspora.Widgets.FlashMessages;
|
var flash = new Diaspora.Widgets.FlashMessages();
|
||||||
flash.render({
|
flash.render({
|
||||||
success: false,
|
success: false,
|
||||||
notice: Diaspora.I18n.t('failed_to_remove')
|
notice: Diaspora.I18n.t('failed_to_remove')
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ app.views.TagFollowingList = app.views.Base.extend({
|
||||||
this.$("input").bind('keydown', function(evt){
|
this.$("input").bind('keydown', function(evt){
|
||||||
if(evt.keyCode == 13 || evt.keyCode == 9 || evt.keyCode == 32){
|
if(evt.keyCode == 13 || evt.keyCode == 9 || evt.keyCode == 32){
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
if( $('li.as-result-item.active').length == 0 ){
|
if( $('li.as-result-item.active').length === 0 ){
|
||||||
$('li.as-result-item').first().click();
|
$('li.as-result-item').first().click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,16 +10,17 @@ var AspectsDropdown = {
|
||||||
selectedAspects = dropdown.children(".selected").length,
|
selectedAspects = dropdown.children(".selected").length,
|
||||||
allAspects = dropdown.children().length,
|
allAspects = dropdown.children().length,
|
||||||
replacement,
|
replacement,
|
||||||
|
message,
|
||||||
isInPublisher = dropdown.closest('#publisher').length;
|
isInPublisher = dropdown.closest('#publisher').length;
|
||||||
|
|
||||||
if (number == 0) {
|
if (number === 0) {
|
||||||
button.removeClass(inAspectClass);
|
button.removeClass(inAspectClass);
|
||||||
if (isInPublisher) {
|
if (isInPublisher) {
|
||||||
replacement = Diaspora.I18n.t("aspect_dropdown.select_aspects");
|
replacement = Diaspora.I18n.t("aspect_dropdown.select_aspects");
|
||||||
} else {
|
} else {
|
||||||
replacement = Diaspora.I18n.t("aspect_dropdown.add_to_aspect");
|
replacement = Diaspora.I18n.t("aspect_dropdown.add_to_aspect");
|
||||||
/* flash message prompt */
|
/* flash message prompt */
|
||||||
var message = Diaspora.I18n.t("aspect_dropdown.stopped_sharing_with", {name: dropdown.data('person-short-name')});
|
message = Diaspora.I18n.t("aspect_dropdown.stopped_sharing_with", {name: dropdown.data('person-short-name')});
|
||||||
Diaspora.page.flashMessages.render({success: true, notice: message});
|
Diaspora.page.flashMessages.render({success: true, notice: message});
|
||||||
}
|
}
|
||||||
} else if (selectedAspects == allAspects) {
|
} else if (selectedAspects == allAspects) {
|
||||||
|
|
@ -29,7 +30,7 @@ var AspectsDropdown = {
|
||||||
replacement = dropdown.find(".selected").first().text();
|
replacement = dropdown.find(".selected").first().text();
|
||||||
/* flash message prompt */
|
/* flash message prompt */
|
||||||
if (!isInPublisher) {
|
if (!isInPublisher) {
|
||||||
var message = Diaspora.I18n.t("aspect_dropdown.started_sharing_with", {name: dropdown.data('person-short-name')});
|
message = Diaspora.I18n.t("aspect_dropdown.started_sharing_with", {name: dropdown.data('person-short-name')});
|
||||||
Diaspora.page.flashMessages.render({success: true, notice: message});
|
Diaspora.page.flashMessages.render({success: true, notice: message});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -21,14 +21,18 @@
|
||||||
var eventNames = eventName.split(" ");
|
var eventNames = eventName.split(" ");
|
||||||
|
|
||||||
for(eventName in eventNames) {
|
for(eventName in eventNames) {
|
||||||
this.eventsContainer.trigger(eventNames[eventName], args);
|
if(eventNames.hasOwnProperty(eventName)) {
|
||||||
|
this.eventsContainer.trigger(eventNames[eventName], args);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
subscribe: function(eventName, callback, context) {
|
subscribe: function(eventName, callback, context) {
|
||||||
var eventNames = eventName.split(" ");
|
var eventNames = eventName.split(" ");
|
||||||
|
|
||||||
for(eventName in eventNames) {
|
for(eventName in eventNames) {
|
||||||
this.eventsContainer.bind(eventNames[eventName], $.proxy(callback, context));
|
if(eventNames.hasOwnProperty(eventName)) {
|
||||||
|
this.eventsContainer.bind(eventNames[eventName], $.proxy(callback, context));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -247,8 +247,8 @@ $(document).ready(function(){
|
||||||
container.show();
|
container.show();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
var container = $("<div class='comments_container not_all_present'></div>"),
|
var comments = $("<ul class='comments'></ul>");
|
||||||
comments = $("<ul class='comments'></ul>");
|
container = $("<div class='comments_container not_all_present'></div>");
|
||||||
|
|
||||||
comments.html(data);
|
comments.html(data);
|
||||||
container.append(comments);
|
container.append(comments);
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ function createUploader(){
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
onComplete: function(id, fileName, responseJSON) {
|
onComplete: function(_id, fileName, responseJSON) {
|
||||||
$('#fileInfo-publisher').text(Diaspora.I18n.t("photo_uploader.completed", {'file': fileName}));
|
$('#fileInfo-publisher').text(Diaspora.I18n.t("photo_uploader.completed", {'file': fileName}));
|
||||||
var id = responseJSON.data.photo.id,
|
var id = responseJSON.data.photo.id,
|
||||||
url = responseJSON.data.photo.unprocessed_image.url,
|
url = responseJSON.data.photo.unprocessed_image.url,
|
||||||
|
|
@ -67,7 +67,7 @@ function createUploader(){
|
||||||
success: function() {
|
success: function() {
|
||||||
photo.fadeOut(400, function(){
|
photo.fadeOut(400, function(){
|
||||||
photo.remove();
|
photo.remove();
|
||||||
if ( $('.publisher_photo').length == 0){
|
if ( $('.publisher_photo').length === 0){
|
||||||
$('#publisher_textarea_wrapper').removeClass("with_attachments");
|
$('#publisher_textarea_wrapper').removeClass("with_attachments");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ OSM.Locator = function(){
|
||||||
|
|
||||||
function errorGettingPosition(err) {
|
function errorGettingPosition(err) {
|
||||||
$("#location").remove();
|
$("#location").remove();
|
||||||
};
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
getAddress: geolocalize
|
getAddress: geolocalize
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ Diaspora.Pages.UsersGettingStarted = function() {
|
||||||
autocompleteInput.bind('keydown', function(evt){
|
autocompleteInput.bind('keydown', function(evt){
|
||||||
if(evt.keyCode == 13 || evt.keyCode == 9 || evt.keyCode == 32){
|
if(evt.keyCode == 13 || evt.keyCode == 9 || evt.keyCode == 32){
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
if( $('li.as-result-item.active').length == 0 ){
|
if( $('li.as-result-item.active').length === 0 ){
|
||||||
$('li.as-result-item').first().click();
|
$('li.as-result-item').first().click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ jQuery.fn.center = (function() {
|
||||||
|
|
||||||
this.nextImage = function(thumb){
|
this.nextImage = function(thumb){
|
||||||
var next = thumb.next();
|
var next = thumb.next();
|
||||||
if (next.length == 0) {
|
if (next.length === 0) {
|
||||||
next = self.imageset.find("img").first();
|
next = self.imageset.find("img").first();
|
||||||
}
|
}
|
||||||
return(next);
|
return(next);
|
||||||
|
|
@ -102,7 +102,7 @@ jQuery.fn.center = (function() {
|
||||||
|
|
||||||
this.prevImage = function(thumb){
|
this.prevImage = function(thumb){
|
||||||
var prev = thumb.prev();
|
var prev = thumb.prev();
|
||||||
if (prev.length == 0) {
|
if (prev.length === 0) {
|
||||||
prev = self.imageset.find("img").last();
|
prev = self.imageset.find("img").last();
|
||||||
}
|
}
|
||||||
return(prev);
|
return(prev);
|
||||||
|
|
@ -132,7 +132,7 @@ jQuery.fn.center = (function() {
|
||||||
|
|
||||||
if(image.attr("data-full-photo") == imageUrl) {
|
if(image.attr("data-full-photo") == imageUrl) {
|
||||||
imageThumb = thumb;
|
imageThumb = thumb;
|
||||||
};
|
}
|
||||||
|
|
||||||
self.imageset.append(thumb);
|
self.imageset.append(thumb);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
44
config/jshint.yml
Normal file
44
config/jshint.yml
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
files: ['**/*.js']
|
||||||
|
|
||||||
|
exclude_paths: [
|
||||||
|
'vendor/assets/javascripts',
|
||||||
|
'lib/assets/javascripts'
|
||||||
|
]
|
||||||
|
|
||||||
|
options:
|
||||||
|
# enforcing options
|
||||||
|
bitwise: false
|
||||||
|
camelcase: false
|
||||||
|
curly: false
|
||||||
|
eqeqeq: false
|
||||||
|
forin: true
|
||||||
|
freeze: true
|
||||||
|
immed: true
|
||||||
|
indent: 2
|
||||||
|
latedef: nofunc
|
||||||
|
newcap: false
|
||||||
|
noarg: true
|
||||||
|
noempty: true
|
||||||
|
nonbsp: true
|
||||||
|
nonew: false
|
||||||
|
notypeof: true
|
||||||
|
undef: false
|
||||||
|
unused: false
|
||||||
|
|
||||||
|
# relaxing options
|
||||||
|
asi: true
|
||||||
|
boss: true
|
||||||
|
eqnull: true
|
||||||
|
evil: true
|
||||||
|
expr: true
|
||||||
|
lastsemic: true
|
||||||
|
laxbreak: true
|
||||||
|
laxcomma: true
|
||||||
|
loopfunc: true
|
||||||
|
scripturl: true
|
||||||
|
sub: true
|
||||||
|
supernew: true
|
||||||
|
|
||||||
|
globals:
|
||||||
|
jQuery: true
|
||||||
|
"$": true
|
||||||
|
|
@ -73,7 +73,7 @@ describe("app.helpers.textFormatter", function(){
|
||||||
it('returns the name of the mention if the mention does not exist in the array', function(){
|
it('returns the name of the mention if the mention does not exist in the array', function(){
|
||||||
var text = "hey there @{Chris Smith; chris@example.com}"
|
var text = "hey there @{Chris Smith; chris@example.com}"
|
||||||
var formattedText = this.formatter(text, [])
|
var formattedText = this.formatter(text, [])
|
||||||
expect(formattedText.match(/\<a/)).toBeNull();
|
expect(formattedText.match(/<a/)).toBeNull();
|
||||||
expect(formattedText).toContain('Chris Smith');
|
expect(formattedText).toContain('Chris Smith');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -134,6 +134,7 @@ describe("app.helpers.textFormatter", function(){
|
||||||
|
|
||||||
context("non-ascii url", function() {
|
context("non-ascii url", function() {
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
|
/* jshint -W100 */
|
||||||
this.evilUrls = [
|
this.evilUrls = [
|
||||||
"http://www.bürgerentscheid-krankenhäuser.de", // example from issue #2665
|
"http://www.bürgerentscheid-krankenhäuser.de", // example from issue #2665
|
||||||
"http://bündnis-für-krankenhäuser.de/wp-content/uploads/2011/11/cropped-logohp.jpg",
|
"http://bündnis-für-krankenhäuser.de/wp-content/uploads/2011/11/cropped-logohp.jpg",
|
||||||
|
|
@ -143,6 +144,7 @@ describe("app.helpers.textFormatter", function(){
|
||||||
"http://de.wikipedia.org/wiki/Liste_der_Abkürzungen_(Netzjargon)", // #3645
|
"http://de.wikipedia.org/wiki/Liste_der_Abkürzungen_(Netzjargon)", // #3645
|
||||||
"http://wiki.com/?query=Kr%E4fte", // #4874
|
"http://wiki.com/?query=Kr%E4fte", // #4874
|
||||||
];
|
];
|
||||||
|
/* jshint +W100 */
|
||||||
this.asciiUrls = [
|
this.asciiUrls = [
|
||||||
"http://www.xn--brgerentscheid-krankenhuser-xkc78d.de",
|
"http://www.xn--brgerentscheid-krankenhuser-xkc78d.de",
|
||||||
"http://xn--bndnis-fr-krankenhuser-i5b27cha.de/wp-content/uploads/2011/11/cropped-logohp.jpg",
|
"http://xn--bndnis-fr-krankenhuser-i5b27cha.de/wp-content/uploads/2011/11/cropped-logohp.jpg",
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ describe("app.models.Photo", function() {
|
||||||
|
|
||||||
describe("createdAt", function() {
|
describe("createdAt", function() {
|
||||||
it("returns the photo's created_at as an integer", function() {
|
it("returns the photo's created_at as an integer", function() {
|
||||||
var date = new Date;
|
var date = new Date();
|
||||||
this.photo.set({ created_at: +date * 1000 });
|
this.photo.set({ created_at: +date * 1000 });
|
||||||
|
|
||||||
expect(typeof this.photo.createdAt()).toEqual("number");
|
expect(typeof this.photo.createdAt()).toEqual("number");
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ describe("app.models.Post", function() {
|
||||||
|
|
||||||
describe("createdAt", function() {
|
describe("createdAt", function() {
|
||||||
it("returns the post's created_at as an integer", function() {
|
it("returns the post's created_at as an integer", function() {
|
||||||
var date = new Date;
|
var date = new Date();
|
||||||
this.post.set({ created_at: +date * 1000 });
|
this.post.set({ created_at: +date * 1000 });
|
||||||
|
|
||||||
expect(typeof this.post.createdAt()).toEqual("number");
|
expect(typeof this.post.createdAt()).toEqual("number");
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,7 @@ describe("app.views.Feedback", function(){
|
||||||
|
|
||||||
it("reshares the model", function(){
|
it("reshares the model", function(){
|
||||||
spyOn(window, "confirm").and.returnValue(true);
|
spyOn(window, "confirm").and.returnValue(true);
|
||||||
spyOn(this.view.model.reshare(), "save").and.returnValue(new $.Deferred)
|
spyOn(this.view.model.reshare(), "save").and.returnValue(new $.Deferred())
|
||||||
this.view.$("a.reshare").first().click();
|
this.view.$("a.reshare").first().click();
|
||||||
expect(this.view.model.reshare().save).toHaveBeenCalled();
|
expect(this.view.model.reshare().save).toHaveBeenCalled();
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -356,7 +356,7 @@ describe("app.views.Publisher", function() {
|
||||||
this.view.view_aspect_selector.toggleAspect(evt);
|
this.view.view_aspect_selector.toggleAspect(evt);
|
||||||
expect($('input[name="aspect_ids[]"][value="42"]').length).toBe(1);
|
expect($('input[name="aspect_ids[]"][value="42"]').length).toBe(1);
|
||||||
|
|
||||||
var evt = $.Event("click", { target: $('.aspect_dropdown li.aspect_selector:last') });
|
evt = $.Event("click", { target: $('.aspect_dropdown li.aspect_selector:last') });
|
||||||
this.view.view_aspect_selector.toggleAspect(evt);
|
this.view.view_aspect_selector.toggleAspect(evt);
|
||||||
expect($('input[name="aspect_ids[]"][value="42"]').length).toBe(0);
|
expect($('input[name="aspect_ids[]"][value="42"]').length).toBe(0);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@ describe("app.views.StreamPost", function(){
|
||||||
})
|
})
|
||||||
|
|
||||||
describe("events", function(){
|
describe("events", function(){
|
||||||
var _PostViewClass = undefined;
|
var _PostViewClass,
|
||||||
var author_id = undefined;
|
author_id;
|
||||||
|
|
||||||
beforeEach(function(){
|
beforeEach(function(){
|
||||||
_PostViewClass = this.PostViewClass;
|
_PostViewClass = this.PostViewClass;
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,42 @@
|
||||||
|
|
||||||
var realXMLHttpRequest = window.XMLHttpRequest;
|
var realXMLHttpRequest = window.XMLHttpRequest;
|
||||||
|
|
||||||
|
// matches flash messages with success/error and contained text
|
||||||
|
var flashMatcher = function(flash, id, text) {
|
||||||
|
textContained = true;
|
||||||
|
if( text ) {
|
||||||
|
textContained = (flash.text().indexOf(text) !== -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return flash.is(id) &&
|
||||||
|
flash.hasClass('expose') &&
|
||||||
|
textContained;
|
||||||
|
};
|
||||||
|
|
||||||
|
var context = describe;
|
||||||
|
var spec = {};
|
||||||
|
var customMatchers = {
|
||||||
|
toBeSuccessFlashMessage: function(util) {
|
||||||
|
return {
|
||||||
|
compare: function(actual, expected) {
|
||||||
|
var result = {};
|
||||||
|
result.pass = flashMatcher(actual, '#flash_notice', expected);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
toBeErrorFlashMessage: function(util) {
|
||||||
|
return {
|
||||||
|
compare: function(actual, expected) {
|
||||||
|
var result = {};
|
||||||
|
result.pass = flashMatcher(actual, '#flash_error', expected);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
$('#jasmine_content').html(spec.readFixture("underscore_templates"));
|
$('#jasmine_content').html(spec.readFixture("underscore_templates"));
|
||||||
|
|
||||||
|
|
@ -39,41 +75,6 @@ afterEach(function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// matches flash messages with success/error and contained text
|
|
||||||
var flashMatcher = function(flash, id, text) {
|
|
||||||
textContained = true;
|
|
||||||
if( text ) {
|
|
||||||
textContained = (flash.text().indexOf(text) !== -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
return flash.is(id) &&
|
|
||||||
flash.hasClass('expose') &&
|
|
||||||
textContained;
|
|
||||||
};
|
|
||||||
|
|
||||||
var context = describe;
|
|
||||||
var spec = {};
|
|
||||||
var customMatchers = {
|
|
||||||
toBeSuccessFlashMessage: function(util) {
|
|
||||||
return {
|
|
||||||
compare: function(actual, expected) {
|
|
||||||
var result = {};
|
|
||||||
result.pass = flashMatcher(actual, '#flash_notice', expected);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
},
|
|
||||||
toBeErrorFlashMessage: function(util) {
|
|
||||||
return {
|
|
||||||
compare: function(actual, expected) {
|
|
||||||
var result = {};
|
|
||||||
result.pass = flashMatcher(actual, '#flash_error', expected);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
window.stubView = function stubView(text){
|
window.stubView = function stubView(text){
|
||||||
var stubClass = Backbone.View.extend({
|
var stubClass = Backbone.View.extend({
|
||||||
render : function(){
|
render : function(){
|
||||||
|
|
@ -82,7 +83,7 @@ window.stubView = function stubView(text){
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return new stubClass
|
return new stubClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
window.loginAs = function loginAs(attrs){
|
window.loginAs = function loginAs(attrs){
|
||||||
|
|
@ -123,8 +124,10 @@ window.hipsterIpsumFourParagraphs = "Mcsweeney's mumblecore irony fugiat, ex iph
|
||||||
|
|
||||||
spec.clearLiveEventBindings = function() {
|
spec.clearLiveEventBindings = function() {
|
||||||
var events = jQuery.data(document, "events");
|
var events = jQuery.data(document, "events");
|
||||||
for (prop in events) {
|
for (var prop in events) {
|
||||||
delete events[prop];
|
if(events.hasOwnProperty(prop)) {
|
||||||
|
delete events[prop];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -178,18 +178,6 @@ factory = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
comment: function(overrides) {
|
|
||||||
var defaultAttrs = {
|
|
||||||
id: this.id.next(),
|
|
||||||
guid: this.guid(),
|
|
||||||
text: "This is an awesome comment!",
|
|
||||||
author: this.author(),
|
|
||||||
created_at: "2012-01-03T19:53:13Z"
|
|
||||||
};
|
|
||||||
|
|
||||||
return new app.models.Comment(_.extend(defaultAttrs, overrides))
|
|
||||||
},
|
|
||||||
|
|
||||||
aspectAttrs: function(overrides) {
|
aspectAttrs: function(overrides) {
|
||||||
var names = ['Work','School','Family','Friends','Just following','People','Interesting'];
|
var names = ['Work','School','Family','Friends','Just following','People','Interesting'];
|
||||||
var defaultAttrs = {
|
var defaultAttrs = {
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
(function() {
|
(function() {
|
||||||
function extend(destination, source) {
|
function extend(destination, source) {
|
||||||
for (var property in source) {
|
for (var property in source) {
|
||||||
destination[property] = source[property];
|
if(source.hasOwnProperty(property)) {
|
||||||
|
destination[property] = source[property];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return destination;
|
return destination;
|
||||||
}
|
}
|
||||||
|
|
@ -225,7 +227,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
};
|
};
|
||||||
|
|
||||||
this.filter = function(url_to_match) {
|
this.filter = function(url_to_match) {
|
||||||
if (requests.length == 0) return [];
|
if (requests.length === 0) return [];
|
||||||
var matching_requests = [];
|
var matching_requests = [];
|
||||||
|
|
||||||
for (var i = 0; i < requests.length; i++) {
|
for (var i = 0; i < requests.length; i++) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue