peeker 0.1.3 → 0.1.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: 3437670101753439a07e1dc16e92d17f64baa76c
4
- data.tar.gz: f83b19ac661b98191cb485d49098ea053ce86812
3
+ metadata.gz: 56f2b1931a2d7e82008da14da53d8414178f5c74
4
+ data.tar.gz: b61c876d526d7fae864619b26b5f865ec008865e
5
5
  SHA512:
6
- metadata.gz: 508e1c648db0967e020b76ba7ede6dfdf1df618f3f16789be9c265a6cac15b609e302675246dc38bec1fc290f96fe1973f831b501297fbde50155785ddd674d9
7
- data.tar.gz: 2712ad927823688df2486c8ae4b84a1ac40232b21d245cb01156f34c73a0314055aa3edbeeb380f56a8284eac4528828c4288a93df88b09016ffa953479128a1
6
+ metadata.gz: 1d48fba8e703ed1abcd1d9c443ed1722d29dc3dcd6526f16dbabb2dd5cfd157ff45363e17c0b3848a767e7d8d320d410a6999ab6766877d6b46ce181976eea18
7
+ data.tar.gz: 61b3f0eaab03d3d64011df141d06efe47a5bc1e76f4f5f1b3fd2d9c95794cd05d56c05bc677c638798c200b3ebc51315b09e5bf0ac38c8388e0030c410b06cc3
@@ -1,12 +1,16 @@
1
- (function () {
1
+ (function (window, document, undefined) {
2
2
 
3
3
  // Find peek element
4
4
  var peekElement = document.querySelector("#peek");
5
-
5
+ var socialPlugins = document.querySelectorAll(".social-plugin");
6
6
  // Check existence of peek element
7
- if (!peekElement)
7
+ if (!peekElement)
8
8
  return false;
9
-
9
+
10
+ // Initialize social-plugin style with localStorage
11
+ var display = localStorage.getItem("peekStatus");
12
+ setSocialPluginStyleInBlogIndex(socialPlugins, display);
13
+
10
14
  // Listener Class
11
15
  var Listener = function (target, handler) {
12
16
  this.target = new RegExp(target, "i");
@@ -25,12 +29,14 @@
25
29
 
26
30
  // Handler
27
31
  var handler = function () {
28
- peekElement.style.display = (localStorage.getItem("peekStatus") == "none") ? "block" : "none";
32
+ var display = getPeekStatusFromLocalStorage();
33
+ peekElement.style.display = display;
34
+ setSocialPluginStyleInBlogIndex(socialPlugins, display);
29
35
  localStorage.setItem("peekStatus", peekElement.style.display);
30
36
  };
31
37
 
32
38
  // Set peekStatus with localStorage
33
- if (!localStorage.getItem("peekStatus"))
39
+ if (!localStorage.getItem("peekStatus"))
34
40
  localStorage.setItem("peekStatus", "none");
35
41
 
36
42
  // Give born to a Listener object
@@ -43,4 +49,17 @@
43
49
  peekListener.compare();
44
50
  });
45
51
 
46
- })();
52
+ })(window, document);
53
+
54
+
55
+ function setSocialPluginStyleInBlogIndex(socialPlugins, display) {
56
+ if (!!socialPlugins.length) {
57
+ for(var i = 0; i < socialPlugins.length; i++) {
58
+ socialPlugins[i].style.display = display;
59
+ }
60
+ }
61
+ }
62
+
63
+ function getPeekStatusFromLocalStorage() {
64
+ return (localStorage.getItem("peekStatus") == "none") ? "block" : "none";
65
+ }
@@ -1,3 +1,3 @@
1
1
  module Peeker
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: peeker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - frozenfung
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-13 00:00:00.000000000 Z
11
+ date: 2016-04-29 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A Javascript and CSS plugin to enhance peek.
14
14
  email:
@@ -48,7 +48,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
48
48
  version: '0'
49
49
  requirements: []
50
50
  rubyforge_project:
51
- rubygems_version: 2.4.5
51
+ rubygems_version: 2.5.1
52
52
  signing_key:
53
53
  specification_version: 4
54
54
  summary: Enhance peek's elasticity.