From fc73011d66a9f79673775b2bdd254b4f0a49dabd Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Wed, 27 Feb 2013 09:56:44 +0100 Subject: [PATCH] The Plugin stops its work and logs an error, if a required option is missing --- jquery.openx.js | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/jquery.openx.js b/jquery.openx.js index 98c56ec..f156ba5 100644 --- a/jquery.openx.js +++ b/jquery.openx.js @@ -36,6 +36,8 @@ $.openx = function( zones, options ) { + var name, src, errors = [], i; + if (domain) { if (console.error) { console.error('jQuery.openx was already initialized!'); @@ -48,10 +50,20 @@ _zones = zones; _options = options; + if (!options.server) + errors.push('Required option "server" is missing!'); + if (errors.length > 0) { + if (console.error) { + for (i=0; i