retreaverjs-rails 0.2.13 → 0.2.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/retreaverjs/rails/version.rb +1 -1
- data/package.json +2 -3
- data/src/retreaver/base/base64.js +2 -3
- data/src/retreaver/base/request.js +2 -2
- data/src/retreaver/campaign.js +8 -8
- data/src/retreaver/vendor/find_and_replace_dom_text.js +2 -10
- data/vendor/assets/javascripts/retreaver.js +16 -23
- data/vendor/assets/javascripts/retreaver.min.js +2 -2
- metadata +6 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e2611b7dada8a8d3a7d786ab656acd69e4eaa6765f0609e756f30c81d759ce15
|
4
|
+
data.tar.gz: 1f41b477aa989624bee98cbda43a3b9922c9acaf4ec3f65ebbe5572f6f590473
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71eac3e52c0ca3391e5fad4df26fe4bab662eeb4f20e645631809baa00fa861b1e0eb8f23715871bad9200e120646f565a907769eef9e7ee142b2c3f10782dff
|
7
|
+
data.tar.gz: 58d8eef1d243ce5e64dd7c5ac525f83a8230332079a3994b4263c988b25105e8c987219a79f8588c472e99f9df3b9bf47e43f7ebe548078d6b83f1710adc3a39
|
data/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "retreaver",
|
3
3
|
"description": "Retreaver Javascript API",
|
4
|
-
"version": "0.2.
|
4
|
+
"version": "0.2.16",
|
5
5
|
"homepage": "https://github.com/retreaver/retreaverjs",
|
6
6
|
"repository": {
|
7
7
|
"type": "git",
|
@@ -42,8 +42,7 @@
|
|
42
42
|
"engines": {
|
43
43
|
"node": ">= 0.6.x"
|
44
44
|
},
|
45
|
-
"dependencies": {
|
46
|
-
},
|
45
|
+
"dependencies": {},
|
47
46
|
"devDependencies": {
|
48
47
|
"grunt": "~0.4.5",
|
49
48
|
"jsdoc": "~3.2.2",
|
@@ -96,8 +96,7 @@
|
|
96
96
|
};
|
97
97
|
Base64._utf8_decode = function (utftext) {
|
98
98
|
var string = "";
|
99
|
-
var i = 0;
|
100
|
-
var c = c1 = c2 = 0;
|
99
|
+
var i = 0, c = 0, c2 = 0, c3 = 0;
|
101
100
|
|
102
101
|
while (i < utftext.length) {
|
103
102
|
|
@@ -123,4 +122,4 @@
|
|
123
122
|
return string;
|
124
123
|
};
|
125
124
|
Retreaver.Base.Base64 = Base64;
|
126
|
-
})();
|
125
|
+
})();
|
@@ -39,7 +39,7 @@
|
|
39
39
|
var request = function () {
|
40
40
|
self.apiRequest(request_url, function (data) {
|
41
41
|
// parse
|
42
|
-
response = JSON.parse(data);
|
42
|
+
var response = JSON.parse(data);
|
43
43
|
// fire callbacks
|
44
44
|
for (var i in callbacks) {
|
45
45
|
if (typeof callbacks[i] == "function") callbacks[i].apply(context, [response]);
|
@@ -216,4 +216,4 @@
|
|
216
216
|
return window.Retreaver._connection;
|
217
217
|
};
|
218
218
|
Retreaver.Base.Request = Request;
|
219
|
-
})();
|
219
|
+
})();
|
data/src/retreaver/campaign.js
CHANGED
@@ -17,8 +17,8 @@
|
|
17
17
|
}
|
18
18
|
|
19
19
|
function find_and_replace_number(replacement_numbers) {
|
20
|
-
for (i = 0; i < replacement_numbers.length; i++) {
|
21
|
-
rn = replacement_numbers[i];
|
20
|
+
for (var i = 0; i < replacement_numbers.length; i++) {
|
21
|
+
var rn = replacement_numbers[i];
|
22
22
|
|
23
23
|
Retreaver.Vendor.findAndReplaceDOMText(document.getElementsByTagName('body')[0], {
|
24
24
|
find: rn['find'],
|
@@ -26,14 +26,14 @@
|
|
26
26
|
});
|
27
27
|
|
28
28
|
var links = document.getElementsByTagName('a');
|
29
|
-
for (j = 0; j < links.length; j++) {
|
30
|
-
link = links[j];
|
31
|
-
href = link.getAttribute('href');
|
29
|
+
for (var j = 0; j < links.length; j++) {
|
30
|
+
var link = links[j];
|
31
|
+
var href = link.getAttribute('href');
|
32
32
|
|
33
33
|
if (href !== null) {
|
34
|
-
match = href.match(
|
35
|
-
if (match && match[
|
36
|
-
link.setAttribute('href',
|
34
|
+
var match = href.match(/^(tel:|clk[a-z]\/tel\/)(.*)/);
|
35
|
+
if (match && match[2] === rn['find']) {
|
36
|
+
link.setAttribute('href', match[1] + rn['replace_with']);
|
37
37
|
}
|
38
38
|
}
|
39
39
|
}
|
@@ -17,16 +17,8 @@ if (typeof(Retreaver.Vendor) === 'undefined') {
|
|
17
17
|
}
|
18
18
|
|
19
19
|
(function (root, factory) {
|
20
|
-
|
21
|
-
|
22
|
-
module.exports = factory();
|
23
|
-
} else if (typeof define === 'function' && define.amd) {
|
24
|
-
// AMD. Register as an anonymous module.
|
25
|
-
define(factory);
|
26
|
-
} else {
|
27
|
-
// Browser globals
|
28
|
-
root.findAndReplaceDOMText = factory();
|
29
|
-
}
|
20
|
+
// Browser globals
|
21
|
+
root.findAndReplaceDOMText = factory();
|
30
22
|
}(Retreaver.Vendor, function factory() {
|
31
23
|
|
32
24
|
var PORTION_MODE_RETAIN = 'retain';
|
@@ -241,8 +241,7 @@
|
|
241
241
|
};
|
242
242
|
Base64._utf8_decode = function (utftext) {
|
243
243
|
var string = "";
|
244
|
-
var i = 0;
|
245
|
-
var c = c1 = c2 = 0;
|
244
|
+
var i = 0, c = 0, c2 = 0, c3 = 0;
|
246
245
|
|
247
246
|
while (i < utftext.length) {
|
248
247
|
|
@@ -268,7 +267,8 @@
|
|
268
267
|
return string;
|
269
268
|
};
|
270
269
|
Retreaver.Base.Base64 = Base64;
|
271
|
-
})()
|
270
|
+
})();
|
271
|
+
;(function () {
|
272
272
|
// Dependencies
|
273
273
|
var Base = Retreaver.Base;
|
274
274
|
/**
|
@@ -501,7 +501,7 @@
|
|
501
501
|
var request = function () {
|
502
502
|
self.apiRequest(request_url, function (data) {
|
503
503
|
// parse
|
504
|
-
response = JSON.parse(data);
|
504
|
+
var response = JSON.parse(data);
|
505
505
|
// fire callbacks
|
506
506
|
for (var i in callbacks) {
|
507
507
|
if (typeof callbacks[i] == "function") callbacks[i].apply(context, [response]);
|
@@ -678,7 +678,8 @@
|
|
678
678
|
return window.Retreaver._connection;
|
679
679
|
};
|
680
680
|
Retreaver.Base.Request = Request;
|
681
|
-
})()
|
681
|
+
})();
|
682
|
+
;(function () {
|
682
683
|
// Dependencies
|
683
684
|
var Base = Retreaver.Base;
|
684
685
|
var Cookies = Retreaver.Base.Cookies;
|
@@ -1135,8 +1136,8 @@
|
|
1135
1136
|
}
|
1136
1137
|
|
1137
1138
|
function find_and_replace_number(replacement_numbers) {
|
1138
|
-
for (i = 0; i < replacement_numbers.length; i++) {
|
1139
|
-
rn = replacement_numbers[i];
|
1139
|
+
for (var i = 0; i < replacement_numbers.length; i++) {
|
1140
|
+
var rn = replacement_numbers[i];
|
1140
1141
|
|
1141
1142
|
Retreaver.Vendor.findAndReplaceDOMText(document.getElementsByTagName('body')[0], {
|
1142
1143
|
find: rn['find'],
|
@@ -1144,14 +1145,14 @@
|
|
1144
1145
|
});
|
1145
1146
|
|
1146
1147
|
var links = document.getElementsByTagName('a');
|
1147
|
-
for (j = 0; j < links.length; j++) {
|
1148
|
-
link = links[j];
|
1149
|
-
href = link.getAttribute('href');
|
1148
|
+
for (var j = 0; j < links.length; j++) {
|
1149
|
+
var link = links[j];
|
1150
|
+
var href = link.getAttribute('href');
|
1150
1151
|
|
1151
1152
|
if (href !== null) {
|
1152
|
-
match = href.match(
|
1153
|
-
if (match && match[
|
1154
|
-
link.setAttribute('href',
|
1153
|
+
var match = href.match(/^(tel:|clk[a-z]\/tel\/)(.*)/);
|
1154
|
+
if (match && match[2] === rn['find']) {
|
1155
|
+
link.setAttribute('href', match[1] + rn['replace_with']);
|
1155
1156
|
}
|
1156
1157
|
}
|
1157
1158
|
}
|
@@ -1313,16 +1314,8 @@ if (typeof(Retreaver.Vendor) === 'undefined') {
|
|
1313
1314
|
}
|
1314
1315
|
|
1315
1316
|
(function (root, factory) {
|
1316
|
-
|
1317
|
-
|
1318
|
-
module.exports = factory();
|
1319
|
-
} else if (typeof define === 'function' && define.amd) {
|
1320
|
-
// AMD. Register as an anonymous module.
|
1321
|
-
define(factory);
|
1322
|
-
} else {
|
1323
|
-
// Browser globals
|
1324
|
-
root.findAndReplaceDOMText = factory();
|
1325
|
-
}
|
1317
|
+
// Browser globals
|
1318
|
+
root.findAndReplaceDOMText = factory();
|
1326
1319
|
}(Retreaver.Vendor, function factory() {
|
1327
1320
|
|
1328
1321
|
var PORTION_MODE_RETAIN = 'retain';
|
@@ -1,2 +1,2 @@
|
|
1
|
-
/*! retreaver
|
2
|
-
if(function(a){var b={configure:function(a){var c={addr:a.host,http_prefix:"http",urlregex:"/\\/\\/[^\\/]*\\/(.*)/"};"undefined"!=typeof a.prefix&&(c.http_prefix=a.prefix),window.Retreaver._connection=new b.Base.Request(c)}};a.Retreaver=b}(window),function(){"undefined"==typeof window.Retreaver&&(window.Retreaver={});var a={};a.assert_required_keys=function(){for(var a=Array.prototype.slice.call(arguments),b=a.shift(),c=0;c<a.length;c++){var d=a[c];if("undefined"==typeof b||"undefined"==typeof b[d])throw"ArgumentError: Required keys are not defined: "+a.join(", ")}return b},a.merge=function(b,c){for(var d in c)try{c[d].constructor==Object?b[d]=a.merge(b[d],c[d]):b[d]=c[d]}catch(a){b[d]=c[d]}return b},a.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)},a.ieVersion=function(){return null==a._ieVersion&&(a._ieVersion=function(){for(var a=3,b=document.createElement("div"),c=b.getElementsByTagName("i");b.innerHTML="<!--[if gt IE "+ ++a+"]><i></i><![endif]-->",c[0];);return a>4&&a}()),6!=a._ieVersion&&7!=a._ieVersion||null==Retreaver.easyxdm_loaded&&(Retreaver.easyxdm_loaded=!1),a._ieVersion},Retreaver.Base=a}(),function(a){var b=function(a,c,d){return 1===arguments.length?b.get(a):b.set(a,c,d)};b._document=document,b._navigator=navigator,b.defaults={path:"/"},b.get=function(a){return b._cachedDocumentCookie!==b._document.cookie&&b._renewCache(),b._cache[a]},b.set=function(a,c,d){return d=b._getExtendedOptions(d),b._document.cookie=b._generateCookieString(a,c,d),b},b._getExtendedOptions=function(c){return{path:c&&c.path||b.defaults.path,domain:c&&c.domain||b.defaults.domain,secure:c&&c.secure!==a?c.secure:b.defaults.secure}},b._isValidDate=function(a){return"[object Date]"===Object.prototype.toString.call(a)&&!isNaN(a.getTime())},b._generateCookieString=function(a,b,c){return a=encodeURIComponent(a),b=(b+"").replace(/[^!#$&-+\--:<-\[\]-~]/g,encodeURIComponent),c=c||{},a=a+"="+b+(c.path?";path="+c.path:""),a+=c.domain?";domain="+c.domain:"",a+=c.secure?";secure":""},b._getCookieObjectFromString=function(c){var d={};c=c?c.split("; "):[];for(var e=0;e<c.length;e++){var f=b._getKeyValuePairFromCookieString(c[e]);d[f.key]===a&&(d[f.key]=f.value)}return d},b._getKeyValuePairFromCookieString=function(a){var b=a.indexOf("="),b=0>b?a.length:b;return{key:decodeURIComponent(a.substr(0,b)),value:decodeURIComponent(a.substr(b+1))}},b._renewCache=function(){b._cache=b._getCookieObjectFromString(b._document.cookie),b._cachedDocumentCookie=b._document.cookie},b._areEnabled=function(){return b._navigator.cookieEnabled||"1"===b.set("cookies.js",1).get("cookies.js")},b.enabled=b._areEnabled(),"function"==typeof define&&define.amd?define(function(){return b}):"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=b),exports.Cookies=b):b,Retreaver.Base.Cookies=b}(),function(){var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};Base64.encode=function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=Base64._utf8_encode(a);j<a.length;)b=a.charCodeAt(j++),c=a.charCodeAt(j++),d=a.charCodeAt(j++),e=b>>2,f=(3&b)<<4|c>>4,g=(15&c)<<2|d>>6,h=63&d,isNaN(c)?g=h=64:isNaN(d)&&(h=64),i=i+Base64._keyStr.charAt(e)+Base64._keyStr.charAt(f)+Base64._keyStr.charAt(g)+Base64._keyStr.charAt(h);return i},Base64.decode=function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");j<a.length;)e=Base64._keyStr.indexOf(a.charAt(j++)),f=Base64._keyStr.indexOf(a.charAt(j++)),g=Base64._keyStr.indexOf(a.charAt(j++)),h=Base64._keyStr.indexOf(a.charAt(j++)),b=e<<2|f>>4,c=(15&f)<<4|g>>2,d=(3&g)<<6|h,i+=String.fromCharCode(b),64!=g&&(i+=String.fromCharCode(c)),64!=h&&(i+=String.fromCharCode(d));return i=Base64._utf8_decode(i)},Base64._utf8_encode=function(string){string=string.replace(eval("/\\r\\n/g"),eval("String('\\n')"));for(var utftext="",n=0;n<string.length;n++){var c=string.charCodeAt(n);c<128?utftext+=String.fromCharCode(c):c>127&&c<2048?(utftext+=String.fromCharCode(c>>6|192),utftext+=String.fromCharCode(63&c|128)):(utftext+=String.fromCharCode(c>>12|224),utftext+=String.fromCharCode(c>>6&63|128),utftext+=String.fromCharCode(63&c|128))}return utftext},Base64._utf8_decode=function(a){for(var b="",c=0,d=c1=c2=0;c<a.length;)d=a.charCodeAt(c),d<128?(b+=String.fromCharCode(d),c++):d>191&&d<224?(c2=a.charCodeAt(c+1),b+=String.fromCharCode((31&d)<<6|63&c2),c+=2):(c2=a.charCodeAt(c+1),c3=a.charCodeAt(c+2),b+=String.fromCharCode((15&d)<<12|(63&c2)<<6|63&c3),c+=3);return b},Retreaver.Base.Base64=Base64}(),function(){var a=Retreaver.Base,b=function(b){function c(){a.assert_required_keys(b,"type","primary_key"),"undefined"==typeof Retreaver.Base.Data._store[b.type]&&(Retreaver.Base.Data._store[b.type]={}),"undefined"==typeof Retreaver.Base.Data._store[b.type][b.primary_key]&&(Retreaver.Base.Data._store[b.type][b.primary_key]={})}var d=this;d.get=function(){var a={};if("undefined"==typeof arguments[0])a=Retreaver.Base.Data._store[b.type][b.primary_key];else if(1===arguments.length)a=Retreaver.Base.Data._store[b.type][b.primary_key][arguments[0]];else for(var c=0;c<arguments.length;c++){var d=arguments[c];a[d]=Retreaver.Base.Data._store[b.type][b.primary_key][d]}return a},d.set=function(a,c){return Retreaver.Base.Data._store[b.type][b.primary_key][a]=c,c},d.merge=function(a){for(var c in a)Retreaver.Base.Data._store[b.type][b.primary_key][c]=a[c];return a},c()};b._store={},Retreaver.Base.Data=b}(),function(){var a=Retreaver.Base,b=Retreaver.Base.Data,c=function(){this.api_host_uri="/api/v1/",this.type="model",this.primary_key=function(a){return c.primary_key(this.type,a)},this.store=function(a){if("undefined"!=typeof a){var b=this.primary_key();if("undefined"==typeof a[b])throw"ArgumentError: Expected to receive primary_key "+b;"undefined"==typeof this._store&&(this._store=new Retreaver.Base.Data({type:this.type,primary_key:a[b]})),this._store.merge(a),c.update_visitor_id(a)}return this._store},this.get_data=function(a,b){return this.connection().getJSON(this.api_host_uri+a,null,[c.update,b],this)},this.post_data=function(a,b,d){return this.connection().postJSON(this.api_host_uri+a,b,[c.update,d],this)},this.set=function(){return"function"==typeof this["set_"+arguments[0]]&&(arguments[1]=this["set_"+arguments[0]].apply(this,[arguments[1]])),this._store.set.apply(this,arguments)},this.get=function(){return this._store.get.apply(this,arguments)},this.connection=function(){return Retreaver.Base.Request.connection()}};c.inflections={number:"numbers",campaign:"campaigns"},c.update=function(d){for(var e in d){var f=e,g=d[e];if("undefined"!=typeof c.inflections[e]&&(f=c.inflections[e]),"undefined"!=typeof b._store[f])if(a.isArray(g))for(var h=0;h<g.length;h++)c.update_record(f,g[h]);else c.update_record(f,g[h])}return d},c.update_record=function(a,b){if(c.update_visitor_id(b),"undefined"!=typeof b.id){var d=c.primary_key(a);for(var e in b)Retreaver.Base.Data._store[a][b[d]][e]=b[e];return!0}return!1},c.update_visitor_id=function(a){"undefined"!=typeof a&&"undefined"!=typeof a.visitor_id&&Retreaver.Base.Cookies.set("CallPixels-vid",a.visitor_id)},c.primary_key=function(a,b){return"undefined"==typeof c.primary_keys&&(c.primary_keys={}),"undefined"==typeof c.primary_keys[a]&&(c.primary_keys[a]="id"),"undefined"!=typeof b&&(c.primary_keys[a]=b),c.primary_keys[a]},Retreaver.Base.Model=c}(),function(){var Base=window.Retreaver.Base,Cookies=window.Retreaver.Base.Cookies,Request=function(options){function initialize(a){config=Base.assert_required_keys(a,"http_prefix","addr","urlregex")}function with_ie_scripts(a){Retreaver.easyxdm_loaded?a():self.loadScript(http_prefix+"://cdn.jsdelivr.net/easyxdm/2.4.17.1/easyXDM.min.js",function(){self.loadScript(http_prefix+"://cdn.jsdelivr.net/easyxdm/2.4.17.1/json2.js",function(){Retreaver.easyxdm_loaded=!0,a()})})}var self=this,config={};self.getJSON=function(a,b,c,d){"function"==typeof c&&(c=[c]),"undefined"==typeof d&&(d=self);var e=function(){self.apiRequest(a,function(a){response=JSON.parse(a);for(var b in c)"function"==typeof c[b]&&c[b].apply(d,[response])},b)};6==Base.ieVersion()||7==Base.ieVersion()?with_ie_scripts(e):e()},self.postJSON=function(){return self.getJSON.apply(this,arguments)},self.apiRequest=function(request_uri,callbackFunctions,payload){function ignored(){}function runCallbacks(a){for(var b in callbackFunctions)"function"==typeof callbackFunctions[b]&&callbackFunctions[b](a)}function forwardResponse(){runCallbacks(xdr.responseText)}function sendXdm(){var remote=http_prefix+"://"+addr+"/ie_provider",swf=http_prefix+"://"+addr+"/easyxdm.swf",rpc=eval('new window.easyXDM.Rpc({ remote: "'+remote+'", swf: "'+swf+'"},{remote: {request: {}}});');rpc.request({url:"/"+request_url.match(urlregex)[1],method:"POST",data:payload},function(a){runCallbacks(a.data)})}var http_prefix=config.http_prefix,addr=config.addr,urlregex=eval(config.urlregex),request_url=http_prefix+"://"+addr+request_uri;if(payload&&"undefined"!=typeof Cookies.get("CallPixels-vid")&&"null"!==Cookies.get("CallPixels-vid")&&(payload.visitor_id=Cookies.get("CallPixels-vid")),"function"==typeof callbackFunctions&&(callbackFunctions=[callbackFunctions]),window.XDomainRequest){var xdr=new XDomainRequest;xdr.onload=forwardResponse,xdr.onprogress=ignored,xdr.onerror=ignored,xdr.ontimeout=ignored,xdr.timeout=3e4,payload?(xdr.open("post",request_url),xdr.send(self.buildPost(payload))):(xdr.open("get",request_url),xdr.send())}else if(6==Base.ieVersion()||7==Base.ieVersion())with_ie_scripts(sendXdm);else{var request=new XMLHttpRequest;request.onload=function(){runCallbacks(this.responseText)},payload?(request.open("POST",request_url),request.setRequestHeader("Content-Type","application/json"),request.send(JSON.stringify(payload))):(request.open("GET",request_url),request.send())}},self.buildPost=function(a){var b="";for(var c in a)b+=c+"="+a[c]+"&";return b},self.loadScript=function(a,b){var c=document.getElementsByTagName("script")[0],d=document.createElement("script");d.type="text/javascript",d.async=!1,d.src=a;var e=function(a,b){"loaded"==a.readyState||"complete"==a.readyState?b():setTimeout(function(){e(a,b)},100)};"function"==typeof b&&("undefined"!=typeof d.addEventListener?d.addEventListener("load",b,!1):d.onreadystatechange=function(){d.onreadystatechange=null,e(d,b)}),c.parentNode.insertBefore(d,c)},initialize(options),self.config=config};Request.connection=function(){if("undefined"==typeof window.Retreaver._connection){var a=window.location.protocol.replace(":","");window.Retreaver._connection=new Retreaver.Base.Request({addr:"api.rtvrapi.com",http_prefix:a,urlregex:"/\\/\\/[^\\/]*\\/(.*)/"})}return window.Retreaver._connection},Retreaver.Base.Request=Request}(),function(){function tags_to_script_tags(a){var b="";for(var c in a){var d=a[c];b=b+"&"+c+"="+d}return b}var Base=Retreaver.Base,Cookies=Retreaver.Base.Cookies,Base64=Retreaver.Base.Base64,Request=Retreaver.Base.Request,RequestNumber=function(options){function initialize(a){config=Base.assert_required_keys(a,"campaign_key")}function getParts(a){for(var b={},c=0;c<a.length;c++){var d=getUrlParts(a[c]);for(var e in d)b[e]=d[e]}return b}function getUrlParts(url){var objURL=new Object;try{url=url.match(eval("/\\?(.*)/"))[0]}catch(a){return objURL}return url.replace(new RegExp("([^?=&]+)(=([^&]*))?","g"),function(a,b,c,d){objURL[b.toLowerCase()]=d}),objURL}function getGACookies(){var a=["__utma","__utmb","__utmc","__utmz","__utmv"],b=new Object;for(var c in a){var d=extractCookie(a[c]);if(!(d||c>0))break;d&&(b[a[c]]=d)}return b}function extractCookie(a){var b=new RegExp(a+"=([^;]*)","g");try{return b.exec(document.cookie)[1]}catch(a){return!1}}function findOne(a,b){for(var c in b)for(var d in a)if(d==b[c])return a[d];return!1}var self=this,config={},resource_url="/api/v1/numbers?";self.perform=function(callback){function sendGARequest(a,b){request_ran||(request_ran=!0,body.ga=Base64.encode(a),body.c=Base64.encode(JSON.stringify(b)),Request.connection().getJSON(request_url,body,callback))}function runRequest(){request_ran||(request_ran=!0,Request.connection().getJSON(request_url,body,callback))}if("function"!=typeof callback)throw"ArgumentError: Expected to receive a callback function";var request_url=resource_url+"&campaign_key="+config.campaign_key;config.default_number_replacement&&(request_url=request_url+"&default_number="+config.default_number_replacement),config.message_replacement&&(request_url=request_url+"&message="+config.message_replacement);var body=new Object,uri=document.location.href;body.u=Base64.encode(uri),body.st=Base64.encode(tags_to_script_tags(config.number_matching_tags));var ou=Cookies.get("CallPixels-ou");getParts([document.location.href]).cpreset||!ou?Cookies.set("CallPixels-ou",body.u):body.ou=ou;var ga_acct="FAILED",request_ran=!1;window.setTimeout(runRequest,1e3);try{_gaq.push(function(){ga_acct=eval("_gat._getTrackerByName()._getAccount()"),sendGARequest(ga_acct,getGACookies())})}catch(e){try{ga(function(tracker){if(tracker&&tracker.get)try{var clientId=tracker.get("clientId"),allTrackers=eval("ga.getAll()");ga_acct=allTrackers[0].get("trackingId");var ga_cookies={};ga_cookies.__utma=clientId,ga_cookies.mp="yes",sendGARequest(ga_acct,ga_cookies)}catch(a){sendGARequest("",{})}else sendGARequest("",{})})}catch(a){runRequest()}}},initialize(options)};Retreaver.Base.RequestNumber=RequestNumber}(),window.Retreaver.Cache={},function(){function a(b){if("undefined"!=typeof Retreaver.Base.Data._store){var c=Retreaver.Base.Data._store.numbers;if("undefined"!=typeof c){var d={};for(var e in c){var f=c[e];"true"===f.is_active&&("undefined"==typeof d[f.campaign_key]&&(d[f.campaign_key]=[],d[f.campaign_key].ids=[],d[f.campaign_key].hashes=[]),d[f.campaign_key].ids.push(f.id),d[f.campaign_key].hashes.push(f.id_checksum))}for(var g in d){var h={ids:d[g].ids,hashes:d[g].hashes};Retreaver.Base.Request.connection().postJSON("/api/v1/numbers/ping",h,[Retreaver.Base.Model.update,b],this)}}}setTimeout(a,15e3)}var b=Retreaver.Base;Retreaver.Number=function(a){function c(a){g.store(a),g.set("is_active","true")}function d(a){return"string"==typeof a&&(a=Retreaver.Number.extract_tags_from_string(a)),{tag_values:a,ids:[e("id")],campaign_key:e("campaign_key")}}function e(a){return g.get(a)}function f(){if(g.get("is_per_visitor")===!1)throw"Error: Tried to add tags to non per-visitor number."}var g=this;g.type="numbers",g.add_tags=function(a,b){f(),g.post_data("numbers/tag",d(a),b)},g.replace_tags=function(a,b){f(),g.post_data("numbers/replace_tags",d(a),b)},g.remove_tags=function(a,b){f(),g.post_data("numbers/untag",d(a),b)},g.remove_tags_by_keys=function(a,b){f(),"string"==typeof a&&(a=a.split(","));var c={tag_keys:a,ids:[e("id")],campaign_key:e("campaign_key")};g.post_data("numbers/untag/keys",c,b)},g.clear_tags=function(a){f();var b={ids:[e("id")],campaign_key:e("campaign_key"),all:"true"};g.post_data("numbers/untag",b,a)},g.release=function(){g.set("is_active","false")},g.initiate_call=function(a,c,d){"undefined"==typeof c&&(c={}),c.dial=a,c=b.merge(g.get("id","campaign_key"),c),g.post_data("numbers/initiate_call",c,d)},c(a)},Retreaver.Number.extract_tags_from_string=function(a){for(var b={},a=a.split(","),c=0;c<a.length;c++){var d=a[c].split(":");b[d[0]]=d[1]}return b},Retreaver.Number.prototype=new Retreaver.Base.Model,a()}(),function(){var a=Retreaver.Base.RequestNumber,b=function(b){function c(a){e.store(a)}function d(a){for(i=0;i<a.length;i++){rn=a[i],Retreaver.Vendor.findAndReplaceDOMText(document.getElementsByTagName("body")[0],{find:rn.find,replace:rn.replace_with});var b=document.getElementsByTagName("a");for(j=0;j<b.length;j++)link=b[j],href=link.getAttribute("href"),null!==href&&(match=href.match(/tel:(.*)/),match&&match[1]===rn.find&&link.setAttribute("href","tel:"+rn.replace_with))}}var e=this;e.type="campaigns",e.primary_key("campaign_key"),e.numbers=[],e.request_number=function(b,c,f){"function"==typeof b&&(f=c,c=b,b={}),"undefined"==typeof c&&(c=function(){}),"undefined"==typeof b&&(b={}),e.set("number_matching_tags",b),new a(e.get("campaign_key","number_matching_tags")).perform(function(a){if("undefined"!=typeof a&&"undefined"!=typeof a.number&&""!==a.number){var b=new Retreaver.Number(a.number);"undefined"!=typeof a.number.replacement_numbers&&d(a.number.replacement_numbers),c.apply(e,[b])}else"function"==typeof f&&f.apply(e,[a])})},e.auto_replace_numbers=function(a,b,c){"undefined"==typeof b&&(b=function(){}),"undefined"==typeof c&&(c=function(){}),e.request_number(a,b,c)},e.numbers=function(){var a=[];if("undefined"!=typeof Retreaver.Base.Data._store){var b=Retreaver.Base.Data._store.numbers;if("undefined"!=typeof b)for(var c in b){var d=b[c];e.get("campaign_key")==d.campaign_key&&a.push(new Retreaver.Number(d))}}return a},e.set_number_matching_tags=function(a){if("string"==typeof a&&(a=Retreaver.Number.extract_tags_from_string(a)),!a||"object"!=typeof a||a instanceof Array)throw"ArgumentError: Expected number_matching_tags to be an object. eg: {tag: 'value'}";return a},c(b)};b.prototype=new Retreaver.Base.Model,Retreaver.Campaign=b}(),function(a){a.Callpixels=window.Retreaver}(window),"undefined"==typeof Retreaver)var Retreaver={};"undefined"==typeof Retreaver.Vendor&&(Retreaver.Vendor={}),function(a,b){"object"==typeof module&&module.exports?module.exports=b():"function"==typeof define&&define.amd?define(b):a.findAndReplaceDOMText=b()}(Retreaver.Vendor,function(){function a(a){return String(a).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function b(){return c.apply(null,arguments)||d.apply(null,arguments)}function c(a,c,e,f,g){if(c&&!c.nodeType&&arguments.length<=2)return!1;var h="function"==typeof e;h&&(e=function(a){return function(b,c){return a(b.text,c.startIndex)}}(e));var i=d(c,{find:a,wrap:h?null:e,replace:h?e:"$"+(f||"&"),prepMatch:function(a,b){if(!a[0])throw"findAndReplaceDOMText cannot handle zero-length matches";if(f>0){var c=a[f];a.index+=a[0].indexOf(c),a[0]=c}return a.endIndex=a.index+a[0].length,a.startIndex=a.index,a.index=b,a},filterElements:g});return b.revert=function(){return i.revert()},!0}function d(a,b){return new e(a,b)}function e(a,c){var d=c.preset&&b.PRESETS[c.preset];if(c.portionMode=c.portionMode||f,d)for(var e in d)i.call(d,e)&&!i.call(c,e)&&(c[e]=d[e]);this.node=a,this.options=c,this.prepMatch=c.prepMatch||this.prepMatch,this.reverts=[],this.matches=this.search(),this.matches.length&&this.processMatches()}var f="retain",g="first",h=document,i={}.hasOwnProperty;return b.NON_PROSE_ELEMENTS={br:1,hr:1,script:1,style:1,img:1,video:1,audio:1,canvas:1,svg:1,map:1,object:1,input:1,textarea:1,select:1,option:1,optgroup:1,button:1},b.NON_CONTIGUOUS_PROSE_ELEMENTS={address:1,article:1,aside:1,blockquote:1,dd:1,div:1,dl:1,fieldset:1,figcaption:1,figure:1,footer:1,form:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,header:1,hgroup:1,hr:1,main:1,nav:1,noscript:1,ol:1,output:1,p:1,pre:1,section:1,ul:1,br:1,li:1,summary:1,dt:1,details:1,rp:1,rt:1,rtc:1,script:1,style:1,img:1,video:1,audio:1,canvas:1,svg:1,map:1,object:1,input:1,textarea:1,select:1,option:1,optgroup:1,button:1,table:1,tbody:1,thead:1,th:1,tr:1,td:1,caption:1,col:1,tfoot:1,colgroup:1},b.NON_INLINE_PROSE=function(a){return i.call(b.NON_CONTIGUOUS_PROSE_ELEMENTS,a.nodeName.toLowerCase())},b.PRESETS={prose:{forceContext:b.NON_INLINE_PROSE,filterElements:function(a){return!i.call(b.NON_PROSE_ELEMENTS,a.nodeName.toLowerCase())}}},b.Finder=e,e.prototype={search:function(){function b(a){for(var g=0,j=a.length;g<j;++g){var k=a[g];if("string"==typeof k){if(f.global)for(;c=f.exec(k);)h.push(i.prepMatch(c,d++,e));else(c=k.match(f))&&h.push(i.prepMatch(c,0,e));e+=k.length}else b(k)}}var c,d=0,e=0,f=this.options.find,g=this.getAggregateText(),h=[],i=this;return f="string"==typeof f?RegExp(a(f),"g"):f,b(g),h},prepMatch:function(a,b,c){if(!a[0])throw new Error("findAndReplaceDOMText cannot handle zero-length matches");return a.endIndex=c+a.index+a[0].length,a.startIndex=c+a.index,a.index=b,a},getAggregateText:function(){function a(d){if(3===d.nodeType)return[d.data];if(b&&!b(d))return[];var e=[""],f=0;if(d=d.firstChild)do if(3!==d.nodeType){var g=a(d);c&&1===d.nodeType&&(c===!0||c(d))?(e[++f]=g,e[++f]=""):("string"==typeof g[0]&&(e[f]+=g.shift()),g.length&&(e[++f]=g,e[++f]=""))}else e[f]+=d.data;while(d=d.nextSibling);return e}var b=this.options.filterElements,c=this.options.forceContext;return a(this.node)},processMatches:function(){var a,b,c,d=this.matches,e=this.node,f=this.options.filterElements,g=[],h=e,i=d.shift(),j=0,k=0,l=0,m=[e];a:for(;;){if(3===h.nodeType&&(!b&&h.length+j>=i.endIndex?b={node:h,index:l++,text:h.data.substring(i.startIndex-j,i.endIndex-j),indexInMatch:j-i.startIndex,indexInNode:i.startIndex-j,endIndexInNode:i.endIndex-j,isEnd:!0}:a&&g.push({node:h,index:l++,text:h.data,indexInMatch:j-i.startIndex,indexInNode:0}),!a&&h.length+j>i.startIndex&&(a={node:h,index:l++,indexInMatch:0,indexInNode:i.startIndex-j,endIndexInNode:i.endIndex-j,text:h.data.substring(i.startIndex-j,i.endIndex-j)}),j+=h.data.length),c=1===h.nodeType&&f&&!f(h),a&&b){if(h=this.replaceMatch(i,a,g,b),j-=b.node.data.length-b.endIndexInNode,a=null,b=null,g=[],i=d.shift(),l=0,k++,!i)break}else if(!c&&(h.firstChild||h.nextSibling)){h.firstChild?(m.push(h),h=h.firstChild):h=h.nextSibling;continue}for(;;){if(h.nextSibling){h=h.nextSibling;break}if(h=m.pop(),h===e)break a}}},revert:function(){for(var a=this.reverts.length;a--;)this.reverts[a]();this.reverts=[]},prepareReplacementString:function(a,b,c){var d=this.options.portionMode;return d===g&&b.indexInMatch>0?"":(a=a.replace(/\$(\d+|&|`|')/g,function(a,b){var d;switch(b){case"&":d=c[0];break;case"`":d=c.input.substring(0,c.startIndex);break;case"'":d=c.input.substring(c.endIndex);break;default:d=c[+b]}return d}),d===g?a:b.isEnd?a.substring(b.indexInMatch):a.substring(b.indexInMatch,b.indexInMatch+b.text.length))},getPortionReplacementNode:function(a,b){var c=this.options.replace||"$&",d=this.options.wrap;if(d&&d.nodeType){var e=h.createElement("div");e.innerHTML=d.outerHTML||(new XMLSerializer).serializeToString(d),d=e.firstChild}if("function"==typeof c)return c=c(a,b),c&&c.nodeType?c:h.createTextNode(String(c));var f="string"==typeof d?h.createElement(d):d;return c=h.createTextNode(this.prepareReplacementString(c,a,b)),c.data&&f?(f.appendChild(c),f):c},replaceMatch:function(a,b,c,d){var e,f,g=b.node,i=d.node;if(g===i){var j=g;b.indexInNode>0&&(e=h.createTextNode(j.data.substring(0,b.indexInNode)),j.parentNode.insertBefore(e,j));var k=this.getPortionReplacementNode(d,a);return j.parentNode.insertBefore(k,j),d.endIndexInNode<j.length&&(f=h.createTextNode(j.data.substring(d.endIndexInNode)),j.parentNode.insertBefore(f,j)),j.parentNode.removeChild(j),this.reverts.push(function(){e===k.previousSibling&&e.parentNode.removeChild(e),f===k.nextSibling&&f.parentNode.removeChild(f),k.parentNode.replaceChild(j,k)}),k}e=h.createTextNode(g.data.substring(0,b.indexInNode)),f=h.createTextNode(i.data.substring(d.endIndexInNode));for(var l=this.getPortionReplacementNode(b,a),m=[],n=0,o=c.length;n<o;++n){var p=c[n],q=this.getPortionReplacementNode(p,a);p.node.parentNode.replaceChild(q,p.node),this.reverts.push(function(a,b){return function(){b.parentNode.replaceChild(a.node,b)}}(p,q)),m.push(q)}var r=this.getPortionReplacementNode(d,a);return g.parentNode.insertBefore(e,g),g.parentNode.insertBefore(l,g),g.parentNode.removeChild(g),i.parentNode.insertBefore(r,i),i.parentNode.insertBefore(f,i),i.parentNode.removeChild(i),this.reverts.push(function(){e.parentNode.removeChild(e),l.parentNode.replaceChild(g,l),f.parentNode.removeChild(f),r.parentNode.replaceChild(i,r)}),r}},b});
|
1
|
+
/*! retreaver 06-04-2022 */
|
2
|
+
if(function(a){var b={configure:function(a){var c={addr:a.host,http_prefix:"http",urlregex:"/\\/\\/[^\\/]*\\/(.*)/"};void 0!==a.prefix&&(c.http_prefix=a.prefix),window.Retreaver._connection=new b.Base.Request(c)}};a.Retreaver=b}(window),function(){void 0===window.Retreaver&&(window.Retreaver={});var a={};a.assert_required_keys=function(){for(var a=Array.prototype.slice.call(arguments),b=a.shift(),c=0;c<a.length;c++){var d=a[c];if(void 0===b||void 0===b[d])throw"ArgumentError: Required keys are not defined: "+a.join(", ")}return b},a.merge=function(b,c){for(var d in c)try{c[d].constructor==Object?b[d]=a.merge(b[d],c[d]):b[d]=c[d]}catch(a){b[d]=c[d]}return b},a.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)},a.ieVersion=function(){return null==a._ieVersion&&(a._ieVersion=function(){for(var a=3,b=document.createElement("div"),c=b.getElementsByTagName("i");b.innerHTML="\x3c!--[if gt IE "+ ++a+"]><i></i><![endif]--\x3e",c[0];);return a>4&&a}()),6!=a._ieVersion&&7!=a._ieVersion||null==Retreaver.easyxdm_loaded&&(Retreaver.easyxdm_loaded=!1),a._ieVersion},Retreaver.Base=a}(),function(a){var b=function(a,c,d){return 1===arguments.length?b.get(a):b.set(a,c,d)};b._document=document,b._navigator=navigator,b.defaults={path:"/"},b.get=function(a){return b._cachedDocumentCookie!==b._document.cookie&&b._renewCache(),b._cache[a]},b.set=function(a,c,d){return d=b._getExtendedOptions(d),b._document.cookie=b._generateCookieString(a,c,d),b},b._getExtendedOptions=function(c){return{path:c&&c.path||b.defaults.path,domain:c&&c.domain||b.defaults.domain,secure:c&&c.secure!==a?c.secure:b.defaults.secure}},b._isValidDate=function(a){return"[object Date]"===Object.prototype.toString.call(a)&&!isNaN(a.getTime())},b._generateCookieString=function(a,b,c){return a=encodeURIComponent(a),b=(b+"").replace(/[^!#$&-+\--:<-\[\]-~]/g,encodeURIComponent),c=c||{},a=a+"="+b+(c.path?";path="+c.path:""),a+=c.domain?";domain="+c.domain:"",a+=c.secure?";secure":""},b._getCookieObjectFromString=function(c){var d={};c=c?c.split("; "):[];for(var e=0;e<c.length;e++){var f=b._getKeyValuePairFromCookieString(c[e]);d[f.key]===a&&(d[f.key]=f.value)}return d},b._getKeyValuePairFromCookieString=function(a){var b=a.indexOf("="),b=0>b?a.length:b;return{key:decodeURIComponent(a.substr(0,b)),value:decodeURIComponent(a.substr(b+1))}},b._renewCache=function(){b._cache=b._getCookieObjectFromString(b._document.cookie),b._cachedDocumentCookie=b._document.cookie},b._areEnabled=function(){return b._navigator.cookieEnabled||"1"===b.set("cookies.js",1).get("cookies.js")},b.enabled=b._areEnabled(),"function"==typeof define&&define.amd?define(function(){return b}):"undefined"!=typeof exports&&("undefined"!=typeof module&&module.exports&&(exports=module.exports=b),exports.Cookies=b),Retreaver.Base.Cookies=b}(),function(){var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};Base64.encode=function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=Base64._utf8_encode(a);j<a.length;)b=a.charCodeAt(j++),c=a.charCodeAt(j++),d=a.charCodeAt(j++),e=b>>2,f=(3&b)<<4|c>>4,g=(15&c)<<2|d>>6,h=63&d,isNaN(c)?g=h=64:isNaN(d)&&(h=64),i=i+Base64._keyStr.charAt(e)+Base64._keyStr.charAt(f)+Base64._keyStr.charAt(g)+Base64._keyStr.charAt(h);return i},Base64.decode=function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");j<a.length;)e=Base64._keyStr.indexOf(a.charAt(j++)),f=Base64._keyStr.indexOf(a.charAt(j++)),g=Base64._keyStr.indexOf(a.charAt(j++)),h=Base64._keyStr.indexOf(a.charAt(j++)),b=e<<2|f>>4,c=(15&f)<<4|g>>2,d=(3&g)<<6|h,i+=String.fromCharCode(b),64!=g&&(i+=String.fromCharCode(c)),64!=h&&(i+=String.fromCharCode(d));return i=Base64._utf8_decode(i)},Base64._utf8_encode=function(string){string=string.replace(eval("/\\r\\n/g"),eval("String('\\n')"));for(var utftext="",n=0;n<string.length;n++){var c=string.charCodeAt(n);c<128?utftext+=String.fromCharCode(c):c>127&&c<2048?(utftext+=String.fromCharCode(c>>6|192),utftext+=String.fromCharCode(63&c|128)):(utftext+=String.fromCharCode(c>>12|224),utftext+=String.fromCharCode(c>>6&63|128),utftext+=String.fromCharCode(63&c|128))}return utftext},Base64._utf8_decode=function(a){for(var b="",c=0,d=0,e=0,f=0;c<a.length;)d=a.charCodeAt(c),d<128?(b+=String.fromCharCode(d),c++):d>191&&d<224?(e=a.charCodeAt(c+1),b+=String.fromCharCode((31&d)<<6|63&e),c+=2):(e=a.charCodeAt(c+1),f=a.charCodeAt(c+2),b+=String.fromCharCode((15&d)<<12|(63&e)<<6|63&f),c+=3);return b},Retreaver.Base.Base64=Base64}(),function(){var a=Retreaver.Base,b=function(b){function c(){a.assert_required_keys(b,"type","primary_key"),void 0===Retreaver.Base.Data._store[b.type]&&(Retreaver.Base.Data._store[b.type]={}),void 0===Retreaver.Base.Data._store[b.type][b.primary_key]&&(Retreaver.Base.Data._store[b.type][b.primary_key]={})}var d=this;d.get=function(){var a={};if(void 0===arguments[0])a=Retreaver.Base.Data._store[b.type][b.primary_key];else if(1===arguments.length)a=Retreaver.Base.Data._store[b.type][b.primary_key][arguments[0]];else for(var c=0;c<arguments.length;c++){var d=arguments[c];a[d]=Retreaver.Base.Data._store[b.type][b.primary_key][d]}return a},d.set=function(a,c){return Retreaver.Base.Data._store[b.type][b.primary_key][a]=c,c},d.merge=function(a){for(var c in a)Retreaver.Base.Data._store[b.type][b.primary_key][c]=a[c];return a},c()};b._store={},Retreaver.Base.Data=b}(),function(){var a=Retreaver.Base,b=Retreaver.Base.Data,c=function(){this.api_host_uri="/api/v1/",this.type="model",this.primary_key=function(a){return c.primary_key(this.type,a)},this.store=function(a){if(void 0!==a){var b=this.primary_key();if(void 0===a[b])throw"ArgumentError: Expected to receive primary_key "+b;void 0===this._store&&(this._store=new Retreaver.Base.Data({type:this.type,primary_key:a[b]})),this._store.merge(a),c.update_visitor_id(a)}return this._store},this.get_data=function(a,b){return this.connection().getJSON(this.api_host_uri+a,null,[c.update,b],this)},this.post_data=function(a,b,d){return this.connection().postJSON(this.api_host_uri+a,b,[c.update,d],this)},this.set=function(){return"function"==typeof this["set_"+arguments[0]]&&(arguments[1]=this["set_"+arguments[0]].apply(this,[arguments[1]])),this._store.set.apply(this,arguments)},this.get=function(){return this._store.get.apply(this,arguments)},this.connection=function(){return Retreaver.Base.Request.connection()}};c.inflections={number:"numbers",campaign:"campaigns"},c.update=function(d){for(var e in d){var f=e,g=d[e];if(void 0!==c.inflections[e]&&(f=c.inflections[e]),void 0!==b._store[f])if(a.isArray(g))for(var h=0;h<g.length;h++)c.update_record(f,g[h]);else c.update_record(f,g[h])}return d},c.update_record=function(a,b){if(c.update_visitor_id(b),void 0!==b.id){var d=c.primary_key(a);for(var e in b)Retreaver.Base.Data._store[a][b[d]][e]=b[e];return!0}return!1},c.update_visitor_id=function(a){void 0!==a&&void 0!==a.visitor_id&&Retreaver.Base.Cookies.set("CallPixels-vid",a.visitor_id)},c.primary_key=function(a,b){return void 0===c.primary_keys&&(c.primary_keys={}),void 0===c.primary_keys[a]&&(c.primary_keys[a]="id"),void 0!==b&&(c.primary_keys[a]=b),c.primary_keys[a]},Retreaver.Base.Model=c}(),function(){var Base=window.Retreaver.Base,Cookies=window.Retreaver.Base.Cookies,Request=function(options){function initialize(a){config=Base.assert_required_keys(a,"http_prefix","addr","urlregex")}function with_ie_scripts(a){Retreaver.easyxdm_loaded?a():self.loadScript(http_prefix+"://cdn.jsdelivr.net/easyxdm/2.4.17.1/easyXDM.min.js",function(){self.loadScript(http_prefix+"://cdn.jsdelivr.net/easyxdm/2.4.17.1/json2.js",function(){Retreaver.easyxdm_loaded=!0,a()})})}var self=this,config={};self.getJSON=function(a,b,c,d){"function"==typeof c&&(c=[c]),void 0===d&&(d=self);var e=function(){self.apiRequest(a,function(a){var b=JSON.parse(a);for(var e in c)"function"==typeof c[e]&&c[e].apply(d,[b])},b)};6==Base.ieVersion()||7==Base.ieVersion()?with_ie_scripts(e):e()},self.postJSON=function(){return self.getJSON.apply(this,arguments)},self.apiRequest=function(request_uri,callbackFunctions,payload){function ignored(){}function runCallbacks(a){for(var b in callbackFunctions)"function"==typeof callbackFunctions[b]&&callbackFunctions[b](a)}function forwardResponse(){runCallbacks(xdr.responseText)}function sendXdm(){var remote=http_prefix+"://"+addr+"/ie_provider",swf=http_prefix+"://"+addr+"/easyxdm.swf",rpc=eval('new window.easyXDM.Rpc({ remote: "'+remote+'", swf: "'+swf+'"},{remote: {request: {}}});');rpc.request({url:"/"+request_url.match(urlregex)[1],method:"POST",data:payload},function(a){runCallbacks(a.data)})}var http_prefix=config.http_prefix,addr=config.addr,urlregex=eval(config.urlregex),request_url=http_prefix+"://"+addr+request_uri;if(payload&&void 0!==Cookies.get("CallPixels-vid")&&"null"!==Cookies.get("CallPixels-vid")&&(payload.visitor_id=Cookies.get("CallPixels-vid")),"function"==typeof callbackFunctions&&(callbackFunctions=[callbackFunctions]),window.XDomainRequest){var xdr=new XDomainRequest;xdr.onload=forwardResponse,xdr.onprogress=ignored,xdr.onerror=ignored,xdr.ontimeout=ignored,xdr.timeout=3e4,payload?(xdr.open("post",request_url),xdr.send(self.buildPost(payload))):(xdr.open("get",request_url),xdr.send())}else if(6==Base.ieVersion()||7==Base.ieVersion())with_ie_scripts(sendXdm);else{var request=new XMLHttpRequest;request.onload=function(){runCallbacks(this.responseText)},payload?(request.open("POST",request_url),request.setRequestHeader("Content-Type","application/json"),request.send(JSON.stringify(payload))):(request.open("GET",request_url),request.send())}},self.buildPost=function(a){var b="";for(var c in a)b+=c+"="+a[c]+"&";return b},self.loadScript=function(a,b){var c=document.getElementsByTagName("script")[0],d=document.createElement("script");d.type="text/javascript",d.async=!1,d.src=a;var e=function(a,b){"loaded"==a.readyState||"complete"==a.readyState?b():setTimeout(function(){e(a,b)},100)};"function"==typeof b&&(void 0!==d.addEventListener?d.addEventListener("load",b,!1):d.onreadystatechange=function(){d.onreadystatechange=null,e(d,b)}),c.parentNode.insertBefore(d,c)},initialize(options),self.config=config};Request.connection=function(){if(void 0===window.Retreaver._connection){var a=window.location.protocol.replace(":","");window.Retreaver._connection=new Retreaver.Base.Request({addr:"api.rtvrapi.com",http_prefix:a,urlregex:"/\\/\\/[^\\/]*\\/(.*)/"})}return window.Retreaver._connection},Retreaver.Base.Request=Request}(),function(){function tags_to_script_tags(a){var b="";for(var c in a){b=b+"&"+c+"="+a[c]}return b}var Base=Retreaver.Base,Cookies=Retreaver.Base.Cookies,Base64=Retreaver.Base.Base64,Request=Retreaver.Base.Request,RequestNumber=function(options){function initialize(a){config=Base.assert_required_keys(a,"campaign_key")}function getParts(a){for(var b={},c=0;c<a.length;c++){var d=getUrlParts(a[c]);for(var e in d)b[e]=d[e]}return b}function getUrlParts(url){var objURL=new Object;try{url=url.match(eval("/\\?(.*)/"))[0]}catch(a){return objURL}return url.replace(new RegExp("([^?=&]+)(=([^&]*))?","g"),function(a,b,c,d){objURL[b.toLowerCase()]=d}),objURL}function getGACookies(){var a=["__utma","__utmb","__utmc","__utmz","__utmv"],b=new Object;for(var c in a){var d=extractCookie(a[c]);if(!(d||c>0))break;d&&(b[a[c]]=d)}return b}function extractCookie(a){var b=new RegExp(a+"=([^;]*)","g");try{return b.exec(document.cookie)[1]}catch(a){return!1}}function findOne(a,b){for(var c in b)for(var d in a)if(d==b[c])return a[d];return!1}var self=this,config={},resource_url="/api/v1/numbers?";self.perform=function(callback){function sendGARequest(a,b){request_ran||(request_ran=!0,body.ga=Base64.encode(a),body.c=Base64.encode(JSON.stringify(b)),Request.connection().getJSON(request_url,body,callback))}function runRequest(){request_ran||(request_ran=!0,Request.connection().getJSON(request_url,body,callback))}if("function"!=typeof callback)throw"ArgumentError: Expected to receive a callback function";var request_url=resource_url+"&campaign_key="+config.campaign_key;config.default_number_replacement&&(request_url=request_url+"&default_number="+config.default_number_replacement),config.message_replacement&&(request_url=request_url+"&message="+config.message_replacement);var body=new Object,uri=document.location.href;body.u=Base64.encode(uri),body.st=Base64.encode(tags_to_script_tags(config.number_matching_tags));var ou=Cookies.get("CallPixels-ou");getParts([document.location.href]).cpreset||!ou?Cookies.set("CallPixels-ou",body.u):body.ou=ou;var ga_acct="FAILED",request_ran=!1;window.setTimeout(runRequest,1e3);try{_gaq.push(function(){ga_acct=eval("_gat._getTrackerByName()._getAccount()"),sendGARequest(ga_acct,getGACookies())})}catch(e){try{ga(function(tracker){if(tracker&&tracker.get)try{var clientId=tracker.get("clientId"),allTrackers=eval("ga.getAll()");ga_acct=allTrackers[0].get("trackingId");var ga_cookies={};ga_cookies.__utma=clientId,ga_cookies.mp="yes",sendGARequest(ga_acct,ga_cookies)}catch(a){sendGARequest("",{})}else sendGARequest("",{})})}catch(a){runRequest()}}},initialize(options)};Retreaver.Base.RequestNumber=RequestNumber}(),window.Retreaver.Cache={},function(){function a(b){if(void 0!==Retreaver.Base.Data._store){var c=Retreaver.Base.Data._store.numbers;if(void 0!==c){var d={};for(var e in c){var f=c[e];"true"===f.is_active&&(void 0===d[f.campaign_key]&&(d[f.campaign_key]=[],d[f.campaign_key].ids=[],d[f.campaign_key].hashes=[]),d[f.campaign_key].ids.push(f.id),d[f.campaign_key].hashes.push(f.id_checksum))}for(var g in d){var h={ids:d[g].ids,hashes:d[g].hashes};Retreaver.Base.Request.connection().postJSON("/api/v1/numbers/ping",h,[Retreaver.Base.Model.update,b],this)}}}setTimeout(a,15e3)}var b=Retreaver.Base;Retreaver.Number=function(a){function c(a){g.store(a),g.set("is_active","true")}function d(a){return"string"==typeof a&&(a=Retreaver.Number.extract_tags_from_string(a)),{tag_values:a,ids:[e("id")],campaign_key:e("campaign_key")}}function e(a){return g.get(a)}function f(){if(!1===g.get("is_per_visitor"))throw"Error: Tried to add tags to non per-visitor number."}var g=this;g.type="numbers",g.add_tags=function(a,b){f(),g.post_data("numbers/tag",d(a),b)},g.replace_tags=function(a,b){f(),g.post_data("numbers/replace_tags",d(a),b)},g.remove_tags=function(a,b){f(),g.post_data("numbers/untag",d(a),b)},g.remove_tags_by_keys=function(a,b){f(),"string"==typeof a&&(a=a.split(","));var c={tag_keys:a,ids:[e("id")],campaign_key:e("campaign_key")};g.post_data("numbers/untag/keys",c,b)},g.clear_tags=function(a){f();var b={ids:[e("id")],campaign_key:e("campaign_key"),all:"true"};g.post_data("numbers/untag",b,a)},g.release=function(){g.set("is_active","false")},g.initiate_call=function(a,c,d){void 0===c&&(c={}),c.dial=a,c=b.merge(g.get("id","campaign_key"),c),g.post_data("numbers/initiate_call",c,d)},c(a)},Retreaver.Number.extract_tags_from_string=function(a){for(var b={},a=a.split(","),c=0;c<a.length;c++){var d=a[c].split(":");b[d[0]]=d[1]}return b},Retreaver.Number.prototype=new Retreaver.Base.Model,a()}(),function(){var a=Retreaver.Base.RequestNumber,b=function(b){function c(a){e.store(a)}function d(a){for(var b=0;b<a.length;b++){var c=a[b];Retreaver.Vendor.findAndReplaceDOMText(document.getElementsByTagName("body")[0],{find:c.find,replace:c.replace_with});for(var d=document.getElementsByTagName("a"),e=0;e<d.length;e++){var f=d[e],g=f.getAttribute("href");if(null!==g){var h=g.match(/^(tel:|clk[a-z]\/tel\/)(.*)/);h&&h[2]===c.find&&f.setAttribute("href",h[1]+c.replace_with)}}}}var e=this;e.type="campaigns",e.primary_key("campaign_key"),e.numbers=[],e.request_number=function(b,c,f){"function"==typeof b&&(f=c,c=b,b={}),void 0===c&&(c=function(){}),void 0===b&&(b={}),e.set("number_matching_tags",b),new a(e.get("campaign_key","number_matching_tags")).perform(function(a){if(void 0!==a&&void 0!==a.number&&""!==a.number){var b=new Retreaver.Number(a.number);void 0!==a.number.replacement_numbers&&d(a.number.replacement_numbers),c.apply(e,[b])}else"function"==typeof f&&f.apply(e,[a])})},e.auto_replace_numbers=function(a,b,c){void 0===b&&(b=function(){}),void 0===c&&(c=function(){}),e.request_number(a,b,c)},e.numbers=function(){var a=[];if(void 0!==Retreaver.Base.Data._store){var b=Retreaver.Base.Data._store.numbers;if(void 0!==b)for(var c in b){var d=b[c];e.get("campaign_key")==d.campaign_key&&a.push(new Retreaver.Number(d))}}return a},e.set_number_matching_tags=function(a){if("string"==typeof a&&(a=Retreaver.Number.extract_tags_from_string(a)),!a||"object"!=typeof a||a instanceof Array)throw"ArgumentError: Expected number_matching_tags to be an object. eg: {tag: 'value'}";return a},c(b)};b.prototype=new Retreaver.Base.Model,Retreaver.Campaign=b}(),function(a){a.Callpixels=window.Retreaver}(window),void 0===Retreaver)var Retreaver={};void 0===Retreaver.Vendor&&(Retreaver.Vendor={}),function(a,b){a.findAndReplaceDOMText=b()}(Retreaver.Vendor,function(){function a(a){return String(a).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function b(){return c.apply(null,arguments)||d.apply(null,arguments)}function c(a,c,e,f,g){if(c&&!c.nodeType&&arguments.length<=2)return!1;var h="function"==typeof e;h&&(e=function(a){return function(b,c){return a(b.text,c.startIndex)}}(e));var i=d(c,{find:a,wrap:h?null:e,replace:h?e:"$"+(f||"&"),prepMatch:function(a,b){if(!a[0])throw"findAndReplaceDOMText cannot handle zero-length matches";if(f>0){var c=a[f];a.index+=a[0].indexOf(c),a[0]=c}return a.endIndex=a.index+a[0].length,a.startIndex=a.index,a.index=b,a},filterElements:g});return b.revert=function(){return i.revert()},!0}function d(a,b){return new e(a,b)}function e(a,c){var d=c.preset&&b.PRESETS[c.preset];if(c.portionMode=c.portionMode||f,d)for(var e in d)i.call(d,e)&&!i.call(c,e)&&(c[e]=d[e]);this.node=a,this.options=c,this.prepMatch=c.prepMatch||this.prepMatch,this.reverts=[],this.matches=this.search(),this.matches.length&&this.processMatches()}var f="retain",g="first",h=document,i={}.hasOwnProperty;return b.NON_PROSE_ELEMENTS={br:1,hr:1,script:1,style:1,img:1,video:1,audio:1,canvas:1,svg:1,map:1,object:1,input:1,textarea:1,select:1,option:1,optgroup:1,button:1},b.NON_CONTIGUOUS_PROSE_ELEMENTS={address:1,article:1,aside:1,blockquote:1,dd:1,div:1,dl:1,fieldset:1,figcaption:1,figure:1,footer:1,form:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,header:1,hgroup:1,hr:1,main:1,nav:1,noscript:1,ol:1,output:1,p:1,pre:1,section:1,ul:1,br:1,li:1,summary:1,dt:1,details:1,rp:1,rt:1,rtc:1,script:1,style:1,img:1,video:1,audio:1,canvas:1,svg:1,map:1,object:1,input:1,textarea:1,select:1,option:1,optgroup:1,button:1,table:1,tbody:1,thead:1,th:1,tr:1,td:1,caption:1,col:1,tfoot:1,colgroup:1},b.NON_INLINE_PROSE=function(a){return i.call(b.NON_CONTIGUOUS_PROSE_ELEMENTS,a.nodeName.toLowerCase())},b.PRESETS={prose:{forceContext:b.NON_INLINE_PROSE,filterElements:function(a){return!i.call(b.NON_PROSE_ELEMENTS,a.nodeName.toLowerCase())}}},b.Finder=e,e.prototype={search:function(){function b(a){for(var g=0,j=a.length;g<j;++g){var k=a[g];if("string"==typeof k){if(f.global)for(;c=f.exec(k);)h.push(i.prepMatch(c,d++,e));else(c=k.match(f))&&h.push(i.prepMatch(c,0,e));e+=k.length}else b(k)}}var c,d=0,e=0,f=this.options.find,g=this.getAggregateText(),h=[],i=this;return f="string"==typeof f?RegExp(a(f),"g"):f,b(g),h},prepMatch:function(a,b,c){if(!a[0])throw new Error("findAndReplaceDOMText cannot handle zero-length matches");return a.endIndex=c+a.index+a[0].length,a.startIndex=c+a.index,a.index=b,a},getAggregateText:function(){function a(d){if(3===d.nodeType)return[d.data];if(b&&!b(d))return[];var e=[""],f=0;if(d=d.firstChild)do{if(3!==d.nodeType){var g=a(d);c&&1===d.nodeType&&(!0===c||c(d))?(e[++f]=g,e[++f]=""):("string"==typeof g[0]&&(e[f]+=g.shift()),g.length&&(e[++f]=g,e[++f]=""))}else e[f]+=d.data}while(d=d.nextSibling);return e}var b=this.options.filterElements,c=this.options.forceContext;return a(this.node)},processMatches:function(){var a,b,c,d=this.matches,e=this.node,f=this.options.filterElements,g=[],h=e,i=d.shift(),j=0,k=0,l=0,m=[e];a:for(;;){if(3===h.nodeType&&(!b&&h.length+j>=i.endIndex?b={node:h,index:l++,text:h.data.substring(i.startIndex-j,i.endIndex-j),indexInMatch:j-i.startIndex,indexInNode:i.startIndex-j,endIndexInNode:i.endIndex-j,isEnd:!0}:a&&g.push({node:h,index:l++,text:h.data,indexInMatch:j-i.startIndex,indexInNode:0}),!a&&h.length+j>i.startIndex&&(a={node:h,index:l++,indexInMatch:0,indexInNode:i.startIndex-j,endIndexInNode:i.endIndex-j,text:h.data.substring(i.startIndex-j,i.endIndex-j)}),j+=h.data.length),c=1===h.nodeType&&f&&!f(h),a&&b){if(h=this.replaceMatch(i,a,g,b),j-=b.node.data.length-b.endIndexInNode,a=null,b=null,g=[],i=d.shift(),l=0,k++,!i)break}else if(!c&&(h.firstChild||h.nextSibling)){h.firstChild?(m.push(h),h=h.firstChild):h=h.nextSibling;continue}for(;;){if(h.nextSibling){h=h.nextSibling;break}if((h=m.pop())===e)break a}}},revert:function(){for(var a=this.reverts.length;a--;)this.reverts[a]();this.reverts=[]},prepareReplacementString:function(a,b,c){var d=this.options.portionMode;return d===g&&b.indexInMatch>0?"":(a=a.replace(/\$(\d+|&|`|')/g,function(a,b){var d;switch(b){case"&":d=c[0];break;case"`":d=c.input.substring(0,c.startIndex);break;case"'":d=c.input.substring(c.endIndex);break;default:d=c[+b]}return d}),d===g?a:b.isEnd?a.substring(b.indexInMatch):a.substring(b.indexInMatch,b.indexInMatch+b.text.length))},getPortionReplacementNode:function(a,b){var c=this.options.replace||"$&",d=this.options.wrap;if(d&&d.nodeType){var e=h.createElement("div");e.innerHTML=d.outerHTML||(new XMLSerializer).serializeToString(d),d=e.firstChild}if("function"==typeof c)return c=c(a,b),c&&c.nodeType?c:h.createTextNode(String(c));var f="string"==typeof d?h.createElement(d):d;return c=h.createTextNode(this.prepareReplacementString(c,a,b)),c.data&&f?(f.appendChild(c),f):c},replaceMatch:function(a,b,c,d){var e,f,g=b.node,i=d.node;if(g===i){var j=g;b.indexInNode>0&&(e=h.createTextNode(j.data.substring(0,b.indexInNode)),j.parentNode.insertBefore(e,j));var k=this.getPortionReplacementNode(d,a);return j.parentNode.insertBefore(k,j),d.endIndexInNode<j.length&&(f=h.createTextNode(j.data.substring(d.endIndexInNode)),j.parentNode.insertBefore(f,j)),j.parentNode.removeChild(j),this.reverts.push(function(){e===k.previousSibling&&e.parentNode.removeChild(e),f===k.nextSibling&&f.parentNode.removeChild(f),k.parentNode.replaceChild(j,k)}),k}e=h.createTextNode(g.data.substring(0,b.indexInNode)),f=h.createTextNode(i.data.substring(d.endIndexInNode));for(var l=this.getPortionReplacementNode(b,a),m=[],n=0,o=c.length;n<o;++n){var p=c[n],q=this.getPortionReplacementNode(p,a);p.node.parentNode.replaceChild(q,p.node),this.reverts.push(function(a,b){return function(){b.parentNode.replaceChild(a.node,b)}}(p,q)),m.push(q)}var r=this.getPortionReplacementNode(d,a);return g.parentNode.insertBefore(e,g),g.parentNode.insertBefore(l,g),g.parentNode.removeChild(g),i.parentNode.insertBefore(r,i),i.parentNode.insertBefore(f,i),i.parentNode.removeChild(i),this.reverts.push(function(){e.parentNode.removeChild(e),l.parentNode.replaceChild(g,l),f.parentNode.removeChild(f),r.parentNode.replaceChild(i,r)}),r}},b});
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: retreaverjs-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Blake Hilscher
|
8
8
|
- Jason Kay
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-04-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: railties
|
@@ -137,7 +137,7 @@ homepage: ''
|
|
137
137
|
licenses:
|
138
138
|
- GPLv3
|
139
139
|
metadata: {}
|
140
|
-
post_install_message:
|
140
|
+
post_install_message:
|
141
141
|
rdoc_options: []
|
142
142
|
require_paths:
|
143
143
|
- lib
|
@@ -152,9 +152,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
152
152
|
- !ruby/object:Gem::Version
|
153
153
|
version: '0'
|
154
154
|
requirements: []
|
155
|
-
|
156
|
-
|
157
|
-
signing_key:
|
155
|
+
rubygems_version: 3.0.9
|
156
|
+
signing_key:
|
158
157
|
specification_version: 4
|
159
158
|
summary: retreaver.js rails wrapper
|
160
159
|
test_files: []
|