Skip to content

Commit

Permalink
Preload iframe for some places
Browse files Browse the repository at this point in the history
  • Loading branch information
remdex committed Dec 6, 2014
1 parent 8e6aaa1 commit 44feef3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
Expand Up @@ -7,7 +7,7 @@
<?php elseif ($visitor->has_message_from_operator == true) : ?>
lh_inst.stopCheckNewMessage();
if (window.innerWidth > 1023) {
lh_inst.showStartWindow('<?php echo erLhcoreClassModelChatConfig::fetch('explicit_http_mode')->current_value?>//<?php echo $_SERVER['HTTP_HOST']?><?php echo erLhcoreClassDesign::baseurl('chat/readoperatormessage')?><?php $department !== false ? print '/(department)/'.$department : '' ?><?php $theme !== false ? print '/(theme)/'.$theme : ''?><?php $operator !== false ? print '/(operator)/'.$operator : ''?><?php $priority !== false ? print '/(priority)/'.$priority : ''?>/(vid)/<?php echo $vid;?><?php $visitor->invitation_assigned == true ? print '/(playsound)/true' : ''?>');
lh_inst.showStartWindow('<?php echo erLhcoreClassModelChatConfig::fetch('explicit_http_mode')->current_value?>//<?php echo $_SERVER['HTTP_HOST']?><?php echo erLhcoreClassDesign::baseurl('chat/readoperatormessage')?><?php $department !== false ? print '/(department)/'.$department : '' ?><?php $theme !== false ? print '/(theme)/'.$theme : ''?><?php $operator !== false ? print '/(operator)/'.$operator : ''?><?php $priority !== false ? print '/(priority)/'.$priority : ''?>/(vid)/<?php echo $vid;?><?php $visitor->invitation_assigned == true ? print '/(playsound)/true' : ''?>',true);
};
<?php endif; ?>
<?php if (isset($operation)) : ?><?php echo $operation;?><?php endif;?>
24 changes: 19 additions & 5 deletions lhc_web/design/defaulttheme/tpl/lhchat/getstatus.tpl.php
Expand Up @@ -372,7 +372,7 @@
}
})(),

showStartWindow : function(url_to_open) {
showStartWindow : function(url_to_open,delayShow) {

if (this.isOnline == false && typeof LHCChatOptions != 'undefined' && typeof LHCChatOptions.opt != 'undefined' && typeof LHCChatOptions.opt.offline_redirect != 'undefined'){
window.open(LHCChatOptions.opt.offline_redirect,"_blank");
Expand Down Expand Up @@ -419,8 +419,17 @@
var fragment = this.appendHTML(this.iframe_html);

document.body.insertBefore(fragment, document.body.childNodes[0]);

var lhc_obj = this;

if (typeof delayShow !== 'undefined') {
this.addClass(document.getElementById('lhc_container'),'lhc-delayed');
setTimeout(function(){
lhc_obj.removeClass(document.getElementById('lhc_container'),'lhc-delayed');
lhc_obj.toggleStatusWidget(true);
},900);
}

document.getElementById('lhc_close').onclick = function() { lhc_obj.hide(); return false; };
document.getElementById('lhc_min').onclick = function() { lhc_obj.min(); return false; };
<?php if (erLhcoreClassModelChatConfig::fetch('disable_popup_restore')->current_value == 0) : ?>
Expand All @@ -433,7 +442,11 @@
<?php include(erLhcoreClassDesign::designtpl('lhchat/getstatus/drag_drop_logic.tpl.php')); ?>

if (this.cookieData.m) {this.min(true);};
this.toggleStatusWidget(true);

if (typeof delayShow === 'undefined') {
this.toggleStatusWidget(true);
}

},

toggleStatusWidget : function(hide){
Expand Down Expand Up @@ -808,8 +821,9 @@

if (lh_inst.cookieData.hash) {
lh_inst.stopCheckNewMessage();
lh_inst.substatus = '_reopen';
lh_inst.showStartWindow();
lh_inst.substatus = '_reopen';
lh_inst.toggleStatusWidget(true);
lh_inst.showStartWindow(undefined,true);
}

<?php if ($check_operator_messages == 'true' && $disable_pro_active == false) : ?>
Expand Down
@@ -1,4 +1,4 @@
this.iframe_html = '<div id="lhc_container">' +
'<div id="lhc_header"><?php include(erLhcoreClassDesign::designtpl('lhchat/widget_brand/live_help.tpl.php')); ?><a href="#" title="<?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/getstatus','Close')?>" id="lhc_close"><img src="<?php echo erLhcoreClassModelChatConfig::fetch('explicit_http_mode')->current_value?>//<?php echo $_SERVER['HTTP_HOST']?><?php echo erLhcoreClassDesign::design('images/icons/cancel.png');?>" title="<?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/getstatus','Close')?>" alt="<?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/getstatus','Close')?>" /></a><?php if (erLhcoreClassModelChatConfig::fetch('disable_popup_restore')->current_value == 0) : ?>&nbsp;<a href="#" title="<?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/getstatus','Open in a new window')?>" id="lhc_remote_window"><img src="<?php echo erLhcoreClassModelChatConfig::fetch('explicit_http_mode')->current_value?>//<?php echo $_SERVER['HTTP_HOST']?><?php echo erLhcoreClassDesign::design('images/icons/application_double.png');?>" alt="<?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/getstatus','Open in a new window')?>" title="<?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/getstatus','Open in a new window')?>" /></a><?php endif; ?><a href="#" id="lhc_min" title="<?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/getstatus','Minimize/Restore')?>"></a></div>' +
this.iframe_html + '</div>';
raw_css = ".lhc-no-transition{ -webkit-transition: none !important; -moz-transition: none !important;-o-transition: none !important;-ms-transition: none !important;transition: none !important;}\n.lhc-min{height:35px !important;transition: all 0.4s!important;}\n#lhc_container * {line-height:100%;direction:<?php (erConfigClassLhConfig::getInstance()->getOverrideValue('site', 'dir_language') == 'ltr' || erConfigClassLhConfig::getInstance()->getOverrideValue('site', 'dir_language') == '') ? print 'ltr;text-align:left;' : print 'rtl;text-align:right;'; ?>;font-family:arial;font-size:12px;line-height:100%;box-sizing: content-box;-moz-box-sizing:content-box;padding:0;margin:0;}\n#lhc_container img {border:0;}\n#lhc_title{float:left;}\n#lhc_header{position:relative;z-index:9990;height:15px;overflow:hidden;text-align:right;clear:both;background-color:#<?php $theme !== false ? print $theme->header_background : print '525252' ?>;padding:5px;}\n#lhc_remote_window,#lhc_min,#lhc_close{padding:2px;float:right;}.lhc-min #lhc_min{background-image:url(<?php echo erLhcoreClassModelChatConfig::fetch('explicit_http_mode')->current_value?>//<?php echo $_SERVER['HTTP_HOST']?><?php echo erLhcoreClassDesign::design('images/icons/restore.png');?>)}#lhc_min{width:14px;height:14px;background:url(<?php echo erLhcoreClassModelChatConfig::fetch('explicit_http_mode')->current_value?>//<?php echo $_SERVER['HTTP_HOST']?><?php echo erLhcoreClassDesign::design('images/icons/min.png');?>) no-repeat center center;}\n#lhc_close:hover,#lhc_min:hover,#lhc_remote_window:hover{opacity:0.4;}\n#lhc_container {background-color:#FFF;-moz-user-select:none; -khtml-user-drag:element;cursor: move;cursor: -moz-grab;cursor: -webkit-grab;overflow:hidden;transition-property:height;transition-duration: 0.4s;-webkit-transition: height 0.4s ease-in-out;transition: height 0.4s;\nz-index:9990;\n position: fixed;<?php echo $currentPosition['position_body']?>;-webkit-box-shadow: <?php echo $currentPosition['shadow']?> rgba(50, 50, 50, 0.17);-moz-box-shadow: <?php echo $currentPosition['shadow']?> rgba(50, 50, 50, 0.17);box-shadow: <?php echo $currentPosition['shadow']?> rgba(50, 50, 50, 0.17);-webkit-border-radius: 5px;-moz-border-radius: 5px;border-radius: 5px; }\n#lhc_container iframe{display:block;transition-property: height;transition-duration: 0.4s;-webkit-transition: height 0.4s ease-in-out;transition: height 0.4s;}\n#lhc_container #lhc_iframe_container{border: 1px solid #<?php $theme !== false ? print $theme->widget_border_color : print 'cccccc' ?>;border-top: 0;border-bottom-left-radius: 5px;border-bottom-right-radius: 5px;overflow: hidden;}\n#lhc_container iframe.lhc-loading{\nbackground: #FFF url(<?php echo erLhcoreClassModelChatConfig::fetch('explicit_http_mode')->current_value?>//<?php echo $_SERVER['HTTP_HOST']?><?php echo erLhcoreClassDesign::design('images/general/loading.gif');?>) no-repeat center center; }\n@media only screen and (max-width : 640px) {#lhc_container{margin-bottom:5px;position:relative;right:0 !important;bottom:0 !important;top:0 !important}#lhc_container iframe{width:100% !important}}";
raw_css = ".lhc-no-transition{ -webkit-transition: none !important; -moz-transition: none !important;-o-transition: none !important;-ms-transition: none !important;transition: none !important;}\n.lhc-min{height:35px !important;transition: all 0.4s!important;}\n#lhc_container.lhc-delayed{visibility:hidden}\n#lhc_container * {line-height:100%;direction:<?php (erConfigClassLhConfig::getInstance()->getOverrideValue('site', 'dir_language') == 'ltr' || erConfigClassLhConfig::getInstance()->getOverrideValue('site', 'dir_language') == '') ? print 'ltr;text-align:left;' : print 'rtl;text-align:right;'; ?>;font-family:arial;font-size:12px;line-height:100%;box-sizing: content-box;-moz-box-sizing:content-box;padding:0;margin:0;}\n#lhc_container img {border:0;}\n#lhc_title{float:left;}\n#lhc_header{position:relative;z-index:9990;height:15px;overflow:hidden;text-align:right;clear:both;background-color:#<?php $theme !== false ? print $theme->header_background : print '525252' ?>;padding:5px;}\n#lhc_remote_window,#lhc_min,#lhc_close{padding:2px;float:right;}.lhc-min #lhc_min{background-image:url(<?php echo erLhcoreClassModelChatConfig::fetch('explicit_http_mode')->current_value?>//<?php echo $_SERVER['HTTP_HOST']?><?php echo erLhcoreClassDesign::design('images/icons/restore.png');?>)}#lhc_min{width:14px;height:14px;background:url(<?php echo erLhcoreClassModelChatConfig::fetch('explicit_http_mode')->current_value?>//<?php echo $_SERVER['HTTP_HOST']?><?php echo erLhcoreClassDesign::design('images/icons/min.png');?>) no-repeat center center;}\n#lhc_close:hover,#lhc_min:hover,#lhc_remote_window:hover{opacity:0.4;}\n#lhc_container {background-color:#FFF;-moz-user-select:none; -khtml-user-drag:element;cursor: move;cursor: -moz-grab;cursor: -webkit-grab;overflow:hidden;transition-property:height;transition-duration: 0.4s;-webkit-transition: height 0.4s ease-in-out;transition: height 0.4s;\nz-index:9990;\n position: fixed;<?php echo $currentPosition['position_body']?>;-webkit-box-shadow: <?php echo $currentPosition['shadow']?> rgba(50, 50, 50, 0.17);-moz-box-shadow: <?php echo $currentPosition['shadow']?> rgba(50, 50, 50, 0.17);box-shadow: <?php echo $currentPosition['shadow']?> rgba(50, 50, 50, 0.17);-webkit-border-radius: 5px;-moz-border-radius: 5px;border-radius: 5px; }\n#lhc_container iframe{display:block;transition-property: height;transition-duration: 0.4s;-webkit-transition: height 0.4s ease-in-out;transition: height 0.4s;}\n#lhc_container #lhc_iframe_container{border: 1px solid #<?php $theme !== false ? print $theme->widget_border_color : print 'cccccc' ?>;border-top: 0;border-bottom-left-radius: 5px;border-bottom-right-radius: 5px;overflow: hidden;}\n#lhc_container iframe.lhc-loading{\nbackground: #FFF url(<?php echo erLhcoreClassModelChatConfig::fetch('explicit_http_mode')->current_value?>//<?php echo $_SERVER['HTTP_HOST']?><?php echo erLhcoreClassDesign::design('images/general/loading.gif');?>) no-repeat center center; }\n@media only screen and (max-width : 640px) {#lhc_container{margin-bottom:5px;position:relative;right:0 !important;bottom:0 !important;top:0 !important}#lhc_container iframe{width:100% !important}}";

0 comments on commit 44feef3

Please sign in to comment.