[kupu-checkins] r54095 - kupu/trunk/kupu/common
mihxil at codespeak.net
mihxil at codespeak.net
Thu Apr 24 16:48:16 CEST 2008
Author: mihxil
Date: Thu Apr 24 16:48:16 2008
New Revision: 54095
Modified:
kupu/trunk/kupu/common/kuputoolcollapser.js
Log:
Using regexp to match the class name kupu-toolbox, which makes it possible to give a toolbox also other classes, and still have it functional
Modified: kupu/trunk/kupu/common/kuputoolcollapser.js
==============================================================================
--- kupu/trunk/kupu/common/kuputoolcollapser.js (original)
+++ kupu/trunk/kupu/common/kuputoolcollapser.js Thu Apr 24 16:48:16 2008
@@ -20,11 +20,11 @@
};
for (var i=0; i < this.parent.childNodes.length; i++) {
var child = this.parent.childNodes[i];
- if (child.className == 'kupu-toolbox') {
+ if (child.className.match(/\bkupu-toolbox\b/)) {
var heading = child.getElementsByTagName('h1')[0];
if (!heading) {
throw('heading not found by collapser for toolbox ' +
- child.id);
+ child.id);henadle
};
heading.setAttribute('title', _('click to unfold'));
// find the toolbox's body
@@ -54,7 +54,7 @@
};
};
addEventHandler(heading, 'click', handler, body, heading);
- if (initial_state[child.id] === undefined ||
+ if (initial_state[child.id] === undefined ||
initial_state[child.id] == '0') {
body.style.display = 'none';
} else {
@@ -98,12 +98,12 @@
var body = this.getToolBody(child);
current_state[child.id] = body.style.display == 'none' ? '0' : '1';
};
-
+
var exp = new Date();
// 100 years before state is lost... should be enough ;)
exp.setTime(exp.getTime() + (100 * 365 * 24 * 60 * 60 * 1000));
- var cookie = 'initial_state=' +
- escape(this.serializeMapping(current_state)) +
+ var cookie = 'initial_state=' +
+ escape(this.serializeMapping(current_state)) +
';' +
'expires=' + exp.toGMTString() + ';' +
'path=/';
@@ -112,7 +112,7 @@
ToolCollapser.prototype.serializeMapping = function(mapping) {
/* serializes the config dict into a string that can be evalled
-
+
works only for dicts with string values
*/
if (typeof(mapping) == 'string') {
@@ -124,7 +124,7 @@
if (!first) {
ret += ', ';
};
- ret += "'" + key + "': " +
+ ret += "'" + key + "': " +
this.serializeMapping(mapping[key]);
first = false;
};
More information about the kupu-checkins
mailing list