-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f5abce7
Showing
41 changed files
with
626 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"directory": "bower_components", | ||
"analytics": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# EditorConfig helps developers define and maintain consistent | ||
# coding styles between different editors and IDEs | ||
# editorconfig.org | ||
|
||
root = true | ||
|
||
|
||
[*] | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.js] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.hbs] | ||
insert_final_newline = false | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.css] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.html] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.{diff,md}] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
/** | ||
Ember CLI sends analytics information by default. The data is completely | ||
anonymous, but there are times when you might want to disable this behavior. | ||
|
||
Setting `disableAnalytics` to true will prevent any data from being sent. | ||
*/ | ||
"disableAnalytics": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# See http://help.github.com/ignore-files/ for more about ignoring files. | ||
|
||
# compiled output | ||
/dist | ||
/tmp | ||
|
||
# dependencies | ||
/node_modules | ||
/bower_components | ||
|
||
# misc | ||
/.sass-cache | ||
/connect.lock | ||
/coverage/* | ||
/libpeerconnection.log | ||
npm-debug.log | ||
testem.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"predef": [ | ||
"document", | ||
"window", | ||
"-Promise" | ||
], | ||
"browser": true, | ||
"boss": true, | ||
"curly": true, | ||
"debug": false, | ||
"devel": true, | ||
"eqeqeq": true, | ||
"evil": true, | ||
"forin": false, | ||
"immed": false, | ||
"laxbreak": false, | ||
"newcap": true, | ||
"noarg": true, | ||
"noempty": false, | ||
"nonew": false, | ||
"nomen": false, | ||
"onevar": false, | ||
"plusplus": false, | ||
"regexp": false, | ||
"undef": true, | ||
"sub": true, | ||
"strict": false, | ||
"white": false, | ||
"eqnull": true, | ||
"esnext": true, | ||
"unused": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
bower_components/ | ||
tests/ | ||
tmp/ | ||
|
||
.bowerrc | ||
.editorconfig | ||
.ember-cli | ||
.travis.yml | ||
.npmignore | ||
**/.gitkeep | ||
bower.json | ||
Brocfile.js | ||
testem.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
language: node_js | ||
node_js: | ||
- "0.12" | ||
|
||
sudo: false | ||
|
||
cache: | ||
directories: | ||
- node_modules | ||
|
||
before_install: | ||
- "npm config set spin false" | ||
- "npm install -g npm@^2" | ||
|
||
install: | ||
- npm install -g bower | ||
- npm install | ||
- bower install | ||
|
||
script: | ||
- npm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* jshint node: true */ | ||
/* global require, module */ | ||
|
||
var EmberAddon = require('ember-cli/lib/broccoli/ember-addon'); | ||
|
||
var app = new EmberAddon(); | ||
|
||
// Use `app.import` to add additional libraries to the generated | ||
// output files. | ||
// | ||
// If you need to use different assets in different | ||
// environments, specify an object as the first parameter. That | ||
// object's keys should be the environment name and the values | ||
// should be the asset to use in that environment. | ||
// | ||
// If the library that you are including contains AMD or ES6 | ||
// modules that you would like to import into your application | ||
// please specify an object with the list of modules as keys | ||
// along with the exports of each module as its value. | ||
|
||
module.exports = app.toTree(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2015 | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# Ember skeleton # | ||
|
||
[![Build Status](https://secure.travis-ci.org/dockyard/ember-skeleton.svg?branch=master)](http://travis-ci.org/dockyard/ember-skeleton) | ||
|
||
## About ## | ||
|
||
Show fast-loading temporary images in place of an eventual slow-loading | ||
image. | ||
|
||
## Building yourself ## | ||
|
||
```bash | ||
npm install && bower install | ||
ember build | ||
``` | ||
|
||
The builds will be in the `dist/` directory. | ||
|
||
## Installing ## | ||
|
||
`ember install ember-skeleton` | ||
|
||
## Looking for help? ## | ||
|
||
If it is a bug [please open an issue on GitHub](https://github.com/dockyard/ember-skeleton/issues). | ||
|
||
## Usage ## | ||
|
||
Simply use the component in your templates: | ||
|
||
```hbs | ||
{{skeleton-img src="/path/to/large/image.png" tmpSrc="/path/to/small/placeholder.png"}} | ||
``` | ||
|
||
The workflow is thus: | ||
|
||
1. The `tmpSrc` image will be loaded first | ||
2. Once complete the `src` image will attempt to load | ||
3. If the `src` completes successfully it will be displayed | ||
4. If the `src` does not complete successfully the `tmpSrc` will stay | ||
5. If an optional `errorSrc` is provided that image will be displayed in | ||
the even of `src` not completing successfully. | ||
|
||
### Error Example ### | ||
|
||
```hbs | ||
{{skeleton-img src="/path/to/invalid/large/image.png" tmpSrc="/path/to/small/placeholder.png" errorSrc="/path/to/error/placeholder.png"}} | ||
``` | ||
|
||
## Authors ## | ||
|
||
* [Brian Cardarella](http://twitter.com/bcardarella) | ||
|
||
[We are very thankful for the many contributors](https://github.com/dockyard/ember-skeleton/graphs/contributors) | ||
|
||
## Versioning ## | ||
|
||
This library follows [Semantic Versioning](http://semver.org) | ||
|
||
## Want to help? ## | ||
|
||
Please do! We are always looking to improve this library. Please see our | ||
[Contribution Guidelines](https://github.com/dockyard/ember-skeleton/blob/master/CONTRIBUTING.md) | ||
on how to properly submit issues and pull requests. | ||
|
||
## Legal ## | ||
|
||
[DockYard](http://dockyard.com), Inc © 2015 | ||
|
||
[@dockyard](http://twitter.com/dockyard) | ||
|
||
[Licensed under the MIT license](http://www.opensource.org/licenses/mit-license.php) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import Ember from 'ember'; | ||
|
||
const { | ||
set, | ||
get, | ||
on | ||
} = Ember; | ||
|
||
export default Ember.Component.extend({ | ||
setupSrcs: on('init', function() { | ||
set(this, 'actualSrc', get(this, 'src')); | ||
set(this, 'src', get(this, 'tmpSrc')); | ||
set(this, 'loadState', 'loading'); | ||
}), | ||
setupImgBindings: on('init', function() { | ||
set(this, 'imgBindings', { | ||
loadTmp: this.loadTmp.bind(this), | ||
loadActual: this.loadActual.bind(this), | ||
errorActual: this.errorActual.bind(this) | ||
}); | ||
}), | ||
classNames: ['skeleton-img'], | ||
classNameBindings: ['loadState'], | ||
tagName: 'img', | ||
attributeBindings: [ | ||
'src' | ||
], | ||
didInsertElement() { | ||
let target = this.element; | ||
let loadTmp = get(this, 'imgBindings.loadTmp'); | ||
target.addEventListener('load', loadTmp); | ||
}, | ||
loadTmp(event) { | ||
let target = event.target; | ||
let loadTmp = get(this, 'imgBindings.loadTmp'); | ||
let loadActual = get(this, 'imgBindings.loadActual'); | ||
let errorActual = get(this, 'imgBindings.errorActual'); | ||
target.removeEventListener('load', loadTmp); | ||
target.addEventListener('load', loadActual); | ||
target.addEventListener('error', errorActual); | ||
set(this, 'src', get(this, 'actualSrc')); | ||
}, | ||
loadActual(event) { | ||
set(this, 'loadState', 'loaded'); | ||
this.removeEvents(event.target); | ||
}, | ||
errorActual(event) { | ||
let errorSrc = get(this, 'errorSrc') || get(this, 'tmpSrc'); | ||
this.removeEvents(event.target); | ||
set(this, 'src', errorSrc); | ||
set(this, 'loadState', 'load-error'); | ||
}, | ||
removeEvents(target) { | ||
let loadActual = get(this, 'imgBindings.loadActual'); | ||
let errorActual = get(this, 'imgBindings.errorActual'); | ||
target.removeEventListener('load', loadActual); | ||
target.removeEventListener('error', errorActual); | ||
} | ||
}); |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import SkeletonImg from 'ember-skeleton/components/skeleton-img'; | ||
|
||
export default SkeletonImg.extend(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "ember-skeleton", | ||
"dependencies": { | ||
"ember": "1.11.1", | ||
"ember-cli-shims": "ember-cli/ember-cli-shims#0.0.3", | ||
"ember-cli-test-loader": "ember-cli-test-loader#0.1.3", | ||
"ember-data": "1.0.0-beta.16.1", | ||
"ember-load-initializers": "ember-cli/ember-load-initializers#0.1.4", | ||
"ember-qunit": "0.3.1", | ||
"ember-qunit-notifications": "0.0.7", | ||
"ember-resolver": "~0.1.15", | ||
"jquery": "^1.11.1", | ||
"loader.js": "ember-cli/loader.js#3.2.0", | ||
"qunit": "~1.17.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
'use strict'; | ||
|
||
module.exports = function(/* environment, appConfig */) { | ||
return { }; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/* jshint node: true */ | ||
'use strict'; | ||
|
||
module.exports = { | ||
name: 'ember-skeleton' | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"name": "ember-skeleton", | ||
"version": "0.0.0", | ||
"description": "The default blueprint for ember-cli addons.", | ||
"directories": { | ||
"doc": "doc", | ||
"test": "tests" | ||
}, | ||
"scripts": { | ||
"start": "ember server", | ||
"build": "ember build", | ||
"test": "ember try:testall" | ||
}, | ||
"repository": "", | ||
"engines": { | ||
"node": ">= 0.10.0" | ||
}, | ||
"author": "", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"broccoli-asset-rev": "^2.0.2", | ||
"ember-cli": "0.2.3", | ||
"ember-cli-app-version": "0.3.3", | ||
"ember-cli-content-security-policy": "0.4.0", | ||
"ember-cli-dependency-checker": "0.0.8", | ||
"ember-cli-htmlbars": "0.7.4", | ||
"ember-cli-ic-ajax": "0.1.1", | ||
"ember-cli-inject-live-reload": "^1.3.0", | ||
"ember-cli-qunit": "0.3.10", | ||
"ember-cli-uglify": "1.0.1", | ||
"ember-data": "1.0.0-beta.16.1", | ||
"ember-export-application-global": "^1.0.2", | ||
"ember-disable-prototype-extensions": "^1.0.0", | ||
"ember-try": "0.0.4" | ||
}, | ||
"keywords": [ | ||
"ember-addon" | ||
], | ||
"dependencies": { | ||
"ember-cli-babel": "^5.0.0" | ||
}, | ||
"ember-addon": { | ||
"configPath": "tests/dummy/config" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"framework": "qunit", | ||
"test_page": "tests/index.html?hidepassed", | ||
"launch_in_ci": [ | ||
"PhantomJS" | ||
], | ||
"launch_in_dev": [ | ||
"PhantomJS", | ||
"Chrome" | ||
] | ||
} |
Oops, something went wrong.