|
@@ -94,47 +94,7 @@ function dw_online_get_status() {
|
|
|
$dw_status = get_option('daw_is_online_settings');
|
|
|
if( $dw_status['daw_is_online_select_field_0'] == '1' ) { ?>
|
|
|
<script type="text/javascript">
|
|
|
- var i;i = 0;
|
|
|
- $(function(){
|
|
|
- Messenger.options = {extraClasses: "messenger-fixed messenger-on-bottom messenger-on-left",theme: "flat"};
|
|
|
- var msg; msg = Messenger().post({
|
|
|
- message: 'I am currently online', type: 'success',
|
|
|
- actions: {retry: {label: 'Connect', delay: 30,
|
|
|
- action: function(){
|
|
|
- txt_dave();
|
|
|
- var msg_return; msg_return = Messenger().run({
|
|
|
- errorMessage: 'Please wait a moment while I am texted a message to get connected with you.',
|
|
|
- successMessage: 'Connecting Now!',
|
|
|
- action: function(opts) {
|
|
|
- msg.hide();
|
|
|
- if (++i < 2) {
|
|
|
- return opts.error({status: 500,readyState: 0,responseText: 0});
|
|
|
- }
|
|
|
- else {
|
|
|
- window.location.href = 'contact/chat';
|
|
|
- return msg.update({message: 'Redirect to Chat', hideAfter: 20, type: 'success', actions: false});
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- },
|
|
|
- cancel: {
|
|
|
- label: 'No Thanks',
|
|
|
- action: function() {
|
|
|
- return msg.update({message: 'Maybe Next Time', hideAfter: 1, type: 'error', actions: false});
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
- function txt_dave() {
|
|
|
- $.ajax({
|
|
|
- url: 'https://davidawindham.com/wha/phony/sms',
|
|
|
- dataType: 'json',
|
|
|
- success: function(data){},
|
|
|
- });
|
|
|
- }
|
|
|
+ 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:30,action:function(){txt_dave();var c;c=Messenger().run({errorMessage:"Please wait a moment while I get connected with you.",successMessage:"Connecting Now!",action:function(c){return b.hide(),++a<2?c.error({status:500,readyState:0,responseText:0}):(window.location.href="http://davidawindham.com/contact/chat",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 }
|
|
|
}
|
|
@@ -143,112 +103,13 @@ function dw_online_get_chat() {
|
|
|
$dw_status = get_option('daw_is_online_settings');
|
|
|
if( $dw_status['daw_is_online_select_field_0'] == '1' ) { ?>
|
|
|
<script type="text/javascript">
|
|
|
- var i;i = 0;
|
|
|
- $(function(){
|
|
|
- Messenger.options = {extraClasses: "messenger-fixed messenger-on-bottom messenger-on-left",theme: "flat"};
|
|
|
- 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://macs.local: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(){
|
|
|
- Messenger.options = {extraClasses: "messenger-fixed messenger-on-bottom messenger-on-left",theme: "flat"};
|
|
|
- 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(){
|
|
|
- Messenger.options = {extraClasses: "messenger-fixed messenger-on-bottom messenger-on-left",theme: "flat"};
|
|
|
- var msg_error; msg_error = Messenger().post({
|
|
|
- message: 'Sorry, but I am busy.',
|
|
|
- type: 'error',
|
|
|
- id: 'one',
|
|
|
- showCloseButton: true,
|
|
|
- actions:{
|
|
|
- cancel: {
|
|
|
- label: '<a href="../">Leave me a message</a>',
|
|
|
- action: function(){
|
|
|
- window.location.href = '../';
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- function dave_error(){
|
|
|
- Messenger.options = {extraClasses: "messenger-fixed messenger-on-bottom messenger-on-left",theme: "flat"};
|
|
|
- var msg_error; msg_error = Messenger().post({
|
|
|
- message: 'Oops. Something has gone wrong.',
|
|
|
- type: 'error',
|
|
|
- id: 'one',
|
|
|
- showCloseButton: true,
|
|
|
- actions:{
|
|
|
- cancel: {
|
|
|
- label: '<a href="../">Leave me a message</a>',
|
|
|
- action: function(){
|
|
|
- window.location.href = '../';
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- $(function() {
|
|
|
- if (window.location.hash.indexOf("chat") !== -1) {
|
|
|
- $('.chat').modal('show');
|
|
|
- }
|
|
|
- });
|
|
|
+ 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 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://macs.local: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 = '../';}}}});}
|
|
|
+ function dave_error(){var msg_error; msg_error = Messenger().post({message: 'Oops. Something has gone wrong.',type: 'error',id: 'one',showCloseButton: true,actions:{cancel: {label: 'Leave me a message',action: function(){window.location.href = '../';}}}});}
|
|
|
+ $(function() {if (window.location.hash.indexOf("chat") !== -1) {$('.chat').modal('show');}});
|
|
|
</script>
|
|
|
<?php }
|
|
|
}
|