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

Robots for demo #447

Closed
wants to merge 12 commits into from
20 changes: 5 additions & 15 deletions editors/default-editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,14 @@
<html>
<head>
<title>Event Editor</title>
<style>
table#table tr td:nth-child(2) * {
font-size: 0.9em;
}
table {
font-family: helvetica !important;
color: #fff !important;
}
p#message {
color: #FF0000;
}
</style>
<link rel="stylesheet" href="editor-style.css">
<script type="text/javascript" src="editor.js"></script>
<script type="text/javascript" src="default-editor.js"></script>
</head>
<body>
<table id="table">
</table>
<p id="message"></p>
<div id="title" class="butter-form-title"></div>
<form id="form" class="butter-form">
</form>
<div id="message"></div>
</body>
</html>
44 changes: 33 additions & 11 deletions editors/default-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@

_comm.listen( "trackeventupdatefailed", function( e ) {
if( e.data === "invalidtime" ){
document.getElementById( "message" ).innerHTML = "You've entered an invalid start or end time. Please verify that they are both greater than 0, the end time is equal to or less than the media's duration, and that the start time is less than the end time.";
document.getElementById( "message" ).innerHTML = "<div class=\"butter-error\">You've entered an invalid start or end time. Please verify that they are both greater than 0, the end time is equal to or less than the media's duration, and that the start time is less than the end time.</div>";
} //if
});

_comm.listen( "trackeventdata", function( e ){
var popcornOptions = e.data.popcornOptions,
targets = e.data.targets,
media = e.data.media,
table = document.getElementById( "table" ),
form = document.getElementById( "form" ),
mediaName = "Current Media Element",
elemToFocus,
createElement = {
Expand All @@ -114,7 +114,6 @@

elem.type = type;
elem.id = manifestProp;
elem.style.width = "100%";
elem.placeholder = "Empty";

elem.value = elem.checked = this.defaultValue( manifestItem, popcornOptions[ manifestProp ] );
Expand Down Expand Up @@ -152,17 +151,23 @@
_manifest = e.data.manifest.options;

function createRow( item, data ) {
var row = document.createElement( "TR" ),
col1 = document.createElement( "TD" ),
col2 = document.createElement( "TD" ),
var row = document.createElement( "div" ),
rowClassPrefix = "fieldset-",
col1 = document.createElement( "label" ),
col2 = document.createElement( "div" ),
currentItem = _manifest[ item ],
itemLabel = currentItem.label || item,
unitLabel,
field;

if ( itemLabel === "In" ) {
itemLabel = "Start (seconds)";
} else if ( itemLabel === "Out" ) {
itemLabel = "End (seconds)";
// Add units, they exist in the manifest
if ( item === "start" || item === "end" ) {
currentItem.units = "seconds";
}
if ( currentItem.units ) {
unitLabel = document.createElement("span");
unitLabel.classList.add( "butter-unit" );
unitLabel.innerHTML = currentItem.units;
}

col1.innerHTML = "<span>" + itemLabel + "</span>";
Expand All @@ -177,9 +182,23 @@
// Remember first control added in editor so we can focus
elemToFocus = elemToFocus || field;

//Add classes for style selecting
row.classList.add( rowClassPrefix + item );

//Add unit label if it exists
if( unitLabel ) {
col2.classList.add("butter-form-append");
col2.appendChild( unitLabel );
}

//Hide if the manifest says so
if( currentItem.hidden === true ) {
row.style.display = "none";
}

row.appendChild( col1 );
row.appendChild( col2 );
table.appendChild( row );
form.appendChild( row );
}

_manifest.target = {
Expand All @@ -195,6 +214,9 @@
}
}

//Add the title info
document.getElementById("title").innerHTML = "<h3>"+e.data.manifest.about.name+"</h3>"+"<p>"+e.data.manifest.about.author+"</p>"

// Focus the first element in the editor
if ( elemToFocus && elemToFocus.focus ) {
elemToFocus.focus();
Expand Down
188 changes: 188 additions & 0 deletions editors/editor-style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@

html {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #EEE;
font-size: 100%;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}

button,
input,
select,
textarea {
margin: 0;
font-size: 100%;
vertical-align: middle;
}

button,
input {
line-height: normal;
}

button::-moz-focus-inner,
input::-moz-focus-inner {
padding: 0;
border: 0;
}

textarea {
overflow: auto;
vertical-align: top;
}


/* Main styles
-------------------------------------------------- */

.butter-form-title {
float: left;
width: 100px;
margin-right: 20px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #DDD;
text-align: right;
text-shadow: 0 -1px 1px rgba(0,0,0,.4);
}
.butter-form-title h3 {
margin-top: 0;
}

.butter-form {
float: left;
width: 450px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #FFF;
font-size: 1em;
}

.butter-form > div { /* fieldset */
display: table;
content: "";
clear: both;
font-size: 13px;
line-height: 18px;
}
label {
float: left;
width: 80px;
padding-top: 5px;
margin-bottom: 5px;
text-align: right;
display: block;
font-weight: 600;
color: #DDD;
text-shadow: 0 -1px 1px rgba(0,0,0,.4);
}
.butter-form > div > div { /* input container */
margin-left: 100px;
margin-bottom: 5px;
}

input, .butter-unit {
padding: 4px 9px;
font-size: 13px;
font-weight: normal;
line-height: 16px;
background-color: #626262;
background: -moz-linear-gradient(top, rgba(0,0,0,.1) 0%, rgba(0,0,0,0) 100%), #999;
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(46,46,46,1)), color-stop(100%,rgba(57,57,57,1)));
background: -webkit-linear-gradient(top, rgba(0,0,0,.1) 0%,rgba(0,0,0,0) 100%), #333;
background: -o-linear-gradient(top, rgba(0,0,0,.1) 0%,rgba(0,0,0,0) 100%), #999;
background: -ms-linear-gradient(top, rgba(0,0,0,.1) 0%,rgba(0,0,0,0) 100%), #999;
background: linear-gradient(top, rgba(0,0,0,.1) 0%,rgba(0,0,0,0) 100%), #999;
border: 1px solid #222;
-webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 0 rgba(255, 255, 255, 0.15);
-moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 0 rgba(255, 255, 255, 0.15);
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 0 rgba(255, 255, 255, 0.15);
border-radius: 3px;
color: #D5D5D5;
}

select {
margin-top: 4px;
width: 90px;
}
input[type="text"]{
width: 260px;
}
input[type="number"]{
width: 70px;
}
input[type="checkbox"] {
width: auto;
margin-top: 9px;
}

input:focus{
outline: none;
border: 1px solid #272822;
color: #FFF;
-webkit-transition: all .3s ease;
-moz-transition: all .3s ease;
-o-transition: all .3s ease;
-ms-transition: all .3s ease;
transition: all .3s ease;
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(68,68,68,1)), color-stop(100%,rgba(85,85,85,1)));
background: -webkit-linear-gradient(top, rgba(0,0,0,.1) 0%,rgba(0,0,0,0) 100%), #555;
background: -moz-linear-gradient(top, rgba(0,0,0,.1) 0%,rgba(0,0,0,0) 100%), #555;
background: -o-linear-gradient(top, rgba(0,0,0,.1) 0%,rgba(0,0,0,0) 100%), #555;
background: -ms-linear-gradient(top, rgba(0,0,0,.1) 0%,rgba(0,0,0,0) 100%), #555;
background: linear-gradient(top, rgba(0,0,0,.1) 0%,rgba(0,0,0,0) 100%), #555;
}
input:focus + .butter-unit {
color: #CCC;
}
.butter-form-append input {
display: inline-block;
border-radius: 3px 0 0 3px;
border-right: 1px solid #000;
}
.butter-unit {
display: inline-block;
margin-left: -1px;
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
font-size: 10px;
width: auto;
min-width: 16px;
padding: 4px 5px;
font-weight: normal;
text-align: center;
background-color: #222;
color: #999;
border: 1px solid black;
border-left: 0;
border-radius: 0 3px 3px 0;
}

#message {
float: left;
font-size: 12px;
line-height: 1.5;
width: 450px;
}
.butter-error {
color: #FFF;
font-weight: 600;
background: #B55054;
background: rgb(178,108,111);
border-radius: 6px;
padding: 15px;
box-shadow: 0 2px 3px rgba(0,0,0,.2);
text-shadow: 0 -1px 1px rgba(0,0,0,.4);
}


/* Class specific
-------------------------------------------------- */
.butter-form > .fieldset-start input,
.butter-form > .fieldset-end input {
width: 70px;
}

.butter-form > .fieldset-target select {
width: auto;
}

/* ---/ Class specific ------------------------------- */
28 changes: 26 additions & 2 deletions templates/supported/robots/butter/config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
{
"name": "robots",
"baseDir": "../../../",
"editor": {
"default": "{{baseDir}}editors/default-editor.html",
"photo": "{{baseDir}}templates/supported/shared/editors/photo-editor.html",
"googlemap": "{{baseDir}}editors/googlemap-editor.html"
},
"plugin": {
"plugins": [
{
Expand All @@ -14,12 +19,31 @@
{
"type": "zoink",
"path": "{{baseDir}}templates/supported/shared/plugins/zoink/popcorn.zoink.js"
},
{
"type": "titles",
"path": "{{baseDir}}templates/supported/shared/plugins/titles/popcorn.titles.robots.js"
},
{
"type": "photo",
"path": "{{baseDir}}templates/supported/shared/plugins/photo/popcorn.photo.js"
},
{
"type": "googlemap",
"path": "{{baseDir}}templates/supported/shared/plugins/googlemap/popcorn.googlemap.js"
},
{
"type": "flickr",
"path": "{{baseDir}}templates/supported/shared/plugins/flickr/popcorn.flickr.js"
}
],
"defaults": [
"text",
"photo",
"speak",
"zoink"
"zoink",
"titles",
"googlemap",
"flickr"
]
}
}
17 changes: 13 additions & 4 deletions templates/supported/robots/butter/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,36 @@ document.addEventListener( "DOMContentLoaded", function( e ){
Butter({
config: "butter/config.json",
ready: function( butter ){
var media = butter.media[ 0 ];
var media = butter.media[ 0 ],
popcorn = butter.media[ 0 ].popcorn.popcorn;

function start(){
media.addTrack( "Track1" );
media.addTrack();
media.addTrack();

butter.tracks[0].addTrackEvent({
type: "text",
type: "titles",
popcornOptions: {
start: 0,
end: 1,
text: "This is a test.",
target: "Area1"
text: "Robots invade...",
target: "video-overlay"
}
});

} //start

media.onReady( start );

//Export this later
popcorn.on( "play", function(){
$(".popcorn-effect-rumble-play").addClass("popcorn-effect-rumble");
});
popcorn.on( "pause", function(){
$(".popcorn-effect-rumble-play").removeClass("popcorn-effect-rumble");
});

}
}); //Butter

Expand Down
Loading