retreaverjs-rails 0.2.16 → 0.2.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/retreaverjs/compile.rb +8 -2
- data/lib/retreaverjs/rails/version.rb +1 -1
- data/package.json +12 -8
- data/vendor/assets/javascripts/retreaver.min.js +1 -1
- data/vendor/documentation/javascript/v1/Retreaver.Campaign.html +290 -331
- data/vendor/documentation/javascript/v1/Retreaver.Number.html +731 -843
- data/vendor/documentation/javascript/v1/Retreaver.html +134 -157
- data/vendor/documentation/javascript/v1/{retreaver_campaign.js.html → campaign.js.html} +17 -18
- data/vendor/documentation/javascript/v1/global.html +97 -119
- data/vendor/documentation/javascript/v1/index.html +8 -10
- data/vendor/documentation/javascript/v1/{retreaver_number.js.html → number.js.html} +7 -8
- data/vendor/documentation/javascript/v1/retreaver.js.html +7 -8
- data/vendor/documentation/javascript/v1/scripts/linenumber.js +11 -19
- data/vendor/documentation/javascript/v1/styles/jsdoc-default.css +129 -193
- data/vendor/documentation/javascript/v1/styles/prettify-tomorrow.css +1 -1
- metadata +5 -23
- data/vendor/documentation/javascript/v1/fonts/OpenSans-Bold-webfont.eot +0 -0
- data/vendor/documentation/javascript/v1/fonts/OpenSans-Bold-webfont.svg +0 -1830
- data/vendor/documentation/javascript/v1/fonts/OpenSans-Bold-webfont.woff +0 -0
- data/vendor/documentation/javascript/v1/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
- data/vendor/documentation/javascript/v1/fonts/OpenSans-BoldItalic-webfont.svg +0 -1830
- data/vendor/documentation/javascript/v1/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
- data/vendor/documentation/javascript/v1/fonts/OpenSans-Italic-webfont.eot +0 -0
- data/vendor/documentation/javascript/v1/fonts/OpenSans-Italic-webfont.svg +0 -1830
- data/vendor/documentation/javascript/v1/fonts/OpenSans-Italic-webfont.woff +0 -0
- data/vendor/documentation/javascript/v1/fonts/OpenSans-Light-webfont.eot +0 -0
- data/vendor/documentation/javascript/v1/fonts/OpenSans-Light-webfont.svg +0 -1831
- data/vendor/documentation/javascript/v1/fonts/OpenSans-Light-webfont.woff +0 -0
- data/vendor/documentation/javascript/v1/fonts/OpenSans-LightItalic-webfont.eot +0 -0
- data/vendor/documentation/javascript/v1/fonts/OpenSans-LightItalic-webfont.svg +0 -1835
- data/vendor/documentation/javascript/v1/fonts/OpenSans-LightItalic-webfont.woff +0 -0
- data/vendor/documentation/javascript/v1/fonts/OpenSans-Regular-webfont.eot +0 -0
- data/vendor/documentation/javascript/v1/fonts/OpenSans-Regular-webfont.svg +0 -1831
- data/vendor/documentation/javascript/v1/fonts/OpenSans-Regular-webfont.woff +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2059d0acc28982b7aa213f773af57e8213c3e00e7eb24a1fe99a414a2edd783b
|
4
|
+
data.tar.gz: d79e9083125fa96db8e310bb001f2a88cde18dd02e15613444a90b5504eff233
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71b2b93c0e6c354a38df9ecfb390b0557879fed2ff97dbce7d0ceb33fd46a9061aefc5ef031e24db03daa2815bac14814a96e0c5815d4e3b9f9e70d47f4357ef
|
7
|
+
data.tar.gz: abc041378b8281bcf907dd62ee1fcf5deafbb77aeb33f95b18457628d314ab7a8f82bb845ec5a029e44d2eef3d11ca90a752147787a8248179fd87f75d5e10e1
|
data/lib/retreaverjs/compile.rb
CHANGED
@@ -6,7 +6,7 @@ module Retreaver
|
|
6
6
|
Dir.chdir(root) do |f|
|
7
7
|
run("npm install") unless Dir.exist?('./node_modules')
|
8
8
|
# compile src
|
9
|
-
run("grunt")
|
9
|
+
run("npx grunt-cli -y")
|
10
10
|
output = 'vendor/assets/javascripts/'
|
11
11
|
FileUtils.rm_rf(output)
|
12
12
|
FileUtils.mkdir_p(output)
|
@@ -20,7 +20,13 @@ module Retreaver
|
|
20
20
|
|
21
21
|
def run(command)
|
22
22
|
puts(command)
|
23
|
-
|
23
|
+
system_with_abort(command)
|
24
|
+
end
|
25
|
+
|
26
|
+
def system_with_abort(command, abort_message=nil)
|
27
|
+
system(command, out: $stdout, err: :out)
|
28
|
+
abort_message ||= "Error executing: '#{command}'"
|
29
|
+
abort abort_message unless $?.success?
|
24
30
|
end
|
25
31
|
|
26
32
|
def root
|
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.17",
|
5
5
|
"homepage": "https://github.com/retreaver/retreaverjs",
|
6
6
|
"repository": {
|
7
7
|
"type": "git",
|
@@ -44,12 +44,16 @@
|
|
44
44
|
},
|
45
45
|
"dependencies": {},
|
46
46
|
"devDependencies": {
|
47
|
-
"
|
48
|
-
"
|
49
|
-
"grunt-contrib-
|
50
|
-
"grunt-contrib-
|
51
|
-
"grunt-contrib-
|
52
|
-
"grunt-contrib-
|
53
|
-
"grunt-contrib-
|
47
|
+
"catharsis": "0.9.0",
|
48
|
+
"grunt": "0.4.5",
|
49
|
+
"grunt-contrib-concat": "0.4.0",
|
50
|
+
"grunt-contrib-jshint": "0.10.0",
|
51
|
+
"grunt-contrib-nodeunit": "0.4.1",
|
52
|
+
"grunt-contrib-uglify": "0.5.1",
|
53
|
+
"grunt-contrib-watch": "0.6.1",
|
54
|
+
"jsdoc": "3.2.2",
|
55
|
+
"marked": "4.0.14",
|
56
|
+
"taffydb": "2.7.3",
|
57
|
+
"underscore": "1.13.2"
|
54
58
|
}
|
55
59
|
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
/*! retreaver
|
1
|
+
/*! retreaver 01-12-2022 */
|
2
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});
|