fixed_footer-rails 0.1.0 → 0.1.1

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: 105c36dcaced615f4ce99da7d83401fb582deeb6
4
- data.tar.gz: 88089eee29847fe9a0ad5faef7af9a04a91d6f61
3
+ metadata.gz: 61c03c1beeb3efa7570f7f65ec776bbd3c6b3477
4
+ data.tar.gz: becc29d3871ecd8a8618a4aa0aa99c5e1ef3fbf4
5
5
  SHA512:
6
- metadata.gz: aa02074ea893834c2db1fc94a64ab8db62b5ea17695261ef6f933b7fee474406d79d5d66efc4763db94d67c66a0f90a98c6562fa4fee84b12826cd85cee64772
7
- data.tar.gz: 13bd8fb1293dc98885d704cb7597c7c6d262c9bf715c1fac31a6cadb0bebfc50b0c31d923708498f068888e1e496e2160070a71436aa15f3ad6e62313513b8ee
6
+ metadata.gz: 573100e9ecb1fb191583cf7f612d9211ef59000ba17eb273d7e6528f9cdc7c5530b6be0c8fc3dc231f9ee50c8ec0ec1df69660569744297b2706a2c17f6e1df2
7
+ data.tar.gz: 87084cf1dfae1c208697d7ec929fe2447d94f5696c54c5cd2f4b408b533101e2db680a82952718e7fa66db2e90cb717a2b6ee790d13d0e1136b979613aa0edf7
data/README.md CHANGED
@@ -26,8 +26,8 @@ And in your application.js manifest:
26
26
 
27
27
  Call constructor.
28
28
 
29
- ```javascript
30
- # app/assets/javascripts/fixed_footer.coffee
29
+ ```coffeescript
30
+ # app/assets/javascripts/footer.coffee
31
31
  $(document).on "turbolinks:load", ->
32
32
  new FixedFooter("your-footer-id")
33
33
  ```
@@ -1,5 +1,5 @@
1
1
  module FixedFooter
2
2
  module Rails
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
@@ -1,15 +1,14 @@
1
1
  window.FixedFooter = function(id) {
2
- var addEvent, checkFontSize, footer, footerFixed;
3
- footer = document.getElementById(id);
4
- if (!footer) {
5
- return null;
6
- }
7
- footerFixed = function() {
8
- var dh, fh, ft, wh;
9
- dh = document.getElementsByTagName("body")[0].clientHeight;
2
+ var footer = document.getElementById(id);
3
+ if (!footer) { return null; }
4
+
5
+ var footerFixed = function() {
6
+ var footer = document.getElementById(id);
7
+ var dh = document.getElementsByTagName("body")[0].clientHeight;
10
8
  footer.style.top = "0px";
11
- ft = footer.offsetTop;
12
- fh = footer.offsetHeight;
9
+ var ft = footer.offsetTop;
10
+ var fh = footer.offsetHeight;
11
+ var wh;
13
12
  if (window.innerHeight) {
14
13
  wh = window.innerHeight;
15
14
  } else if (document.documentElement && document.documentElement.clientHeight !== 0) {
@@ -17,29 +16,11 @@ window.FixedFooter = function(id) {
17
16
  }
18
17
  if (ft + fh < wh) {
19
18
  footer.style.position = "relative";
20
- return footer.style.top = wh - fh - ft - 1 + "px";
19
+ footer.style.top = wh - fh - ft - 1 + "px";
21
20
  }
22
21
  };
23
- checkFontSize = function(callback) {
24
- var checkBoxSize, defHeight, e, s;
25
- e = document.createElement("div");
26
- s = document.createTextNode("S");
27
- checkBoxSize = function() {
28
- var defHeight;
29
- if (defHeight !== e.offsetHeight) {
30
- callback();
31
- return defHeight = e.offsetHeight;
32
- }
33
- };
34
- e.appendChild(s);
35
- e.style.visibility = "hidden";
36
- e.style.position = "absolute";
37
- e.style.top = "0";
38
- document.body.appendChild(e);
39
- defHeight = e.offsetHeight;
40
- return setInterval(checkBoxSize, 1000);
41
- };
42
- addEvent = function(elm, listener, fn) {
22
+
23
+ var addEvent = function(elm, listener, fn) {
43
24
  var e;
44
25
  try {
45
26
  elm.addEventListener(listener, fn, false);
@@ -48,6 +29,7 @@ window.FixedFooter = function(id) {
48
29
  elm.attachEvent("on" + listener, fn);
49
30
  }
50
31
  };
51
- checkFontSize(footerFixed);
52
- return addEvent(window, "resize", footerFixed);
32
+
33
+ footerFixed();
34
+ addEvent(window, "resize", footerFixed);
53
35
  };
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fixed_footer-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masaki Komagata