coffeebox 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -6
- data/app/assets/javascripts/coffeebox/imgpreload.js +128 -0
- data/app/assets/javascripts/coffeebox/main.js.coffee +1 -1
- data/app/assets/javascripts/coffeebox/spin.js +10 -15
- data/app/assets/stylesheets/coffeebox.css.sass +2 -23
- data/app/assets/stylesheets/coffeebox_basic.css.sass +29 -0
- data/lib/coffeebox/engine.rb +0 -0
- data/lib/coffeebox/version.rb +1 -1
- metadata +14 -13
- data/app/assets/javascripts/coffeebox/imgpreload.js.coffee +0 -50
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20d7102d3791699b975ab8e89557784801aed307
|
4
|
+
data.tar.gz: 3be1e55b7d44df899762e2c9a495e542d535ab01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5710b985c64873a7ba329f70f7bad315abdc645c903d0cb3dbb5d746cbd239c3f11324b1f8521433f0e91b096baa1771d946ba2c2d55bee62816c928f6796ef7
|
7
|
+
data.tar.gz: d7512f80232bb0c7cdf34d4e2def71ada26201f34e15bf74796986fad048bf748a7817cc38002cddd14cd8cbd5504b8114dbbbe3985c3059f2c1c5d2df7aae07
|
data/README.md
CHANGED
@@ -48,12 +48,12 @@ and in application.css.sass:
|
|
48
48
|
or import SASS file directly (from sass\scss only)
|
49
49
|
|
50
50
|
// Set some options
|
51
|
-
$
|
52
|
-
$
|
53
|
-
$
|
54
|
-
$
|
55
|
-
$
|
56
|
-
$
|
51
|
+
$coffeebox-background: #fff
|
52
|
+
$coffeebox-close-color: #000
|
53
|
+
$coffeebox-close-hover: #333
|
54
|
+
$coffeebox-close-size: 25px
|
55
|
+
$coffeebox-border: 3px solid rgba(0, 0, 0, 0)
|
56
|
+
$coffeebox-border-radius: 25px
|
57
57
|
|
58
58
|
// Then import
|
59
59
|
@import coffeebox
|
@@ -0,0 +1,128 @@
|
|
1
|
+
/* v1.5
|
2
|
+
Copyright (c) 2009 Dimas Begunoff, http://www.farinspace.com
|
3
|
+
https://github.com/farinspace/jquery.imgpreload
|
4
|
+
Licensed under the MIT license
|
5
|
+
http://en.wikipedia.org/wiki/MIT_License
|
6
|
+
*/
|
7
|
+
|
8
|
+
if ('undefined' != typeof jQuery)
|
9
|
+
{
|
10
|
+
(function($){
|
11
|
+
|
12
|
+
// extend jquery (because i love jQuery)
|
13
|
+
$.imgpreload = function (imgs,settings)
|
14
|
+
{
|
15
|
+
settings = $.extend({},$.fn.imgpreload.defaults,(settings instanceof Function)?{all:settings}:settings);
|
16
|
+
|
17
|
+
// use of typeof required
|
18
|
+
// https://developer.mozilla.org/En/Core_JavaScript_1.5_Reference/Operators/Special_Operators/Instanceof_Operator#Description
|
19
|
+
if ('string' == typeof imgs) { imgs = new Array(imgs); }
|
20
|
+
|
21
|
+
var loaded = new Array();
|
22
|
+
|
23
|
+
$.each(imgs,function(i,elem)
|
24
|
+
{
|
25
|
+
var img = new Image();
|
26
|
+
|
27
|
+
var url = elem;
|
28
|
+
|
29
|
+
var img_obj = img;
|
30
|
+
|
31
|
+
if ('string' != typeof elem)
|
32
|
+
{
|
33
|
+
url = $(elem).attr('src') || $(elem).css('background-image').replace(/^url\((?:"|')?(.*)(?:'|")?\)$/mg, "$1");
|
34
|
+
|
35
|
+
img_obj = elem;
|
36
|
+
}
|
37
|
+
|
38
|
+
$(img).bind('load error', function(e)
|
39
|
+
{
|
40
|
+
loaded.push(img_obj);
|
41
|
+
|
42
|
+
$.data(img_obj, 'loaded', ('error'==e.type)?false:true);
|
43
|
+
|
44
|
+
if (settings.each instanceof Function) { settings.each.call(img_obj); }
|
45
|
+
|
46
|
+
// http://jsperf.com/length-in-a-variable
|
47
|
+
if (loaded.length>=imgs.length && settings.all instanceof Function) { settings.all.call(loaded); }
|
48
|
+
|
49
|
+
$(this).unbind('load error');
|
50
|
+
});
|
51
|
+
|
52
|
+
img.src = url;
|
53
|
+
});
|
54
|
+
};
|
55
|
+
|
56
|
+
$.fn.imgpreload = function(settings)
|
57
|
+
{
|
58
|
+
$.imgpreload(this,settings);
|
59
|
+
|
60
|
+
return this;
|
61
|
+
};
|
62
|
+
|
63
|
+
$.fn.imgpreload.defaults =
|
64
|
+
{
|
65
|
+
each: null // callback invoked when each image in a group loads
|
66
|
+
, all: null // callback invoked when when the entire group of images has loaded
|
67
|
+
};
|
68
|
+
|
69
|
+
})(jQuery);
|
70
|
+
}
|
71
|
+
|
72
|
+
/*
|
73
|
+
|
74
|
+
Usage:
|
75
|
+
|
76
|
+
$('#content img').imgpreload(function()
|
77
|
+
{
|
78
|
+
// this = array of dom image objects
|
79
|
+
// callback executes when all images are loaded
|
80
|
+
});
|
81
|
+
|
82
|
+
$('#content img').imgpreload
|
83
|
+
({
|
84
|
+
each: function()
|
85
|
+
{
|
86
|
+
// this = dom image object
|
87
|
+
// check for success with: $(this).data('loaded')
|
88
|
+
// callback executes when each image loads
|
89
|
+
},
|
90
|
+
all: function()
|
91
|
+
{
|
92
|
+
// this = array of dom image objects
|
93
|
+
// check for success with: $(this[i]).data('loaded')
|
94
|
+
// callback executes when all images are loaded
|
95
|
+
}
|
96
|
+
});
|
97
|
+
|
98
|
+
$.imgpreload('/images/a.gif',function()
|
99
|
+
{
|
100
|
+
// this = array of dom image objects
|
101
|
+
// check for success with: $(this[i]).data('loaded')
|
102
|
+
// callback
|
103
|
+
});
|
104
|
+
|
105
|
+
$.imgpreload(['/images/a.gif','/images/b.gif'],function()
|
106
|
+
{
|
107
|
+
// this = array of dom image objects
|
108
|
+
// check for success with: $(this[i]).data('loaded')
|
109
|
+
// callback executes when all images are loaded
|
110
|
+
});
|
111
|
+
|
112
|
+
$.imgpreload(['/images/a.gif','/images/b.gif'],
|
113
|
+
{
|
114
|
+
each: function()
|
115
|
+
{
|
116
|
+
// this = dom image object
|
117
|
+
// check for success with: $(this).data('loaded')
|
118
|
+
// callback executes on every image load
|
119
|
+
},
|
120
|
+
all: function()
|
121
|
+
{
|
122
|
+
// this = array of dom image objects
|
123
|
+
// check for success with: $(this[i]).data('loaded')
|
124
|
+
// callback executes when all images are loaded
|
125
|
+
}
|
126
|
+
});
|
127
|
+
|
128
|
+
*/
|
@@ -1,7 +1,6 @@
|
|
1
|
-
//fgnass.github.com/spin.js#v1.3.2
|
2
|
-
|
3
1
|
/**
|
4
|
-
*
|
2
|
+
* v 2.0.1
|
3
|
+
* Copyright (c) 2011-2014 Felix Gnass
|
5
4
|
* Licensed under the MIT license
|
6
5
|
*/
|
7
6
|
(function(root, factory) {
|
@@ -154,14 +153,13 @@
|
|
154
153
|
fps: 20, // Frames per second when using setTimeout()
|
155
154
|
zIndex: 2e9, // Use a high z-index by default
|
156
155
|
className: 'spinner', // CSS class to assign to the element
|
157
|
-
top: '
|
158
|
-
left: '
|
159
|
-
position: '
|
156
|
+
top: '50%', // center vertically
|
157
|
+
left: '50%', // center horizontally
|
158
|
+
position: 'absolute' // element position
|
160
159
|
}
|
161
160
|
|
162
161
|
/** The constructor */
|
163
162
|
function Spinner(o) {
|
164
|
-
if (typeof this == 'undefined') return new Spinner(o)
|
165
163
|
this.opts = merge(o || {}, Spinner.defaults, defaults)
|
166
164
|
}
|
167
165
|
|
@@ -182,17 +180,14 @@
|
|
182
180
|
, o = self.opts
|
183
181
|
, el = self.el = css(createEl(0, {className: o.className}), {position: o.position, width: 0, zIndex: o.zIndex})
|
184
182
|
, mid = o.radius+o.length+o.width
|
185
|
-
, ep // element position
|
186
|
-
, tp // target position
|
187
183
|
|
184
|
+
css(el, {
|
185
|
+
left: o.left,
|
186
|
+
top: o.top
|
187
|
+
})
|
188
|
+
|
188
189
|
if (target) {
|
189
190
|
target.insertBefore(el, target.firstChild||null)
|
190
|
-
tp = pos(target)
|
191
|
-
ep = pos(el)
|
192
|
-
css(el, {
|
193
|
-
left: (o.left == 'auto' ? tp.x-ep.x + (target.offsetWidth >> 1) : parseInt(o.left, 10) + mid) + 'px',
|
194
|
-
top: (o.top == 'auto' ? tp.y-ep.y + (target.offsetHeight >> 1) : parseInt(o.top, 10) + mid) + 'px'
|
195
|
-
})
|
196
191
|
}
|
197
192
|
|
198
193
|
el.setAttribute('role', 'progressbar')
|
@@ -6,18 +6,10 @@ $coffeebox-close-size: 25px !default
|
|
6
6
|
$coffeebox-border: 3px solid rgba(0, 0, 0, 0) !default
|
7
7
|
$coffeebox-border-radius: 5px !default
|
8
8
|
|
9
|
+
@import "coffeebox_basic"
|
10
|
+
|
9
11
|
#coffeebox
|
10
|
-
position: absolute
|
11
|
-
top: 0
|
12
|
-
left: 0
|
13
|
-
z-index: 100
|
14
|
-
text-align: left
|
15
|
-
.loading
|
16
|
-
width: 400px
|
17
|
-
height: 200px
|
18
|
-
position: relative
|
19
12
|
.popup
|
20
|
-
position: relative
|
21
13
|
border: $coffeebox-border
|
22
14
|
border-radius: $coffeebox-border-radius
|
23
15
|
box-shadow: 0 0 18px rgba(0, 0, 0, 0.4)
|
@@ -34,7 +26,6 @@ $coffeebox-border-radius: 5px !default
|
|
34
26
|
&:last-child
|
35
27
|
margin-bottom: 0
|
36
28
|
.close
|
37
|
-
cursor: pointer
|
38
29
|
position: absolute
|
39
30
|
top: 5px
|
40
31
|
right: 5px
|
@@ -53,15 +44,3 @@ $coffeebox-border-radius: 5px !default
|
|
53
44
|
border: 0
|
54
45
|
margin: 0
|
55
46
|
|
56
|
-
#coffeebox_overlay
|
57
|
-
position: fixed
|
58
|
-
top: 0px
|
59
|
-
left: 0px
|
60
|
-
height: 100%
|
61
|
-
width: 100%
|
62
|
-
transition: opacity 0.3s ease
|
63
|
-
background-color: #000
|
64
|
-
z-index: 99
|
65
|
-
opacity: 0.4
|
66
|
-
&.hide
|
67
|
-
opacity: 0
|
@@ -0,0 +1,29 @@
|
|
1
|
+
$coffeebox-overlay-opacity: 0.4 !default
|
2
|
+
|
3
|
+
#coffeebox
|
4
|
+
position: absolute
|
5
|
+
top: 0
|
6
|
+
left: 0
|
7
|
+
z-index: 100
|
8
|
+
text-align: left
|
9
|
+
.loading
|
10
|
+
width: 400px
|
11
|
+
height: 200px
|
12
|
+
position: relative
|
13
|
+
.popup
|
14
|
+
position: relative
|
15
|
+
.close
|
16
|
+
cursor: pointer
|
17
|
+
|
18
|
+
#coffeebox_overlay
|
19
|
+
position: fixed
|
20
|
+
top: 0px
|
21
|
+
left: 0px
|
22
|
+
height: 100%
|
23
|
+
width: 100%
|
24
|
+
transition: opacity 0.3s ease
|
25
|
+
background-color: #000
|
26
|
+
z-index: 99
|
27
|
+
opacity: $coffeebox-overlay-opacity
|
28
|
+
&.hide
|
29
|
+
opacity: 0
|
data/lib/coffeebox/engine.rb
CHANGED
File without changes
|
data/lib/coffeebox/version.rb
CHANGED
metadata
CHANGED
@@ -1,55 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coffeebox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- glebtv
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '3.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '3.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '1.3'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.3'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
description: An opinionated rewrite of Facebox in coffescript bundled as a rails gem
|
@@ -59,16 +59,17 @@ executables: []
|
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
|
-
- .gitignore
|
62
|
+
- ".gitignore"
|
63
63
|
- Gemfile
|
64
64
|
- LICENSE.txt
|
65
65
|
- README.md
|
66
66
|
- Rakefile
|
67
67
|
- app/assets/javascripts/coffeebox.js.coffee
|
68
|
-
- app/assets/javascripts/coffeebox/imgpreload.js
|
68
|
+
- app/assets/javascripts/coffeebox/imgpreload.js
|
69
69
|
- app/assets/javascripts/coffeebox/main.js.coffee
|
70
70
|
- app/assets/javascripts/coffeebox/spin.js
|
71
71
|
- app/assets/stylesheets/coffeebox.css.sass
|
72
|
+
- app/assets/stylesheets/coffeebox_basic.css.sass
|
72
73
|
- coffeebox.gemspec
|
73
74
|
- lib/coffeebox.rb
|
74
75
|
- lib/coffeebox/engine.rb
|
@@ -83,17 +84,17 @@ require_paths:
|
|
83
84
|
- lib
|
84
85
|
required_ruby_version: !ruby/object:Gem::Requirement
|
85
86
|
requirements:
|
86
|
-
- -
|
87
|
+
- - ">="
|
87
88
|
- !ruby/object:Gem::Version
|
88
89
|
version: '0'
|
89
90
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
91
|
requirements:
|
91
|
-
- -
|
92
|
+
- - ">="
|
92
93
|
- !ruby/object:Gem::Version
|
93
94
|
version: '0'
|
94
95
|
requirements: []
|
95
96
|
rubyforge_project:
|
96
|
-
rubygems_version: 2.
|
97
|
+
rubygems_version: 2.2.2
|
97
98
|
signing_key:
|
98
99
|
specification_version: 4
|
99
100
|
summary: An opinionated rewrite of Facebox in coffescript bundled as a rails gem
|
@@ -1,50 +0,0 @@
|
|
1
|
-
# v1.4
|
2
|
-
#Copyright (c) 2009 Dimas Begunoff, http://www.farinspace.com
|
3
|
-
#
|
4
|
-
#https://github.com/farinspace/jquery.imgpreload
|
5
|
-
#
|
6
|
-
# Licensed under the MIT:
|
7
|
-
# http://www.opensource.org/licenses/mit-license.php
|
8
|
-
|
9
|
-
unless "undefined" is typeof jQuery
|
10
|
-
(($) ->
|
11
|
-
|
12
|
-
# extend jquery (because i love jQuery)
|
13
|
-
$.imgpreload = (imgs, settings) ->
|
14
|
-
settings = $.extend({}, $.fn.imgpreload.defaults, (if (settings instanceof Function) then all: settings else settings))
|
15
|
-
|
16
|
-
# use of typeof required
|
17
|
-
# https://developer.mozilla.org/En/Core_JavaScript_1.5_Reference/Operators/Special_Operators/Instanceof_Operator#Description
|
18
|
-
imgs = new Array(imgs) if "string" is typeof imgs
|
19
|
-
loaded = new Array()
|
20
|
-
$.each imgs, (i, elem) ->
|
21
|
-
img = new Image()
|
22
|
-
url = elem
|
23
|
-
img_obj = img
|
24
|
-
unless "string" is typeof elem
|
25
|
-
url = $(elem).attr("src")
|
26
|
-
img_obj = elem
|
27
|
-
$(img).bind "load error", (e) ->
|
28
|
-
loaded.push img_obj
|
29
|
-
$.data img_obj, "loaded", (if ("error" is e.type) then false else true)
|
30
|
-
settings.each.call(img_obj) if settings.each instanceof Function
|
31
|
-
|
32
|
-
# http://jsperf.com/length-in-a-variable
|
33
|
-
if loaded.length >= imgs.length and settings.all instanceof Function
|
34
|
-
settings.all.call(loaded)
|
35
|
-
|
36
|
-
$(this).unbind "load error"
|
37
|
-
|
38
|
-
img.src = url
|
39
|
-
|
40
|
-
|
41
|
-
$.fn.imgpreload = (settings) ->
|
42
|
-
$.imgpreload this, settings
|
43
|
-
this
|
44
|
-
|
45
|
-
$.fn.imgpreload.defaults =
|
46
|
-
each: null # callback invoked when each image in a group loads
|
47
|
-
all: null # callback invoked when when the entire group of images has loaded
|
48
|
-
) jQuery
|
49
|
-
|
50
|
-
|