jsbin/views/user.html
Remy Sharp 09abba5c3e Embed correctly erroring on https if no pro
Also slimmed down index page so it's controlled through JS (prep for service worker)
2015-06-07 20:31:37 +01:00

21 lines
581 B
HTML

var jsbin = {};
jsbin.user = {{{user}}};
if (jsbin.user && jsbin.user.name) {
$('.loggedout').hide();
var menu = $('.loggedin').show();
var html = $('#profile-template').text();
var $html = $(html.replace(/({.*?})/g, function (all, match) {
var key = match.slice(1, -1).trim(); // ditch the wrappers
return jsbin.user[key] || '';
}));
if (jsbin.user.pro) {
document.documentElement.className += ' pro';
$html.find('.gopro').remove();
} else {
$html.find('.pro').remove();
}
var $menu = menu.append($html);
} else {
$('.loggedout').show();
}