Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
htmlhero committed Jan 9, 2017
0 parents commit 08ea3da
Show file tree
Hide file tree
Showing 35 changed files with 3,088 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.idea
.DS_Store
node_modules
npm-debug.log
.code-cache
dist
docs
web/dev.js
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017 Andrew Motoshin

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Digital Clock
Application for Smart TV.

License
-----

Project licensed under MIT licence. Please read LICENSE file.

Also in project used [Digital-7](http://www.styleseven.com/php/get_product.php?product=Digital-7) font, created by Style-7 company.
Font have other license. For more information, please visit [www.styleseven.com](http://www.styleseven.com).
49 changes: 49 additions & 0 deletions app/dc/application.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
goog.provide('dc.Application');
goog.require('dc.BaseApplication');
goog.require('dc.services.Settings');
goog.require('zb.console');



/**
* @extends {dc.BaseApplication}
* @constructor
*/
dc.Application = function() {
zb.console.setLevel(zb.console.Level.LOG);
goog.base(this);

this.services = {
settings: new dc.services.Settings
};
};
goog.inherits(dc.Application, dc.BaseApplication);


/**
* @override
*/
dc.Application.prototype.onReady = function() {
this.services.settings.setStorage(this.device.storage);
this.setHomeScene('home');
};


/**
* @override
*/
dc.Application.prototype.onStart = function() {
if (this.isDeviceSamsung()) {
this.device.screenSaverOff();
}

this.home();
};


/**
* @type {{
* settings: dc.services.Settings
* }}
*/
dc.Application.prototype.services;
6 changes: 6 additions & 0 deletions app/dc/fonts/digital-7.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions app/dc/fonts/icomoon.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@font-face {
font-family: 'Icomoon';
src: url('icomoon.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
Binary file added app/dc/fonts/icomoon.ttf
Binary file not shown.
Empty file added app/dc/popups/.hidden
Empty file.
Empty file added app/dc/scenes/.hidden
Empty file.
117 changes: 117 additions & 0 deletions app/dc/scenes/home/home-osd.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
goog.provide('dc.scenes.HomeOsd');
goog.require('zb.Timeout');
goog.require('zb.events.EventPublisher');
goog.require('zb.html');



/**
* @param {dc.scenes.HomeOsd.Input} input
* @extends {zb.events.EventPublisher}
* @constructor
*/
dc.scenes.HomeOsd = function(input) {
goog.base(this);

this._helpBar = input.helpBar;
this._isHelpBarVisible = false;

this._helpBarTimer = new zb.Timeout(this.hideHelpBar.bind(this), this.HELP_BAR_SHOW_TIME);
};
goog.inherits(dc.scenes.HomeOsd, zb.events.EventPublisher);


/**
*/
dc.scenes.HomeOsd.prototype.beforeDOMShow = function() {
this.showHelpBar();
};


/**
*/
dc.scenes.HomeOsd.prototype.afterDOMHide = function() {
this.hideHelpBar();
};


/**
*/
dc.scenes.HomeOsd.prototype.showHelpBar = function() {
this._helpBarTimer.restart();
this._setHelpBarVisible(true);
};


/**
*/
dc.scenes.HomeOsd.prototype.hideHelpBar = function() {
this._helpBarTimer.stop();
this._setHelpBarVisible(false);
};


/**
* @param {zb.device.input.Keys} zbKey
* @param {KeyboardEvent|WheelEvent=} opt_e
* @return {boolean} True if Key handled, false if not
*/
dc.scenes.HomeOsd.prototype.processKey = function(zbKey, opt_e) {
var keys = zb.device.input.Keys;
var isHandled = false;

if (!this._isHelpBarVisible) {
var isEnter = zbKey === keys.ENTER;
var isNavigation = zbKey === keys.UP || zbKey === keys.RIGHT || zbKey === keys.DOWN || zbKey === keys.LEFT;
isHandled = isEnter || isNavigation;
}

this.showHelpBar();

return isHandled;
};


/**
* @param {boolean} isHelpBarVisible
* @private
*/
dc.scenes.HomeOsd.prototype._setHelpBarVisible = function(isHelpBarVisible) {
zb.html.showHide(this._helpBar, isHelpBarVisible);
this._isHelpBarVisible = isHelpBarVisible;
};


/**
* @type {HTMLElement}
* @private
*/
dc.scenes.HomeOsd.prototype._helpBar;


/**
* @type {zb.Timeout}
* @private
*/
dc.scenes.HomeOsd.prototype._helpBarTimer;


/**
* @type {boolean}
* @private
*/
dc.scenes.HomeOsd.prototype._isHelpBarVisible;


/**
* @const {number}
*/
dc.scenes.HomeOsd.prototype.HELP_BAR_SHOW_TIME = 5 * 1000;


/**
* @typedef {{
* helpBar: HTMLElement
* }}
*/
dc.scenes.HomeOsd.Input;
17 changes: 17 additions & 0 deletions app/dc/scenes/home/home.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* Home scene
*******************************/

.s-home {}
.s-home .w-clock {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
}
.s-home .w-help-bar {
position: absolute;
right: 0;
bottom: 0;
left: 0;
}
Loading

0 comments on commit 08ea3da

Please sign in to comment.