Skip to content

Commit

Permalink
refix #541
Browse files Browse the repository at this point in the history
  • Loading branch information
remdex committed Nov 11, 2014
1 parent 71c8edb commit dd152ff
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
27 changes: 25 additions & 2 deletions lhc_web/design/defaulttheme/tpl/lhchat/getstatus.tpl.php
Expand Up @@ -524,13 +524,36 @@
}, <?php echo (int)(erLhcoreClassModelChatConfig::fetch('sync_sound_settings')->data['check_for_operator_msg']*1000); ?> );
},

getTzOffset : function(){
Date.prototype.stdTimezoneOffset = function() {
var jan = new Date(this.getFullYear(), 0, 1);
var jul = new Date(this.getFullYear(), 6, 1);
return Math.max(jan.getTimezoneOffset(), jul.getTimezoneOffset());
}

Date.prototype.dst = function() {
return this.getTimezoneOffset() < this.stdTimezoneOffset();
}

var today = new Date();
var timeZoneOffset = 0;

if (today.dst()) {
timeZoneOffset = today.getTimezoneOffset();
} else {
timeZoneOffset = today.getTimezoneOffset()-60;
}

return (timeZoneOffset/60)*-1;
},

startNewMessageCheckSingle : function() {
var vid = this.cookieDataPers.vid;
lh_inst.removeById('lhc_operator_message');
var th = document.getElementsByTagName('head')[0];
var s = document.createElement('script');
var locationCurrent = encodeURIComponent(window.location.href.substring(window.location.protocol.length));
var tzOffset = ((new Date().getTimezoneOffset())/60) * -1;
var tzOffset = this.getTzOffset();

s.setAttribute('id','lhc_operator_message');
s.setAttribute('type','text/javascript');
Expand All @@ -543,7 +566,7 @@
var th = document.getElementsByTagName('head')[0];
var s = document.createElement('script');
var locationCurrent = encodeURIComponent(window.location.href.substring(window.location.protocol.length));
var tzOffset = ((new Date().getTimezoneOffset())/60) * -1;
var tzOffset = this.getTzOffset();
s.setAttribute('id','lhc_log_pageview');
s.setAttribute('type','text/javascript');
s.setAttribute('src','<?php echo erLhcoreClassModelChatConfig::fetch('explicit_http_mode')->current_value?>//<?php echo $_SERVER['HTTP_HOST']?><?php echo erLhcoreClassDesign::baseurlsite()?>'+this.lang+'/chat/logpageview<?php $department !== false ? print '/(department)/'.$department : ''?><?php $identifier !== false ? print '/(identifier)/'.htmlspecialchars($identifier) : ''?>/(tz)/'+tzOffset+'/(vid)/'+vid+'?l='+locationCurrent+this.parseStorageArguments()+this.parseOptionsOnline()+'&dt='+encodeURIComponent(document.title));
Expand Down
Expand Up @@ -18,7 +18,7 @@
if (today.dst()) {
timeZoneOffset = today.getTimezoneOffset();
} else {
timeZoneOffset = today.getTimezoneOffset()+3600;
timeZoneOffset = today.getTimezoneOffset()-60;
}
$('input[name=user_timezone]').val(((timeZoneOffset)/60) * -1);
Expand Down

0 comments on commit dd152ff

Please sign in to comment.