Skip to content

Commit 924f360

Browse files
committed
Allow override typing name
1 parent e1f9ae2 commit 924f360

3 files changed

Lines changed: 10 additions & 5 deletions

File tree

nodejshelper/design/nodejshelpertheme/js/customjs.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,9 +363,13 @@
363363
},
364364

365365
initTypingMonitoringAdminInform : function(data) {
366-
if (nodejshelper.isConnected == true) {
367-
data.msg = nodejshelperConfig.typer;
368-
nodejshelper.socket.emit('operatortyping',{chat_data:data,instance_id:nodejshelperConfig.instance_id});
366+
if (nodejshelper.isConnected == true) {
367+
if (typeof nodejshelperConfig.typer === "string"){
368+
data.msg = nodejshelperConfig.typer;
369+
nodejshelper.socket.emit('operatortyping',{chat_data:data,instance_id:nodejshelperConfig.instance_id});
370+
} else if (typeof nodejshelperConfig.typer === "function") {
371+
nodejshelperConfig.typer(data, nodejshelper);
372+
};
369373
}
370374
},
371375

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
var nodejshelperHostConnect = '<?php echo $nodeJsHelperSettings['host']?><?php echo $nodeJsHelperSettings['port']?>';
2-
var nodejshelperConfig = {online_timeout:<?php echo (int)erLhcoreClassModelChatConfig::fetch('sync_sound_settings')->data['online_timeout']?>,use_publish_notifications:<?php echo $nodeJsHelperSettings['use_publish_notifications'] == true ? 'true' : 'false'?>,path:'<?php echo $nodeJsHelperSettings['path']?>',is_admin:<?php echo erLhcoreClassSystem::instance()->SiteAccess == 'site_admin' ? 'true' : 'false'?>,instance_id:'<?php echo $nodeJsHelperSettings['instance_id']?>',secure:<?php echo $nodeJsHelperSettings['secure'] == true ? 'true' : 'false' ?>,'typer':'','sync':<?php echo (isset($Result['chat']) && $Result['chat']->status == erLhcoreClassModelChat::STATUS_PENDING_CHAT) ? 'true' : 'false'?>,'synctimeout':5};
2+
var nodejshelperConfig = nodejshelperConfig || {};
3+
nodejshelperConfig = $.extend(nodejshelperConfig,{online_timeout:<?php echo (int)erLhcoreClassModelChatConfig::fetch('sync_sound_settings')->data['online_timeout']?>,use_publish_notifications:<?php echo $nodeJsHelperSettings['use_publish_notifications'] == true ? 'true' : 'false'?>,path:'<?php echo $nodeJsHelperSettings['path']?>',is_admin:<?php echo erLhcoreClassSystem::instance()->SiteAccess == 'site_admin' ? 'true' : 'false'?>,instance_id:'<?php echo $nodeJsHelperSettings['instance_id']?>',secure:<?php echo $nodeJsHelperSettings['secure'] == true ? 'true' : 'false' ?>,'sync':<?php echo (isset($Result['chat']) && $Result['chat']->status == erLhcoreClassModelChat::STATUS_PENDING_CHAT) ? 'true' : 'false'?>,'synctimeout':5});

nodejshelper/design/nodejshelpertheme/tpl/pagelayouts/parts/page_head_js_extension_multiinclude.tpl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<?php if (erLhcoreClassSystem::instance()->SiteAccess == 'site_admin' && erLhcoreClassUser::instance()->isLogged()) :
66
$currentUser = erLhcoreClassUser::instance();
77
$userData = $currentUser->getUserData(true); ?>
8-
nodejshelperConfig.typer = '<?php echo htmlspecialchars($userData->name_support,ENT_QUOTES);?> <?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chat','is typing now...')?>';
8+
nodejshelperConfig.typer = typeof nodejshelperConfig.typer !== 'undefined' ? nodejshelperConfig.typer : '<?php echo htmlspecialchars($userData->name_support,ENT_QUOTES);?> <?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chat','is typing now...')?>';
99
<?php endif;?>
1010
</script>
1111
<?php if ($nodeJsHelperSettings['use_cdn'] == true) : ?>

0 commit comments

Comments
 (0)