|
@@ -124,8 +124,57 @@ function dw_online_get_status() {
|
|
|
if( $dw_status['daw_is_online_select_field_0'] == '1' ) {
|
|
|
wp_enqueue_style( 'message', get_template_directory_uri() . '/css/messenger.css');
|
|
|
?>
|
|
|
-<script type="text/javascript">function txt_dave(){$.ajax({url:"https://davidawindham.com/wha/phony/sms.php",dataType:"json",success:function(){}})}$(function(){var a;a=0,Messenger.options={extraClasses:"messenger-fixed messenger-on-bottom messenger-on-left",theme:"flat"};var b;b=Messenger().post({message:"I am currently online",type:"success",actions:{retry:{label:"Connect",delay:60,action:function(){txt_dave();var c;c=Messenger().run({errorMessage:"Please wait a moment while I get connected with you.",successMessage:"Connecting",action:function(c){return b.hide(),++a<2?c.error({status:500,readyState:0,responseText:0}):(window.location.href="http://chat.davidawindham.com",b.update({message:"Redirect to Chat",hideAfter:20,type:"success",actions:!1}))}})}},cancel:{label:"No Thanks",action:function(){return b.update({message:"Maybe Next Time",hideAfter:1,type:"error",actions:!1})}}}})});</script>
|
|
|
- <?php }
|
|
|
+<script type="text/javascript">
|
|
|
+ function txt_dave(){
|
|
|
+ $.ajax({
|
|
|
+ url:"https://davidawindham.com/wha/phony/sms.php",
|
|
|
+ dataType:"json",
|
|
|
+ success:function(){}})
|
|
|
+ }
|
|
|
+ $(function(){
|
|
|
+ var a;a=0,Messenger.options={extraClasses:"messenger-fixed messenger-on-bottom messenger-on-left",theme:"flat"};
|
|
|
+ var b;b=Messenger().post({
|
|
|
+ message:"I'm Currently Online",
|
|
|
+ type:'success',
|
|
|
+ actions:{
|
|
|
+ cancel:{
|
|
|
+ label:"Connect",
|
|
|
+ delay:60,
|
|
|
+ action:function(){
|
|
|
+ txt_dave();
|
|
|
+ var c;c=Messenger().run({
|
|
|
+ errorMessage:"Please wait a moment while I get connected with you.",
|
|
|
+ successMessage:"Connecting",
|
|
|
+ action:function(c){
|
|
|
+ return b.hide(),
|
|
|
+ ++a<2?c.error({
|
|
|
+ status:500,
|
|
|
+ readyState:0,
|
|
|
+ responseText:0
|
|
|
+ }):
|
|
|
+ (window.location.href="http://chat.davidawindham.com",
|
|
|
+ b.update({
|
|
|
+ message:"Redirect to Chat",
|
|
|
+ hideAfter:20,
|
|
|
+ type:"success",
|
|
|
+ actions:!1}))}})}
|
|
|
+ }
|
|
|
+ },
|
|
|
+ retry:{
|
|
|
+ label:"No Thanks",
|
|
|
+ action:function(){
|
|
|
+ return b.update({
|
|
|
+ message:"Maybe Next Time",
|
|
|
+ hideAfter:1,
|
|
|
+ type:"error",
|
|
|
+ actions:!1
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ });
|
|
|
+</script>
|
|
|
+<?php }
|
|
|
}
|
|
|
|
|
|
function dw_online_get_chat() {
|
|
@@ -133,7 +182,12 @@ function dw_online_get_chat() {
|
|
|
if( $dw_status['daw_is_online_select_field_0'] == '1' ) { ?>
|
|
|
<script type="text/javascript">
|
|
|
Messenger.options = {extraClasses: "messenger-fixed messenger-on-bottom messenger-on-left",theme: "flat"};var i;i = 0;
|
|
|
- $(function(){var msg_return; msg_return = Messenger().run({id: 'one',errorMessage: 'Looking for David...', action: function(opts) {if (++i < 2) {get_dave();return opts.error({status: 500,readyState: 0,responseText: 0});}}});});
|
|
|
+ $(function(){
|
|
|
+ var msg_return;
|
|
|
+ msg_return = Messenger().run({
|
|
|
+ id: 'one',
|
|
|
+ errorMessage: 'Looking for David...',
|
|
|
+ action: function(opts) {if (++i < 2) {get_dave();return opts.error({status: 500,readyState: 0,responseText: 0});}}});});
|
|
|
function get_dave() {$(function poll() {var x = 0; var countTimer = setInterval(function () {if(x > 5){clearInterval(countTimer)}else if(x == 5){dave_not_available()}else{var URLchatAPI = "http://code.davidawindham.com:8080/status";var request = $.ajax({url: URLchatAPI,dataType: 'json',cache: false, success: function (data) {online = data.online;if(online=='yes') {$('.chat').modal('show');x = x+5;};if (online=='no') {dave_connecting();};},error: function ( xhr, tStatus, err ) {dave_error();x = x+5;}});x++;}}, 5000);});}
|
|
|
function dave_connecting(){var y;y = 0;var msg_waiting; msg_waiting = Messenger().run({id: 'one',hideAfter: 4,errorMessage: 'Waiting on David...',action: function(opts) {if (++y < 2) {get_dave();return opts.error({status: 500,readyState: 0,responseText: 0});}}});}
|
|
|
function dave_not_available(){var msg_error; msg_error = Messenger().post({message: 'Sorry, but I am busy.',type: 'error',id: 'one',showCloseButton: true,actions:{cancel: {label: 'Leave me a message',action: function(){window.location.href = '../';}}}});}
|