initialjs-rails 0.2.0.3 → 0.2.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 235e89e592a71f91e8b516e22c29f502171c3333
4
- data.tar.gz: 743bdbca989b41ac6e108f743a206bdae5c017d0
3
+ metadata.gz: 79ef4f520336dba26d51b7c25a622d72c43200dc
4
+ data.tar.gz: b6e5423bd85ecd47ff18ce07fc3a4d9f9c1c8ecd
5
5
  SHA512:
6
- metadata.gz: eaa80ec1c8b6b9eb97e9d637b5d8baa6cc48e012a09c66533c817f58d1b3dc24361fa8a773b023464aac89f67aa48e31478a5721c89de34efdbaf7234f311247
7
- data.tar.gz: 8955ce10edd02915c25400e0e860482d599f1347ebcaa60f8e15affb78bc693cea225ce2b612429e890f6f434596c96d97730f7b6859c3c989d93e3e04001382
6
+ metadata.gz: 7907fc8b6106f5101931ed400695d7200aebb7419acf16d219926752563f8b9d4b2289ad92958412726ab7ce176c293308f0754c029dc8fe568d3a8c6bd7d5c7
7
+ data.tar.gz: d601cd089d6f18146089a7b10168c0a26327ee1a41e10f683cd5fcc95c4ad093c142eef02ffbb84392db95773abdf6b4febf699d85829954f3e0a9b758cc989b
@@ -1,3 +1,7 @@
1
+ ## 0.2.0.3
2
+
3
+ * Updates initial.js to master - Adds unicode support ~ @kikito
4
+
1
5
  ## 0.2.0.2
2
6
 
3
7
  * Adds `color` and `count` options; Allows the helper to accept both an object responding to `:name` and a String name. ~ @shah743
@@ -1,3 +1,3 @@
1
1
  module InitialjsRails
2
- VERSION = "0.2.0.3"
2
+ VERSION = '0.2.0.4'
3
3
  end
@@ -1,4 +1,35 @@
1
1
  (function ($) {
2
+
3
+ var unicode_charAt = function(string, index) {
4
+ var first = string.charCodeAt(index);
5
+ var second;
6
+ if (first >= 0xD800 && first <= 0xDBFF && string.length > index + 1) {
7
+ second = string.charCodeAt(index + 1);
8
+ if (second >= 0xDC00 && second <= 0xDFFF) {
9
+ return string.substring(index, index + 2);
10
+ }
11
+ }
12
+ return string[index];
13
+ };
14
+
15
+ var unicode_slice = function(string, start, end) {
16
+ var accumulator = "";
17
+ var character;
18
+ var stringIndex = 0;
19
+ var unicodeIndex = 0;
20
+ var length = string.length;
21
+
22
+ while (stringIndex < length) {
23
+ character = unicode_charAt(string, stringIndex);
24
+ if (unicodeIndex >= start && unicodeIndex < end) {
25
+ accumulator += character;
26
+ }
27
+ stringIndex += character.length;
28
+ unicodeIndex += 1;
29
+ }
30
+ return accumulator;
31
+ };
32
+
2
33
  $.fn.initial = function (options) {
3
34
 
4
35
  // Defining Colors
@@ -25,7 +56,7 @@
25
56
  settings = $.extend(settings, e.data());
26
57
 
27
58
  // making the text object
28
- var c = settings.name.substr(0, settings.charCount).toUpperCase();
59
+ var c = unicode_slice(settings.name, 0, settings.charCount).toUpperCase();
29
60
  var cobj = $('<text text-anchor="middle"></text>').attr({
30
61
  'y': '50%',
31
62
  'x': '50%',
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: initialjs-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.3
4
+ version: 0.2.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Gil
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-09-10 00:00:00.000000000 Z
11
+ date: 2016-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -66,6 +66,7 @@ extensions: []
66
66
  extra_rdoc_files: []
67
67
  files:
68
68
  - ".gitignore"
69
+ - CHANGELOG.md
69
70
  - CODE_OF_CONDUCT.md
70
71
  - Gemfile
71
72
  - LICENSE.txt
@@ -75,7 +76,6 @@ files:
75
76
  - bin/setup
76
77
  - initialjs-rails.gemspec
77
78
  - lib/initialjs-rails.rb
78
- - lib/initialjs-rails/CHANGELOG.md
79
79
  - lib/initialjs-rails/engine.rb
80
80
  - lib/initialjs-rails/version.rb
81
81
  - lib/initialjs-rails/view_helpers.rb