simpleslider 1.0.1 → 1.0.2
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b70b6b875995d8f6a2ce0fe8e2bc1c4b92a79d7
|
4
|
+
data.tar.gz: 4d3eebd3c4476dedfac6702368eaad34499530f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6f79e6c37cd7d5ceb1de751ed0afe43d8c29fd718e7565ecec874788071e32be72d8128b8f1c04b3ff41e83e942d39e03b8f3ab85c0275e9c33c5b760ee1878
|
7
|
+
data.tar.gz: fc8b1f4d3e4f1617cc63890def417bc178186db5573e973f544bf2ff62ea9cc9be91200449baa077506d64fada7452ee1147427fe1f15aaf16967e2734b1f6e4
|
@@ -1,11 +1,12 @@
|
|
1
|
-
/*! Simpleslider - v0.1.0 - 2014-03-
|
1
|
+
/*! Simpleslider - v0.1.0 - 2014-03-13
|
2
2
|
* https://github.com/vlewin/jquery.simpleslider
|
3
3
|
* Copyright (c) 2014 Vladislav Lewinn; Licensed MIT */
|
4
|
-
/*!
|
5
|
-
* https://github.com/vlewin/jquery.
|
4
|
+
/*! Simplediv - v0.1.0 - 2014-02-28
|
5
|
+
* https://github.com/vlewin/jquery.simplediv
|
6
6
|
* Copyright (c) 2014 Vladislav Lewinn; Licensed MIT */
|
7
7
|
|
8
8
|
/*global $:false */
|
9
|
+
|
9
10
|
var SimpleSlider = function(element, opts) {
|
10
11
|
this.init = function() {
|
11
12
|
this.id = element.selector;
|
@@ -34,7 +35,9 @@ var SimpleSlider = function(element, opts) {
|
|
34
35
|
parentName = location.pathname.replace(/\//g, '').capitalize();
|
35
36
|
}
|
36
37
|
|
37
|
-
var
|
38
|
+
var pathname = (location.pathname+location.hash);
|
39
|
+
var childName = sessionStorage.getItem(pathname);
|
40
|
+
|
38
41
|
var back_arrow = '<i class="fa fa-lg fa-arrow-circle-left"></i> ';
|
39
42
|
var parent = '<li><a class="' + this.back_link_selector.replace('.', '') +'">' + back_arrow + parentName + '</a>';
|
40
43
|
var child = '<li><a>' + childName + '</a></li>';
|
@@ -75,6 +78,10 @@ var SimpleSlider = function(element, opts) {
|
|
75
78
|
return this;
|
76
79
|
};
|
77
80
|
|
81
|
+
this.remember = function(url, title) {
|
82
|
+
sessionStorage.setItem(url, title);
|
83
|
+
};
|
84
|
+
|
78
85
|
this.forward = function(pageurl) {
|
79
86
|
var plugin = this;
|
80
87
|
$.get(pageurl, function(data) {
|
@@ -128,8 +135,10 @@ var SimpleSlider = function(element, opts) {
|
|
128
135
|
|
129
136
|
var id = $(this).data('id');
|
130
137
|
var target = $(this).data('target');
|
138
|
+
var title = $(this).data('title');
|
131
139
|
var history_pathname = this.pathname.replace(id, target);
|
132
140
|
|
141
|
+
plugin.remember(history_pathname, title);
|
133
142
|
plugin.forward(this.pathname);
|
134
143
|
|
135
144
|
// Browser history
|
@@ -150,7 +159,7 @@ var SimpleSlider = function(element, opts) {
|
|
150
159
|
|
151
160
|
// Browser history
|
152
161
|
window.history.pushState(
|
153
|
-
{path: location.pathname},
|
162
|
+
{ path: location.pathname },
|
154
163
|
'Index',
|
155
164
|
location.pathname
|
156
165
|
);
|
@@ -164,8 +173,8 @@ var SimpleSlider = function(element, opts) {
|
|
164
173
|
|
165
174
|
$.fn.simpleslider = function(options) {
|
166
175
|
var opts = $.extend({}, $.fn.simpleslider.defaults, options);
|
167
|
-
var
|
168
|
-
return
|
176
|
+
var slider_instance = new SimpleSlider($(this), opts);
|
177
|
+
return slider_instance.init();
|
169
178
|
};
|
170
179
|
|
171
180
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/*! Simpleslider - v0.1.0 - 2014-03-
|
1
|
+
/*! Simpleslider - v0.1.0 - 2014-03-13
|
2
2
|
* https://github.com/vlewin/jquery.simpleslider
|
3
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=$(this.id).find("section").data("crumb");a||(a=location.pathname.replace(/\//g,"").capitalize());var b=
|
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=$(this.id).find("section").data("crumb");a||(a=location.pathname.replace(/\//g,"").capitalize());var b=location.pathname+location.hash,c=sessionStorage.getItem(b),d='<i class="fa fa-lg fa-arrow-circle-left"></i> ',e='<li><a class="'+this.back_link_selector.replace(".","")+'">'+d+a+"</a>",f="<li><a>"+c+"</a></li>";$(this.breadcrumb_selector).html(e).append(f).show()}return this},this.hideBreadCrumb=function(){return this.breadcrumb&&$(this.breadcrumb_selector).html(""),this},this.html=function(a){return $(this.id).find("section article: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("section article:first-of-type"),c=$(this.id).find("section article:last-of-type");return"right"===a?(b.css("margin-left","-100%").css("visibility","hidden"),c.css("visibility","visible")):(b.css("margin-left","0%").css("visibility","visible"),c.css("visibility","hidden")),this},this.remember=function(a,b){sessionStorage.setItem(a,b)},this.forward=function(a){var b=this;return $.get(a,function(a){b.showBreadCrumb().slide("right").html(a)}),this},this.back=function(){$(this.id).find("section article:first-of-type").css("visibility","visible"),$(this.id).find("section article:last-of-type").css("visibility","hidden"),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).data("title"),f=this.pathname.replace(c,d);return a.remember(f,e),a.forward(this.pathname),window.history.pushState({path:f},$(this).data("title"),f),!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]};
|
data/lib/simpleslider/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simpleslider
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vladislav Lewin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jquery-rails
|