Skip to content

Commit

Permalink
readme updated grunt tweaks for dev
Browse files Browse the repository at this point in the history
  • Loading branch information
mattybow committed Oct 30, 2014
1 parent 6826a28 commit 6786dd8
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 45 deletions.
7 changes: 3 additions & 4 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,16 @@ module.exports = function(grunt) {
files:[
"src/**/*.scss",
"src/**/*.html",
"*.html",
"*.md",
"index.html"
],
tasks:[
"exec:sass"
]
}
});

grunt.registerTask('build', ['sass','vulcanize']);
grunt.registerTask('deploy', ['copy','gh-pages']);
grunt.registerTask('build', ['sass','vulcanize','copy']);
grunt.registerTask('deploy', ['gh-pages']);
grunt.registerTask('serve', ['build','connect','watch']);

};
21 changes: 7 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ a polymer web-component for displaying gifs thru [gfycat](http://gfycat.com/)'s

## Demo

[Check it live!](http://mattybow.github.io/gfy-cat)
[See this working here](http://mattybow.github.io/gfy-cat)

## Install

Expand All @@ -28,30 +28,23 @@ Or [download as ZIP](https://github.com/mattybow/gfy-cat/archive/master.zip).
</body>
```

Use, [grunt-vulcanize](https://github.com/Polymer/grunt-vulcanize) to reduce network requests

## Options

Attribute | Options | Default | Description
--- | --- | --- | ---
`src` | *string* | `` | .gif source url
`gfyName` | *string* | `` | gfyName returned by gfycat.com _example:CostlyAfraidEmu_
`src` | *string* | `''` | .gif source url
`gfyName` | *string* | `''` | gfyName returned by gfycat.com _example:CostlyAfraidEmu_
`width` | *% or px* | `100%` | size you want the element
`color` | *hex rbg or rgba* | `#eee` | the color of the contols and the text
`fill` | *true or false* | `false` | true means a solid filled in polygon, false will be a path
`strokeWidth` | *integer* | `3` | controls the line width if you have fill attribute set to true
`ntimes` | *integer* | `3` | if not specified, animation will loop 3 times then pause, user can playback at will
`loop` | *true or false* | `false` | video will loop infinitely until paused or pingpong is activated in which case ntimes is set to 100

## Methods

Method | Parameters | Returns | Description
--- | --- | --- | ---
`unicorn()` | None. | Nothing. | Magic stuff appears.

## Events

Event | Description
--- | ---
`onsomething` | Triggers when something happens.
## Compatibility
Please see bottom of the [demo](http://mattybow.github.io/gfy-cat) on notes about iOS safari fallbacks

## Development

Expand Down
4 changes: 0 additions & 4 deletions dist/gfy-cat.html

This file was deleted.

40 changes: 21 additions & 19 deletions dist/gfy-cat/gfy-cat.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/gfy-cat/gfy-cat.css.map

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

20 changes: 17 additions & 3 deletions dist/gfy-cat/gfy-cat.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@
}.bind(this));
this.$.gfyAjax.go();
}
if(this.isIdevice()){
this.$.vid.style.height=this.$.vid.getBoundingClientRect().width+'px';
this.$.vid.setAttribute('controls','true');
this.$.vid.addEventListener('loadedmetadata',this.scaleMedia.bind(this));
}
},
addLoopAttr:function(){
this.$.vid.setAttribute('loop','true');
Expand All @@ -121,6 +126,12 @@
}
},

scaleMedia:function(e){
var curWidth = this.$.vid.getBoundingClientRect().width;
var calcHeight = Math.floor((this.$.vid.videoHeight * curWidth)/ this.$.vid.videoWidth);
this.$.vid.style.height=calcHeight+'px';
},

incrementPlayCount:function(){
this.playCount++;
//console.log("playCount=" + this.playCount,"endCount="+this.ntimes);
Expand All @@ -140,7 +151,7 @@
},
pingPongActiveChanged:function(){
this.toggleNTimes();
console.log('ntimes changed, now:'+this.ntimes);
//console.log('ntimes changed, now:'+this.ntimes);
},

toggleNTimes:function(){
Expand Down Expand Up @@ -187,6 +198,9 @@
isMobile:function(){
return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
isIdevice:function(){
return (/iPhone|iPad|iPod/i.test(navigator.userAgent));
},
hoverOutHandle:function(){
if(this.hideTimeOut){
clearTimeout(this.hideTimeOut);
Expand Down Expand Up @@ -232,10 +246,10 @@
reversePlayback:function(e,d,s){
if(this.playMode === 'reverse'){
this.playMode = 'forward';
console.log('play forward');
//console.log('play forward');
} else {
this.playMode = 'reverse';
console.log('play backward');
//console.log('play backward');
}

if(e) {
Expand Down
6 changes: 6 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="bower_components/platform/platform.js"></script>
<!--uncomment this out for dev-->
<!--<link rel="import" href="src/gfy-cat/gfy-cat.html">
<link rel="import" href="bower_components/paper-button/paper-button.html">
<link rel="import" href="bower_components/x-gif/dist/x-gif.html">-->

<!--comment this out for dev, vulcanize takes too long on livereload-->
<link rel="import" href="gfy-cat-demo.vulcanized.html">
<style>
body {
Expand Down

0 comments on commit 6786dd8

Please sign in to comment.