summaryrefslogtreecommitdiff
path: root/rt/share/static/js/titlebox-state.js
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2015-07-26 15:41:26 -0700
committerIvan Kohler <ivan@freeside.biz>2015-07-26 15:41:26 -0700
commit9aee669886202be7035e6c6049fc71bc99dd3013 (patch)
tree2fd5bf6de74f3d99270587ffb1833e4188a6373d /rt/share/static/js/titlebox-state.js
parentac20214d38d9af00430423f147b5a0e50751b050 (diff)
parent1add633372bdca3cc7163c2ce48363fed3984437 (diff)
Merge branch 'master' of git.freeside.biz:/home/git/freeside
Diffstat (limited to 'rt/share/static/js/titlebox-state.js')
-rw-r--r--rt/share/static/js/titlebox-state.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/rt/share/static/js/titlebox-state.js b/rt/share/static/js/titlebox-state.js
new file mode 100644
index 000000000..d4053390b
--- /dev/null
+++ b/rt/share/static/js/titlebox-state.js
@@ -0,0 +1,36 @@
+function createCookie(name,value,days) {
+ var path = RT.Config.WebPath ? RT.Config.WebPath : "/";
+
+ if (days) {
+ var date = new Date();
+ date.setTime(date.getTime()+(days*24*60*60*1000));
+ var expires = "; expires="+date.toGMTString();
+ }
+ else
+ expires = "";
+
+ document.cookie = name+"="+value+expires+"; path="+path;
+}
+
+function loadTitleBoxStates() {
+ var cookies = document.cookie.split(/;\s*/);
+ var len = cookies.length;
+
+ for (var i = 0; i < len; i++) {
+ var c = cookies[i].split('=');
+
+ if (c[0].match(/^TitleBox--/)) {
+ var e = document.getElementById(c[0]);
+ if (e) {
+ var e2 = e.parentNode;
+
+ if (c[1] != 0) {
+ set_rollup_state(e,e2,'shown');
+ }
+ else {
+ set_rollup_state(e,e2,'hidden');
+ }
+ }
+ }
+ }
+}