projects
/
openx
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8bf0530
)
Fetch on resize: min/max-widths are collected from "class"
author
Kai Moritz
<kai@juplo.de>
Thu, 28 Feb 2013 14:22:45 +0000
(15:22 +0100)
committer
Kai Moritz
<kai@juplo.de>
Thu, 28 Feb 2013 15:50:31 +0000
(16:50 +0100)
jquery.openx.js
patch
|
blob
|
history
diff --git
a/jquery.openx.js
b/jquery.openx.js
index
d687dfa
..
a2343bb
100644
(file)
--- a/
jquery.openx.js
+++ b/
jquery.openx.js
@@
-29,6
+29,8
@@
count = 0,
slots = {},
count = 0,
slots = {},
+ min_width = {},
+ max_width = {},
queue = [],
output = [];
queue = [],
output = [];
@@
-92,6
+94,10
@@
* selector: string A selector for selecting the DOM-elements, that
* should display ad-banners. DEFAULT: ".oa".
* See: http://api.jquery.com/category/selectors/
* selector: string A selector for selecting the DOM-elements, that
* should display ad-banners. DEFAULT: ".oa".
* See: http://api.jquery.com/category/selectors/
+ * min_prefix: string Prefix for the encoding of the minmal width as
+ * CSS-classname. DEFAULT: "min_".
+ * max_prefix: string Prefix for the encoding of the maximal width as
+ * CSS-classname. DEFAULT: "max_".
*/
$.openx = function( options ) {
*/
$.openx = function( options ) {
@@
-123,6
+129,8
@@
'delivery': '/www/delivery',
'fl': 'fl.js',
'selector': '.oa',
'delivery': '/www/delivery',
'fl': 'fl.js',
'selector': '.oa',
+ 'min_prefix': 'min_',
+ 'max_prefix': 'max_',
'cache': true
},
options
'cache': true
},
options
@@
-158,10
+166,26
@@
for(name in OA_zones) {
$(settings.selector).each(function() {
var
for(name in OA_zones) {
$(settings.selector).each(function() {
var
- id;
+ id,
+ classes,
+ i,
+ min = new RegExp('^' + settings.min_prefix + '([0-9]+)$'),
+ max = new RegExp('^' + settings.max_prefix + '([0-9]+)$'),
+ match;
if (this.id === name) {
id = 'oa_' + ++count;
slots[id] = this;
if (this.id === name) {
id = 'oa_' + ++count;
slots[id] = this;
+ min_width[id] = 0;
+ max_width[id] = Number.MAX_VALUE;
+ classes = this.className.split(/\s+/);
+ for (i=0; i<classes.length; i++) {
+ match = min.exec(classes[i]);
+ if (match)
+ min_width[id] = match[1];
+ match = max.exec(classes[i]);
+ if (match)
+ max_width[id] = match[1];
+ }
}
});
}
}
});
}