diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2009-10-31 16:27:49 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2009-10-31 16:27:49 -0700 |
commit | 55d6e4be43225184f9a656e6d9cc8fc1e8e7387b (patch) | |
tree | c382ef957455af8a39f80789dff9b112e97c2fe6 /tools/Sandcastle/Presentation/hana/Scripts/DataStore.js | |
parent | 07a8ecbc4fc50d11179f7e0b3fadb9f2be430ae5 (diff) | |
parent | ebf5efb48cddbfaf08aec24117b7c5f9626f1c02 (diff) | |
download | DotNetOpenAuth-55d6e4be43225184f9a656e6d9cc8fc1e8e7387b.zip DotNetOpenAuth-55d6e4be43225184f9a656e6d9cc8fc1e8e7387b.tar.gz DotNetOpenAuth-55d6e4be43225184f9a656e6d9cc8fc1e8e7387b.tar.bz2 |
Merge branch 'contracts'
Diffstat (limited to 'tools/Sandcastle/Presentation/hana/Scripts/DataStore.js')
-rw-r--r-- | tools/Sandcastle/Presentation/hana/Scripts/DataStore.js | 116 |
1 files changed, 0 insertions, 116 deletions
diff --git a/tools/Sandcastle/Presentation/hana/Scripts/DataStore.js b/tools/Sandcastle/Presentation/hana/Scripts/DataStore.js deleted file mode 100644 index 12e072c..0000000 --- a/tools/Sandcastle/Presentation/hana/Scripts/DataStore.js +++ /dev/null @@ -1,116 +0,0 @@ -// cookie data store -function DataStore(name) -{ - this.name = name; - this.load(); -} - -DataStore.prototype.load = function () -{ - // create a key/value store - this.language = new Object(); - - // get cookie text - var text = getCookie(this.name); - - if (text == null) return; - - // populate the store using the cookie text - var data = text.split(';'); - - for (var i=0; i<data.length; i++) - { - var datum = data[i]; - var index = datum.indexOf('='); - - if (index > 0) - { - var key = datum.substring(0,index); - var value = datum.substring(index+1); - this.language[key] = value; - } - } - -} - -function setCookie(name, value, expires, path, domain, secure) -{ - var text = name + "=" + escape(value); - - if (expires) - { - - var currentDate = new Date(); - var expireDate = new Date( currentDate.getTime() + expires*24*60*60*1000 ); - text = text + ";expires=" + expireDate.toGMTString(); - } - if (path) text = text + ";path=" + path; - if (domain) text = text + ";domain=" + domain; - if (secure) text = text + ";secure"; - - document.cookie = text; -} - -function removeCookie(name) -{ - setCookie(name, "", -1); -} - -function getCookie(name) -{ - var text = document.cookie; - - var index = text.indexOf(name + "="); - - if (index < 0) return(null); - - var start = index + name.length + 1; - var end = text.indexOf(";", start); - - if (end < 0) end = text.length; - - var value = unescape( text.substring(start, end) ); - return(value); -} - -DataStore.prototype.set = function(key, value) -{ - this.language[key] = value; -} - -DataStore.prototype.get = function(key) -{ - return(this.language[key]); -} - -DataStore.prototype.clear = function () -{ - this.language = new Object(); -} - -DataStore.prototype.save = function () -{ - // prepare a cookie string - var text = ""; - - // construct the string - for (var key in this.language) - { - var datum = key + "=" + this.language[key]; - text = text + datum + ";"; - } - - // set it - setCookie(this.name, text); -} - -DataStore.prototype.count = function() -{ - var i = 0; - for (var key in this.data) - { - i++; - } - return(i); -} -
\ No newline at end of file |