easy_zoom_on_rails 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +43 -0
- data/Rakefile +2 -0
- data/app/assets/javascripts/easyzoom.js +6 -0
- data/app/assets/stylesheets/easyzoom.css +65 -0
- data/easy_zoom_on_rails.gemspec +22 -0
- data/lib/easy_zoom_on_rails.rb +7 -0
- data/lib/easy_zoom_on_rails/easy_zoom_helper.rb +11 -0
- data/lib/easy_zoom_on_rails/engine.rb +4 -0
- data/lib/easy_zoom_on_rails/railtie.rb +7 -0
- data/lib/easy_zoom_on_rails/version.rb +3 -0
- metadata +84 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 114c01bfc552f78203a1065f3749269a599dddd7
|
4
|
+
data.tar.gz: db94f46b1f1991d18777257edff9b9fef9cee9e9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 61fd3dc57593e57d5905b3c50fe64861d9abb3d5fb0f8ae72bbad1613644848c4fa21020d6210fcdcbb193080eb713673f444f138af9cb5d22702b58774add5d
|
7
|
+
data.tar.gz: 4399bd95c8a2dbc61bfd988153bc206a0e01e13ef74923e3b87271b7d710e06e943c8c888623a18d833a9bf580ca3f17141352afd5f663902ab25e9227e3f7bd
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Said Kaldybaev
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# EasyZoomOnRails
|
2
|
+
|
3
|
+
EasyZoom is an elegant, highly optimised jQuery image zoom and panning plugin based on the original work by Alen Grakalic. EasyZoom supports touch-enabled devices and is easily customisable with CSS.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```
|
10
|
+
gem 'easy_zoom_on_rails'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install easy_zoom_on_rails
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
### application.js
|
24
|
+
|
25
|
+
```//= require easyzoom```
|
26
|
+
|
27
|
+
### application.css
|
28
|
+
|
29
|
+
```*= require easyzoom```
|
30
|
+
|
31
|
+
To simplify the usage of plugin, ```easy_zoom_tag``` view helper method provided
|
32
|
+
|
33
|
+
```= easy_zoom_tag(zoom: '1_zoom.jpg', standard: '1_standard.jpg', class: 'easyzoom easyzoom--overlay')```
|
34
|
+
|
35
|
+
More [info](http://i-like-robots.github.io/EasyZoom/)
|
36
|
+
|
37
|
+
## Contributing
|
38
|
+
|
39
|
+
1. Fork it ( https://github.com/Saidbek/easy_zoom_on_rails/fork )
|
40
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
41
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
42
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
43
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
/*!
|
2
|
+
* @name image-zoom
|
3
|
+
* @author Matt Hinchliffe <http://maketea.co.uk>
|
4
|
+
* @modified Monday, September 15th, 2014
|
5
|
+
* @version 2.2.1
|
6
|
+
*/!function(a){"use strict";function b(b,c){return this.$target=a(b),this.opts=a.extend({},i,c),void 0===this.isOpen&&this._init(),this}var c,d,e,f,g,h,i={loadingNotice:"Loading image",errorNotice:"The image could not be loaded",errorDuration:2500,preventClicks:!0,onShow:void 0,onHide:void 0};b.prototype._init=function(){var b=this;this.$link=this.$target.find("a"),this.$image=this.$target.find("img"),this.$flyout=a('<div class="easyzoom-flyout" />'),this.$notice=a('<div class="easyzoom-notice" />'),this.$target.on("mouseenter.easyzoom touchstart.easyzoom",function(a){b.isMouseOver=!0,a.originalEvent.touches&&1!==a.originalEvent.touches.length||(a.preventDefault(),b.show(a,!0))}).on("mousemove.easyzoom touchmove.easyzoom",function(a){b.isOpen&&(a.preventDefault(),b._move(a))}).on("mouseleave.easyzoom touchend.easyzoom",function(){b.isMouseOver=!1,b.isOpen&&b.hide()}),this.opts.preventClicks&&this.$target.on("click.easyzoom","a",function(a){a.preventDefault()})},b.prototype.show=function(a,b){var g,h,i,j,k=this;return this.isReady?(this.$target.append(this.$flyout),g=this.$target.width(),h=this.$target.height(),i=this.$flyout.width(),j=this.$flyout.height(),c=this.$zoom.width()-i,d=this.$zoom.height()-j,e=c/g,f=d/h,this.isOpen=!0,this.opts.onShow&&this.opts.onShow.call(this),void(a&&this._move(a))):void this._load(this.$link.attr("href"),function(){(k.isMouseOver||!b)&&k.show(a)})},b.prototype._load=function(b,c){var d=new Image;this.$target.addClass("is-loading").append(this.$notice.text(this.opts.loadingNotice)),this.$zoom=a(d),d.onerror=a.proxy(function(){var a=this;this.$notice.text(this.opts.errorNotice),this.$target.removeClass("is-loading").addClass("is-error"),this.detachNotice=setTimeout(function(){a.$notice.detach(),a.detachNotice=null},this.opts.errorDuration)},this),d.onload=a.proxy(function(){d.width&&(this.isReady=!0,this.$notice.detach(),this.$flyout.html(this.$zoom),this.$target.removeClass("is-loading").addClass("is-ready"),c())},this),d.style.position="absolute",d.src=b},b.prototype._move=function(a){if(0===a.type.indexOf("touch")){var b=a.touches||a.originalEvent.touches;g=b[0].pageX,h=b[0].pageY}else g=a.pageX||g,h=a.pageY||h;var i=this.$target.offset(),j=h-i.top,k=g-i.left,l=Math.ceil(j*f),m=Math.ceil(k*e);0>m||0>l||m>c||l>d?this.hide():this.$zoom.css({top:""+-1*l+"px",left:""+-1*m+"px"})},b.prototype.hide=function(){this.isOpen&&(this.$flyout.detach(),this.isOpen=!1,this.opts.onHide&&this.opts.onHide.call(this))},b.prototype.swap=function(b,c,d){this.hide(),this.isReady=!1,this.detachNotice&&clearTimeout(this.detachNotice),this.$notice.parent().length&&this.$notice.detach(),a.isArray(d)&&(d=d.join()),this.$target.removeClass("is-loading is-ready is-error"),this.$image.attr({src:b,srcset:d}),this.$link.attr("href",c)},b.prototype.teardown=function(){this.hide(),this.$target.removeClass("is-loading is-ready is-error").off(".easyzoom"),this.detachNotice&&clearTimeout(this.detachNotice),delete this.$link,delete this.$zoom,delete this.$image,delete this.$notice,delete this.$flyout,delete this.isOpen,delete this.isReady},a.fn.easyZoom=function(c){return this.each(function(){var d=a.data(this,"easyZoom");d?void 0===d.isOpen&&d._init():a.data(this,"easyZoom",new b(this,c))})},"function"==typeof define&&define.amd?define(function(){return b}):"undefined"!=typeof module&&module.exports&&(module.exports=b)}(jQuery);
|
@@ -0,0 +1,65 @@
|
|
1
|
+
/**
|
2
|
+
* EasyZoom core styles
|
3
|
+
*/
|
4
|
+
.easyzoom {
|
5
|
+
position: relative;
|
6
|
+
|
7
|
+
/* 'Shrink-wrap' the element */
|
8
|
+
display: inline-block;
|
9
|
+
*display: inline;
|
10
|
+
*zoom: 1;
|
11
|
+
}
|
12
|
+
|
13
|
+
.easyzoom img {
|
14
|
+
vertical-align: bottom;
|
15
|
+
}
|
16
|
+
|
17
|
+
.easyzoom.is-loading img {
|
18
|
+
cursor: progress;
|
19
|
+
}
|
20
|
+
|
21
|
+
.easyzoom.is-ready img {
|
22
|
+
cursor: crosshair;
|
23
|
+
}
|
24
|
+
|
25
|
+
.easyzoom.is-error img {
|
26
|
+
cursor: not-allowed;
|
27
|
+
}
|
28
|
+
|
29
|
+
.easyzoom-notice {
|
30
|
+
position: absolute;
|
31
|
+
top: 50%;
|
32
|
+
left: 50%;
|
33
|
+
z-index: 150;
|
34
|
+
width: 10em;
|
35
|
+
margin: -1em 0 0 -5em;
|
36
|
+
line-height: 2em;
|
37
|
+
text-align: center;
|
38
|
+
background: #FFF;
|
39
|
+
box-shadow: 0 0 10px #888;
|
40
|
+
}
|
41
|
+
|
42
|
+
.easyzoom-flyout {
|
43
|
+
position:absolute;
|
44
|
+
z-index: 100;
|
45
|
+
overflow: hidden;
|
46
|
+
background: #FFF;
|
47
|
+
}
|
48
|
+
|
49
|
+
/**
|
50
|
+
* EasyZoom layout variations
|
51
|
+
*/
|
52
|
+
.easyzoom--overlay .easyzoom-flyout {
|
53
|
+
top: 0;
|
54
|
+
left: 0;
|
55
|
+
width: 100%;
|
56
|
+
height: 100%;
|
57
|
+
}
|
58
|
+
|
59
|
+
.easyzoom--adjacent .easyzoom-flyout {
|
60
|
+
top: 0;
|
61
|
+
left: 100%;
|
62
|
+
width: 100%;
|
63
|
+
height: 100%;
|
64
|
+
margin-left: 20px;
|
65
|
+
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'easy_zoom_on_rails/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'easy_zoom_on_rails'
|
8
|
+
spec.version = EasyZoomOnRails::VERSION
|
9
|
+
spec.authors = ['Said Kaldybaev']
|
10
|
+
spec.email = ['said.kaldybaev@gmail.com']
|
11
|
+
spec.summary = %q{Matt Hinchliffe's jQuery easy zoom plugin for rails}
|
12
|
+
spec.description = %q{Matt Hinchliffe's jQuery easy zoom plugin for rails}
|
13
|
+
spec.homepage = 'https://github.com/Saidbek/easy_zoom_on_rails'
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0")
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ['lib']
|
19
|
+
|
20
|
+
spec.add_development_dependency 'bundler', '~> 1.7'
|
21
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: easy_zoom_on_rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Said Kaldybaev
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-10-17 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.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
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
|
+
description: Matt Hinchliffe's jQuery easy zoom plugin for rails
|
42
|
+
email:
|
43
|
+
- said.kaldybaev@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- Gemfile
|
50
|
+
- LICENSE.txt
|
51
|
+
- README.md
|
52
|
+
- Rakefile
|
53
|
+
- app/assets/javascripts/easyzoom.js
|
54
|
+
- app/assets/stylesheets/easyzoom.css
|
55
|
+
- easy_zoom_on_rails.gemspec
|
56
|
+
- lib/easy_zoom_on_rails.rb
|
57
|
+
- lib/easy_zoom_on_rails/easy_zoom_helper.rb
|
58
|
+
- lib/easy_zoom_on_rails/engine.rb
|
59
|
+
- lib/easy_zoom_on_rails/railtie.rb
|
60
|
+
- lib/easy_zoom_on_rails/version.rb
|
61
|
+
homepage: https://github.com/Saidbek/easy_zoom_on_rails
|
62
|
+
licenses: []
|
63
|
+
metadata: {}
|
64
|
+
post_install_message:
|
65
|
+
rdoc_options: []
|
66
|
+
require_paths:
|
67
|
+
- lib
|
68
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
requirements: []
|
79
|
+
rubyforge_project:
|
80
|
+
rubygems_version: 2.2.2
|
81
|
+
signing_key:
|
82
|
+
specification_version: 4
|
83
|
+
summary: Matt Hinchliffe's jQuery easy zoom plugin for rails
|
84
|
+
test_files: []
|