active_frontend 14.0.7 → 14.0.8

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: 4500a8aa2c78938a6b5e581c74087802a8f83bd7
4
- data.tar.gz: 0e2238a3d4b4e8fe92bf5f872abac85f03556a97
3
+ metadata.gz: 502d1e97143a3dc4f247894ce7249facdfcdaf93
4
+ data.tar.gz: e55922451f4872bc85347a4f645f5eb2813d2e2f
5
5
  SHA512:
6
- metadata.gz: ce58b6806be68c1bdfc0a1bc1e290d9f01a19747f37204e74e372092646ae0301136fcfef97ead93282c683decab28204762a1e1db9c15c845fe0446c3273658
7
- data.tar.gz: dc7e0999e25a448f0024cfb958a32234588523a01747164e9eca19aace7c5267590600198a8c38e4330a1c6c61e03efd8d02f1d1ef9d8665ae8b06a12f34d9c2
6
+ metadata.gz: e55afb65aa8b03abfe080c1e6d3148f217710bbdf178d191201d511cd7e3cf28013cad03f02b084b4b34b7a25e70a91b41d5d1ad2957a3c1a46c6e180a7cbbc5
7
+ data.tar.gz: ea1d203a0e1ad6c84b159c1fb939345bfbfb3a78f0d2c14ce1cb7b53f93636b9f6cd270b8230a25d0d79c82b578b829c1e7d965e907d8eedfd535e31fe6c3663
@@ -1,3 +1,3 @@
1
1
  module ActiveFrontend
2
- VERSION = '14.0.7'.freeze
2
+ VERSION = '14.0.8'.freeze
3
3
  end
@@ -29,6 +29,7 @@
29
29
  //= require base/_typeahead
30
30
  //= require base/_timeago
31
31
  //= require base/_switch
32
+ //= require base/_timezone
32
33
  //= require base/_tour
33
34
  //
34
35
  // Extensions Imports
@@ -29,6 +29,7 @@
29
29
  //= require base/_typeahead
30
30
  //= require base/_timeago
31
31
  //= require base/_switch
32
+ //= require base/_timezone
32
33
  //= require base/_tour
33
34
  //
34
35
  // Extensions Imports
@@ -0,0 +1,130 @@
1
+ +function ($) {
2
+ 'use strict';
3
+
4
+ // TIMEZONE CLASS DEFINITION
5
+ // =========================
6
+
7
+ var Timezone = function (element, options) {
8
+ this.$element = $(element);
9
+ this.$window = $(window);
10
+ this.settings = {
11
+ default: this.$element.data('default'),
12
+ format: this.$element.data('format')
13
+ };
14
+ this.options = $.extend({}, Timezone.DEFAULTS, this.settings, options);
15
+
16
+ this.init();
17
+ };
18
+
19
+ Timezone.VERSION = '1.0.0';
20
+ Timezone.DEFAULTS = {
21
+ default: 'America/New_York',
22
+ format: 'olson',
23
+ timezones: {
24
+ '-12': 'Pacific/Kwajalein',
25
+ '-11': 'Pacific/Samoa',
26
+ '-10': 'Pacific/Honolulu',
27
+ '-9': 'America/Juneau',
28
+ '-8': 'America/Los_Angeles',
29
+ '-7': 'America/Denver',
30
+ '-6': 'America/Mexico_City',
31
+ '-5': 'America/New_York',
32
+ '-4': 'America/Caracas',
33
+ '-3.5': 'America/St_Johns',
34
+ '-3': 'America/Argentina/Buenos_Aires',
35
+ '-2': 'Atlantic/Azores',
36
+ '-1': 'Atlantic/Azores',
37
+ '0': 'UTC',
38
+ '1': 'Europe/Paris',
39
+ '2': 'Europe/Helsinki',
40
+ '3': 'Europe/Moscow',
41
+ '3.5': 'Asia/Tehran',
42
+ '4': 'Asia/Baku',
43
+ '4.5': 'Asia/Kabul',
44
+ '5': 'Asia/Karachi',
45
+ '5.5': 'Asia/Calcutta',
46
+ '6': 'Asia/Colombo',
47
+ '7': 'Asia/Bangkok',
48
+ '8': 'Asia/Singapore',
49
+ '9': 'Asia/Tokyo',
50
+ '9.5': 'Australia/Darwin',
51
+ '10': 'Pacific/Guam',
52
+ '11': 'Asia/Magadan',
53
+ '12': 'Asia/Kamchatka'
54
+ }
55
+ };
56
+
57
+ Timezone.prototype.constructor = Timezone;
58
+
59
+ Timezone.prototype.init = function () {
60
+ var timezone = this.getTimezone();
61
+
62
+ if (this.$element.data('toggle') == 'timezone') {
63
+ this.$element.val(timezone);
64
+ } else {
65
+ return timezone;
66
+ }
67
+ };
68
+
69
+ Timezone.prototype.getTimezone = function () {
70
+ var offset = (new Date()).getTimezoneOffset();
71
+ if (offset === 'undefined') return this.options.default;
72
+
73
+ offset = -offset / 60;
74
+ if (offset === 'undefined') return this.options.default;
75
+
76
+ return this.options.timezones[offset];
77
+ };
78
+
79
+ Timezone.prototype.formatTimezone = function () {
80
+ var timezone = this.getTimezone();
81
+
82
+ switch (this.options.format) {
83
+ case 'region':
84
+ return timezone.split('/')[0];
85
+ case 'city':
86
+ return timezone.split('/')[1];
87
+ default:
88
+ return timezone;
89
+ }
90
+ };
91
+
92
+ // TIMEZONE PLUGIN DEFINITION
93
+ // ==========================
94
+
95
+ function Plugin(option) {
96
+ return this.each(function () {
97
+ var $this = $(this);
98
+ var data = $this.data('bs.timezone');
99
+ var options = typeof option === 'object' && option;
100
+
101
+ if (!data) $this.data('bs.timezone', (data = new Timezone(this, options)));
102
+ if (typeof option === 'string') data[option]();
103
+ });
104
+ }
105
+
106
+ var old = $.fn.timezone;
107
+
108
+ $.fn.timezone = Plugin;
109
+ $.fn.timezone.Constructor = Timezone;
110
+
111
+ // TIMEZONE NO CONFLICT
112
+ // ====================
113
+
114
+ $.fn.timezone.noConflict = function () {
115
+ $.fn.timezone = old;
116
+ return this;
117
+ };
118
+
119
+ // TIMEZONE DATA-API
120
+ // =================
121
+
122
+ $(document).on('ready.bs.timezone.data-api', function () {
123
+ $('[data-toggle="timezone"]').each(function () {
124
+ var $this = $(this);
125
+ if ($this.data('timezone')) return;
126
+ Plugin.call($this, $this.data());
127
+ });
128
+ });
129
+
130
+ }(jQuery);
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_frontend
3
3
  version: !ruby/object:Gem::Version
4
- version: 14.0.7
4
+ version: 14.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Gomez
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-10-20 00:00:00.000000000 Z
11
+ date: 2016-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -227,6 +227,7 @@ files:
227
227
  - vendor/assets/javascripts/base/_table.js
228
228
  - vendor/assets/javascripts/base/_timeago.js
229
229
  - vendor/assets/javascripts/base/_timepicker.js
230
+ - vendor/assets/javascripts/base/_timezone.js
230
231
  - vendor/assets/javascripts/base/_tooltip.js
231
232
  - vendor/assets/javascripts/base/_tour.js
232
233
  - vendor/assets/javascripts/base/_transition.js