Ticket #3895: dbx.js.diff
| File dbx.js.diff, 2.2 KB (added by , 19 years ago) |
|---|
-
dbx-2.01-formatted.js
1 // DBX2.0 1:: Docking Boxes (dbx)1 // DBX2.05 :: Docking Boxes (dbx) 2 2 // ***************************************************** 3 3 // DOM scripting by brothercake -- http://www.brothercake.com/ 4 4 // GNU Lesser General Public License -- http://www.gnu.org/licenses/lgpl.html … … 41 41 } 42 42 } 43 43 this.state = str.replace(/^(.+)&$/, '$1'); 44 this.cookiestring = this.state.replace(/,/g, '|'); 45 this.cookiestring = this.cookiestring.replace(/=/g, ':'); 44 46 if (typeof this.onstatechange == 'undefined' || this.onstatechange()) { 45 document.cookie = 'dbx-' + this.sid + '=' + this. state+ '; expires=' + now.toGMTString() + '; path=/';47 document.cookie = 'dbx-' + this.sid + '=' + this.cookiestring + '; expires=' + now.toGMTString() + '; path=/'; 46 48 } 47 49 }; 48 50 … … 50 52 this.cookiestate = null; 51 53 if (document.cookie) { 52 54 if (document.cookie.indexOf('dbx-' + this.sid) != -1) { 53 this.cookie = document.cookie.split('dbx-' + this.sid + '=')[1].split(' &');55 this.cookie = document.cookie.split('dbx-' + this.sid + '=')[1].split(';')[0].split('&'); 54 56 for (var i in this.cookie) { 55 57 if (typeof this.cookie[i] != 'function') { 56 this.cookie[i] = this.cookie[i].split('='); 58 this.cookie[i] = this.cookie[i].replace(/\|/g, ','); 59 this.cookie[i] = this.cookie[i].replace(/:/g, '='); 60 this.cookie[i] = this.cookie[i].split('='); 57 61 this.cookie[i][1] = this.cookie[i][1].split(','); 58 62 } 59 63 } … … 186 190 for (i=0; i<num; i++) { 187 191 var index = parseInt(dbx.cookiestate[this.gid][i], 10); 188 192 this.container.insertBefore(this.boxes[index], dummy); 189 if (this.toggles && dbx.cookiestate[this.gid][i].charAt(1) == '-') {193 if (this.toggles && /\-$/.test(dbx.cookiestate[this.gid][i])) { 190 194 this.toggleBoxState(this.buttons[index], false); 191 195 } 192 196 } … … 210 214 }, false); 211 215 document[dbx.etype](dbx.eprefix + 'mousemove', function(e) { 212 216 self.mousemove(e); 217 return !self.dragok; 213 218 }, false); 214 219 document[dbx.etype](dbx.eprefix + 'mouseup', function(e) { 215 220 self.mouseup(e);