Permalink
Browse files

fix: put avatar in /other/ jsbin object

  • Loading branch information...
1 parent 8dd79c6 commit b999ce0642dc75036c8b93be54c1c41afa1b6407 @remy remy committed Jul 22, 2015
Showing with 20 additions and 10 deletions.
  1. +1 −1 .jshintrc
  2. +9 −0 lib/handlers/bin.js
  3. +10 −9 public/js/jsbin.js
View
@@ -10,6 +10,6 @@
"node": true,
"quotmark": "single",
"undef": true,
- "strict": true,
+ "strict": false,
"unused": true
}
View
@@ -951,6 +951,15 @@ module.exports = Observable.extend({
var userfields = 'avatar name bincount created pro settings';
jsbin.user = _.pick.apply(_, [user].concat(userfields.split(' ')));
+
+ if (!jsbin.user.avatar && req.session.user) {
+ req.session.user.avatar = jsbin.user.avatar = req.app.locals.gravatar(req.session.user);
+ }
+
+ if (jsbin.user.avatar) {
+ jsbin.user.large_avatar = req.app.locals.gravatar(req.session.user, 120);
+ }
+
// if you don't have the checksum AND the bin is currently writable (i.e.
// streaming) AND you're not the owner - then make it readonly
if ((!jsbin.state.checksum && jsbin.state.streaming === true) &&
View
@@ -12,12 +12,11 @@ try {
}
// required because jQuery 1.4.4 lost ability to search my object property :( (i.e. a[host=foo.com])
-jQuery.expr[':'].host = function(obj, index, meta, stack) {
- return obj.host == meta[3];
+jQuery.expr[':'].host = function(obj, index, meta) {
+ return obj.host === meta[3];
};
function throttle(fn, delay) {
- var timer = null;
var throttled = function () {
var context = this, args = arguments;
throttled.cancel();
@@ -73,7 +72,7 @@ function escapeHTML(html){
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;');
-};
+}
function dedupe(array) {
var hash = {},
@@ -167,8 +166,8 @@ function exposeSettings() {
}
var storedSettings = store.localStorage.getItem('settings');
-if (storedSettings === "undefined" || jsbin.embed) {
- // yes, equals the *string* "undefined", then something went wrong
+if (storedSettings === 'undefined' || jsbin.embed) {
+ // yes, equals the *string* 'undefined', then something went wrong
storedSettings = null;
}
@@ -196,7 +195,7 @@ jsbin.ie = (function(){
while (
div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->',
all[0]
- );
+ ) {}
return v > 4 ? v : undef;
}());
@@ -334,6 +333,7 @@ if ($.browser.opera) {
setInterval(unload, 500);
}
+// TODO remove this entirely, it's kinda stupid - RS 2015-07-19
if (location.search.indexOf('api=') !== -1) {
(function () {
var urlParts = location.search.substring(1).split(','),
@@ -361,17 +361,18 @@ if (location.search.indexOf('api=') !== -1) {
}());
}
-
$document.one('jsbinReady', function () {
exposeSettings();
$bin.removeAttr('style');
$body.addClass('ready');
});
-if (navigator.userAgent.indexOf(' Mac ') !== -1) (function () {
+if (navigator.userAgent.indexOf(' Mac ') !== -1) {
+ (function () {
var el = $('#keyboardHelp')[0];
el.innerHTML = el.innerHTML.replace(/ctrl/g, 'cmd').replace(/Ctrl/g, 'ctrl');
})();
+}
if (jsbin.embed) {
$window.on('focus', function () {

0 comments on commit b999ce0

Please sign in to comment.