nc-ripple-rails 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 79499be64c19309b429cca70295ac30adb40c162
4
+ data.tar.gz: f9ff5e54f0f84b1bbcd20bee513b7973295052a1
5
+ SHA512:
6
+ metadata.gz: 4f31a66d91036848e6b1ee239ea252bbbd646bfd6d7308f751722daca4b8851ee95b1e1cbfcbc8b019252cbe4a47f3fa1652299e5bc27cb1879d81976407747f
7
+ data.tar.gz: ee96d49d4f4e415af42ce9b577f67eee03330cafc9c25246fafb75b43bfedb5c00b936352a4cea720db80a07a4ba0c961a007d283bf40899c174ff8bf572e1ff
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in nc-ripple-rails.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Nate
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,38 @@
1
+ # nc-ripple-ripple
2
+
3
+ A Wrap for nc-ripple
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'nc-ripple-rails'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install nc-ripple-rails
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Development
26
+
27
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
28
+
29
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
30
+
31
+ ## Contributing
32
+
33
+ 1. Fork it ( https://github.com/[my-github-username]/nc-ripple-rails/fork )
34
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
35
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
36
+ 4. Push to the branch (`git push origin my-new-feature`)
37
+ 5. Create a new Pull Request
38
+ # nc-ripple-rails
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "nc/ripple/rails"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,9 @@
1
+ require "nc/ripple/rails/version"
2
+
3
+ module Nc
4
+ module Ripple
5
+ module Rails
6
+ class Engine < ::Rails::Engine; end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ module Nc
2
+ module Ripple
3
+ module Rails
4
+ VERSION = "0.1.0"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'nc/ripple/rails/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "nc-ripple-rails"
8
+ spec.version = Nc::Ripple::Rails::VERSION
9
+ spec.authors = ["Nate"]
10
+ spec.email = ["boo0330@gmail.com"]
11
+
12
+ #if spec.respond_to?(:metadata)
13
+ # spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com' to prevent pushes to rubygems.org, or delete to allow pushes to any server."
14
+ #end
15
+
16
+ spec.summary = %q{The material design effect ripple in angular way, can be used on any button.}
17
+ spec.description = %q{The material design effect ripple in angular way, can be used on any button.}
18
+ spec.homepage = "https://github.com/qqnc/nc-ripple-rails"
19
+ spec.license = "MIT"
20
+
21
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
22
+ spec.bindir = "exe"
23
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ spec.require_paths = ["lib"]
25
+
26
+ spec.add_development_dependency "bundler", "~> 1.8"
27
+ spec.add_development_dependency "rake", "~> 10.0"
28
+
29
+ spec.add_dependency "angularjs-rails"
30
+ end
@@ -0,0 +1,113 @@
1
+ angular.module('nc.ripple', [])
2
+ .directive("ncRipple", function() {
3
+ return {
4
+ restrict: 'A',
5
+ scope: {
6
+ rOpacity: '@',
7
+ rSize: '@',
8
+ rDuration: '@',
9
+ rColor: '@'
10
+ },
11
+ link: function(scope, element, attrs) {
12
+
13
+ var COLOR_REGEXP = "^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$";
14
+ var cutHex = function(h) {return (h.charAt(0)=="#") ? h.substring(1,7):h}
15
+ var hexToR = function(h) {return parseInt((cutHex(h)).substring(0,2),16)}
16
+ var hexToG = function(h) {return parseInt((cutHex(h)).substring(2,4),16)}
17
+ var hexToB = function(h) {return parseInt((cutHex(h)).substring(4,6),16)}
18
+
19
+ /* Initailizing */
20
+ element.css('overflow', 'hidden');
21
+ element.css('transform', 'translateZ(0)');
22
+
23
+ if(scope.rOpacity && scope.rOpacity >= 0 && scope.rOpacity <=1)
24
+ ;
25
+ else
26
+ scope.rOpacity = '.5';
27
+
28
+ if(!scope.rSize)
29
+ scope.rSize = 200;
30
+ if(!scope.rDuration)
31
+ scope.rDuration=1.5;
32
+
33
+ scope.rDurationS = scope.rDuration +'s';
34
+ /* End of initializing */
35
+ var r=220,g=220,b=220;
36
+
37
+ var validates = new RegExp(COLOR_REGEXP);
38
+ if (scope.rColor && validates.test(scope.rColor)){
39
+
40
+ r=hexToR(scope.rColor);
41
+ g=hexToG(scope.rColor);
42
+ b=hexToB(scope.rColor);
43
+ }
44
+
45
+
46
+ var x, y=0, size={},
47
+ offsets,
48
+ func = function(e) {
49
+
50
+ var ripple = this.querySelector('b.drop');
51
+
52
+ if (ripple == null) {
53
+ // Create ripple
54
+ ripple = document.createElement('b');
55
+ ripple.className += 'drop';
56
+
57
+ // Prepend ripple to element
58
+ this.insertBefore(ripple, this.firstChild);
59
+
60
+ ripple.style.background = 'rgba(' + r + ',' + g +',' + b + ',' + scope.rOpacity + ')'
61
+ ripple.style.height=scope.rSize+'px';
62
+ ripple.style.width=scope.rSize+'px';
63
+ size.x = ripple.offsetWidth;
64
+ size.y = ripple.offsetHeight;
65
+ }
66
+
67
+ var eventType = e.type;
68
+
69
+ // Remove animation effect
70
+ ripple.style.animationDuration=null;
71
+ ripple.style.oAnimationDuration=null;
72
+ ripple.style.webkitAnimationDuration=null;
73
+ ripple.style.mozAnimationDuration=null;
74
+ ripple.style.msAnimationDuration=null;
75
+ ripple.className = ripple.className.replace(/ ?(animate)/g, '');
76
+
77
+ // get click coordinates by event type
78
+
79
+ x = e.pageX;
80
+ y = e.pageY;
81
+
82
+ // set new ripple position by click or touch position
83
+ function getPos(element) {
84
+ var de = document.documentElement;
85
+ var box = element.getBoundingClientRect();
86
+ var top = box.top + window.pageYOffset - de.clientTop;
87
+ var left = box.left + window.pageXOffset - de.clientLeft;
88
+ return {
89
+ top: top,
90
+ left: left
91
+ };
92
+ }
93
+ offsets = getPos(element[0]);
94
+
95
+ innerPos = {};
96
+ innerPos.x = e.pageX;
97
+ innerPos.y = e.pageY;
98
+
99
+ ripple.style.left = (innerPos.x - offsets.left - size.x / 2) + 'px';
100
+ ripple.style.top = (innerPos.y - offsets.top - size.y / 2) + 'px';
101
+
102
+ // Add animation effect
103
+ ripple.style.animationDuration=scope.rDurationS;
104
+ ripple.style.oAnimationDuration=scope.rDurationS;
105
+ ripple.style.webkitAnimationDuration=scope.rDurationS;
106
+ ripple.style.mozAnimationDuration=scope.rDurationS;
107
+ ripple.style.msAnimationDuration=scope.rDurationS;
108
+ ripple.className += ' animate';
109
+ }
110
+ element.on("mouseup", func);
111
+ }
112
+ }
113
+ })
@@ -0,0 +1,28 @@
1
+ /* ng module css */
2
+ .drop {
3
+ display: block;
4
+ position: absolute;
5
+ background: rgba(220,220,220,.5);
6
+ border-radius: 100%;
7
+ transform: scale(0);
8
+ pointer-events: none;
9
+ width:200px;
10
+ height:200px;
11
+ }
12
+
13
+ .drop.animate {
14
+ /*animation: drop 1.5s ease-out;*/
15
+ -webkit-animation-name: drop;
16
+ -moz-animation-name: drop;
17
+ -o-animation-name: drop;
18
+ animation-name: drop;
19
+ transition-timing-function: ease-out;
20
+ }
21
+
22
+
23
+ @keyframes drop {
24
+ 100% {
25
+ opacity: 0;
26
+ transform: scale(2.5);
27
+ }
28
+ }
metadata ADDED
@@ -0,0 +1,100 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nc-ripple-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Nate
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-01-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.8'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.8'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: angularjs-rails
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: The material design effect ripple in angular way, can be used on any
56
+ button.
57
+ email:
58
+ - boo0330@gmail.com
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".gitignore"
64
+ - CODE_OF_CONDUCT.md
65
+ - Gemfile
66
+ - LICENSE.txt
67
+ - README.md
68
+ - Rakefile
69
+ - bin/console
70
+ - bin/setup
71
+ - lib/nc/ripple/rails.rb
72
+ - lib/nc/ripple/rails/version.rb
73
+ - nc-ripple-rails.gemspec
74
+ - vendor/assets/javascripts/nc-ripple.js
75
+ - vendor/assets/stylesheets/nc-ripple.css
76
+ homepage: https://github.com/qqnc/nc-ripple-rails
77
+ licenses:
78
+ - MIT
79
+ metadata: {}
80
+ post_install_message:
81
+ rdoc_options: []
82
+ require_paths:
83
+ - lib
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ requirements: []
95
+ rubyforge_project:
96
+ rubygems_version: 2.4.6
97
+ signing_key:
98
+ specification_version: 4
99
+ summary: The material design effect ripple in angular way, can be used on any button.
100
+ test_files: []