Setup modules, Gruntfile, File Structure, etc
This commit is contained in:
parent
94e867874b
commit
86113d017d
92
Gruntfile.js
92
Gruntfile.js
@ -1,16 +1,44 @@
|
|||||||
var path = require('path'),
|
|
||||||
fs = require('fs');
|
|
||||||
|
|
||||||
module.exports = function(grunt) {
|
module.exports = function(grunt) {
|
||||||
|
require('grunt-task-loader')(grunt);
|
||||||
|
|
||||||
grunt.initConfig({
|
grunt.initConfig({
|
||||||
|
browserify: {
|
||||||
|
dev: {
|
||||||
|
files: {
|
||||||
|
'build/main.js': 'src/js/**/*'
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
transform: ['babelify'],
|
||||||
|
plugin: [
|
||||||
|
[
|
||||||
|
'remapify', [
|
||||||
|
{
|
||||||
|
src: '**/*.js',
|
||||||
|
expose: 'components',
|
||||||
|
cwd: __dirname + '/src/js/components/'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
prod: {
|
||||||
|
files: {
|
||||||
|
'build/main.js': 'src/js/**/*'
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
transform: ['babelify', 'uglifyify']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
less: {
|
less: {
|
||||||
development: {
|
dev: {
|
||||||
files: [{
|
files: [{
|
||||||
src: 'less/main.less',
|
src: 'less/main.less',
|
||||||
dest: 'style.css'
|
dest: 'style.css'
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
production: {
|
prod: {
|
||||||
options: {
|
options: {
|
||||||
plugins: require('less-plugin-clean-css')()
|
plugins: require('less-plugin-clean-css')()
|
||||||
},
|
},
|
||||||
@ -20,64 +48,14 @@ module.exports = function(grunt) {
|
|||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
uglify: {
|
|
||||||
production: {
|
|
||||||
files: {
|
|
||||||
'main.js': 'js/**/*.js'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
injector: {
|
|
||||||
options: {
|
|
||||||
transform: function(file) {
|
|
||||||
var ext = path.extname(file).slice(1);
|
|
||||||
|
|
||||||
switch (ext) {
|
|
||||||
case 'css':
|
|
||||||
return '<link rel="stylesheet" href="' + file + '" />';
|
|
||||||
case 'js':
|
|
||||||
return '<script src="' + file + '"></script>';
|
|
||||||
case 'html':
|
|
||||||
return fs.readFileSync(__dirname + file);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
development: {
|
|
||||||
files: {
|
|
||||||
'index.html': ['js/libs/*.js', 'js/*.js',
|
|
||||||
'style.css', 'partials/**/*.html'],
|
|
||||||
'how.html': ['js/libs/*.js', 'js/*.js',
|
|
||||||
'style.css', 'partials/0-header.html',
|
|
||||||
'partials/how*.html']
|
|
||||||
}
|
|
||||||
},
|
|
||||||
production: {
|
|
||||||
files: {
|
|
||||||
'index.html': ['main.js', 'style.css', 'partials/**/*.html'],
|
|
||||||
'how.html': ['main.js', 'style.css',
|
|
||||||
'partials/0-header.html', 'partials/how*.html']
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
watch: {
|
watch: {
|
||||||
styles: {
|
styles: {
|
||||||
files: ['less/**/*.less'],
|
files: ['less/**/*.less'],
|
||||||
tasks: ['less']
|
tasks: ['less']
|
||||||
},
|
|
||||||
partials: {
|
|
||||||
files: ['partials/**/*.html'],
|
|
||||||
tasks: ['injector']
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
grunt.loadNpmTasks('grunt-contrib-less');
|
grunt.registerTask('default', ['browserify:dev', 'less:dev']);
|
||||||
grunt.loadNpmTasks('grunt-contrib-watch');
|
grunt.registerTask('production', ['browserify:prod', 'less:prod']);
|
||||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
|
||||||
grunt.loadNpmTasks('grunt-asset-injector');
|
|
||||||
|
|
||||||
grunt.registerTask('default', ['less:development', 'injector:development']);
|
|
||||||
grunt.registerTask('production', ['less:production',
|
|
||||||
'uglify:production',
|
|
||||||
'injector:production']);
|
|
||||||
};
|
};
|
||||||
|
21419
build/main.js
Normal file
21419
build/main.js
Normal file
File diff suppressed because it is too large
Load Diff
24
manifest.webapp
Normal file
24
manifest.webapp
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"version": "0.1.0",
|
||||||
|
"name": "Hawk",
|
||||||
|
"description": "Keep an eye on your files with a full-featured file-manager",
|
||||||
|
"launch_path": "/index.html",
|
||||||
|
"icons": {
|
||||||
|
"16": "/img/icons/icon16x16.png",
|
||||||
|
"48": "/img/icons/icon48x48.png",
|
||||||
|
"60": "/img/icons/icon60x60.png",
|
||||||
|
"128": "/img/icons/icon128x128.png"
|
||||||
|
},
|
||||||
|
"developer": {
|
||||||
|
"name": "Mahdi Dibaiee",
|
||||||
|
"url": "http://dibaiee.ir"
|
||||||
|
},
|
||||||
|
"type": "privileged",
|
||||||
|
"permissions": {},
|
||||||
|
"installs_allowed_from": [
|
||||||
|
"*"
|
||||||
|
],
|
||||||
|
"locales": {
|
||||||
|
},
|
||||||
|
"default_locale": "en"
|
||||||
|
}
|
15
package.json
15
package.json
@ -30,11 +30,20 @@
|
|||||||
"homepage": "https://github.com/mdibaiee/",
|
"homepage": "https://github.com/mdibaiee/",
|
||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"babelify": "^6.2.0",
|
||||||
|
"browserify": "^11.0.1",
|
||||||
"grunt": "^0.4.5",
|
"grunt": "^0.4.5",
|
||||||
"grunt-asset-injector": "^0.1.0",
|
"grunt-browserify": "^4.0.0",
|
||||||
"grunt-contrib-less": "^1.0.1",
|
"grunt-contrib-less": "^1.0.1",
|
||||||
"grunt-contrib-uglify": "^0.9.2",
|
|
||||||
"grunt-contrib-watch": "^0.6.1",
|
"grunt-contrib-watch": "^0.6.1",
|
||||||
"less-plugin-clean-css": "^1.5.1"
|
"grunt-fxos": "^0.1.2",
|
||||||
|
"grunt-task-loader": "^0.6.0",
|
||||||
|
"less-plugin-clean-css": "^1.5.1",
|
||||||
|
"react": "^0.13.3",
|
||||||
|
"react-redux": "^1.0.1",
|
||||||
|
"redux": "^1.0.1",
|
||||||
|
"redux-devtools": "^1.1.2",
|
||||||
|
"remapify": "^2.0.3",
|
||||||
|
"uglifyify": "^3.0.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
3
src/data/en-US.properties
Normal file
3
src/data/en-US.properties
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
app_title = Privileged empty app
|
||||||
|
app_description.innerHTML = This app is empty. Fill it with your own stuff!
|
||||||
|
message = Hello world
|
3
src/data/es.properties
Normal file
3
src/data/es.properties
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
app_title = Aplicación vacía privilegiada
|
||||||
|
app_description.innerHTML = Esta aplicación está vacía. ¡Lista para que añadas tu código!
|
||||||
|
message = ¡Hola, mundo!
|
5
src/data/locales.ini
Normal file
5
src/data/locales.ini
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
@import url(en-US.properties)
|
||||||
|
|
||||||
|
[es]
|
||||||
|
@import url(es.properties)
|
||||||
|
|
5
src/js/components/root.js
Normal file
5
src/js/components/root.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
export default React.createClass({
|
||||||
|
render() {
|
||||||
|
return <div></div>;
|
||||||
|
}
|
||||||
|
});
|
1571
src/js/libs/l10n.js
Normal file
1571
src/js/libs/l10n.js
Normal file
File diff suppressed because it is too large
Load Diff
2
src/js/main.js
Normal file
2
src/js/main.js
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
import Root from 'components/root'
|
||||||
|
let x = "I'm just testing";
|
202
template/LICENSE
Normal file
202
template/LICENSE
Normal file
@ -0,0 +1,202 @@
|
|||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright 2014 Mozilla Foundation
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
|
68
template/README.md
Normal file
68
template/README.md
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
# Privileged empty app
|
||||||
|
|
||||||
|
This is a privileged empty app template that provides you with a barebones structure for you to build your app.
|
||||||
|
|
||||||
|
This is part of the [mortar](https://github.com/mozilla/mortar/) template collection for building [Open Web Apps](https://developer.mozilla.org/Apps).
|
||||||
|
|
||||||
|
## Obtaining
|
||||||
|
|
||||||
|
There are a few ways to get this template:
|
||||||
|
|
||||||
|
If you use [Git](http://www.git-scm.com/):
|
||||||
|
|
||||||
|
````bash
|
||||||
|
git clone https://github.com/mozilla/mortar-privileged-empty-app.git
|
||||||
|
````
|
||||||
|
|
||||||
|
Or download the latest version in this [ZIP file](https://github.com/mozilla/mortar-privileged-empty-app/archive/master.zip).
|
||||||
|
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
Import the app into the [App Manager](https://developer.mozilla.org/Firefox_OS/Using_the_App_Manager). Then you can run it in the simulator, or in a Firefox OS device.
|
||||||
|
|
||||||
|
## Code walkthrough
|
||||||
|
|
||||||
|
The `manifest.webapp` file contains metadata about the app, such as its name, description, icon and required permissions for running under Firefox OS.
|
||||||
|
|
||||||
|
Moving over to `index.html`, this is the starting point for the app when it's launched, and also where the layout is defined and the JavaScript files with the functionality and logic are loaded.
|
||||||
|
|
||||||
|
The appearance is defined in `css/app.css`. There are just some very basic rules.
|
||||||
|
|
||||||
|
We define the app's behaviour in `js/app.js`. Right now we're just basically displaying a "Hello world" message.
|
||||||
|
|
||||||
|
Finally we are also including `js/libs/l10n.js`, which contains [L10n](https://developer.mozilla.org/en-US/docs/Web/API/L10n_API), a library for translating the strings in the app. Using this library, users can run the app in their own language, as long as you provide the translations for those languages. We're currently including a translation to Spanish as an example, but feel free to contribute with more translations in `data/locales.ini`, looking at `data/es.properties` and `data/en-US.properties` to see the syntax in action. The way it works, it will automatically translate the HTML elements that contain a `data-l10n-id` attribute with the translation identifier.
|
||||||
|
|
||||||
|
For any dynamically shown content, you need to use the `navigator.webL10n.get` function, but since that is slightly tedious to write each time, we're aliasing it to just `translate`:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var translate = navigator.mozL10n.get;
|
||||||
|
```
|
||||||
|
|
||||||
|
## Getting help
|
||||||
|
|
||||||
|
If you find something that doesn't quite work as you'd expect, we'd appreciate if you [filed a bug](https://github.com/mozilla/mortar-privileged-empty-app/issues)!
|
||||||
|
|
||||||
|
We need your help in order to help you. Therefore:
|
||||||
|
|
||||||
|
1. Tell us which version of the template are you using. Where did you get the code from?
|
||||||
|
* Specify the environment where the bug occurs i.e. which version of the Simulator or Firefox OS device. An example would be `1.2 simulator` or `Boot2Gecko 1.4.0.0`.
|
||||||
|
* Describe the problem in detail. What were you doing? What happened? What did you expect to happen?
|
||||||
|
* Probably also provide a test case so we can see what is happening and try to reproduce the error.
|
||||||
|
|
||||||
|
Ultimately it all boils down to the fact that if we can't reproduce it, we can't help you or fix it either.
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
Contributions are always welcome! If you want to collaborate, whether that is with a new feature or fixing a bug, we recommend you...
|
||||||
|
|
||||||
|
1. Have a look at the [issue tracker](https://github.com/mozilla/mortar-privileged-empty-app/issues) first--to make sure there isn't anyone working on that already.
|
||||||
|
* If it's a new issue/feature, or no one is working on it already, fork the project in GitHub (you'll need an account if you don't have it yet).
|
||||||
|
* Create the bug to let us know you want to work on this. That way we are aware of and can keep an eye on it, or maybe tell you that it is not a bug but an intended feature, and save you the hassle of working on something that is not needed.
|
||||||
|
* Clone your fork to your computer (i.e. get the code onto your computer)
|
||||||
|
* Make a new branch, and switch to that new branch
|
||||||
|
* Do the changes you deem necessary
|
||||||
|
* Push the branch to GitHub
|
||||||
|
* Send a pull request
|
||||||
|
|
||||||
|
To make your changes as easy to merge back onto the project as possible, you should only work on one feature per branch. That makes code review simpler and faster!
|
18
template/css/app.css
Normal file
18
template/css/app.css
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
html, body {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-size: 1rem;
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
margin: 0 0 1rem 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
font-size: inherit;
|
||||||
|
}
|
||||||
|
|
106
template/img/icons/icon.svg
Normal file
106
template/img/icons/icon.svg
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns:sketch="http://www.bohemiancoding.com/sketch/ns"
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
width="128px"
|
||||||
|
height="128px"
|
||||||
|
viewBox="0 0 128 128"
|
||||||
|
version="1.1"
|
||||||
|
id="svg2"
|
||||||
|
inkscape:version="0.48.2 r9819"
|
||||||
|
sodipodi:docname="icon.svg">
|
||||||
|
<metadata
|
||||||
|
id="metadata14">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<sodipodi:namedview
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1"
|
||||||
|
objecttolerance="10"
|
||||||
|
gridtolerance="10"
|
||||||
|
guidetolerance="10"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:window-width="1142"
|
||||||
|
inkscape:window-height="849"
|
||||||
|
id="namedview12"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:zoom="1.84375"
|
||||||
|
inkscape:cx="-32.542373"
|
||||||
|
inkscape:cy="64"
|
||||||
|
inkscape:window-x="672"
|
||||||
|
inkscape:window-y="146"
|
||||||
|
inkscape:window-maximized="0"
|
||||||
|
inkscape:current-layer="Page-1" />
|
||||||
|
<!-- Generator: Sketch 3.0.2 (7799) - http://www.bohemiancoding.com/sketch -->
|
||||||
|
<title
|
||||||
|
id="title4">empty</title>
|
||||||
|
<description
|
||||||
|
id="description6">Created with Sketch.</description>
|
||||||
|
<defs
|
||||||
|
id="defs8">
|
||||||
|
<linearGradient
|
||||||
|
id="linearGradient3761">
|
||||||
|
<stop
|
||||||
|
style="stop-color:#4e748b;stop-opacity:1;"
|
||||||
|
offset="0"
|
||||||
|
id="stop3763" />
|
||||||
|
<stop
|
||||||
|
style="stop-color:#393e3f;stop-opacity:1;"
|
||||||
|
offset="1"
|
||||||
|
id="stop3765" />
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient3761"
|
||||||
|
id="linearGradient3767"
|
||||||
|
x1="129.66949"
|
||||||
|
y1="65.8983"
|
||||||
|
x2="129.66949"
|
||||||
|
y2="188.59828"
|
||||||
|
gradientUnits="userSpaceOnUse" />
|
||||||
|
</defs>
|
||||||
|
<path
|
||||||
|
sodipodi:type="arc"
|
||||||
|
style="fill:url(#linearGradient3767);fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||||
|
id="path2991"
|
||||||
|
sodipodi:cx="129.35593"
|
||||||
|
sodipodi:cy="128.27118"
|
||||||
|
sodipodi:rx="63.18644"
|
||||||
|
sodipodi:ry="63.18644"
|
||||||
|
d="m 192.54237,128.27118 a 63.18644,63.18644 0 1 1 -126.372883,0 63.18644,63.18644 0 1 1 126.372883,0 z"
|
||||||
|
transform="translate(-65.355927,-64.271179)" />
|
||||||
|
<g
|
||||||
|
id="Page-1"
|
||||||
|
sketch:type="MSPage"
|
||||||
|
transform="matrix(0.9,0,0,0.9,6.4,6.4)"
|
||||||
|
style="fill:none;stroke:none">
|
||||||
|
<circle
|
||||||
|
id="empty"
|
||||||
|
sketch:type="MSShapeGroup"
|
||||||
|
cx="64"
|
||||||
|
cy="64"
|
||||||
|
r="58"
|
||||||
|
sodipodi:cx="64"
|
||||||
|
sodipodi:cy="64"
|
||||||
|
sodipodi:rx="58"
|
||||||
|
sodipodi:ry="58"
|
||||||
|
style="stroke:#bcc6c5;stroke-width:11;stroke-linecap:round;stroke-dasharray:20, 20;fill:none;fill-opacity:1"
|
||||||
|
d="M 122,64 C 122,96.032515 96.032515,122 64,122 31.967485,122 6,96.032515 6,64 6,31.967485 31.967485,6 64,6 c 32.032515,0 58,25.967485 58,58 z" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 3.2 KiB |
BIN
template/img/icons/icon128x128.png
Normal file
BIN
template/img/icons/icon128x128.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.6 KiB |
BIN
template/img/icons/icon16x16.png
Normal file
BIN
template/img/icons/icon16x16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 804 B |
BIN
template/img/icons/icon48x48.png
Normal file
BIN
template/img/icons/icon48x48.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
BIN
template/img/icons/icon60x60.png
Normal file
BIN
template/img/icons/icon60x60.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.3 KiB |
48
template/index.html
Normal file
48
template/index.html
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Privileged app</title>
|
||||||
|
<meta name="description" content="A privileged app stub">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
viewport allows you to control how mobile browsers will render your content.
|
||||||
|
width=device-width tells mobile browsers to render your content across the
|
||||||
|
full width of the screen, without being zoomed out (by default it would render
|
||||||
|
it at a desktop width, then shrink it to fit.)
|
||||||
|
Read more about it here:
|
||||||
|
https://developer.mozilla.org/Mozilla/Mobile/Viewport_meta_tag
|
||||||
|
-->
|
||||||
|
<meta name="viewport" content="width=device-width">
|
||||||
|
<link rel="stylesheet" href="css/app.css">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Inline JavaScript code is not allowed for privileged and certified apps,
|
||||||
|
due to Content Security Policy restrictions.
|
||||||
|
You can read more about it here: https://developer.mozilla.org/Apps/CSP
|
||||||
|
Plus keeping your JavaScript separated from your HTML is always a good practice!
|
||||||
|
|
||||||
|
We're also using the 'defer' attribute. This allows us to tell the browser that
|
||||||
|
it should not wait for this file to load before continuing to load the rest of
|
||||||
|
resources in the page. Then, once everything has been loaded, it will parse and
|
||||||
|
execute the deferred files.
|
||||||
|
Read about defer: https://developer.mozilla.org/Web/HTML/Element/script#attr-defer
|
||||||
|
-->
|
||||||
|
<script type="text/javascript" src="js/app.js" defer></script>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
The following two lines are for loading the localisations library
|
||||||
|
and the localisation data-so people can use the app in their
|
||||||
|
own language (as long as you provide translations).
|
||||||
|
-->
|
||||||
|
<link rel="prefetch" type="application/l10n" href="data/locales.ini" />
|
||||||
|
<script type="text/javascript" src="js/libs/l10n.js" defer></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<section>
|
||||||
|
<h1 data-l10n-id="app_title">Privileged empty app</h1>
|
||||||
|
<p data-l10n-id="app_description">This app is empty. Fill it with your own stuff!</p>
|
||||||
|
<p id="message"></p>
|
||||||
|
</section>
|
||||||
|
</body>
|
||||||
|
</html>
|
29
template/js/app.js
Normal file
29
template/js/app.js
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
// DOMContentLoaded is fired once the document has been loaded and parsed,
|
||||||
|
// but without waiting for other external resources to load (css/images/etc)
|
||||||
|
// That makes the app more responsive and perceived as faster.
|
||||||
|
// https://developer.mozilla.org/Web/Reference/Events/DOMContentLoaded
|
||||||
|
window.addEventListener('DOMContentLoaded', function() {
|
||||||
|
|
||||||
|
// We'll ask the browser to use strict code to help us catch errors earlier.
|
||||||
|
// https://developer.mozilla.org/Web/JavaScript/Reference/Functions_and_function_scope/Strict_mode
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var translate = navigator.mozL10n.get;
|
||||||
|
|
||||||
|
// We want to wait until the localisations library has loaded all the strings.
|
||||||
|
// So we'll tell it to let us know once it's ready.
|
||||||
|
navigator.mozL10n.once(start);
|
||||||
|
|
||||||
|
// ---
|
||||||
|
|
||||||
|
function start() {
|
||||||
|
|
||||||
|
var message = document.getElementById('message');
|
||||||
|
|
||||||
|
// We're using textContent because inserting content from external sources into your page using innerHTML can be dangerous.
|
||||||
|
// https://developer.mozilla.org/Web/API/Element.innerHTML#Security_considerations
|
||||||
|
message.textContent = translate('message');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
1571
template/js/libs/l10n.js
Normal file
1571
template/js/libs/l10n.js
Normal file
File diff suppressed because it is too large
Load Diff
29
template/manifest.webapp
Normal file
29
template/manifest.webapp
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"version": "0.1.0",
|
||||||
|
"name": "Hawk",
|
||||||
|
"description": "A template with the bare minimum structure",
|
||||||
|
"launch_path": "/index.html",
|
||||||
|
"icons": {
|
||||||
|
"16": "/img/icons/icon16x16.png",
|
||||||
|
"48": "/img/icons/icon48x48.png",
|
||||||
|
"60": "/img/icons/icon60x60.png",
|
||||||
|
"128": "/img/icons/icon128x128.png"
|
||||||
|
},
|
||||||
|
"developer": {
|
||||||
|
"name": "Your name",
|
||||||
|
"url": "http://example.com"
|
||||||
|
},
|
||||||
|
"type": "privileged",
|
||||||
|
"permissions": {},
|
||||||
|
"installs_allowed_from": [
|
||||||
|
"*"
|
||||||
|
],
|
||||||
|
"locales": {
|
||||||
|
"es": {
|
||||||
|
"name": "Aplicación vacía privilegiada",
|
||||||
|
"description": "Una plantilla con la mínima estructura",
|
||||||
|
"permissions": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"default_locale": "en"
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user