slighty 0.1.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 +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +38 -0
- data/Rakefile +27 -0
- data/lib/slighty.rb +4 -0
- data/lib/slighty/version.rb +3 -0
- data/lib/tasks/slighty_tasks.rake +4 -0
- data/vendor/assets/javascripts/slighty.js +60 -0
- data/vendor/assets/stylesheets/slighty.css +49 -0
- metadata +66 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 322139357a21eb62fae71dee4e32281cebedb0a9
|
|
4
|
+
data.tar.gz: 2dd3e0216840e2d78b9b69e14c153acd9c9b2958
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 78f8ed4be4fed6f195a4dcc1a9c8668d89092d6e355694e107cb3689d3ec667a4494ddc24bffea696fb80b0a31bca4dbc59b5290d391f951d37463d644030265
|
|
7
|
+
data.tar.gz: 76f341b534cdb3a35defb421786719cfc62ed4f1cc7bf135328e45f7f7116658b93eead00123aa7bb680d7af18b100d415d43a8827bf90bd72d599103cd5b4d8
|
data/MIT-LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright 2017 Okan Vurdu
|
|
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/README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# slighty
|
|
2
|
+
|
|
3
|
+
a simple lightbox plugin that runs with Rails Asset Pipeline.
|
|
4
|
+
|
|
5
|
+
## installation
|
|
6
|
+
|
|
7
|
+
1. add to your `Gemfile` and install with bundler:
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
gem 'slighty'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
bundle install
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
3. require the slight javascript file in `app/assets/javascripts/application.js`:
|
|
18
|
+
|
|
19
|
+
```js
|
|
20
|
+
//= require slighty
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
4. require the modified slighty css file in `app/assets/stylesheets/application.css`:
|
|
24
|
+
|
|
25
|
+
```css
|
|
26
|
+
*= require slighty
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## how it works?
|
|
30
|
+
slighty automatically binds your `a` tags that includes `data-slighty` attribute. for example;
|
|
31
|
+
|
|
32
|
+
```html
|
|
33
|
+
<a href="image_url_to_show_in_slighty" data-slighty>
|
|
34
|
+
<img src="..." />
|
|
35
|
+
</a>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
copyright [Okan Vurdu](https://github.com/okan), released under the MIT License.
|
data/Rakefile
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
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 = 'Slighty'
|
|
12
|
+
rdoc.options << '--line-numbers'
|
|
13
|
+
rdoc.rdoc_files.include('README.md')
|
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
require 'bundler/gem_tasks'
|
|
18
|
+
require 'rake/testtask'
|
|
19
|
+
|
|
20
|
+
Rake::TestTask.new(:test) do |t|
|
|
21
|
+
t.libs << 'lib'
|
|
22
|
+
t.libs << 'test'
|
|
23
|
+
t.pattern = 'test/**/*_test.rb'
|
|
24
|
+
t.verbose = false
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
task default: :test
|
data/lib/slighty.rb
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
(function (root, factory){
|
|
2
|
+
if(typeof define === 'function' && define.amd){
|
|
3
|
+
define(['jquery'], factory);
|
|
4
|
+
}
|
|
5
|
+
else if(typeof exports === 'object'){
|
|
6
|
+
module.exports = factory(require('jquery'));
|
|
7
|
+
}
|
|
8
|
+
else {
|
|
9
|
+
root.slighty = factory(root.jQuery);
|
|
10
|
+
}
|
|
11
|
+
}(this, function($) {
|
|
12
|
+
|
|
13
|
+
function slighty(options){
|
|
14
|
+
this.init();
|
|
15
|
+
this.options = $.extend(options, this.constructor.defaults);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
slighty.defaults = {
|
|
19
|
+
borderSize: 2,
|
|
20
|
+
borderColor: '#000'
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
slighty.prototype.init = function() {
|
|
24
|
+
var self = this;
|
|
25
|
+
$(function(){
|
|
26
|
+
self.build();
|
|
27
|
+
self.bind();
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
slighty.prototype.bind = function(){
|
|
32
|
+
var self = this;
|
|
33
|
+
$(document).on('click', 'a[data-slighty]', function(event){
|
|
34
|
+
event.preventDefault();
|
|
35
|
+
self.show($(event.currentTarget));
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
slighty.prototype.build = function(){
|
|
40
|
+
var self = this;
|
|
41
|
+
var element = '<div class="slighty-overlay"><div class="slighty-container"><div class="slighty-image-container"><a class="slighty-close-button"></a><div class="slighty-image-view"><img class="slighty-image"/></div></div></div></div>';
|
|
42
|
+
$(element).appendTo('body');
|
|
43
|
+
|
|
44
|
+
this.$slighty = $(".slighty-overlay");
|
|
45
|
+
this.$slighty.hide();
|
|
46
|
+
|
|
47
|
+
this.$slighty.find('a.slighty-close-button').on('click', function(){
|
|
48
|
+
self.$slighty.fadeOut('fast');
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
slighty.prototype.show = function(target){
|
|
53
|
+
var self = this;
|
|
54
|
+
var src = $(target[0]).attr('href');
|
|
55
|
+
$('.slighty-image').attr('src', src);
|
|
56
|
+
$(".slighty-overlay").fadeIn('fast');
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return new slighty();
|
|
60
|
+
}));
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
.slighty-overlay {
|
|
2
|
+
background-color: rgba(255, 255, 255, .85);
|
|
3
|
+
display: table;
|
|
4
|
+
height: 100%;
|
|
5
|
+
left: 0;
|
|
6
|
+
position: fixed;
|
|
7
|
+
top: 0;
|
|
8
|
+
width: 100%;
|
|
9
|
+
z-index: 999;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.slighty-container {
|
|
13
|
+
display: table-cell;
|
|
14
|
+
vertical-align: middle;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.slighty-image-container {
|
|
18
|
+
border: 2px solid #000;
|
|
19
|
+
height: 440px;
|
|
20
|
+
margin-left: auto;
|
|
21
|
+
margin-right: auto;
|
|
22
|
+
width: 600px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.slighty-image-view {
|
|
26
|
+
background: #E9EBEE;
|
|
27
|
+
display: block;
|
|
28
|
+
margin: 20px 0;
|
|
29
|
+
min-height: 400px;
|
|
30
|
+
text-align: center;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.slighty-image {
|
|
34
|
+
display: block;
|
|
35
|
+
margin: 0 auto;
|
|
36
|
+
max-width: 600px;
|
|
37
|
+
min-height: 400px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.slighty-close-button {
|
|
41
|
+
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAGzUlEQVR4Xu2dSagdRRSGv0Qw6k5xAnEeiAOIILhScFw4ggNm6wgGZ0UcMaCgGGdFBY1bxQHHhaCioCtBUSRqkDgQccJhZ6I4cUw3XB7X97pvd51z6p7TkFW6q+v//++eqtvV79Yy8gjtwLLQ6lM8CUBwCBKABCC4A8HlZwVIAII7EFx+VoAEILgDweVnBUgAgjsQXH5WgAQguAPB5WcFSACCOxBcflaABCC4A8HlZwVIAII7EFx+VoAEILgDweVnBUgAgjsQXH5WgAQguAPB5WcFSADcOCAwrgT2B1YAvwLrgR/c9HC2juwOHArsCGwGNgIbgH9ma27cqzxUgP2Aq4BVwM5T5H0EPAGsawwc14Eyre0AXARcCBw25RY/Ak8B9wFfl+lCt1YtAdgGuBm4Edi2Q3e/As4H3upwruUpJzaw7tmhE78DtwF3AH93OH/0U6wA2B54Dji5pyIx6VLg0Z7XaZ1+GXA/sLznDV8GzgW29Lxu8OkWAMgnXwT3DX9SrAwZYrSn41p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DSZVDGwB5Jq69398s4VtCoDoUaAPw8f/spVuK9iHhW0HwPnBkKUMWtqsJgOyi/Z2WsJHf2ZfXvLTmBLJhxC7AzxpeaQJwfPMr4Rq6xvjkL+yn5vB1DPCOhlGaAJwNPKsgqkT4kws5GnOYudw06hTg1cIAlAxfE4K53DZuZbNvcCkGNMLXgkD2WP6ylFGT7WoOAXIv2TVs1wLCNMMvDcE3ms9JNAEQ42T8lMnUmIdF+G3/S/y28VrgujENWqwtbQD2BjYAK0YSaBl+CQh+Aw4EZANplUMbABF1E3D7COo8hD82BLJCqrVB5X99twBgOfACcPoACDyFPxYEzwPnAPIgSO2wAEDEbQc8A5zWU6lsrbZac2PFnv2TvsnGmAJ5n+NFYJXmIlDbOSsA5P5i0vXALQ0QSxm2EThP6wnZUp1Z5P9lX8R1wL4d2tgCrAHu0v7kewCg7cNezVZu8gmQ9YLJQ8rhB42hT1p8QjqEOO0UqXAXNP+OmHKCrIk83Wybt2nGe4xymWUFWChA+iIzYHkIIlvMyu7Z64GfRlFq14gs7Mga/07AZkAqmWwR6+LwBIALQ6J1IgGIlvgCvQlAAhDcgeDyswIkAMEdCC4/K0ACENyB4PKzAiQAwR0ILj8rQAIQ3IHg8rMCJADBHQguPytAAhDcgeDyswIkAMEdCC4/K0ACENyB4PKzAiQAwR0ILj8rQAIQ3IHg8rMCJADBHQgu/19k+BSQrvskYAAAAABJRU5ErkJggg==');
|
|
42
|
+
background-size: 24px 24px;
|
|
43
|
+
cursor: pointer;
|
|
44
|
+
height: 24px;
|
|
45
|
+
right: 10px;
|
|
46
|
+
position: absolute;
|
|
47
|
+
top: 10px;
|
|
48
|
+
width: 24px;
|
|
49
|
+
}
|
metadata
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: slighty
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Okan Vurdu
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2017-03-30 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: railties
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '3.1'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '3.1'
|
|
27
|
+
description: A simple lightbox plugin for Rails asset pipeline.
|
|
28
|
+
email:
|
|
29
|
+
- okanvurdu@gmail.com
|
|
30
|
+
executables: []
|
|
31
|
+
extensions: []
|
|
32
|
+
extra_rdoc_files: []
|
|
33
|
+
files:
|
|
34
|
+
- MIT-LICENSE
|
|
35
|
+
- README.md
|
|
36
|
+
- Rakefile
|
|
37
|
+
- lib/slighty.rb
|
|
38
|
+
- lib/slighty/version.rb
|
|
39
|
+
- lib/tasks/slighty_tasks.rake
|
|
40
|
+
- vendor/assets/javascripts/slighty.js
|
|
41
|
+
- vendor/assets/stylesheets/slighty.css
|
|
42
|
+
homepage: http://github.com/okan/slighty
|
|
43
|
+
licenses:
|
|
44
|
+
- MIT
|
|
45
|
+
metadata: {}
|
|
46
|
+
post_install_message:
|
|
47
|
+
rdoc_options: []
|
|
48
|
+
require_paths:
|
|
49
|
+
- lib
|
|
50
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ">="
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0'
|
|
55
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
56
|
+
requirements:
|
|
57
|
+
- - ">="
|
|
58
|
+
- !ruby/object:Gem::Version
|
|
59
|
+
version: '0'
|
|
60
|
+
requirements: []
|
|
61
|
+
rubyforge_project:
|
|
62
|
+
rubygems_version: 2.6.8
|
|
63
|
+
signing_key:
|
|
64
|
+
specification_version: 4
|
|
65
|
+
summary: A simple lightbox plugin for Rails asset pipeline.
|
|
66
|
+
test_files: []
|