intercom-rails 0.2.12 → 0.2.13
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.
@@ -38,24 +38,9 @@ module IntercomRails
|
|
38
38
|
def output
|
39
39
|
str = <<-INTERCOM_SCRIPT
|
40
40
|
<script id="IntercomSettingsScriptTag">
|
41
|
-
|
42
|
-
</script>
|
43
|
-
<script>
|
44
|
-
(function() {
|
45
|
-
function async_load() {
|
46
|
-
var s = document.createElement('script');
|
47
|
-
s.type = 'text/javascript'; s.async = true;
|
48
|
-
s.src = '#{Config.library_url || 'https://api.intercom.io/api/js/library.js'}';
|
49
|
-
var x = document.getElementsByTagName('script')[0];
|
50
|
-
x.parentNode.insertBefore(s, x);
|
51
|
-
}
|
52
|
-
if (window.attachEvent) {
|
53
|
-
window.attachEvent('onload', async_load);
|
54
|
-
} else {
|
55
|
-
window.addEventListener('load', async_load, false);
|
56
|
-
}
|
57
|
-
})();
|
41
|
+
window.intercomSettings = #{ActiveSupport::JSON.encode(intercom_settings)};
|
58
42
|
</script>
|
43
|
+
<script>(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',intercomSettings);}else{var d=document;var i=function(){i.c(arguments)};i.q=[];i.c=function(args){i.q.push(args)};w.Intercom=i;function l(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='#{Config.library_url || 'https://api.intercom.io/api/js/library.js'}';var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);}if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}};})()</script>
|
59
44
|
INTERCOM_SCRIPT
|
60
45
|
|
61
46
|
str.respond_to?(:html_safe) ? str.html_safe : str
|
@@ -115,14 +115,14 @@ class AutoIncludeFilterTest < ActionController::TestCase
|
|
115
115
|
def test_library_url_default
|
116
116
|
get :with_current_user_method, :body => "<body>Hello world</body>"
|
117
117
|
assert_includes @response.body, "<script>"
|
118
|
-
assert_includes @response.body, "s.src
|
118
|
+
assert_includes @response.body, "s.src='https://api.intercom.io/api/js/library.js"
|
119
119
|
end
|
120
120
|
|
121
121
|
def test_library_url_override
|
122
122
|
IntercomRails.config.library_url = 'http://a.b.c.d/library.js'
|
123
123
|
get :with_current_user_method, :body => "<body>Hello world</body>"
|
124
124
|
assert_includes @response.body, "<script>"
|
125
|
-
assert_includes @response.body, "s.src
|
125
|
+
assert_includes @response.body, "s.src='http://a.b.c.d/library.js"
|
126
126
|
end
|
127
127
|
|
128
128
|
def test_auto_insert_with_api_secret_set
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: intercom-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.13
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2013-01-
|
14
|
+
date: 2013-01-15 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activesupport
|
@@ -180,7 +180,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
180
180
|
version: '0'
|
181
181
|
segments:
|
182
182
|
- 0
|
183
|
-
hash:
|
183
|
+
hash: 1447193965659527356
|
184
184
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
185
185
|
none: false
|
186
186
|
requirements:
|
@@ -189,7 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
189
189
|
version: '0'
|
190
190
|
segments:
|
191
191
|
- 0
|
192
|
-
hash:
|
192
|
+
hash: 1447193965659527356
|
193
193
|
requirements: []
|
194
194
|
rubyforge_project: intercom-rails
|
195
195
|
rubygems_version: 1.8.23
|