peeker 0.1.3 → 0.1.4
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 +4 -4
- data/app/assets/javascripts/peeker.js +26 -7
- data/lib/peeker/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56f2b1931a2d7e82008da14da53d8414178f5c74
|
4
|
+
data.tar.gz: b61c876d526d7fae864619b26b5f865ec008865e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
+
}
|
data/lib/peeker/version.rb
CHANGED
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.
|
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:
|
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.
|
51
|
+
rubygems_version: 2.5.1
|
52
52
|
signing_key:
|
53
53
|
specification_version: 4
|
54
54
|
summary: Enhance peek's elasticity.
|