projects
/
openx
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9468906
)
The Plugin stops its work and logs an error, if a required option is missing
author
Kai Moritz
<kai@juplo.de>
Wed, 27 Feb 2013 08:56:44 +0000
(09:56 +0100)
committer
Kai Moritz
<kai@juplo.de>
Wed, 27 Feb 2013 18:35:42 +0000
(19:35 +0100)
jquery.openx.js
patch
|
blob
|
history
diff --git
a/jquery.openx.js
b/jquery.openx.js
index
98c56ec
..
f156ba5
100644
(file)
--- a/
jquery.openx.js
+++ b/
jquery.openx.js
@@
-36,6
+36,8
@@
$.openx = function( zones, options ) {
$.openx = function( zones, options ) {
+ var name, src, errors = [], i;
+
if (domain) {
if (console.error) {
console.error('jQuery.openx was already initialized!');
if (domain) {
if (console.error) {
console.error('jQuery.openx was already initialized!');
@@
-48,10
+50,20
@@
_zones = zones;
_options = options;
_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<errors.length; i++)
+ console.error('Required option "server" is missing!');
+ console.log('options: ', options);
+ }
+ return;
+ }
+
settings = $.extend(
{
settings = $.extend(
{
- 'protocol': document.location.protocol,
- 'server': 'localhost'
+ 'protocol': document.location.protocol
},
options
);
},
options
);
@@
-63,10
+75,6
@@
if (settings.protocol === 'https:' && settings.https_port)
domain += ':' + settings.https_port;
if (settings.protocol === 'https:' && settings.https_port)
domain += ':' + settings.https_port;
- var
- name,
- src = domain;
-
/**
* Without this option, jQuery appends an timestamp to every URL, that
* is fetched via $.getScript(). This can mess up badly written
/**
* Without this option, jQuery appends an timestamp to every URL, that
* is fetched via $.getScript(). This can mess up badly written
@@
-75,7
+83,7
@@
*/
$.ajaxSetup({ cache: true });
*/
$.ajaxSetup({ cache: true });
- src
+= "/www/delivery/spc.php?zones="
;
+ src
= domain + '/www/delivery/spc.php?zones='
;
/** Only fetch banners, that are really included in this page */
for(name in zones) {
/** Only fetch banners, that are really included in this page */
for(name in zones) {