simpleslider 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1fc64bb70efe1259dad08f25970c26571b86e4d7
4
- data.tar.gz: 9f998280154dad42680864fb73c2ecc7fa93979e
3
+ metadata.gz: 020a141864905e52484bd363f970467afe0b208b
4
+ data.tar.gz: 8829d25b1702fc25a29ff0ef74338e41fe4ddc69
5
5
  SHA512:
6
- metadata.gz: 265fc69dffa81ccce727f26b3badff3f0042a47bcae8470815353c737773dd59fcf11fbe8e15f3534792a17fea14ccaeefaaa43d4b20c5d77c3cc595f1530dda
7
- data.tar.gz: 8904b2616dccb7501572c7206182c2057f5d453a34b7b99cd4d93d4be6d1419e6396859c2e1fa5c60877413da458e33c763bd02d16a08ce57ca685bce97900f9
6
+ metadata.gz: 5d481b92028070382357d7e349d15565a97a6fe106e3bceb2ae05b03a292fab975bf63ff9a6c56e4812b59fc42db0fb537817266b1f4a2b090b2d22d955d66e5
7
+ data.tar.gz: 1bf9fa9ad3b0f070a3e53649bdcda3473868ead106865e193c6b695ed359db06c89daddd938d34f51e620655047b602dbabcdbed03ba17ee70ca63beac5503d4
@@ -1,7 +1,7 @@
1
- /*! Simpleslider - v1.0.3 - 2014-03-13
1
+ /*! Simpleslider - v1.0.4 - 2014-03-14
2
2
  * https://github.com/vlewin/jquery.simpleslider
3
3
  * Copyright (c) 2014 Vladislav Lewinn; Licensed MIT */
4
- /*! Simplediv - 1.0.3 - 2014-03-13
4
+ /*! Simplediv - 1.0.4 - 2014-03-14
5
5
  * https://github.com/vlewin/jquery.simplediv
6
6
  * Copyright (c) 2014 Vladislav Lewinn; Licensed MIT */
7
7
 
@@ -11,12 +11,13 @@ var SimpleSlider = function(element, opts) {
11
11
  this.init = function() {
12
12
  this.id = element.selector;
13
13
  this.element = $(this.selector);
14
- this.spinner = opts.spinner;
15
- this.breadcrumb = opts.breadcrumb;
16
- this.breadcrumb_selector = opts.breadcrumb_selector;
17
14
  this.link_selector = opts.link_selector;
18
15
  this.back_link_selector = opts.back_link_selector;
19
16
 
17
+ this.spinner = opts.spinner;
18
+ this.breadcrumb = opts.breadcrumb;
19
+ this.breadcrumb_selector = opts.breadcrumb.selector;
20
+
20
21
  this.bind();
21
22
 
22
23
  return this;
@@ -29,7 +30,7 @@ var SimpleSlider = function(element, opts) {
29
30
 
30
31
  //=== Chainable methods
31
32
  this.showBreadCrumb = function() {
32
- if(this.breadcrumb) {
33
+ if(this.breadcrumb.show) {
33
34
  var parentName = $(this.id).find('section').data('crumb');
34
35
 
35
36
  if(!parentName) {
@@ -40,15 +41,30 @@ var SimpleSlider = function(element, opts) {
40
41
  var childName = sessionStorage.getItem(pathname);
41
42
  var back_arrow = '<i class="fa fa-lg fa-arrow-circle-left"></i> ';
42
43
  var parent = '<li><a class="' + this.back_link_selector.replace('.', '') +'">' + back_arrow + parentName + '</a>';
43
- var child = '<li><a>' + childName + '</a></li>';
44
- $(this.breadcrumb_selector).html(parent).append(child).show();
44
+ var child = '<li>' + childName + '</li>';
45
+
46
+ var $breadcrumb = $(this.breadcrumb_selector);
47
+
48
+ if(this.breadcrumb.animate === true) {
49
+ $breadcrumb.html(parent).append(child).css('width', '0').show().animate({
50
+ width: "100%"
51
+ }, this.breadcrumb.speed);
52
+ } else {
53
+ $breadcrumb.html(parent).append(child).show();
54
+ }
45
55
  }
56
+
46
57
  return this;
47
58
  };
48
59
 
49
60
  this.hideBreadCrumb = function() {
50
- if(this.breadcrumb) {
51
- $(this.breadcrumb_selector).html('');
61
+ if(this.breadcrumb.show) {
62
+ var $breadcrumb = $(this.breadcrumb_selector);
63
+ if(this.breadcrumb.animate === true) {
64
+ $breadcrumb.css('width', '0').html('');
65
+ } else {
66
+ $breadcrumb.html('');
67
+ }
52
68
  }
53
69
  return this;
54
70
  };
@@ -89,9 +105,17 @@ var SimpleSlider = function(element, opts) {
89
105
 
90
106
  this.forward = function(pageurl) {
91
107
  var plugin = this;
92
- plugin.wait().slide('right');
93
108
 
94
- $.get(pageurl, function(data) {
109
+ $.ajax({
110
+ url: pageurl,
111
+ beforeSend: function() {
112
+ setTimeout(function(){
113
+ plugin.slide('right');
114
+ }, 150);
115
+
116
+ plugin.wait();
117
+ }
118
+ }).done(function( data ) {
95
119
  plugin.showBreadCrumb().html(data);
96
120
  });
97
121
 
@@ -101,7 +125,7 @@ var SimpleSlider = function(element, opts) {
101
125
  this.back = function() {
102
126
  $(this.id).find('section article:first-of-type').css('visibility', 'visible');
103
127
  $(this.id).find('section article:last-of-type').css('visibility', 'hidden');
104
- this.hideBreadCrumb().slide('left');
128
+ this.slide('left').hideBreadCrumb();
105
129
  };
106
130
 
107
131
  // DOM event handling
@@ -1,4 +1,4 @@
1
- /*! Simpleslider - v1.0.3 - 2014-03-13
1
+ /*! Simpleslider - v1.0.4 - 2014-03-14
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.spinner=b.spinner,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(this.spinner?this.spinner:'<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 b.wait().slide("right"),$.get(a,function(a){b.showBreadCrumb().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]};
4
+ var SimpleSlider=function(a,b){this.init=function(){return this.id=a.selector,this.element=$(this.selector),this.link_selector=b.link_selector,this.back_link_selector=b.back_link_selector,this.spinner=b.spinner,this.breadcrumb=b.breadcrumb,this.breadcrumb_selector=b.breadcrumb.selector,this.bind(),this},this.activeLink=function(){return $(this.id).find("a[data-target='"+location.hash+"']")},this.showBreadCrumb=function(){if(this.breadcrumb.show){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>"+c+"</li>",g=$(this.breadcrumb_selector);this.breadcrumb.animate===!0?g.html(e).append(f).css("width","0").show().animate({width:"100%"},this.breadcrumb.speed):g.html(e).append(f).show()}return this},this.hideBreadCrumb=function(){if(this.breadcrumb.show){var a=$(this.breadcrumb_selector);this.breadcrumb.animate===!0?a.css("width","0").html(""):a.html("")}return this},this.html=function(a){return $(this.id).find("section article:last-of-type").html(a),this},this.wait=function(){return this.html(this.spinner?this.spinner:'<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 $.ajax({url:a,beforeSend:function(){setTimeout(function(){b.slide("right")},150),b.wait()}}).done(function(a){b.showBreadCrumb().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.slide("left").hideBreadCrumb()},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]};
@@ -1,3 +1,3 @@
1
1
  module SimpleSlider
2
- VERSION = "1.0.3"
2
+ VERSION = "1.0.4"
3
3
  end
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.3
4
+ version: 1.0.4
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-13 00:00:00.000000000 Z
11
+ date: 2014-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jquery-rails