diff --git a/build/picreel.js b/build/picreel.js index 411c2f1..922ceae 100644 --- a/build/picreel.js +++ b/build/picreel.js @@ -17,9 +17,11 @@ this.emailSelector = this.emailSelector || "input[name='email']"; this.errorClass = this.errorClass || "subscriber-error"; this.loadingClass = this.loadingClass || "subscriber-loading"; - this.onerror = this.onerror || function() {}; - this.onsuccess = this.onsuccess || function() {}; - this.oncomplete = this.oncomplete || function() {}; + this.onerror = this.onerror || noop; + this.onsuccess = this.onsuccess || noop; + this.oncomplete = this.oncomplete || noop; + this.vars = this.vars || []; + this.event = this.event || null; this.action = this.action || "/"; this.carrier = null; @@ -84,6 +86,8 @@ var data = {}; data['email'] = this.$(this.emailSelector).val(); + if(this.vars.length) data['vars'] = this.vars; + if(this.event) data['event'] = this.event; if (this.lists.length) { data['lists'] = []; @@ -141,7 +145,7 @@ }); }; - getTopWindow = function() { + var getTopWindow = function() { var topWindow = window; while (topWindow !== topWindow.parent) { topWindow = topWindow.parent; @@ -149,6 +153,8 @@ return topWindow; }; + var noop = function() {}; + return APLSubscriber; })(); diff --git a/build/picreel.min.js b/build/picreel.min.js index 9e63f77..228ca7b 100644 --- a/build/picreel.min.js +++ b/build/picreel.min.js @@ -1,2 +1,2 @@ -!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return b.test(a)},a.prototype.formToCarrierParams=function(){var a={};if(a.email=this.$(this.emailSelector).val(),this.lists.length){a.lists=[];for(var b=0;b()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return b.test(a)},a.prototype.formToCarrierParams=function(){var a={};if(a.email=this.$(this.emailSelector).val(),this.vars.length&&(a.vars=this.vars),this.event&&(a.event=this.event),this.lists.length){a.lists=[];for(var b=0;b= 0), "If a list is specified, it is submitted"); + assert.ok((subject.formToCarrierParams().vars.indexOf(validVarsName) >= 0), "If var values exist, they are submitted"); + assert.ok((subject.formToCarrierParams().event == validEventName), "If an event name exists, it is submitted"); carrierSpy.reset(); $(subject.emailSelector).val(validEmail);