Changeset 2233


Ignore:
Timestamp:
09/21/11 13:24:50 (8 months ago)
Author:
sam
Message:

debug local store

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.3-dev/model/sources/academic/gen/_web/widg/tpl/tplMgr.doss/tplMgr.js

    r2213 r2233  
    261261} 
    262262 
    263 // Local Storage API (localStorage/userData/cookie) 
     263/** Local Storage API (localStorage/userData/cookie) */ 
    264264function LocalStore(pId){ 
    265265        if (pId && !/^[a-z][a-z0-9]+$/.exec(pId)) throw new Error("Invalid store name"); 
     
    267267        this.fRootKey = document.location.pathname.substring(0,document.location.pathname.lastIndexOf("/")) +"/"; 
    268268        if ("localStorage" in window) { 
    269                 this.get = function(pKey) {return unescape(localStorage.getItem(this.fRootKey+this.xKey(pKey)))}; 
     269                this.get = function(pKey) {var vRet = localStorage.getItem(this.fRootKey+this.xKey(pKey));return (typeof vRet == "string" ? unescape(vRet) : null)}; 
    270270                this.set = function(pKey, pVal) {localStorage.setItem(this.fRootKey+this.xKey(pKey), escape(pVal))}; 
    271271        } else if (window.ActiveXObject){ 
     
    279279                document.body.appendChild(this.fIE); 
    280280        } else { 
    281                 this.get = function(pKey){var vReg=new RegExp(this.xKey(pKey)+"=([^;]*)");var vArr=vReg.exec(document.cookie);if(vArr && vArr.length==2) return(unescape(vArr[1]));else return ""}; 
     281                this.get = function(pKey){var vReg=new RegExp(this.xKey(pKey)+"=([^;]*)");var vArr=vReg.exec(document.cookie);if(vArr && vArr.length==2) return(unescape(vArr[1]));else return null}; 
    282282                this.set = function(pKey,pVal){document.cookie = this.xKey(pKey)+"="+escape(pVal)}; 
    283283        } 
Note: See TracChangeset for help on using the changeset viewer.