JSHint boss, evil, loopfunc and scripturl
This commit is contained in:
parent
ab6732cac1
commit
2ec093a54c
6 changed files with 26 additions and 10 deletions
|
|
@ -35,7 +35,10 @@ var app = {
|
|||
events: _.extend({}, Backbone.Events),
|
||||
|
||||
user: function(userAttrs) {
|
||||
if(userAttrs) { return this._user = new app.models.User(userAttrs) }
|
||||
if(userAttrs) {
|
||||
this._user = new app.models.User(userAttrs);
|
||||
return this._user;
|
||||
}
|
||||
return this._user || false;
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,8 @@ app.models.Post = Backbone.Model.extend(_.extend({}, app.models.formatDateMixin,
|
|||
},
|
||||
|
||||
reshare : function(){
|
||||
return this._reshare = this._reshare || new app.models.Reshare({root_guid : this.get("guid")});
|
||||
this._reshare = this._reshare || new app.models.Reshare({root_guid : this.get("guid")});
|
||||
return this._reshare;
|
||||
},
|
||||
|
||||
reshareAuthor : function(){
|
||||
|
|
|
|||
|
|
@ -274,9 +274,16 @@ app.views.Publisher = Backbone.View.extend({
|
|||
var mentioned_people = [],
|
||||
regexp = new RegExp("@{\(\[\^\;\]\+\); \(\[\^\}\]\+\)}", "g"),
|
||||
user;
|
||||
|
||||
var getMentionedUser = function(handle) {
|
||||
return Mentions.contacts.filter(function(user) {
|
||||
return user.handle === handle;
|
||||
})[0];
|
||||
};
|
||||
|
||||
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];
|
||||
var mentioned_user = getMentionedUser(user[2]);
|
||||
if(mentioned_user){
|
||||
mentioned_people.push({
|
||||
"id":mentioned_user["id"],
|
||||
|
|
|
|||
|
|
@ -22,7 +22,10 @@ Diaspora.I18n = {
|
|||
|
||||
var rule = this._resolve(locale, ['pluralization_rule']);
|
||||
if (rule !== "") {
|
||||
/* jshint evil:true */
|
||||
// TODO change this to `locale.pluralizationKey = rule`?
|
||||
eval("locale.pluralizationKey = "+rule);
|
||||
/* jshint evil:false */
|
||||
}
|
||||
},
|
||||
|
||||
|
|
@ -37,7 +40,7 @@ Diaspora.I18n = {
|
|||
_resolve: function(locale, items) {
|
||||
var translatedMessage, nextNamespace, originalItems = items.slice();
|
||||
|
||||
while(nextNamespace = items.shift()) {
|
||||
while( (nextNamespace = items.shift()) ) {
|
||||
translatedMessage = (translatedMessage)
|
||||
? translatedMessage[nextNamespace]
|
||||
: locale.data[nextNamespace];
|
||||
|
|
|
|||
|
|
@ -27,19 +27,19 @@ options:
|
|||
|
||||
# relaxing options
|
||||
asi: false
|
||||
boss: true
|
||||
boss: false
|
||||
browser: true
|
||||
devel: true
|
||||
eqnull: true
|
||||
evil: true
|
||||
evil: false
|
||||
expr: true
|
||||
jasmine: true
|
||||
jquery: true
|
||||
lastsemic: true
|
||||
laxbreak: true
|
||||
laxcomma: true
|
||||
loopfunc: true
|
||||
scripturl: true
|
||||
loopfunc: false
|
||||
scripturl: false
|
||||
sub: true
|
||||
supernew: true
|
||||
|
||||
|
|
|
|||
|
|
@ -90,12 +90,14 @@ window.stubView = function stubView(text){
|
|||
};
|
||||
|
||||
window.loginAs = function loginAs(attrs){
|
||||
return app.currentUser = app.user(factory.userAttrs(attrs));
|
||||
app.currentUser = app.user(factory.userAttrs(attrs));
|
||||
return app.currentUser;
|
||||
};
|
||||
|
||||
window.logout = function logout(){
|
||||
this.app._user = undefined;
|
||||
return app.currentUser = new app.models.User();
|
||||
app.currentUser = new app.models.User();
|
||||
return app.currentUser;
|
||||
};
|
||||
|
||||
window.hipsterIpsumFourParagraphs = "Mcsweeney's mumblecore irony fugiat, ex iphone brunch helvetica eiusmod retro" +
|
||||
|
|
|
|||
Loading…
Reference in a new issue