smoothproducts_rails 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d731ec02b92fbb5a6cc60289e46c4bcdaf6a0859
4
+ data.tar.gz: b772c0f2482506cb1537ae34e35d9c46ebdc1d8a
5
+ SHA512:
6
+ metadata.gz: 694ffa2b63456df1735fca0f4ec2511ee048801e357a7d4ac6350d54549813d40b29021bb07320c22e7fe0e8153a684bb6bc8f2cac2710476d2aaf92723350f9
7
+ data.tar.gz: 57f6ce30e5bab10dcd3846a2f8c67abc225feeedab3dfdd78d5779e7c2183a4304be00526aed7caf241fe2e1497e4a1b3ac6cc50ab02a5e61f4ff37997e38f8a
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2015 calve
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,22 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'SmoothproductsRails'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+
18
+
19
+
20
+
21
+
22
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,260 @@
1
+ /*
2
+ * Smoothproducts version 2.0.2
3
+ * http://kthornbloom.com/smoothproducts.php
4
+ *
5
+ * Copyright 2013, Kevin Thornbloom
6
+ * Free to use and abuse under the MIT license.
7
+ * http://www.opensource.org/licenses/mit-license.php
8
+ */
9
+
10
+ (function($) {
11
+ $.fn.extend({
12
+ smoothproducts: function() {
13
+
14
+ // Add some markup & set some CSS
15
+
16
+ $('.sp-loading').hide();
17
+ $('.sp-wrap').each(function() {
18
+ $(this).addClass('sp-touch');
19
+ var thumbQty = $('a', this).length;
20
+
21
+ // If more than one image
22
+ if (thumbQty > 1) {
23
+ $(this).append('<div class="sp-large"></div><div class="sp-thumbs sp-tb-active"></div>');
24
+ $('a', this).each(function() {
25
+ var thumb = $('img', this).attr('src'),
26
+ large = $(this).attr('href');
27
+ $(this).parents('.sp-wrap').find('.sp-thumbs').append('<a href="' + large + '" style="background-image:url(' + thumb + ')"></a>');
28
+ $(this).remove();
29
+ });
30
+ $('.sp-thumbs a:first', this).addClass('sp-current');
31
+ var firstLarge = $('.sp-thumbs a:first', this).attr('href'),
32
+ firstThumb = get_url_from_background($('.sp-thumbs a:first', this).css('backgroundImage'));
33
+ //alert(firstThumb);
34
+ $('.sp-large', this).append('<a href="' + firstLarge + '" class="sp-current-big"><img src="' + firstThumb + '" alt="" /></a>');
35
+ $('.sp-wrap').css('display', 'inline-block');
36
+ // If only one image
37
+ } else {
38
+ $(this).append('<div class="sp-large"></div>');
39
+ $('a', this).appendTo($('.sp-large', this)).addClass('.sp-current-big');
40
+ $('.sp-wrap').css('display', 'inline-block');
41
+ }
42
+ });
43
+
44
+
45
+ // Prevent clicking while things are happening
46
+ $(document.body).on('click', '.sp-thumbs', function(event) {
47
+ event.preventDefault();
48
+ });
49
+
50
+
51
+ // Is this a touch screen or not?
52
+ $(document.body).on('mouseover', function(event) {
53
+ $('.sp-wrap').removeClass('sp-touch').addClass('sp-non-touch');
54
+ event.preventDefault();
55
+ });
56
+
57
+ $(document.body).on('touchstart', function() {
58
+ $('.sp-wrap').removeClass('sp-non-touch').addClass('sp-touch');
59
+ });
60
+
61
+ // Clicking a thumbnail
62
+ $(document.body).on('click', '.sp-tb-active a', function(event) {
63
+
64
+ event.preventDefault();
65
+ $(this).parent().find('.sp-current').removeClass();
66
+ $(this).addClass('sp-current');
67
+ $(this).parents('.sp-wrap').find('.sp-thumbs').removeClass('sp-tb-active');
68
+ $(this).parents('.sp-wrap').find('.sp-zoom').remove();
69
+
70
+ var currentHeight = $(this).parents('.sp-wrap').find('.sp-large').height(),
71
+ currentWidth = $(this).parents('.sp-wrap').find('.sp-large').width();
72
+ $(this).parents('.sp-wrap').find('.sp-large').css({
73
+ overflow: 'hidden',
74
+ height: currentHeight + 'px',
75
+ width: currentWidth + 'px'
76
+ });
77
+
78
+ $(this).addClass('sp-current').parents('.sp-wrap').find('.sp-large a').remove();
79
+
80
+ var nextLarge = $(this).parent().find('.sp-current').attr('href'),
81
+ nextThumb = get_url_from_background($(this).parent().find('.sp-current').css('backgroundImage'));
82
+
83
+ $(this).parents('.sp-wrap').find('.sp-large').html('<a href="' + nextLarge + '" class="sp-current-big"><img src="' + nextThumb + '"/></a>');
84
+ $(this).parents('.sp-wrap').find('.sp-large').hide().fadeIn(250, function() {
85
+
86
+ var autoHeight = $(this).parents('.sp-wrap').find('.sp-large img').height();
87
+
88
+ $(this).parents('.sp-wrap').find('.sp-large').animate({
89
+ height: autoHeight
90
+ }, 'fast', function() {
91
+ $('.sp-large').css({
92
+ height: 'auto',
93
+ width: 'auto'
94
+ });
95
+ });
96
+
97
+ $(this).parents('.sp-wrap').find('.sp-thumbs').addClass('sp-tb-active');
98
+ });
99
+ });
100
+
101
+ // Zoom In non-touch
102
+ $(document.body).on('mouseenter', '.sp-non-touch .sp-large', function(event) {
103
+ var largeUrl = $('a', this).attr('href');
104
+ $(this).append('<div class="sp-zoom"><img src="' + largeUrl + '"/></div>');
105
+ $(this).find('.sp-zoom').fadeIn(250);
106
+ event.preventDefault();
107
+ });
108
+
109
+ // Zoom Out non-touch
110
+ $(document.body).on('mouseleave', '.sp-non-touch .sp-large', function(event) {
111
+ $(this).find('.sp-zoom').fadeOut(250, function() {
112
+ $(this).remove();
113
+ });
114
+ event.preventDefault();
115
+ });
116
+
117
+ // Open in Lightbox non-touch
118
+ $(document.body).on('click', '.sp-non-touch .sp-zoom', function(event) {
119
+ var currentImg = $(this).html(),
120
+ thumbAmt = $(this).parents('.sp-wrap').find('.sp-thumbs a').length,
121
+ currentThumb = ($(this).parents('.sp-wrap').find('.sp-thumbs .sp-current').index())+1;
122
+ $(this).parents('.sp-wrap').addClass('sp-selected');
123
+ $('body').append("<div class='sp-lightbox' data-currenteq='"+currentThumb+"'>" + currentImg + "</div>");
124
+
125
+ if(thumbAmt > 1){
126
+ $('.sp-lightbox').append("<a href='#' id='sp-prev'></a><a href='#' id='sp-next'></a>");
127
+ if(currentThumb == 1) {
128
+ $('#sp-prev').css('opacity','.1');
129
+ } else if (currentThumb == thumbAmt){
130
+ $('#sp-next').css('opacity','.1');
131
+ }
132
+ }
133
+ $('.sp-lightbox').fadeIn();
134
+ event.preventDefault();
135
+ });
136
+
137
+ // Open in Lightbox touch
138
+ $(document.body).on('click', '.sp-large a', function(event) {
139
+ var currentImg = $(this).attr('href'),
140
+ thumbAmt = $(this).parents('.sp-wrap').find('.sp-thumbs a').length,
141
+ currentThumb = ($(this).parents('.sp-wrap').find('.sp-thumbs .sp-current').index())+1;
142
+
143
+ $(this).parents('.sp-wrap').addClass('sp-selected');
144
+ $('body').append('<div class="sp-lightbox" data-currenteq="'+currentThumb+'"><img src="' + currentImg + '"/></div>');
145
+
146
+ if(thumbAmt > 1){
147
+ $('.sp-lightbox').append("<a href='#' id='sp-prev'></a><a href='#' id='sp-next'></a>");
148
+ if(currentThumb == 1) {
149
+ $('#sp-prev').css('opacity','.1');
150
+ } else if (currentThumb == thumbAmt){
151
+ $('#sp-next').css('opacity','.1');
152
+ }
153
+ }
154
+ $('.sp-lightbox').fadeIn();
155
+ event.preventDefault();
156
+ });
157
+
158
+ // Pagination Forward
159
+ $(document.body).on('click', '#sp-next', function(event) {
160
+ event.stopPropagation();
161
+ var currentEq = $('.sp-lightbox').data('currenteq'),
162
+ totalItems = $('.sp-selected .sp-thumbs a').length;
163
+
164
+ if(currentEq >= totalItems) {
165
+ } else {
166
+ var nextEq = currentEq + 1,
167
+ newImg = $('.sp-selected .sp-thumbs').find('a:eq('+currentEq+')').attr('href'),
168
+ newThumb = get_url_from_background($('.sp-selected .sp-thumbs').find('a:eq('+currentEq+')').css('backgroundImage'));
169
+ if (currentEq == (totalItems - 1)) {
170
+ $('#sp-next').css('opacity','.1');
171
+ }
172
+ $('#sp-prev').css('opacity','1');
173
+ $('.sp-selected .sp-current').removeClass();
174
+ $('.sp-selected .sp-thumbs a:eq('+currentEq+')').addClass('sp-current');
175
+ $('.sp-selected .sp-large').empty().append('<a href='+newImg+'><img src="'+newThumb+'"/></a>');
176
+ $('.sp-lightbox img').fadeOut(250, function() {
177
+ $(this).remove();
178
+ $('.sp-lightbox').data('currenteq',nextEq).append('<img src="'+newImg+'"/>');
179
+ $('.sp-lightbox img').hide().fadeIn(250);
180
+ });
181
+ }
182
+
183
+ event.preventDefault();
184
+ });
185
+
186
+ // Pagination Backward
187
+ $(document.body).on('click', '#sp-prev', function(event) {
188
+
189
+ event.stopPropagation();
190
+ var currentEq = $('.sp-lightbox').data('currenteq'),
191
+ currentEq = currentEq - 1;
192
+ if(currentEq <= 0) {
193
+ } else {
194
+ if (currentEq == 1) {
195
+ $('#sp-prev').css('opacity','.1');
196
+ }
197
+ var nextEq = currentEq - 1,
198
+ newImg = $('.sp-selected .sp-thumbs').find('a:eq('+nextEq+')').attr('href'),
199
+ newThumb = get_url_from_background($('.sp-selected .sp-thumbs').find('a:eq('+nextEq+')').css('backgroundImage'));
200
+ $('#sp-next').css('opacity','1');
201
+ $('.sp-selected .sp-current').removeClass();
202
+ $('.sp-selected .sp-thumbs a:eq('+nextEq+')').addClass('sp-current');
203
+ $('.sp-selected .sp-large').empty().append('<a href='+newImg+'><img src="'+newThumb+'"/></a>');
204
+ $('.sp-lightbox img').fadeOut(250, function() {
205
+ $(this).remove();
206
+ $('.sp-lightbox').data('currenteq',currentEq).append('<img src="'+newImg+'"/>');
207
+ $('.sp-lightbox img').hide().fadeIn(250);
208
+ });
209
+ }
210
+ event.preventDefault();
211
+ });
212
+
213
+
214
+ // Close Lightbox
215
+ $(document.body).on('click', '.sp-lightbox', function() {
216
+ closeModal();
217
+ });
218
+
219
+ // Close on Esc
220
+ $(document).keydown(function(e) {
221
+ if (e.keyCode == 27) {
222
+ closeModal();
223
+ return false;
224
+ }
225
+ });
226
+
227
+ function closeModal (){
228
+ $('.sp-selected').removeClass('sp-selected');
229
+ $('.sp-lightbox').fadeOut(function() {
230
+ $(this).remove();
231
+ });
232
+ }
233
+
234
+
235
+ // Panning zoomed image (non-touch)
236
+
237
+ $('.sp-large').mousemove(function(e) {
238
+ var viewWidth = $(this).width(),
239
+ viewHeight = $(this).height(),
240
+ largeWidth = $(this).find('.sp-zoom').width(),
241
+ largeHeight = $(this).find('.sp-zoom').height(),
242
+ parentOffset = $(this).parent().offset(),
243
+ relativeXPosition = (e.pageX - parentOffset.left),
244
+ relativeYPosition = (e.pageY - parentOffset.top),
245
+ moveX = Math.floor((relativeXPosition * (viewWidth - largeWidth) / viewWidth)),
246
+ moveY = Math.floor((relativeYPosition * (viewHeight - largeHeight) / viewHeight));
247
+
248
+ $(this).find('.sp-zoom').css({
249
+ left: moveX,
250
+ top: moveY
251
+ });
252
+
253
+ });
254
+
255
+ function get_url_from_background(bg){
256
+ return bg.match(/url\([\"\']{0,1}(.+)[\"\']{0,1}\)+/i)[1];
257
+ }
258
+ }
259
+ });
260
+ })(jQuery);
@@ -0,0 +1,178 @@
1
+ /* Needed for the lightbox */
2
+
3
+ html, body {
4
+ height: 100%;
5
+ width: 100%;
6
+ }
7
+
8
+ /* CSS for the loading div */
9
+
10
+ .sp-loading {
11
+ text-align: center;
12
+ max-width: 270px;
13
+ padding: 15px;
14
+ border: 5px solid #eee;
15
+ border-radius: 3px;
16
+ font-size: 12px;
17
+ color: #888;
18
+ }
19
+
20
+ /* Element wrapper */
21
+
22
+ .sp-wrap {
23
+ display: none;
24
+ line-height: 0;
25
+ font-size: 0;
26
+ background: #eee;
27
+ border: 5px solid #eee;
28
+ border-radius: 3px;
29
+ position: relative;
30
+ margin: 0 25px 15px 0;
31
+ float: left;
32
+ /**************
33
+ Set max-width to your thumbnail width
34
+ ***************/
35
+
36
+ max-width: 300px;
37
+ }
38
+
39
+ /* Thumbnails */
40
+
41
+ .sp-thumbs {
42
+ text-align: left;
43
+ display: inline-block;
44
+ }
45
+ .sp-thumbs img {
46
+ min-height: 50px;
47
+ min-width: 50px;
48
+ max-width: 50px;
49
+ }
50
+ .sp-thumbs a:link, .sp-thumbs a:visited {
51
+ width: 50px;
52
+ height: 50px;
53
+ overflow: hidden;
54
+ opacity: .3;
55
+ display: inline-block;
56
+ background-size: cover;
57
+ background-position: center;
58
+ -webkit-transition: all .2s ease-out;
59
+ -moz-transition: all .2s ease-out;
60
+ -ms-transition: all .2s ease-out;
61
+ -o-transition: all .2s ease-out;
62
+ transition: all .2s ease-out;
63
+ }
64
+ .sp-thumbs a:hover {
65
+ opacity: 1;
66
+ }
67
+
68
+ /* Styles for the currently selected thumbnail */
69
+
70
+ .sp-thumbs a:active, .sp-current {
71
+ opacity: 1!important;
72
+ position: relative;
73
+ }
74
+
75
+ /* Image currently being viewed */
76
+
77
+ .sp-large {
78
+ position: relative;
79
+ overflow: hidden;
80
+ top: 0;
81
+ left: 0;
82
+ }
83
+ .sp-large a img {
84
+ max-width: 100%;
85
+ height: auto;
86
+ }
87
+ .sp-large a {
88
+ display: block;
89
+ }
90
+
91
+ /* Panning Zoomed Image */
92
+
93
+ .sp-zoom {
94
+ position: absolute;
95
+ left: -50%;
96
+ top: -50%;
97
+ cursor: -webkit-zoom-in;
98
+ cursor: -moz-zoom-in;
99
+ display: none;
100
+ }
101
+ /* Lightbox */
102
+
103
+ .sp-lightbox {
104
+ position: fixed;
105
+ top: 0;
106
+ left: 0;
107
+ height: 100%;
108
+ width: 100%;
109
+ background: rgb(0, 0, 0);
110
+ background: rgba(0, 0, 0, .9);
111
+ z-index: 500;
112
+ display: none;
113
+ }
114
+ .sp-lightbox img {
115
+ position: absolute;
116
+ margin: auto;
117
+ top: 0;
118
+ bottom: 0;
119
+ left: 0;
120
+ right: 0;
121
+ max-width: 90%;
122
+ max-height: 90%;
123
+ border: 2px solid #fff;
124
+ }
125
+ #sp-prev, #sp-next {
126
+ position: absolute;
127
+ top: 50%;
128
+ margin-top: -25px;
129
+ z-index: 501;
130
+ color: #fff;
131
+ padding: 14px;
132
+ text-decoration: none;
133
+ background: #000;
134
+ border-radius: 25px;
135
+ border: 2px solid #fff;
136
+ width: 50px;
137
+ height: 50px;
138
+ box-sizing: border-box;
139
+ transition: .2s;
140
+ }
141
+ #sp-prev {
142
+ left: 10px;
143
+ }
144
+ #sp-prev:before {
145
+ content: '';
146
+ border: 7px solid transparent;
147
+ border-right: 15px solid #fff;
148
+ position: absolute;
149
+ top: 16px;
150
+ left: 7px;
151
+ }
152
+ #sp-next {
153
+ right: 10px;
154
+ }
155
+ #sp-next:before {
156
+ content: '';
157
+ border: 7px solid transparent;
158
+ border-left: 15px solid white;
159
+ position: absolute;
160
+ top: 16px;
161
+ left: 18px;
162
+ }
163
+ #sp-prev:hover, #sp-next:hover {
164
+ background: #444;
165
+ }
166
+
167
+ /* Tweak styles for small viewports */
168
+
169
+ @media screen and (max-width: 400px) {
170
+ .sp-wrap {
171
+ margin: 0 0 15px 0;
172
+ }
173
+ #sp-prev, #sp-next {
174
+ top: auto;
175
+ margin-top: 0;
176
+ bottom: 25px;
177
+ }
178
+ }
@@ -0,0 +1,6 @@
1
+ module SmoothproductsRails
2
+ module Rails
3
+ class Engine < ::Rails::Engine
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,3 @@
1
+ module SmoothproductsRails
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :smoothproducts_rails do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,79 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: smoothproducts_rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - calve
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-04-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 4.2.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 4.2.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: railties
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 4.2.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 4.2.0
41
+ description: A jquery plugin
42
+ email:
43
+ - calvinh34@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - MIT-LICENSE
49
+ - Rakefile
50
+ - app/assets/javascripts/smoothproducts.js
51
+ - app/assets/stylesheets/smoothproducts.css
52
+ - lib/smoothproducts_rails.rb
53
+ - lib/smoothproducts_rails/version.rb
54
+ - lib/tasks/smoothproducts_rails_tasks.rake
55
+ homepage: https://github.com/calve/smoothproducts_rails
56
+ licenses:
57
+ - MIT
58
+ metadata: {}
59
+ post_install_message:
60
+ rdoc_options: []
61
+ require_paths:
62
+ - lib
63
+ required_ruby_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ requirements: []
74
+ rubyforge_project:
75
+ rubygems_version: 2.4.5
76
+ signing_key:
77
+ specification_version: 4
78
+ summary: Ressources for Smoothproducts
79
+ test_files: []