flash-messenger 0.1.1 → 0.1.2

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: 0f70fa2a6af0ec4ae7b6a881d08d1b61799d6943
4
- data.tar.gz: e35854d4464f603ca260e882a223e1eba8eab7a4
3
+ metadata.gz: 63c140f3c764215c635dedda6f450cddb3a1267f
4
+ data.tar.gz: 65305fe364e9ec851d34c73867a1ec6f6e252248
5
5
  SHA512:
6
- metadata.gz: cc68330e6146525a919f6c3fb3bb9dbde11b270af928727907afc26a0d3991f9c565bd29f28758cc1009732fc3ab20497e98cb072ca6469448892913ed127bd4
7
- data.tar.gz: d3c59501426a88e489332347136c61f2c00a4691ce96b3a55bc3fecd1085bf87ed2e2550a070d0f13d802de5678573443a658f858c688c95bca235aa4cc79d6f
6
+ metadata.gz: c63bafeb3e0fbf08b7bb30c5ece99b44909ba05738802948b2d4abbd679ac600ee9f61b4a891b848a83ef8c090aad5eb0236c06e2ffced49cf176be0f0716856
7
+ data.tar.gz: c8099d599b5769ab103f2820ca089a4d4da51ab8283a40f9de887bed660d9a665c0ee493a1e1e8e3c1424a632db6e9a3e088e7952b2999288f4868e6ae0be9f7
@@ -1,3 +1,7 @@
1
+ # v0.1.2 / 2016-05-02
2
+
3
+ Update flash-messenger to 0.1.1
4
+
1
5
  # v0.1.1 / 2016-04-17
2
6
 
3
7
  Fixed model errors issue.
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * [flash-messenger]{@link https://github.com/emn178/flash-messenger}
3
3
  *
4
- * @version 0.1.0
4
+ * @version 0.1.1
5
5
  * @author Chen, Yi-Cyuan [emn178@gmail.com]
6
6
  * @copyright Chen, Yi-Cyuan 2016
7
7
  * @license MIT
@@ -9,7 +9,7 @@
9
9
  (function ($) {
10
10
  'use strict';
11
11
 
12
- var OPTIONS = ['type', 'time', 'sticky', 'fadeOut', 'closable'];
12
+ var OPTIONS = ['type', 'time', 'sticky', 'fadeOut', 'closable', 'scrollTo'];
13
13
  var TYPES = ['error', 'danger', 'info', 'notice', 'success', 'warning', 'alert'];
14
14
 
15
15
  var setting = {
@@ -22,7 +22,8 @@
22
22
  time: 3000,
23
23
  sticky: false,
24
24
  fadeOut: 1000,
25
- closable: true
25
+ closable: true,
26
+ scrollTo: true
26
27
  },
27
28
  typesDefault: {
28
29
  error: {
@@ -34,7 +35,7 @@
34
35
  }
35
36
  };
36
37
 
37
- var container, encorder = $('<div/>');
38
+ var container, encorder = $('<div/>'), screenHeight, screenWidth;
38
39
  function htmlEncode (message) {
39
40
  return encorder.text(message).html();
40
41
  }
@@ -68,7 +69,18 @@
68
69
  } else {
69
70
  div.addClass('nonclosable');
70
71
  }
71
- }
72
+ if (options.scrollTo) {
73
+ var rect = div[0].getBoundingClientRect();
74
+ if (rect.top < 0 || rect.top > screenHeight) {
75
+ div[0].scrollIntoView();
76
+ }
77
+ }
78
+ }
79
+
80
+ function resize() {
81
+ screenHeight = window.innerHeight || document.documentElement.clientHeight;
82
+ screenWidth = window.innerWidth || document.documentElement.clientWidth;
83
+ }
72
84
 
73
85
  var flash = function () {
74
86
  setting.method.apply(this, arguments);
@@ -86,7 +98,9 @@
86
98
  }
87
99
  });
88
100
 
89
- $(document).on('ready page:load', function () {
101
+ $(window).resize(resize);
102
+
103
+ $(document).ready(resize).bind('ready page:load', function () {
90
104
  if (!container) {
91
105
  container = $(setting.container);
92
106
  }
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * [flash-messenger]{@link https://github.com/emn178/flash-messenger}
3
3
  *
4
- * @version 0.1.0
4
+ * @version 0.1.1
5
5
  * @author Chen, Yi-Cyuan [emn178@gmail.com]
6
6
  * @copyright Chen, Yi-Cyuan 2016
7
7
  * @license MIT
@@ -1,3 +1,3 @@
1
1
  module FlashMessenger
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flash-messenger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chen, Yi-Cyuan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-17 00:00:00.000000000 Z
11
+ date: 2016-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: request_store