nutella_framework 0.6.6 → 0.6.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/framework_components/roomcast-main-app/.gitignore +2 -0
- data/framework_components/roomcast-main-app/README.md +9 -0
- data/framework_components/roomcast-main-app/dist/LICENSE +21 -0
- data/framework_components/roomcast-main-app/dist/app.js +54280 -0
- data/framework_components/roomcast-main-app/dist/assets/Logo.png +0 -0
- data/framework_components/roomcast-main-app/dist/assets/Logo_alpha.png +0 -0
- data/framework_components/roomcast-main-app/dist/assets/Logo_grid.svg +216 -0
- data/framework_components/roomcast-main-app/dist/css/ionicons.min.css +11 -0
- data/framework_components/roomcast-main-app/dist/fonts/ionicons.eot +0 -0
- data/framework_components/roomcast-main-app/dist/fonts/ionicons.svg +2230 -0
- data/framework_components/roomcast-main-app/dist/fonts/ionicons.ttf +0 -0
- data/framework_components/roomcast-main-app/dist/fonts/ionicons.woff +0 -0
- data/framework_components/roomcast-main-app/dist/main.css +3227 -0
- data/framework_components/roomcast-main-app/gulp/config.js +47 -0
- data/framework_components/roomcast-main-app/gulp/tasks/browserify.js +77 -0
- data/framework_components/roomcast-main-app/gulp/tasks/build.js +3 -0
- data/framework_components/roomcast-main-app/gulp/tasks/css.js +7 -0
- data/framework_components/roomcast-main-app/gulp/tasks/default.js +3 -0
- data/framework_components/roomcast-main-app/gulp/tasks/fonts.js +7 -0
- data/framework_components/roomcast-main-app/gulp/tasks/less.js +16 -0
- data/framework_components/roomcast-main-app/gulp/tasks/markup.js +7 -0
- data/framework_components/roomcast-main-app/gulp/tasks/setWatch.js +5 -0
- data/framework_components/roomcast-main-app/gulp/tasks/svgs.js +7 -0
- data/framework_components/roomcast-main-app/gulp/tasks/watch.js +12 -0
- data/framework_components/roomcast-main-app/gulp/util/bundleLogger.js +21 -0
- data/framework_components/roomcast-main-app/gulp/util/handleErrors.js +15 -0
- data/framework_components/roomcast-main-app/gulpfile.js +16 -0
- data/framework_components/roomcast-main-app/index.html +38 -0
- data/framework_components/roomcast-main-app/nutella.json +6 -0
- data/framework_components/roomcast-main-app/package.json +47 -0
- data/framework_components/roomcast-main-app/src/app/app.js +15 -0
- data/framework_components/roomcast-main-app/src/app/components/app/Channel.js +72 -0
- data/framework_components/roomcast-main-app/src/app/components/app/NutellaMixin.js +23 -0
- data/framework_components/roomcast-main-app/src/app/components/app/Player.js +129 -0
- data/framework_components/roomcast-main-app/src/app/components/app/iOSMixin.js +22 -0
- data/framework_components/roomcast-main-app/src/app/components/app/main.js +519 -0
- data/framework_components/roomcast-main-app/src/app/components/app/material-ui/menu-item.jsx +79 -0
- data/framework_components/roomcast-main-app/src/app/components/app/material-ui/menu.jsx +177 -0
- data/framework_components/roomcast-main-app/src/app/components/app/material-ui/overlay.jsx +21 -0
- data/framework_components/roomcast-main-app/src/app/components/app/material-ui/right-nav.jsx +108 -0
- data/framework_components/roomcast-main-app/src/app/components/identity-selector/IdentitiesGrid.js +91 -0
- data/framework_components/roomcast-main-app/src/app/components/identity-selector/IdentityCard.js +86 -0
- data/framework_components/roomcast-main-app/src/app/components/identity-selector/iOSMixin.js +19 -0
- data/framework_components/roomcast-main-app/src/app/components/identity-selector/main.js +105 -0
- data/framework_components/roomcast-main-app/src/app/components/login/AppIdPage.js +97 -0
- data/framework_components/roomcast-main-app/src/app/components/login/BrokerPage.js +139 -0
- data/framework_components/roomcast-main-app/src/app/components/login/IdentitiesGrid.js +93 -0
- data/framework_components/roomcast-main-app/src/app/components/login/IdentityCard.js +99 -0
- data/framework_components/roomcast-main-app/src/app/components/login/RunIdPage.js +78 -0
- data/framework_components/roomcast-main-app/src/app/components/login/iOSMixin.js +23 -0
- data/framework_components/roomcast-main-app/src/app/components/login/main.js +121 -0
- data/framework_components/roomcast-main-app/src/app/components/main.js +64 -0
- data/framework_components/roomcast-main-app/src/less/main.less +364 -0
- data/framework_components/roomcast-main-app/src/less/my_overrides.less +39 -0
- data/framework_components/roomcast-main-app/src/less/right-nav.less +31 -0
- data/framework_components/roomcast-package-creator/dist/app.js +17830 -3473
- data/framework_components/roomcast-package-creator/dist/fonts/material-ui-icons.eot +0 -0
- data/framework_components/roomcast-package-creator/dist/fonts/material-ui-icons.svg +0 -0
- data/framework_components/roomcast-package-creator/dist/fonts/material-ui-icons.ttf +0 -0
- data/framework_components/roomcast-package-creator/dist/fonts/material-ui-icons.woff +0 -0
- data/framework_components/roomcast-package-creator/dist/main.css +2 -1
- data/framework_components/roomcast-package-creator/dist/nutella_lib.js +4110 -4050
- data/framework_components/roomcast-package-creator/index.html +0 -13
- data/framework_components/roomcast-package-creator/package.json +33 -32
- data/framework_components/roomcast-package-creator/src/app/app.js +14 -4
- data/framework_components/roomcast-package-creator/src/app/components/ChannelCard.js +14 -1
- data/framework_components/roomcast-package-creator/src/app/components/main.js +0 -4
- data/framework_components/roomcast-package-creator/src/less/main.less +1 -0
- metadata +57 -2
@@ -0,0 +1,47 @@
|
|
1
|
+
var dest = './dist',
|
2
|
+
src = './src',
|
3
|
+
mui = './node_modules/material-ui/src';
|
4
|
+
|
5
|
+
module.exports = {
|
6
|
+
browserSync: {
|
7
|
+
server: {
|
8
|
+
// We're serving the src folder as well
|
9
|
+
// for sass sourcemap linking
|
10
|
+
baseDir: [dest, src]
|
11
|
+
},
|
12
|
+
files: [
|
13
|
+
dest + '/**'
|
14
|
+
]
|
15
|
+
},
|
16
|
+
less: {
|
17
|
+
src: src + '/less/main.less',
|
18
|
+
watch: [
|
19
|
+
src + '/less/**',
|
20
|
+
mui + '/less/**'
|
21
|
+
],
|
22
|
+
dest: dest
|
23
|
+
},
|
24
|
+
css: {
|
25
|
+
src: src + "/css/**",
|
26
|
+
dest: dest + "/css"
|
27
|
+
},
|
28
|
+
fonts: {
|
29
|
+
src: src + '/fonts/**',
|
30
|
+
dest: dest + '/fonts'
|
31
|
+
},
|
32
|
+
muiFonts: {
|
33
|
+
src: mui + '/less/material-ui-icons/fonts/**',
|
34
|
+
dest: dest + '/fonts'
|
35
|
+
},
|
36
|
+
browserify: {
|
37
|
+
// Enable source maps
|
38
|
+
debug: true,
|
39
|
+
// A separate bundle will be generated for each
|
40
|
+
// bundle config in the list below
|
41
|
+
bundleConfigs: [{
|
42
|
+
entries: src + '/app/app.js',
|
43
|
+
dest: dest,
|
44
|
+
outputName: 'app.js'
|
45
|
+
}]
|
46
|
+
}
|
47
|
+
};
|
@@ -0,0 +1,77 @@
|
|
1
|
+
/* browserify task
|
2
|
+
---------------
|
3
|
+
Bundle javascripty things with browserify!
|
4
|
+
This task is set up to generate multiple separate bundles, from
|
5
|
+
different sources, and to use Watchify when run from the default task.
|
6
|
+
See browserify.bundleConfigs in gulp/config.js
|
7
|
+
*/
|
8
|
+
|
9
|
+
var browserify = require('browserify');
|
10
|
+
var watchify = require('watchify');
|
11
|
+
var bundleLogger = require('../util/bundleLogger');
|
12
|
+
var gulp = require('gulp');
|
13
|
+
var handleErrors = require('../util/handleErrors');
|
14
|
+
var source = require('vinyl-source-stream');
|
15
|
+
var config = require('../config').browserify;
|
16
|
+
|
17
|
+
gulp.task('browserify', function(callback) {
|
18
|
+
|
19
|
+
var bundleQueue = config.bundleConfigs.length;
|
20
|
+
|
21
|
+
var browserifyThis = function(bundleConfig) {
|
22
|
+
|
23
|
+
var bundler = browserify({
|
24
|
+
// Required watchify args
|
25
|
+
cache: {}, packageCache: {}, fullPaths: false,
|
26
|
+
// Specify the entry point of your app
|
27
|
+
entries: bundleConfig.entries,
|
28
|
+
// Add file extentions to make optional in your requires
|
29
|
+
extensions: config.extensions,
|
30
|
+
// Enable source maps!
|
31
|
+
debug: config.debug
|
32
|
+
});
|
33
|
+
|
34
|
+
var bundle = function() {
|
35
|
+
// Log when bundling starts
|
36
|
+
bundleLogger.start(bundleConfig.outputName);
|
37
|
+
|
38
|
+
return bundler
|
39
|
+
.bundle()
|
40
|
+
// Report compile errors
|
41
|
+
.on('error', handleErrors)
|
42
|
+
// Use vinyl-source-stream to make the
|
43
|
+
// stream gulp compatible. Specifiy the
|
44
|
+
// desired output filename here.
|
45
|
+
.pipe(source(bundleConfig.outputName))
|
46
|
+
// Specify the output destination
|
47
|
+
.pipe(gulp.dest(bundleConfig.dest))
|
48
|
+
.on('end', reportFinished);
|
49
|
+
};
|
50
|
+
|
51
|
+
if(global.isWatching) {
|
52
|
+
// Wrap with watchify and rebundle on changes
|
53
|
+
bundler = watchify(bundler);
|
54
|
+
// Rebundle on update
|
55
|
+
bundler.on('update', bundle);
|
56
|
+
}
|
57
|
+
|
58
|
+
var reportFinished = function() {
|
59
|
+
// Log when bundling completes
|
60
|
+
bundleLogger.end(bundleConfig.outputName);
|
61
|
+
|
62
|
+
if(bundleQueue) {
|
63
|
+
bundleQueue--;
|
64
|
+
if(bundleQueue === 0) {
|
65
|
+
// If queue is empty, tell gulp the task is complete.
|
66
|
+
// https://github.com/gulpjs/gulp/blob/master/docs/API.md#accept-a-callback
|
67
|
+
callback();
|
68
|
+
}
|
69
|
+
}
|
70
|
+
};
|
71
|
+
|
72
|
+
return bundle();
|
73
|
+
};
|
74
|
+
|
75
|
+
// Start bundling with Browserify for each bundleConfig specified
|
76
|
+
config.bundleConfigs.forEach(browserifyThis);
|
77
|
+
});
|
@@ -0,0 +1,16 @@
|
|
1
|
+
var gulp = require('gulp'),
|
2
|
+
less = require('gulp-less'),
|
3
|
+
autoprefixer = require('gulp-autoprefixer'),
|
4
|
+
sourcemaps = require('gulp-sourcemaps'),
|
5
|
+
handleErrors = require('../util/handleErrors'),
|
6
|
+
config = require('../config').less;
|
7
|
+
|
8
|
+
gulp.task('less', function() {
|
9
|
+
return gulp.src(config.src)
|
10
|
+
.pipe(sourcemaps.init())
|
11
|
+
.pipe(less())
|
12
|
+
.on('error', handleErrors)
|
13
|
+
.pipe(autoprefixer({cascade: false, browsers: ['last 2 versions']}))
|
14
|
+
.pipe(sourcemaps.write())
|
15
|
+
.pipe(gulp.dest(config.dest));
|
16
|
+
});
|
@@ -0,0 +1,12 @@
|
|
1
|
+
|
2
|
+
/* Notes:
|
3
|
+
- gulp/tasks/browserify.js handles js recompiling with watchify
|
4
|
+
- gulp/tasks/browserSync.js watches and reloads compiled files
|
5
|
+
*/
|
6
|
+
|
7
|
+
var gulp = require('gulp');
|
8
|
+
var config = require('../config');
|
9
|
+
|
10
|
+
gulp.task('watch', ['setWatch'], function() {
|
11
|
+
gulp.watch(config.less.watch, ['less']);
|
12
|
+
});
|
@@ -0,0 +1,21 @@
|
|
1
|
+
/* bundleLogger
|
2
|
+
------------
|
3
|
+
Provides gulp style logs to the bundle method in browserify.js
|
4
|
+
*/
|
5
|
+
|
6
|
+
var gutil = require('gulp-util');
|
7
|
+
var prettyHrtime = require('pretty-hrtime');
|
8
|
+
var startTime;
|
9
|
+
|
10
|
+
module.exports = {
|
11
|
+
start: function(filepath) {
|
12
|
+
startTime = process.hrtime();
|
13
|
+
gutil.log('Bundling', gutil.colors.green(filepath) + '...');
|
14
|
+
},
|
15
|
+
|
16
|
+
end: function(filepath) {
|
17
|
+
var taskTime = process.hrtime(startTime);
|
18
|
+
var prettyTime = prettyHrtime(taskTime);
|
19
|
+
gutil.log('Bundled', gutil.colors.green(filepath), 'in', gutil.colors.magenta(prettyTime));
|
20
|
+
}
|
21
|
+
};
|
@@ -0,0 +1,15 @@
|
|
1
|
+
var notify = require("gulp-notify");
|
2
|
+
|
3
|
+
module.exports = function() {
|
4
|
+
|
5
|
+
var args = Array.prototype.slice.call(arguments);
|
6
|
+
|
7
|
+
// Send error to notification center with gulp-notify
|
8
|
+
notify.onError({
|
9
|
+
title: "Compile Error",
|
10
|
+
message: "<%= error.message %>"
|
11
|
+
}).apply(this, args);
|
12
|
+
|
13
|
+
// Keep gulp from hanging on this task
|
14
|
+
this.emit('end');
|
15
|
+
};
|
@@ -0,0 +1,16 @@
|
|
1
|
+
/*
|
2
|
+
gulpfile.js
|
3
|
+
===========
|
4
|
+
Rather than manage one giant configuration file responsible
|
5
|
+
for creating multiple tasks, each task has been broken out into
|
6
|
+
its own file in gulp/tasks. Any files in that directory get
|
7
|
+
automatically required below.
|
8
|
+
To add a new task, simply add a new task file that directory.
|
9
|
+
gulp/tasks/default.js specifies the default set of tasks to run
|
10
|
+
when you run `gulp`.
|
11
|
+
*/
|
12
|
+
|
13
|
+
var requireDir = require('require-dir');
|
14
|
+
|
15
|
+
// Require all tasks in gulp/tasks, including subfolders
|
16
|
+
requireDir('./gulp/tasks', { recurse: true });
|
@@ -0,0 +1,38 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html class="no-js" lang="">
|
3
|
+
|
4
|
+
<head>
|
5
|
+
<meta charset="utf-8">
|
6
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
7
|
+
<title>RoomCast</title>
|
8
|
+
<meta name="description" content="RoomCast's main app to log in and play channels.">
|
9
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
10
|
+
<link rel="stylesheet" type="text/css" href="dist/main.css">
|
11
|
+
<link rel="stylesheet" type="text/css" href="dist/css/ionicons.min.css">
|
12
|
+
</head>
|
13
|
+
|
14
|
+
<body>
|
15
|
+
|
16
|
+
<!-- This script adds the Roboto font to our project. For more detail go to this site: http://www.google.com/fonts#UsePlace:use/Collection:Roboto:400,300,500 -->
|
17
|
+
<script>
|
18
|
+
var WebFontConfig = {
|
19
|
+
google: {
|
20
|
+
families: ['Roboto:400,300,500:latin']
|
21
|
+
}
|
22
|
+
};
|
23
|
+
(function () {
|
24
|
+
var wf = document.createElement('script');
|
25
|
+
wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
|
26
|
+
'://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
|
27
|
+
wf.type = 'text/javascript';
|
28
|
+
wf.async = 'true';
|
29
|
+
var s = document.getElementsByTagName('script')[0];
|
30
|
+
s.parentNode.insertBefore(wf, s);
|
31
|
+
})();
|
32
|
+
</script>
|
33
|
+
|
34
|
+
<script src="dist/app.js"></script>
|
35
|
+
|
36
|
+
</body>
|
37
|
+
|
38
|
+
</html>
|
@@ -0,0 +1,47 @@
|
|
1
|
+
{
|
2
|
+
"name": "material-ui-example",
|
3
|
+
"version": "0.7.0",
|
4
|
+
"description": "Sample project that uses material-ui",
|
5
|
+
"repository": {
|
6
|
+
"type": "git",
|
7
|
+
"url": "https://github.com/callemall/material-ui.git"
|
8
|
+
},
|
9
|
+
"scripts": {
|
10
|
+
"start": "gulp"
|
11
|
+
},
|
12
|
+
"browserify": {
|
13
|
+
"transform": [
|
14
|
+
[
|
15
|
+
"reactify",
|
16
|
+
{
|
17
|
+
"es6": true
|
18
|
+
}
|
19
|
+
]
|
20
|
+
]
|
21
|
+
},
|
22
|
+
"devDependencies": {
|
23
|
+
"browser-sync": "^1.8.1",
|
24
|
+
"browserify": "^7.0.3",
|
25
|
+
"gulp": "^3.8.10",
|
26
|
+
"gulp-autoprefixer": "^2.0.0",
|
27
|
+
"gulp-less": "^3.0.0",
|
28
|
+
"gulp-notify": "^2.1.0",
|
29
|
+
"gulp-sourcemaps": "^1.2.8",
|
30
|
+
"gulp-util": "^3.0.1",
|
31
|
+
"pretty-hrtime": "^0.2.2",
|
32
|
+
"reactify": "^0.17.1",
|
33
|
+
"require-dir": "^0.1.0",
|
34
|
+
"underscore": "^1.7.0",
|
35
|
+
"vinyl-source-stream": "^1.0.0",
|
36
|
+
"watchify": "^2.2.1"
|
37
|
+
},
|
38
|
+
"dependencies": {
|
39
|
+
"d3": "^3.5.6",
|
40
|
+
"jquery": "^2.1.4",
|
41
|
+
"jquery-ui": "^1.10.5",
|
42
|
+
"material-ui": "0.7.0",
|
43
|
+
"nutella_lib": "^0.6.2",
|
44
|
+
"react": "0.12.2",
|
45
|
+
"react-tap-event-plugin": "0.1.4"
|
46
|
+
}
|
47
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
|
2
|
+
(function () {
|
3
|
+
var React = require('react'),
|
4
|
+
injectTapEventPlugin = require("react-tap-event-plugin"),
|
5
|
+
Main = require('./components/main.js');
|
6
|
+
|
7
|
+
window.React = React;
|
8
|
+
window.getSelection().removeAllRanges();
|
9
|
+
|
10
|
+
injectTapEventPlugin();
|
11
|
+
|
12
|
+
window.ReactMain = React.render(React.createElement(Main), document.body);
|
13
|
+
ReactMain.login = {};
|
14
|
+
|
15
|
+
})();
|
@@ -0,0 +1,72 @@
|
|
1
|
+
var React = require('react');
|
2
|
+
var Mui = require('material-ui');
|
3
|
+
var Paper = Mui.Paper;
|
4
|
+
var NutellaMixin = require('./NutellaMixin');
|
5
|
+
var iOSMixin = require('./iOSMixin');
|
6
|
+
var $ = require('jquery');
|
7
|
+
|
8
|
+
/**
|
9
|
+
* @prop channel
|
10
|
+
*/
|
11
|
+
var Channel = React.createClass({
|
12
|
+
|
13
|
+
mixins: [NutellaMixin, iOSMixin],
|
14
|
+
|
15
|
+
componentDidMount: function() {
|
16
|
+
// Font-size adaptation based on card width
|
17
|
+
$('.text-fit').each(function() {
|
18
|
+
$(this).css('font-size', '2em');
|
19
|
+
while( $(this).width() > $('.name-wrapper').width() - 10 ) {
|
20
|
+
$(this).css('font-size', (parseInt($(this).css('font-size')) - 1) + "px" );
|
21
|
+
}
|
22
|
+
});
|
23
|
+
},
|
24
|
+
|
25
|
+
handleClick: function() {
|
26
|
+
this.props.onSetPlaying(this.props.chId);
|
27
|
+
},
|
28
|
+
|
29
|
+
render: function() {
|
30
|
+
|
31
|
+
var style = {
|
32
|
+
backgroundImage: 'url(' + this.props.channel.screenshot + ')',
|
33
|
+
backgroundSize: '100% 100%'
|
34
|
+
};
|
35
|
+
|
36
|
+
var iconStyle = {
|
37
|
+
backgroundColor: this.props.channel.icon
|
38
|
+
};
|
39
|
+
|
40
|
+
var border = this.props.playing ? {
|
41
|
+
outline: 'solid 5px rgba(255,255,0,0.5)'
|
42
|
+
} : null;
|
43
|
+
|
44
|
+
return (
|
45
|
+
<Paper className='channel' style={style} ref='channelRef' onTouchTap={this.handleClick} >
|
46
|
+
|
47
|
+
<div className='channel-div' style={border}>
|
48
|
+
|
49
|
+
<div className='channel-caption'>
|
50
|
+
|
51
|
+
<div className='icon-name-wrapper'>
|
52
|
+
|
53
|
+
<div className='channel-icon' ref='channelIcon' style={iconStyle} > </div>
|
54
|
+
|
55
|
+
<div className='name-wrapper'>
|
56
|
+
<span className='channel-name text-fit'>{this.props.channel.name}</span>
|
57
|
+
</div>
|
58
|
+
|
59
|
+
</div>
|
60
|
+
|
61
|
+
</div>
|
62
|
+
|
63
|
+
</div>
|
64
|
+
|
65
|
+
</Paper>);
|
66
|
+
|
67
|
+
}
|
68
|
+
|
69
|
+
});
|
70
|
+
|
71
|
+
module.exports = Channel;
|
72
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
|
2
|
+
var NutellaMixin = {
|
3
|
+
|
4
|
+
getChannelsForRid: function(message, rid) {
|
5
|
+
var myChannelsId = [];
|
6
|
+
var myChannels = [];
|
7
|
+
message.forEach(function(f) {
|
8
|
+
for (var i in f.items) {
|
9
|
+
var item = f.items[i];
|
10
|
+
if (item.name === 'iPad1') {
|
11
|
+
myChannelsId = item.channels;
|
12
|
+
break;
|
13
|
+
}
|
14
|
+
}
|
15
|
+
});
|
16
|
+
myChannelsId.forEach(function(id) {
|
17
|
+
myChannels.push(CHANNELS[id]);
|
18
|
+
});
|
19
|
+
},
|
20
|
+
|
21
|
+
};
|
22
|
+
|
23
|
+
module.exports = NutellaMixin;
|
@@ -0,0 +1,129 @@
|
|
1
|
+
|
2
|
+
var React = require('react');
|
3
|
+
var Mui = require('material-ui');
|
4
|
+
var FloatingActionButton = Mui.FloatingActionButton;
|
5
|
+
var d3 = require('d3');
|
6
|
+
var $ = require('jquery');
|
7
|
+
var NUTELLA = require('nutella_lib');
|
8
|
+
|
9
|
+
var Player = React.createClass({
|
10
|
+
|
11
|
+
componentDidMount: function() {
|
12
|
+
var self = this;
|
13
|
+
this.showLoading();
|
14
|
+
$('.channel-frame').load(function(){
|
15
|
+
self.handleOnLoad();
|
16
|
+
});
|
17
|
+
this.interval_ = null;
|
18
|
+
},
|
19
|
+
|
20
|
+
componentWillUnmount: function() {
|
21
|
+
},
|
22
|
+
|
23
|
+
getInitialState: function () {
|
24
|
+
return {
|
25
|
+
playing: true,
|
26
|
+
loading: true
|
27
|
+
}
|
28
|
+
},
|
29
|
+
|
30
|
+
componentWillReceiveProps: function(props) {
|
31
|
+
this.setState({playing: props.playing});
|
32
|
+
},
|
33
|
+
|
34
|
+
handleOnLoad: function() {
|
35
|
+
this.setState({loading: false});
|
36
|
+
this.hideLoading();
|
37
|
+
},
|
38
|
+
|
39
|
+
showLoading: function() {
|
40
|
+
var self = this;
|
41
|
+
|
42
|
+
d3.xml("dist/assets/Logo_grid.svg", "image/svg+xml", function (logo) {
|
43
|
+
|
44
|
+
self.refs['player'].getDOMNode().appendChild(logo.documentElement);
|
45
|
+
|
46
|
+
d3.select('#logo')
|
47
|
+
.attr({
|
48
|
+
width: window.innerWidth,
|
49
|
+
height: window.innerHeight
|
50
|
+
});
|
51
|
+
|
52
|
+
var colorBlue = function(id) {
|
53
|
+
d3.select(id).style({
|
54
|
+
'fill': '#00bcd4'
|
55
|
+
});
|
56
|
+
};
|
57
|
+
|
58
|
+
var colorPink = function(id) {
|
59
|
+
d3.select(id).style({
|
60
|
+
'fill': '#e91e63'
|
61
|
+
});
|
62
|
+
};
|
63
|
+
|
64
|
+
var removeColor = function() {
|
65
|
+
d3.selectAll('rect').style({
|
66
|
+
'fill': null
|
67
|
+
});
|
68
|
+
};
|
69
|
+
|
70
|
+
var sequence = [1,2,3,4,8,7,6,5];
|
71
|
+
var i = 0;
|
72
|
+
var action = function() {
|
73
|
+
removeColor();
|
74
|
+
if(sequence[i] < 5) {
|
75
|
+
colorBlue('#ch' + sequence[i]);
|
76
|
+
} else {
|
77
|
+
colorPink('#ch' + sequence[i]);
|
78
|
+
}
|
79
|
+
i++;
|
80
|
+
if(i===sequence.length) {
|
81
|
+
i = 0;
|
82
|
+
}
|
83
|
+
};
|
84
|
+
|
85
|
+
self.interval_ = setInterval(action, 200);
|
86
|
+
});
|
87
|
+
},
|
88
|
+
|
89
|
+
hideLoading: function() {
|
90
|
+
d3.select('#logo').remove();
|
91
|
+
clearInterval(this.interval_);
|
92
|
+
},
|
93
|
+
|
94
|
+
render: function () {
|
95
|
+
|
96
|
+
var playerStyle = null;
|
97
|
+
if(!this.state.playing) {
|
98
|
+
playerStyle = {
|
99
|
+
opacity: 0,
|
100
|
+
zIndex: 90,
|
101
|
+
pointerEvents: 'none'
|
102
|
+
};
|
103
|
+
} else {
|
104
|
+
playerStyle = {
|
105
|
+
opacity: 1,
|
106
|
+
zIndex: 100,
|
107
|
+
pointerEvents: 'all'
|
108
|
+
};
|
109
|
+
}
|
110
|
+
|
111
|
+
var url = this.props.url;
|
112
|
+
var qp = this.props.nutellaParams;
|
113
|
+
var suffix = 'broker=' + qp.broker + '&app_id=' + qp.app_id + '&run_id=' + qp.run_id;
|
114
|
+
url = url.indexOf('?') === -1 ? url + '?' + suffix : url + '&' + suffix;
|
115
|
+
|
116
|
+
return (
|
117
|
+
|
118
|
+
<div className='player' style={playerStyle} ref='player' >
|
119
|
+
|
120
|
+
<iframe className='channel-frame' src={url} > </iframe>
|
121
|
+
|
122
|
+
</div>
|
123
|
+
|
124
|
+
);
|
125
|
+
}
|
126
|
+
|
127
|
+
});
|
128
|
+
|
129
|
+
module.exports = Player;
|
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
var iOSMixin = {
|
3
|
+
|
4
|
+
iOScall: function(actionType, actionParameters) {
|
5
|
+
|
6
|
+
// JavaScript to send an action to iOS code
|
7
|
+
var appName = 'roomcast';
|
8
|
+
var url;
|
9
|
+
if(actionParameters) {
|
10
|
+
var jsonString = (JSON.stringify(actionParameters));
|
11
|
+
var escapedJsonParameters = escape(jsonString);
|
12
|
+
url = appName + '://' + actionType + "#" + escapedJsonParameters;
|
13
|
+
} else {
|
14
|
+
url = appName + '://' + actionType;
|
15
|
+
}
|
16
|
+
document.location.href = url;
|
17
|
+
console.log('launching url: ', url);
|
18
|
+
}
|
19
|
+
|
20
|
+
};
|
21
|
+
|
22
|
+
module.exports = iOSMixin;
|