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