diff options
author | AlexKlimenkov <shurick.klimenkov@gmail.com> | 2014-06-10 20:50:30 +0300 |
---|---|---|
committer | AlexKlimenkov <shurick.klimenkov@gmail.com> | 2014-06-10 20:50:30 +0300 |
commit | b5a0589955460a44c5428c4cb5429fcfce265d23 (patch) | |
tree | 87db58400a3e036de646fb630cbb358beeac3bc1 /codebase/sources/ext/dhtmlxscheduler_cookie.js | |
parent | e2aaaef8540fabd0b5200a4959c269d6f1ae352e (diff) | |
download | scheduler-b5a0589955460a44c5428c4cb5429fcfce265d23.zip scheduler-b5a0589955460a44c5428c4cb5429fcfce265d23.tar.gz scheduler-b5a0589955460a44c5428c4cb5429fcfce265d23.tar.bz2 |
[update] version 4.1.0
Diffstat (limited to 'codebase/sources/ext/dhtmlxscheduler_cookie.js')
-rw-r--r-- | codebase/sources/ext/dhtmlxscheduler_cookie.js | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/codebase/sources/ext/dhtmlxscheduler_cookie.js b/codebase/sources/ext/dhtmlxscheduler_cookie.js new file mode 100644 index 0000000..4420e2b --- /dev/null +++ b/codebase/sources/ext/dhtmlxscheduler_cookie.js @@ -0,0 +1,73 @@ +/* +dhtmlxScheduler v.4.1.0 Stardard + +This software is covered by GPL license. You also can obtain Commercial or Enterprise license to use it in non-GPL project - please contact sales@dhtmlx.com. Usage without proper license is prohibited. + +(c) Dinamenta, UAB. +*/ +(function(){ + function setCookie(name,cookie_param,value) { + var str = name + "=" + value + (cookie_param?("; "+cookie_param):""); + document.cookie = str; + } + function getCookie(name) { + var search = name + "="; + if (document.cookie.length > 0) { + var offset = document.cookie.indexOf(search); + if (offset != -1) { + offset += search.length; + var end = document.cookie.indexOf(";", offset); + if (end == -1) + end = document.cookie.length; + return document.cookie.substring(offset, end); + } + } + return ""; + } + var first = true; + scheduler.attachEvent("onBeforeViewChange",function(om,od,m,d){ + if (first){ + first = false; + + + + var data=getCookie("scheduler_settings"); + if (data){ + + if(!scheduler._min_date){ + //otherwise scheduler will have incorrect date until timeout + //it can cause js error with 'onMouseMove' handler of key_nav.js + scheduler._min_date = d; + } + + data = unescape(data).split("@"); + data[0] = this.templates.xml_date(data[0]); + var view = this.isViewExists(data[1]) ? data[1] : m, + date = !isNaN(+data[0]) ? data[0] : d; + + window.setTimeout(function(){ + scheduler.setCurrentView(date,view); + },1); + return false; + } + } + var text = escape(this.templates.xml_format(d||od)+"@"+(m||om)); + setCookie("scheduler_settings","expires=Sun, 31 Jan 9999 22:00:00 GMT",text); + return true; + }); + + + // As we are blocking first render above there could be a problem in case of dynamic loading ('from' won't be defined) + var old_load = scheduler._load; + scheduler._load = function() { + var args = arguments; + if (!scheduler._date && scheduler._load_mode) { + var that = this; + window.setTimeout(function() { + old_load.apply(that, args); + },1); + } else { + old_load.apply(this, args); + } + }; +})();
\ No newline at end of file |