Add JSHint javascript linter

This commit is contained in:
Steffen van Bergerem 2015-02-08 18:21:40 +01:00
parent e6d38db365
commit 6b0a5823e3
38 changed files with 166 additions and 109 deletions

View file

@ -217,6 +217,9 @@ group :development do
gem 'rb-fsevent', '0.9.4', :require => false
gem 'rb-inotify', '0.9.5', :require => false
# Linters
gem 'jshint', '1.3.1'
# Preloading environment
gem 'spring', '1.2.0'
@ -261,5 +264,5 @@ group :development, :test do
# Jasmine (client side application tests (JS))
gem 'jasmine', '2.1.0'
gem 'jasmine-jquery-rails', '2.0.3'
gem 'sinon-rails', '1.10.3'
gem 'sinon-rails', '1.10.3'
end

View file

@ -308,12 +308,17 @@ GEM
sprockets-rails
js_image_paths (0.0.1)
rails (~> 4.0)
jshint (1.3.1)
execjs (>= 1.4.0)
multi_json (~> 1.0)
therubyracer (~> 0.12.1)
json (1.8.1)
jwt (1.0.0)
kaminari (0.16.1)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
kgio (2.9.2)
libv8 (3.16.14.7)
listen (2.8.3)
celluloid (>= 0.15.2)
rb-fsevent (>= 0.9.3)
@ -488,6 +493,7 @@ GEM
redis (3.1.0)
redis-namespace (1.5.1)
redis (~> 3.0, >= 3.0.4)
ref (1.0.5)
remotipart (1.2.1)
request_store (1.1.0)
responders (1.1.2)
@ -569,6 +575,9 @@ GEM
systemu (2.6.4)
test_after_commit (0.4.0)
activerecord (>= 3.2)
therubyracer (0.12.1)
libv8 (~> 3.16.14.0)
ref
thor (0.19.1)
thread_safe (0.3.4)
tilt (1.4.1)
@ -658,6 +667,7 @@ DEPENDENCIES
jquery-rails (= 3.1.2)
js-routes (= 0.9.9)
js_image_paths (= 0.0.1)
jshint (= 1.3.1)
json (= 1.8.1)
markerb (= 1.0.2)
messagebus_ruby_api (= 1.0.3)

View file

@ -70,7 +70,7 @@ var app = {
},
setupDummyPreloads: function() {
if (window.gon == undefined) {
if (window.gon === undefined) {
window.gon = {preloads:{}};
}
},

View file

@ -1,6 +1,6 @@
(function() {
app.helpers.truncate = function(passedString, length) {
if (passedString == null || passedString == undefined) {
if (passedString === null || passedString === undefined) {
return passedString;
}

View file

@ -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;
flash = new Diaspora.Widgets.FlashMessages();
flash.render({
success: false,
notice: Diaspora.I18n.t("failed_to_post_message")
@ -101,7 +101,7 @@ app.models.Post.Interactions = Backbone.Model.extend({
reshare : function(){
var interactions = this
, reshare = this.post.reshare()
, flash = new Diaspora.Widgets.FlashMessages;
, flash = new Diaspora.Widgets.FlashMessages();
reshare.save({}, {
success : function(resp){

View file

@ -42,7 +42,7 @@ app.models.Stream = Backbone.Collection.extend({
this.trigger("fetched", this);
// all loaded?
var respItems = this.items.parse(resp);
if(respItems && (respItems.author || respItems.length == 0)) {
if(respItems && (respItems.author || respItems.length === 0)) {
this.trigger("allItemsLoaded", this);
}
},

View file

@ -132,7 +132,7 @@ app.views.Base = Backbone.View.extend({
})
.fail(function() {
self.$el.removeClass('deleting');
var flash = new Diaspora.Widgets.FlashMessages;
var flash = new Diaspora.Widgets.FlashMessages();
flash.render({
success: false,
notice: Diaspora.I18n.t('failed_to_remove')

View file

@ -75,7 +75,7 @@ app.views.AspectMembershipBlueprint = Backbone.View.extend({
// the user didn't have this person in any aspects before, congratulate them
// 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() });
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
// 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() });
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 txt;
if( aspects_cnt == 0 ) {
if( aspects_cnt === 0 ) {
btn.removeClass('in_aspects');
txt = Diaspora.I18n.t('aspect_dropdown.toggle.zero');
} else {

View file

@ -75,7 +75,7 @@ app.views.AspectMembership = app.views.AspectsDropdown.extend({
// the user didn't have this person in any aspects before, congratulate them
// 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() });
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
// 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() });
Diaspora.page.flashMessages.render({ 'success':true, 'notice':msg });
}

View file

@ -12,7 +12,7 @@ app.views.Aspect = app.views.Base.extend({
},
toggleAspect: function(evt) {
if (evt) { evt.preventDefault(); };
if (evt) { evt.preventDefault(); }
this.model.toggleSelected();
app.router.aspects_stream();

View file

@ -32,7 +32,7 @@ app.views.AspectsDropdown = app.views.Base.extend({
selectedAspects = this.$(".dropdown-menu > li.selected").length,
buttonText;
if (selectedAspects == 0) {
if (selectedAspects === 0) {
button.removeClass(inAspectClass).addClass('btn-default');
buttonText = Diaspora.I18n.t("aspect_dropdown.select_aspects");
} else {

View file

@ -29,7 +29,7 @@ app.views.AspectsList = app.views.Base.extend({
},
toggleAll: function(evt) {
if (evt) { evt.preventDefault(); };
if (evt) { evt.preventDefault(); }
if (this.collection.allSelected()) {
this.collection.deselectAll();

View file

@ -21,7 +21,7 @@ app.views.Contact = app.views.Base.extend({
postRenderTemplate: function() {
var self = this;
var dropdownEl = this.$('.aspect_membership_dropdown.placeholder');
if( dropdownEl.length == 0 ) {
if( dropdownEl.length === 0 ) {
return;
}

View file

@ -17,7 +17,7 @@ app.views.Content = app.views.Base.extend({
largePhoto : function() {
var photos = this.model.get("photos")
if(!photos || photos.length == 0) { return }
if(!photos || photos.length === 0) { return }
return photos[0]
},
@ -49,10 +49,10 @@ app.views.Content = app.views.Base.extend({
, oembed = elem.find(".oembed")
, opengraph = elem.find(".opengraph")
, addHeight = 0;
if($.trim(oembed.html()) != "") {
if($.trim(oembed.html()) !== "") {
addHeight += oembed.height();
}
if($.trim(opengraph.html()) != "") {
if($.trim(opengraph.html()) !== "") {
addHeight += opengraph.height();
}

View file

@ -41,7 +41,7 @@ app.views.Hovercard = app.views.Base.extend({
},
_mouseenterHandler: function(event) {
if( this.active == false ||
if( this.active === false ||
$.contains(this.el, event.target) ) { return false; }
var el = $(event.target);
@ -60,7 +60,7 @@ app.views.Hovercard = app.views.Base.extend({
},
_mouseleaveHandler: function(event) {
if( this.active == false ||
if( this.active === false ||
$.contains(this.el, event.relatedTarget) ) { return false; }
this.show_me = false;
@ -95,7 +95,7 @@ app.views.Hovercard = app.views.Base.extend({
var self = this;
$.get(href, function(person){
if( !person || person.length == 0 ) {
if( !person || person.length === 0 ) {
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!!!
var href = this.href();
href += "/aspect_membership_button";
if(gon.bootstrap == true){
if(gon.bootstrap === true){
href += "?bootstrap=true";
}
$.get(href, function(response) {

View file

@ -43,7 +43,7 @@ app.views.ProfileHeader = app.views.Base.extend({
postRenderTemplate: function() {
var self = this;
var dropdownEl = this.$('.aspect_membership_dropdown.placeholder');
if( dropdownEl.length == 0 ) {
if( dropdownEl.length === 0 ) {
return;
}

View file

@ -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
// question field and two options
if( i !== inputs.length - 1 || inputs.length <= 3) {
if(_this.validateInput($(input)) == false) pollValid = false;
if(_this.validateInput($(input)) === false) pollValid = false;
}
});

View file

@ -66,7 +66,7 @@ app.views.PublisherUploader = Backbone.View.extend({
);
},
uploadCompleteHandler: function(id, fileName, response) {
uploadCompleteHandler: function(_id, fileName, response) {
if (response.success){
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();
// 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');
publisher.setButtonsEnabled(true);
}
@ -139,7 +139,7 @@ app.views.PublisherUploader = Backbone.View.extend({
$.when(photo.fadeOut(400)).then(function(){
photo.remove();
if( self.publisher.$('.publisher_photo').length == 0 ) {
if( self.publisher.$('.publisher_photo').length === 0 ) {
// no more photos left...
self.publisher.el_wrapper.removeClass('with_attachments');
}

View file

@ -53,10 +53,10 @@ app.views.Publisher = Backbone.View.extend({
$(window).on('beforeunload', _.bind(this._beforeUnload, this));
// sync textarea content
if( this.el_hiddenInput.val() == "" ) {
if( this.el_hiddenInput.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() );
}
@ -222,7 +222,7 @@ app.views.Publisher = Backbone.View.extend({
// creates the location
showLocation: function(){
if($('#location').length == 0){
if($('#location').length === 0){
$('#location_container').append('<div id="location"></div>');
this.el_wrapper.addClass('with_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 photos = new Array();
var photos = [];
$('li.publisher_photo img').each(function(){
var file = $(this).attr('src').substring("/uploads/images/".length);
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");
while(user=regexp.exec(serializedForm["status_message[text]"])){
// user[1]: name, user[2]: handle
@ -289,7 +289,7 @@ app.views.Publisher = Backbone.View.extend({
var date = (new Date()).toISOString();
var poll = undefined;
var poll;
var poll_question = serializedForm["poll_question"];
var poll_answers_arry = _.flatten([serializedForm["poll_answers[]"]]);
var poll_answers = _.map(poll_answers_arry, function(answer){

View file

@ -35,7 +35,7 @@ app.views.SinglePostModeration = app.views.Feedback.extend({
document.location.href = "/stream";
})
.fail(function() {
var flash = new Diaspora.Widgets.FlashMessages;
var flash = new Diaspora.Widgets.FlashMessages();
flash.render({
success: false,
notice: Diaspora.I18n.t('failed_to_remove')

View file

@ -43,7 +43,7 @@ app.views.TagFollowingList = app.views.Base.extend({
this.$("input").bind('keydown', function(evt){
if(evt.keyCode == 13 || evt.keyCode == 9 || evt.keyCode == 32){
evt.preventDefault();
if( $('li.as-result-item.active').length == 0 ){
if( $('li.as-result-item.active').length === 0 ){
$('li.as-result-item').first().click();
}
}

View file

@ -10,16 +10,17 @@ var AspectsDropdown = {
selectedAspects = dropdown.children(".selected").length,
allAspects = dropdown.children().length,
replacement,
message,
isInPublisher = dropdown.closest('#publisher').length;
if (number == 0) {
if (number === 0) {
button.removeClass(inAspectClass);
if (isInPublisher) {
replacement = Diaspora.I18n.t("aspect_dropdown.select_aspects");
} else {
replacement = Diaspora.I18n.t("aspect_dropdown.add_to_aspect");
/* 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});
}
} else if (selectedAspects == allAspects) {
@ -29,7 +30,7 @@ var AspectsDropdown = {
replacement = dropdown.find(".selected").first().text();
/* flash message prompt */
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});
}
} else {

View file

@ -21,14 +21,18 @@
var eventNames = eventName.split(" ");
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) {
var eventNames = eventName.split(" ");
for(eventName in eventNames) {
this.eventsContainer.bind(eventNames[eventName], $.proxy(callback, context));
if(eventNames.hasOwnProperty(eventName)) {
this.eventsContainer.bind(eventNames[eventName], $.proxy(callback, context));
}
}
}
});

View file

@ -247,8 +247,8 @@ $(document).ready(function(){
container.show();
} else {
var container = $("<div class='comments_container not_all_present'></div>"),
comments = $("<ul class='comments'></ul>");
var comments = $("<ul class='comments'></ul>");
container = $("<div class='comments_container not_all_present'></div>");
comments.html(data);
container.append(comments);

View file

@ -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}));
var id = responseJSON.data.photo.id,
url = responseJSON.data.photo.unprocessed_image.url,
@ -67,7 +67,7 @@ function createUploader(){
success: function() {
photo.fadeOut(400, function(){
photo.remove();
if ( $('.publisher_photo').length == 0){
if ( $('.publisher_photo').length === 0){
$('#publisher_textarea_wrapper').removeClass("with_attachments");
}
});

View file

@ -16,7 +16,7 @@ OSM.Locator = function(){
function errorGettingPosition(err) {
$("#location").remove();
};
}
return {
getAddress: geolocalize

View file

@ -75,7 +75,7 @@ Diaspora.Pages.UsersGettingStarted = function() {
autocompleteInput.bind('keydown', function(evt){
if(evt.keyCode == 13 || evt.keyCode == 9 || evt.keyCode == 32){
evt.preventDefault();
if( $('li.as-result-item.active').length == 0 ){
if( $('li.as-result-item.active').length === 0 ){
$('li.as-result-item').first().click();
}
}

View file

@ -94,7 +94,7 @@ jQuery.fn.center = (function() {
this.nextImage = function(thumb){
var next = thumb.next();
if (next.length == 0) {
if (next.length === 0) {
next = self.imageset.find("img").first();
}
return(next);
@ -102,7 +102,7 @@ jQuery.fn.center = (function() {
this.prevImage = function(thumb){
var prev = thumb.prev();
if (prev.length == 0) {
if (prev.length === 0) {
prev = self.imageset.find("img").last();
}
return(prev);
@ -132,7 +132,7 @@ jQuery.fn.center = (function() {
if(image.attr("data-full-photo") == imageUrl) {
imageThumb = thumb;
};
}
self.imageset.append(thumb);
});

44
config/jshint.yml Normal file
View 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

View file

@ -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(){
var text = "hey there @{Chris Smith; chris@example.com}"
var formattedText = this.formatter(text, [])
expect(formattedText.match(/\<a/)).toBeNull();
expect(formattedText.match(/<a/)).toBeNull();
expect(formattedText).toContain('Chris Smith');
});
});
@ -134,6 +134,7 @@ describe("app.helpers.textFormatter", function(){
context("non-ascii url", function() {
beforeEach(function() {
/* jshint -W100 */
this.evilUrls = [
"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",
@ -143,6 +144,7 @@ describe("app.helpers.textFormatter", function(){
"http://de.wikipedia.org/wiki/Liste_der_Abkürzungen_(Netzjargon)", // #3645
"http://wiki.com/?query=Kr%E4fte", // #4874
];
/* jshint +W100 */
this.asciiUrls = [
"http://www.xn--brgerentscheid-krankenhuser-xkc78d.de",
"http://xn--bndnis-fr-krankenhuser-i5b27cha.de/wp-content/uploads/2011/11/cropped-logohp.jpg",

View file

@ -16,7 +16,7 @@ describe("app.models.Photo", function() {
describe("createdAt", 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 });
expect(typeof this.photo.createdAt()).toEqual("number");

View file

@ -29,7 +29,7 @@ describe("app.models.Post", function() {
describe("createdAt", 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 });
expect(typeof this.post.createdAt()).toEqual("number");

View file

@ -138,7 +138,7 @@ describe("app.views.Feedback", function(){
it("reshares the model", function(){
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();
expect(this.view.model.reshare().save).toHaveBeenCalled();
})

View file

@ -356,7 +356,7 @@ describe("app.views.Publisher", function() {
this.view.view_aspect_selector.toggleAspect(evt);
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);
expect($('input[name="aspect_ids[]"][value="42"]').length).toBe(0);
});

View file

@ -9,8 +9,8 @@ describe("app.views.StreamPost", function(){
})
describe("events", function(){
var _PostViewClass = undefined;
var author_id = undefined;
var _PostViewClass,
author_id;
beforeEach(function(){
_PostViewClass = this.PostViewClass;

View file

@ -2,6 +2,42 @@
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() {
$('#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){
var stubClass = Backbone.View.extend({
render : function(){
@ -82,7 +83,7 @@ window.stubView = function stubView(text){
}
})
return new stubClass
return new stubClass();
}
window.loginAs = function loginAs(attrs){
@ -123,8 +124,10 @@ window.hipsterIpsumFourParagraphs = "Mcsweeney's mumblecore irony fugiat, ex iph
spec.clearLiveEventBindings = function() {
var events = jQuery.data(document, "events");
for (prop in events) {
delete events[prop];
for (var prop in events) {
if(events.hasOwnProperty(prop)) {
delete events[prop];
}
}
};

View file

@ -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) {
var names = ['Work','School','Family','Friends','Just following','People','Interesting'];
var defaultAttrs = {

View file

@ -33,7 +33,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
(function() {
function extend(destination, source) {
for (var property in source) {
destination[property] = source[property];
if(source.hasOwnProperty(property)) {
destination[property] = source[property];
}
}
return destination;
}
@ -225,7 +227,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
};
this.filter = function(url_to_match) {
if (requests.length == 0) return [];
if (requests.length === 0) return [];
var matching_requests = [];
for (var i = 0; i < requests.length; i++) {