Skip to content
This repository has been archived by the owner on Jul 25, 2018. It is now read-only.

Commit

Permalink
Naming screens, show meta on screens.
Browse files Browse the repository at this point in the history
  • Loading branch information
mythmon committed Jan 26, 2013
1 parent dd4b133 commit 5669fa3
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 26 deletions.
50 changes: 36 additions & 14 deletions static/css/crimsontwins.less
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
@import 'lib/vendor-prefix.less';

.wrap {
position: relative;
background: url(/img/debut_dark.png);
overflow: hidden;
}

.content {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;

transition: opacity 2s;
-moz-transition: opacity 2s;
-webkit-transition: opacity 2s;
Expand All @@ -26,14 +14,48 @@
}

iframe {
width: 100%;
height: 100%;
overflow: hidden;
border: 0;
background: #fff;
}
}

.wrap {
position: relative;
background: url(/img/debut_dark.png);
overflow: hidden;

.content {
width: 100%;
height: ~"calc(100% - 3em)";

iframe {
width: 100%;
height: 100%;
}
}

.meta {
background: #000;
font-size: 2em;
line-height: 1em;
color: #fff;
padding: 0.25em;
vertical-align: middle;
word-wrap: break-word;

span:not(:first-child) {
border-left: 1px solid #fff;
margin-left: 0.5em;
padding-left: 0.5em;

&.url {
font-size: 0.5em;
}
}
}
}

.selector {
list-style: none;
margin: 0;
Expand Down
20 changes: 13 additions & 7 deletions static/js/managed.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ function makeSelector() {
.on('click', function(ev) {
console.log('new clicked');
ev.preventDefault();
now.addScreen('herpderp ' + (new Date()).getMilliseconds());
var name = prompt('Screen name?');
now.addScreen(name);
}));

/*
Expand Down Expand Up @@ -143,14 +144,19 @@ function makeScreenPreview(screen, events) {
return $elem;
}

var seletedScreenTemplate =
'<div class="wrap" name="screen-{id}">' +
'<div class="content"></div>' +
'<div class="meta">' +
'<span class="name">{name}</span>' +
'<span class="url">{content.url}</span>' +
'</div>' +
'</div>';

function selectScreen($elem) {
var screen = $elem.data('screen');
$wrap = $('<div>', {
'class': 'wrap',
'name': 'screen-' + screen.id
})
.append($('<div class="content"/>')
.html(elementFor(screen.content)))
$wrap = $(seletedScreenTemplate.format(screen))
.find('.content').html(elementFor(screen.content)).end()
.css({
width: window.innerWidth,
height: window.innerHeight
Expand Down
14 changes: 11 additions & 3 deletions static/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,22 @@ String.prototype.format = function(obj) {
var args = arguments;
var str = this;
// Support either an object, or a series.
return str.replace(/\{[\w\d_-]+\}/g, function(part) {
return str.replace(/\{[\w\d\._-]+\}/g, function(part) {
// Strip off {}.
part = part.slice(1, -1);
var index = parseInt(part, 10);
if (isNaN(index)) {
return obj[part];
return dottedGet(obj, part);
} else {
return args[index];
}
});
}
};

dottedGet = function(obj, selector) {
selector = selector.split('.');
while (selector.length) {
obj = obj[selector.splice(0, 1)[0]];
}
return obj;
};
12 changes: 10 additions & 2 deletions utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,26 @@ String.prototype.format = function(obj) {
var args = arguments;
var str = this;
// Support either an object, or a series.
return str.replace(/\{[\w\d_-]+\}/g, function(part) {
return str.replace(/\{[\w\d\._-]+\}/g, function(part) {
// Strip off {}.
part = part.slice(1, -1);
var index = parseInt(part, 10);
if (isNaN(index)) {
return obj[part];
return exports.dottedGet(obj, part);
} else {
return args[index];
}
});
};

exports.dottedGet = function(obj, selector) {
selector = selector.split('.');
while (selector.length) {
obj = obj[selector.splice(0, 1)[0]];
}
return obj;
};

var _nextId = 0;
exports.getId = function() {
return _nextId++;
Expand Down

0 comments on commit 5669fa3

Please sign in to comment.