Skip to content

Commit

Permalink
0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
trave committed Sep 6, 2018
1 parent b2d2a61 commit 0ac2524
Show file tree
Hide file tree
Showing 7 changed files with 129 additions and 105 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright © 2016 Interfaced

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.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

Integration
-------

Add code like this to your application.js

```javascript
goog.require('zb.popups.About');

yourApp.Application = class extends yourApp.BaseApplication {

/**
* @override
*/
processKey(zbKey, e) {
zb.popups.About.processKey(zbKey);

return super.processKey(zbKey, e);
}
};
```
107 changes: 51 additions & 56 deletions lib/about.js
Original file line number Diff line number Diff line change
@@ -1,77 +1,72 @@
goog.provide('zb.popups.About');
goog.require('zb.device.input.Keys');
goog.require('zb.ext.about.popups.templates.about');
goog.require('zb.layers.CutePopup');
goog.require('zb.packageInfo');



/**
* @extends {zb.layers.CutePopup}
* @constructor
*/
zb.popups.About = function() {
goog.base(this);
this._addContainerClass('p-zb-about');
this._keyProcessCounter = 0;
};
goog.inherits(zb.popups.About, zb.layers.CutePopup);
zb.popups.About = class extends zb.layers.CutePopup {
constructor() {
super();
this._addContainerClass('p-zb-about');

/**
* @type {zb.ext.about.popups.templates.AboutOut}
* @protected
*/
this._exported;

/**
* @inheritDoc
*/
zb.popups.About.prototype._renderTemplate = function() {
return zb.ext.about.popups.templates.about(this._getTemplateData(), this._getTemplateOptions());
};
/**
* @type {number}
* @private
*/
this._keyProcessCounter = 0;
}


/**
* @inheritDoc
*/
zb.popups.About.prototype._processKey = function() {
if (this._keyProcessCounter > 0) {
this.close(0);
/**
* @inheritDoc
*/
_renderTemplate() {
return zb.ext.about.popups.templates.about(this._getTemplateData(), this._getTemplateOptions());
}
this._keyProcessCounter++;
return true;
};


/**
* @type {zb.ext.about.popups.templates.AboutOut}
* @protected
*/
zb.popups.About.prototype._exported;


/**
* @type {number}
* @private
*/
zb.popups.About.prototype._keyProcessCounter;
/**
* @inheritDoc
*/
_processKey() {
if (this._keyProcessCounter > 0) {
this.close(0);
}
this._keyProcessCounter++;

return true;
}

/**
* @param {Array.<zb.device.input.Keys>} seq
*/
zb.popups.About.setKeySequence = function(seq) {
zb.popups.About._sequence = seq;
zb.popups.About._currentPosition = 0;
};
/**
* @param {Array.<zb.device.input.Keys>} seq
*/
static setKeySequence(seq) {
zb.popups.About._sequence = seq;
zb.popups.About._currentPosition = 0;
}


/**
* @param {zb.device.input.Keys} zbKey
*/
zb.popups.About.processKey = function(zbKey) {
var seq = zb.popups.About._sequence;
zb.popups.About._currentPosition = zb.popups.About._currentPosition || 0;
if (seq[zb.popups.About._currentPosition] !== zbKey) {
zb.popups.About._currentPosition = 0;
} else if (zb.popups.About._currentPosition === seq.length - 1) {
app.showChildLayer(zb.popups.About);
} else {
zb.popups.About._currentPosition++;
/**
* @param {zb.device.input.Keys} zbKey
*/
static processKey(zbKey) {
const seq = zb.popups.About._sequence;
zb.popups.About._currentPosition = zb.popups.About._currentPosition || 0;
if (seq[zb.popups.About._currentPosition] !== zbKey) {
zb.popups.About._currentPosition = 0;
} else if (zb.popups.About._currentPosition === seq.length - 1) {
app.showChildLayer(zb.popups.About);
} else {
zb.popups.About._currentPosition++;
}
}
};

Expand Down
2 changes: 1 addition & 1 deletion lib/about.jst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Application name: {{- zb.packageInfo.name }}<br>
Application version: {{- zb.packageInfo.version }}<br>
Zombiebox version: {{- zb.packageInfo.dependencies.zombiebox }}<br>
Zombiebox in web: http://zombiebox.net/
Zombiebox in web: http://zombiebox.tv/
</div>
</div>
</div>
13 changes: 11 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
{
"name": "zombiebox-extension-about",
"version": "0.1.0",
"main": "zombiebox-extension.js"
"version": "0.2.0",
"main": "zombiebox-extension.js",
"license": "MIT",
"bugs": {
"url": "https://github.com/interfaced/zombiebox-extension-about/issues"
},
"homepage": "https://github.com/interfaced/zombiebox-extension-about",
"files": [
"lib/",
"zombiebox-extension.js"
]
}
17 changes: 0 additions & 17 deletions readme.md

This file was deleted.

53 changes: 24 additions & 29 deletions zombiebox-extension.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,34 @@
var path = require('path');
const path = require('path');


/**
* @implements {IZBAddon}
*/
var extension = function() {

};


/**
* @return {string}
*/
extension.prototype.getName = function() {
return 'about';
};


/**
* @return {string}
*/
extension.prototype.getPublicDir = function() {
return path.join(__dirname, 'lib');
};


/**
* @return {Object}
*/
extension.prototype.getConfig = function() {
return {};
};
class AboutExtension {
/**
* @override
*/
getName() {
return 'about';
}

/**
* @override
*/
getPublicDir() {
return path.join(__dirname, 'lib');
}

/**
* @override
*/
getConfig() {
return {};
}
}


/**
* @type {IZBAddon}
*/
module.exports = extension;
module.exports = AboutExtension;

0 comments on commit 0ac2524

Please sign in to comment.