simpleslider 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/Gemfile +3 -0
- data/LICENSE +21 -0
- data/README.md +4 -0
- data/Rakefile +1 -0
- data/app/assets/javascripts/simpleslider.js +190 -0
- data/app/assets/javascripts/simpleslider.min.js +4 -0
- data/app/assets/stylesheets/simpleslider.css +88 -0
- data/lib/simpleslider/engine.rb +4 -0
- data/lib/simpleslider/version.rb +3 -0
- data/lib/simpleslider.rb +6 -0
- data/simpleslider.gemspec +40 -0
- data/test/test_helper.rb +2 -0
- metadata +72 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8a689826c6d7c89a788bd9c6c8b5e1799b940dd6
|
4
|
+
data.tar.gz: ff1b18f6f8a8d88bda0eafed983066452e2115a5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 43770ed36c8e7cdf1be92ec0c9e582df51b5245bfe4be5dfd4f561722d14dd2c972b66078498cda14f8e89b524e8641fc802ee5d479ac2f5ae67d8ba879a44b8
|
7
|
+
data.tar.gz: 583b9e314aa0e427885d82d91da33b7bdec541a8282062bf6c25849972aefd111d063a1f8884f1bd696e37bf617f253401764bf8bd8e354d646f3e5b12b419fa
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 vlewin
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,190 @@
|
|
1
|
+
/*! Simpleslider - v0.1.0 - 2014-03-03
|
2
|
+
* https://github.com/vlewin/jquery.simpleslider
|
3
|
+
* Copyright (c) 2014 Vladislav Lewinn; Licensed MIT */
|
4
|
+
/*! Simpleslider - v0.1.0 - 2014-02-28
|
5
|
+
* https://github.com/vlewin/jquery.simpleslider
|
6
|
+
* Copyright (c) 2014 Vladislav Lewinn; Licensed MIT */
|
7
|
+
|
8
|
+
/*global $:false */
|
9
|
+
|
10
|
+
var SimpleSlider = function(element, opts) {
|
11
|
+
this.init = function() {
|
12
|
+
this.id = element.selector;
|
13
|
+
this.element = $(this.selector);
|
14
|
+
this.breadcrumb = opts.breadcrumb;
|
15
|
+
this.breadcrumb_selector = opts.breadcrumb_selector;
|
16
|
+
this.link_selector = opts.link_selector;
|
17
|
+
this.back_link_selector = opts.back_link_selector;
|
18
|
+
|
19
|
+
this.bind();
|
20
|
+
|
21
|
+
return this;
|
22
|
+
};
|
23
|
+
|
24
|
+
//=== Helper methods
|
25
|
+
this.activeLink = function() {
|
26
|
+
return $(this.id).find("a[data-target='" + location.hash + "']");
|
27
|
+
};
|
28
|
+
|
29
|
+
//=== Chainable methods
|
30
|
+
this.showBreadCrumb = function() {
|
31
|
+
if(this.breadcrumb) {
|
32
|
+
var parentName = location.pathname.replace(/\//g, '').capitalize();
|
33
|
+
var childName = this.activeLink().data('title');
|
34
|
+
var back_arrow = '<i class="fa fa-lg fa-arrow-circle-left"></i> ';
|
35
|
+
var parent = '<li><a class="' + this.back_link_selector.replace('.', '') +'">' + back_arrow + parentName + '</a>';
|
36
|
+
var child = '<li><a>' + childName + '</a></li>';
|
37
|
+
$(this.breadcrumb_selector).html(parent).append(child).show();
|
38
|
+
}
|
39
|
+
return this;
|
40
|
+
};
|
41
|
+
|
42
|
+
this.hideBreadCrumb = function() {
|
43
|
+
if(this.breadcrumb) {
|
44
|
+
$(this.breadcrumb_selector).html('');
|
45
|
+
}
|
46
|
+
return this;
|
47
|
+
};
|
48
|
+
|
49
|
+
this.html = function(data) {
|
50
|
+
$(this.id).find('ul li:last-of-type').html(data);
|
51
|
+
return this;
|
52
|
+
};
|
53
|
+
|
54
|
+
this.wait = function() {
|
55
|
+
this.html('<img src="/assets/spinner.gif" alt="Spinner"> Please wait ...');
|
56
|
+
return this;
|
57
|
+
};
|
58
|
+
|
59
|
+
this.slide = function(direction) {
|
60
|
+
var first_slide = $(this.id).find('ul li:first-of-type');
|
61
|
+
|
62
|
+
// if (typeof(animation) === 'undefined') {
|
63
|
+
// first_slide.addClass('animated');
|
64
|
+
// } else {
|
65
|
+
// first_slide.removeClass('animated');
|
66
|
+
// }
|
67
|
+
|
68
|
+
if (direction === 'right') {
|
69
|
+
first_slide.css('margin-left', '-100%');
|
70
|
+
} else {
|
71
|
+
first_slide.css('margin-left', '0%');
|
72
|
+
}
|
73
|
+
return this;
|
74
|
+
};
|
75
|
+
|
76
|
+
this.forward = function(pageurl) {
|
77
|
+
var plugin = this;
|
78
|
+
$.get(pageurl, function(data) {
|
79
|
+
plugin.showBreadCrumb().slide('right').html(data);
|
80
|
+
});
|
81
|
+
|
82
|
+
$(this.id).find('ul li:last-of-type').addClass('active');
|
83
|
+
|
84
|
+
return this;
|
85
|
+
};
|
86
|
+
|
87
|
+
this.back = function() {
|
88
|
+
$(this.id).find('ul li:last-of-type').removeClass('active');
|
89
|
+
this.hideBreadCrumb().slide('left');
|
90
|
+
};
|
91
|
+
|
92
|
+
// DOM event handling
|
93
|
+
this.bind = function() {
|
94
|
+
var plugin = this;
|
95
|
+
|
96
|
+
$(window).on('load', function(e) {
|
97
|
+
// console.info('Window.onload');
|
98
|
+
|
99
|
+
if (location.hash) {
|
100
|
+
e.preventDefault();
|
101
|
+
|
102
|
+
plugin.forward(location.href.replace('#', ''));
|
103
|
+
return false;
|
104
|
+
|
105
|
+
} else {
|
106
|
+
// Browser history
|
107
|
+
window.history.pushState(
|
108
|
+
{ path: location.pathname },
|
109
|
+
'Index',
|
110
|
+
location.pathname
|
111
|
+
);
|
112
|
+
}
|
113
|
+
});
|
114
|
+
|
115
|
+
$(window).on('popstate', function(e) {
|
116
|
+
// console.info('window.popstate');
|
117
|
+
|
118
|
+
if (location.hash) {
|
119
|
+
e.preventDefault();
|
120
|
+
|
121
|
+
plugin.forward(location.href.replace('#', ''));
|
122
|
+
return false;
|
123
|
+
|
124
|
+
} else {
|
125
|
+
plugin.back();
|
126
|
+
}
|
127
|
+
});
|
128
|
+
|
129
|
+
$(document).on('click', this.link_selector, function(e) {
|
130
|
+
e.preventDefault();
|
131
|
+
|
132
|
+
var id = $(this).data('id');
|
133
|
+
var target = $(this).data('target');
|
134
|
+
var history_pathname = this.pathname.replace(id, target);
|
135
|
+
|
136
|
+
plugin.forward(this.pathname);
|
137
|
+
|
138
|
+
// Browser history
|
139
|
+
window.history.pushState(
|
140
|
+
{path: history_pathname},
|
141
|
+
$(this).data('title'),
|
142
|
+
history_pathname
|
143
|
+
);
|
144
|
+
|
145
|
+
return false;
|
146
|
+
});
|
147
|
+
|
148
|
+
$(document).on('click', this.back_link_selector, function(e) {
|
149
|
+
if (location.hash) {
|
150
|
+
e.preventDefault();
|
151
|
+
|
152
|
+
plugin.back();
|
153
|
+
|
154
|
+
// Browser history
|
155
|
+
window.history.pushState(
|
156
|
+
{path: location.pathname},
|
157
|
+
'Index',
|
158
|
+
location.pathname
|
159
|
+
);
|
160
|
+
|
161
|
+
return false;
|
162
|
+
}
|
163
|
+
});
|
164
|
+
};
|
165
|
+
|
166
|
+
};
|
167
|
+
|
168
|
+
$.fn.simpleslider = function(options) {
|
169
|
+
var opts = $.extend({}, $.fn.simpleslider.defaults, options);
|
170
|
+
var slider_instance = new SimpleSlider($(this), opts);
|
171
|
+
return slider_instance.init();
|
172
|
+
};
|
173
|
+
|
174
|
+
|
175
|
+
// Javascript helpers
|
176
|
+
String.prototype.capitalize = function() {
|
177
|
+
return this.charAt(0).toUpperCase() + this.slice(1);
|
178
|
+
};
|
179
|
+
|
180
|
+
String.prototype.string = function () {
|
181
|
+
return this.replace('.', '');
|
182
|
+
};
|
183
|
+
|
184
|
+
Number.prototype.px = function () {
|
185
|
+
return this + ('px');
|
186
|
+
};
|
187
|
+
|
188
|
+
Array.prototype.last = function () {
|
189
|
+
return this[this.length - 1];
|
190
|
+
};
|
@@ -0,0 +1,4 @@
|
|
1
|
+
/*! Simpleslider - v0.1.0 - 2014-03-03
|
2
|
+
* https://github.com/vlewin/jquery.simpleslider
|
3
|
+
* Copyright (c) 2014 Vladislav Lewinn; Licensed MIT */
|
4
|
+
var SimpleSlider=function(a,b){this.init=function(){return this.id=a.selector,this.element=$(this.selector),this.breadcrumb=b.breadcrumb,this.breadcrumb_selector=b.breadcrumb_selector,this.link_selector=b.link_selector,this.back_link_selector=b.back_link_selector,this.bind(),this},this.activeLink=function(){return $(this.id).find("a[data-target='"+location.hash+"']")},this.showBreadCrumb=function(){if(this.breadcrumb){var a=location.pathname.replace(/\//g,"").capitalize(),b=this.activeLink().data("title"),c='<i class="fa fa-lg fa-arrow-circle-left"></i> ',d='<li><a class="'+this.back_link_selector.replace(".","")+'">'+c+a+"</a>",e="<li><a>"+b+"</a></li>";$(this.breadcrumb_selector).html(d).append(e).show()}return this},this.hideBreadCrumb=function(){return this.breadcrumb&&$(this.breadcrumb_selector).html(""),this},this.html=function(a){return $(this.id).find("ul li:last-of-type").html(a),this},this.wait=function(){return this.html('<img src="/assets/spinner.gif" alt="Spinner"> Please wait ...'),this},this.slide=function(a){var b=$(this.id).find("ul li:first-of-type");return"right"===a?b.css("margin-left","-100%"):b.css("margin-left","0%"),this},this.forward=function(a){var b=this;return $.get(a,function(a){b.showBreadCrumb().slide("right").html(a)}),$(this.id).find("ul li:last-of-type").addClass("active"),this},this.back=function(){$(this.id).find("ul li:last-of-type").removeClass("active"),this.hideBreadCrumb().slide("left")},this.bind=function(){var a=this;$(window).on("load",function(b){return location.hash?(b.preventDefault(),a.forward(location.href.replace("#","")),!1):void window.history.pushState({path:location.pathname},"Index",location.pathname)}),$(window).on("popstate",function(b){return location.hash?(b.preventDefault(),a.forward(location.href.replace("#","")),!1):void a.back()}),$(document).on("click",this.link_selector,function(b){b.preventDefault();var c=$(this).data("id"),d=$(this).data("target"),e=this.pathname.replace(c,d);return a.forward(this.pathname),window.history.pushState({path:e},$(this).data("title"),e),!1}),$(document).on("click",this.back_link_selector,function(b){return location.hash?(b.preventDefault(),a.back(),window.history.pushState({path:location.pathname},"Index",location.pathname),!1):void 0})}};$.fn.simpleslider=function(a){var b=$.extend({},$.fn.simpleslider.defaults,a),c=new SimpleSlider($(this),b);return c.init()},String.prototype.capitalize=function(){return this.charAt(0).toUpperCase()+this.slice(1)},String.prototype.string=function(){return this.replace(".","")},Number.prototype.px=function(){return this+"px"},Array.prototype.last=function(){return this[this.length-1]};
|
@@ -0,0 +1,88 @@
|
|
1
|
+
#simpleslider {
|
2
|
+
-moz-perspective: 1300px;
|
3
|
+
-ms-perspective: 1300px;
|
4
|
+
-webkit-perspective: 1300px;
|
5
|
+
perspective: 1300px;
|
6
|
+
display: inline-block;
|
7
|
+
text-align: left;
|
8
|
+
position: relative;
|
9
|
+
margin-bottom: 22px;
|
10
|
+
width: 100%;
|
11
|
+
}
|
12
|
+
|
13
|
+
#simpleslider > ul {
|
14
|
+
position: relative;
|
15
|
+
z-index: 1;
|
16
|
+
font-size: 0;
|
17
|
+
line-height: 0;
|
18
|
+
margin: 0 auto;
|
19
|
+
padding: 0;
|
20
|
+
overflow: hidden;
|
21
|
+
white-space: nowrap;
|
22
|
+
|
23
|
+
-moz-box-sizing: border-box;
|
24
|
+
-webkit-box-sizing: border-box;
|
25
|
+
box-sizing: border-box;
|
26
|
+
}
|
27
|
+
|
28
|
+
#simpleslider > ul > li {
|
29
|
+
position: relative;
|
30
|
+
display: inline-block;
|
31
|
+
width: 100%;
|
32
|
+
height: 100%;
|
33
|
+
overflow: hidden;
|
34
|
+
font-size: 15px;
|
35
|
+
font-size: initial;
|
36
|
+
line-height: normal;
|
37
|
+
|
38
|
+
-moz-background-size: cover;
|
39
|
+
-o-background-size: cover;
|
40
|
+
-webkit-background-size: cover;
|
41
|
+
background-size: cover;
|
42
|
+
|
43
|
+
-moz-box-sizing: border-box;
|
44
|
+
-webkit-box-sizing: border-box;
|
45
|
+
box-sizing: border-box;
|
46
|
+
|
47
|
+
-moz-transition: all 0.3s ease;
|
48
|
+
-o-transition: all 0.3s ease;
|
49
|
+
-webkit-transition: all 0.3s ease;
|
50
|
+
transition: all 0.3s ease;
|
51
|
+
|
52
|
+
vertical-align: top;
|
53
|
+
white-space: normal;
|
54
|
+
}
|
55
|
+
|
56
|
+
/*#simpleslider > ul > li.animated {
|
57
|
+
-moz-transition: all 0.3s ease;
|
58
|
+
-o-transition: all 0.3s ease;
|
59
|
+
-webkit-transition: all 0.3s ease;
|
60
|
+
transition: all 0.3s ease;
|
61
|
+
}*/
|
62
|
+
|
63
|
+
#breadcrumb {
|
64
|
+
margin-bottom: 10px;
|
65
|
+
padding: 5px 0;
|
66
|
+
display: none;
|
67
|
+
background: #FAFAFA;
|
68
|
+
}
|
69
|
+
|
70
|
+
#breadcrumb li:not(:first-child):before {
|
71
|
+
content: '> ';
|
72
|
+
margin-left: 5px;
|
73
|
+
}
|
74
|
+
|
75
|
+
#breadcrumb > li {
|
76
|
+
display: inline-block;
|
77
|
+
line-height: normal;
|
78
|
+
}
|
79
|
+
|
80
|
+
#breadcrumb > li > a {
|
81
|
+
font-weight: bold;
|
82
|
+
text-decoration: none;
|
83
|
+
cursor: pointer;
|
84
|
+
}
|
85
|
+
|
86
|
+
#breadcrumb li > a > i {
|
87
|
+
vertical-align: sub;
|
88
|
+
}
|
data/lib/simpleslider.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "simpleslider/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "simpleslider"
|
7
|
+
s.version = SimpleSlider::VERSION
|
8
|
+
s.authors = ["Vladislav Lewin"]
|
9
|
+
s.email = 'vlewin[at]suse.de'
|
10
|
+
s.homepage = "https://github.com/vlewin/simpleslider"
|
11
|
+
s.summary = %q{Rubygem for jquery.simpleslider}
|
12
|
+
s.description = %q{Rubygem for jquery.simpleslider (https://github.com/vlewin/jquery.simpleslider)}
|
13
|
+
s.files = `git ls-files`.split("\n")
|
14
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
15
|
+
# s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
16
|
+
s.require_paths = ["lib"]
|
17
|
+
|
18
|
+
s.licenses = ["MIT"]
|
19
|
+
|
20
|
+
s.add_dependency "jquery-rails"
|
21
|
+
# specify any dependencies here; for example:
|
22
|
+
# s.add_development_dependency "rspec"
|
23
|
+
# s.add_runtime_dependency "railties"
|
24
|
+
end
|
25
|
+
|
26
|
+
# Gem::Specification.new do |s|
|
27
|
+
# s.name = 'svarog-client'
|
28
|
+
# s.version = '1.0.0'
|
29
|
+
# s.date = Time.now.strftime('%F')
|
30
|
+
# s.summary = "Svarog Client"
|
31
|
+
# s.description = "This gem provides a very simple command line tool to send notifications to the Svarog server"
|
32
|
+
# s.authors = ["Vladislav Lewin"]
|
33
|
+
# s.email = 'vlewin[at]suse.de'
|
34
|
+
# s.files = Dir.glob("lib/**/*")
|
35
|
+
# s.executables << 'svarog-client'
|
36
|
+
# s.homepage = 'https://github.com/vlewin/svarog-client'
|
37
|
+
|
38
|
+
# s.add_runtime_dependency 'rest-client'
|
39
|
+
# s.add_runtime_dependency 'choice'
|
40
|
+
# end
|
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: simpleslider
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Vladislav Lewin
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-03-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: jquery-rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: Rubygem for jquery.simpleslider (https://github.com/vlewin/jquery.simpleslider)
|
28
|
+
email: vlewin[at]suse.de
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- .gitignore
|
34
|
+
- Gemfile
|
35
|
+
- LICENSE
|
36
|
+
- README.md
|
37
|
+
- Rakefile
|
38
|
+
- app/assets/javascripts/simpleslider.js
|
39
|
+
- app/assets/javascripts/simpleslider.min.js
|
40
|
+
- app/assets/stylesheets/simpleslider.css
|
41
|
+
- lib/simpleslider.rb
|
42
|
+
- lib/simpleslider/engine.rb
|
43
|
+
- lib/simpleslider/version.rb
|
44
|
+
- simpleslider.gemspec
|
45
|
+
- test/test_helper.rb
|
46
|
+
homepage: https://github.com/vlewin/simpleslider
|
47
|
+
licenses:
|
48
|
+
- MIT
|
49
|
+
metadata: {}
|
50
|
+
post_install_message:
|
51
|
+
rdoc_options: []
|
52
|
+
require_paths:
|
53
|
+
- lib
|
54
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- - '>='
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: '0'
|
59
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - '>='
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
64
|
+
requirements: []
|
65
|
+
rubyforge_project:
|
66
|
+
rubygems_version: 2.1.11
|
67
|
+
signing_key:
|
68
|
+
specification_version: 4
|
69
|
+
summary: Rubygem for jquery.simpleslider
|
70
|
+
test_files:
|
71
|
+
- test/test_helper.rb
|
72
|
+
has_rdoc:
|