light_masonry 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +99 -0
- data/LICENSE.txt +20 -0
- data/VERSION +1 -0
- data/lib/light_masonry.rb +7 -0
- data/light_masonry.gemspec +28 -0
- data/vendor/assets/javascripts/light_masonry/light_masonry.js +99 -0
- metadata +51 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 111bc546a5bd73ffb09cb4209fcc4e6ef046b343
|
4
|
+
data.tar.gz: 4889a24de393522526be6a38c1fffbc1a1566fb0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d932d86f94c788bbe6029d74f95fb1ad34e67dcd698c6bc7ffe650f8cd451927eee1d81f6d09de86d091d89d3f5a9f114900141f2645bd9a06dd31bcc3cc94d5
|
7
|
+
data.tar.gz: 46ab842c6d0d7952b9b18343e0a3ce158714cc4802e558ab6e88b3d1b92f648bd8966013de264ea39711e1f8fd4ccdd4a0801666da6b3b221ae1982f84fb1556
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
abstract (1.0.0)
|
5
|
+
actionpack (3.0.8)
|
6
|
+
activemodel (= 3.0.8)
|
7
|
+
activesupport (= 3.0.8)
|
8
|
+
builder (~> 2.1.2)
|
9
|
+
erubis (~> 2.6.6)
|
10
|
+
i18n (~> 0.5.0)
|
11
|
+
rack (~> 1.2.1)
|
12
|
+
rack-mount (~> 0.6.14)
|
13
|
+
rack-test (~> 0.5.7)
|
14
|
+
tzinfo (~> 0.3.23)
|
15
|
+
activemodel (3.0.8)
|
16
|
+
activesupport (= 3.0.8)
|
17
|
+
builder (~> 2.1.2)
|
18
|
+
i18n (~> 0.5.0)
|
19
|
+
activesupport (3.0.8)
|
20
|
+
addressable (2.3.5)
|
21
|
+
builder (2.1.2)
|
22
|
+
diff-lcs (1.2.5)
|
23
|
+
erubis (2.6.6)
|
24
|
+
abstract (>= 1.0.0)
|
25
|
+
faraday (0.8.7)
|
26
|
+
multipart-post (~> 1.1)
|
27
|
+
git (1.2.5)
|
28
|
+
github_api (0.10.1)
|
29
|
+
addressable
|
30
|
+
faraday (~> 0.8.1)
|
31
|
+
hashie (>= 1.2)
|
32
|
+
multi_json (~> 1.4)
|
33
|
+
nokogiri (~> 1.5.2)
|
34
|
+
oauth2
|
35
|
+
hashie (2.0.5)
|
36
|
+
highline (1.6.19)
|
37
|
+
httpauth (0.2.0)
|
38
|
+
i18n (0.5.0)
|
39
|
+
jeweler (1.8.6)
|
40
|
+
builder
|
41
|
+
bundler (~> 1.0)
|
42
|
+
git (>= 1.2.5)
|
43
|
+
github_api (= 0.10.1)
|
44
|
+
highline (>= 1.6.15)
|
45
|
+
nokogiri (= 1.5.10)
|
46
|
+
rake
|
47
|
+
rdoc
|
48
|
+
json (1.8.1)
|
49
|
+
jwt (0.1.8)
|
50
|
+
multi_json (>= 1.5)
|
51
|
+
multi_json (1.10.1)
|
52
|
+
multi_xml (0.5.4)
|
53
|
+
multipart-post (1.2.0)
|
54
|
+
nokogiri (1.5.10)
|
55
|
+
oauth2 (0.9.2)
|
56
|
+
faraday (~> 0.8)
|
57
|
+
httpauth (~> 0.2)
|
58
|
+
jwt (~> 0.1.4)
|
59
|
+
multi_json (~> 1.0)
|
60
|
+
multi_xml (~> 0.5)
|
61
|
+
rack (~> 1.2)
|
62
|
+
rack (1.2.8)
|
63
|
+
rack-mount (0.6.14)
|
64
|
+
rack (>= 1.0.0)
|
65
|
+
rack-test (0.5.7)
|
66
|
+
rack (>= 1.0)
|
67
|
+
railties (3.0.8)
|
68
|
+
actionpack (= 3.0.8)
|
69
|
+
activesupport (= 3.0.8)
|
70
|
+
rake (>= 0.8.7)
|
71
|
+
thor (~> 0.14.4)
|
72
|
+
rake (10.1.1)
|
73
|
+
rdoc (4.1.2)
|
74
|
+
json (~> 1.4)
|
75
|
+
rspec (2.13.0)
|
76
|
+
rspec-core (~> 2.13.0)
|
77
|
+
rspec-expectations (~> 2.13.0)
|
78
|
+
rspec-mocks (~> 2.13.0)
|
79
|
+
rspec-core (2.13.1)
|
80
|
+
rspec-expectations (2.13.0)
|
81
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
82
|
+
rspec-mocks (2.13.0)
|
83
|
+
simplecov (0.7.1)
|
84
|
+
multi_json (~> 1.0)
|
85
|
+
simplecov-html (~> 0.7.1)
|
86
|
+
simplecov-html (0.7.1)
|
87
|
+
thor (0.14.6)
|
88
|
+
tzinfo (0.3.37)
|
89
|
+
|
90
|
+
PLATFORMS
|
91
|
+
ruby
|
92
|
+
|
93
|
+
DEPENDENCIES
|
94
|
+
bundler (~> 1.2, > 1.2.0)
|
95
|
+
jeweler (~> 1.8, > 1.8.4)
|
96
|
+
railties
|
97
|
+
rdoc (~> 4.0, > 4.0.0)
|
98
|
+
rspec (~> 2.10, > 2.10.0)
|
99
|
+
simplecov (~> 0.5)
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2012 Dileep Nandanam
|
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/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
@@ -0,0 +1,28 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = "light_masonry"
|
3
|
+
s.version = "0.1.0"
|
4
|
+
|
5
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
6
|
+
s.require_paths = ["lib"]
|
7
|
+
s.authors = ["Dileep Nandanam"]
|
8
|
+
s.date = "2019-06-15"
|
9
|
+
s.description = "Tiny masonry gem"
|
10
|
+
s.email = "dileepsnandanam@gmail.com"
|
11
|
+
s.extra_rdoc_files = [
|
12
|
+
"LICENSE.txt"
|
13
|
+
]
|
14
|
+
s.files = [
|
15
|
+
"Gemfile",
|
16
|
+
"Gemfile.lock",
|
17
|
+
"LICENSE.txt",
|
18
|
+
"VERSION",
|
19
|
+
"lib/light_masonry.rb",
|
20
|
+
"light_masonry.gemspec",
|
21
|
+
"vendor/assets/javascripts/light_masonry/light_masonry.js"
|
22
|
+
]
|
23
|
+
s.homepage = "http://github.com/dileepnandanam/light_masonry"
|
24
|
+
s.licenses = ["MIT"]
|
25
|
+
s.rubygems_version = "2.2.2"
|
26
|
+
s.summary = "Use light_masonry with rails asset pipeline"
|
27
|
+
end
|
28
|
+
|
@@ -0,0 +1,99 @@
|
|
1
|
+
masonry = function(config){
|
2
|
+
var surface = [[0, parseInt($(this).css('width')), 0]]
|
3
|
+
var i
|
4
|
+
push = function(e, where) {
|
5
|
+
surface.push(e)
|
6
|
+
}
|
7
|
+
brick = $(config['itemSelector'].split(' ').join(','))
|
8
|
+
for(i = 0; i < brick.length; i++) {
|
9
|
+
width = parseInt($(brick[i]).css('width'))
|
10
|
+
height = parseInt($(brick[i]).css('height'))
|
11
|
+
surface = surface.sort(function(a,b) {
|
12
|
+
if(a[2]==b[2]) {
|
13
|
+
if(a[0] == b[0])
|
14
|
+
return(0)
|
15
|
+
else if(a[0] < b[0])
|
16
|
+
return(-1)
|
17
|
+
else
|
18
|
+
return(1)
|
19
|
+
}
|
20
|
+
else if(a[2]<b[2]) return(-1)
|
21
|
+
else return(1)
|
22
|
+
})
|
23
|
+
|
24
|
+
var j
|
25
|
+
|
26
|
+
for(j = 0; j < surface.length; j++) {
|
27
|
+
if(surface[j][1]-surface[j][0] >= width) {
|
28
|
+
var removed = surface[j]
|
29
|
+
$(brick[i]).css('top', removed[2])
|
30
|
+
$(brick[i]).css('left', removed[0])
|
31
|
+
|
32
|
+
new_l = removed[0]
|
33
|
+
new_r = removed[0] + width
|
34
|
+
new_h = removed[2] + height
|
35
|
+
|
36
|
+
length = surface.length
|
37
|
+
for(k = 0; k < length; k++) {
|
38
|
+
|
39
|
+
if(cond = new_l == surface[k][0] && new_r <= surface[k][1] && new_h > surface[k][2]) {
|
40
|
+
push([new_r + 1, surface[k][1], surface[k][2]], 1)
|
41
|
+
push([surface[k][0], surface[k][1], new_h + 1], 1)
|
42
|
+
surface.splice(k, 1)
|
43
|
+
k = k - 1
|
44
|
+
}
|
45
|
+
else if(cond1 = new_l > surface[k][0] && new_r == surface[k][1] && new_h > surface[k][2]) {
|
46
|
+
push([surface[k][0], new_l - 1, surface[k][2]], 2)
|
47
|
+
push([surface[k][0], surface[k][1], new_h + 1], 2)
|
48
|
+
surface.splice(k, 1)
|
49
|
+
k = k - 1
|
50
|
+
}
|
51
|
+
else if(cond2 = new_l == surface[k][0] && new_r >= surface[k][1] && new_h > surface[k][2]) {
|
52
|
+
//push([surface[k][1] + 1, new_r, surface[k][2]], 3)
|
53
|
+
push([surface[k][0], new_r, new_h + 1], 3)
|
54
|
+
surface.splice(k, 1)
|
55
|
+
k = k - 1
|
56
|
+
}
|
57
|
+
else if(cond3 = new_l < surface[k][0] && new_r == surface[k][1] && new_h > surface[k][2]) {
|
58
|
+
//push([new_l, surface[k][0] - 1, surface[k][2]], 4)
|
59
|
+
push([new_l, surface[k][1], new_h + 1], 4)
|
60
|
+
surface.splice(k, 1)
|
61
|
+
k = k - 1
|
62
|
+
}
|
63
|
+
else if(cond4 = new_l < surface[k][0] && new_r > surface[k][1] && new_h > surface[k][2]) {
|
64
|
+
push([new_l, new_r, new_h + 1])
|
65
|
+
surface.splice(k, 1)
|
66
|
+
k = k - 1
|
67
|
+
}
|
68
|
+
else if(cond5 = new_l > surface[k][0] && new_r < surface[k][1] && new_h > surface[k][2]) {
|
69
|
+
push([new_l, surface[k][0] - 1, surface[k][2]], 5)
|
70
|
+
push([surface[k][1] + 1, new_r, surface[k][2]], 5)
|
71
|
+
push([surface[k][0], surface[k][1], new_h + 1], 5)
|
72
|
+
surface.splice(k, 1)
|
73
|
+
k = k - 1
|
74
|
+
}
|
75
|
+
else if(new_l == surface[k][0] && new_r == surface[k][1] && new_h > surface[k][2]) {
|
76
|
+
push([new_l, new_r, new_h + 1], 6)
|
77
|
+
surface.splice(k, 1)
|
78
|
+
k = k - 1
|
79
|
+
}
|
80
|
+
else if(new_l < surface[k][0] && new_r < surface[k][1] && new_r > surface[k][0] && new_h > surface[k][2]) {
|
81
|
+
push([new_r + 1, surface[k][1], surface[k][2]], 6)
|
82
|
+
surface.splice(k, 1)
|
83
|
+
k = k - 1
|
84
|
+
}
|
85
|
+
else if(new_l > surface[k][0] && new_l < surface[k][1] && new_r > surface[k][1] && new_h > surface[k][2]) {
|
86
|
+
push([surface[k][1], new_r, surface[k][2]], 7)
|
87
|
+
surface.splice(k, 1)
|
88
|
+
k = k - 1
|
89
|
+
}
|
90
|
+
}
|
91
|
+
|
92
|
+
|
93
|
+
break
|
94
|
+
}
|
95
|
+
}
|
96
|
+
}
|
97
|
+
$(this).css('height', surface.sort(function(a,b){if(a<b) return(1);else if(a==b) return(0); else return(-1)})[surface.length - 1][2])
|
98
|
+
}
|
99
|
+
$.fn.extend({masonry: masonry})
|
metadata
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: light_masonry
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dileep Nandanam
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-06-15 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Tiny masonry gem
|
14
|
+
email: dileepsnandanam@gmail.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files:
|
18
|
+
- LICENSE.txt
|
19
|
+
files:
|
20
|
+
- Gemfile
|
21
|
+
- Gemfile.lock
|
22
|
+
- LICENSE.txt
|
23
|
+
- VERSION
|
24
|
+
- lib/light_masonry.rb
|
25
|
+
- light_masonry.gemspec
|
26
|
+
- vendor/assets/javascripts/light_masonry/light_masonry.js
|
27
|
+
homepage: http://github.com/dileepnandanam/light_masonry
|
28
|
+
licenses:
|
29
|
+
- MIT
|
30
|
+
metadata: {}
|
31
|
+
post_install_message:
|
32
|
+
rdoc_options: []
|
33
|
+
require_paths:
|
34
|
+
- lib
|
35
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
45
|
+
requirements: []
|
46
|
+
rubyforge_project:
|
47
|
+
rubygems_version: 2.5.2
|
48
|
+
signing_key:
|
49
|
+
specification_version: 4
|
50
|
+
summary: Use light_masonry with rails asset pipeline
|
51
|
+
test_files: []
|