|
@@ -94,28 +94,25 @@ 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', phrase: 'Chat & Video', delay: 30,
|
|
|
+ actions: {retry: {label: 'Connect', phrase: 'Chat & Video', delay: 30,
|
|
|
action: function(){
|
|
|
var msg_return; msg_return = Messenger().run({
|
|
|
- errorMessage: 'Please wait a moment while I get connected', successMessage: 'Connecting Now!',
|
|
|
+ errorMessage: 'Please wait a moment while I am notified to get connected with you', successMessage: 'Connecting Now!',
|
|
|
action: function(opts) {
|
|
|
msg.hide();
|
|
|
- i = 0
|
|
|
+ txt_dave();
|
|
|
if (++i < 2) {
|
|
|
- return opts.error({status: 500,readyState: 0,responseText: 0});
|
|
|
+ return opts.error({status: 500,readyState: 0,responseText: 0});
|
|
|
}
|
|
|
- else if (++i < 3) {
|
|
|
- // Connect with Cackbone and Twilio via webrtc app at code.davidawindham.com
|
|
|
- return opts.success();
|
|
|
- }
|
|
|
else {
|
|
|
- return msg.on();
|
|
|
+ get_dave()
|
|
|
+ return msg.update({message: 'Connecting Now... Please click the allow camera and microphone access up top', hideAfter: 10, type: 'success', actions: false});
|
|
|
+ window.location.href ="chat";
|
|
|
}
|
|
|
}
|
|
|
});
|
|
@@ -130,6 +127,42 @@ function dw_online_get_status() {
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
+
|
|
|
+
|
|
|
+ function get_dave () {
|
|
|
+ var statusElement = $("#chat");
|
|
|
+ var URLchatAPI = "http://macs.local:8080/status";
|
|
|
+ (function poll() {
|
|
|
+ var request = $.ajax({
|
|
|
+ url: URLchatAPI,
|
|
|
+ dataType: 'json',
|
|
|
+ cache: false,
|
|
|
+ success: function (data) {
|
|
|
+ online = data.online;
|
|
|
+ if(online=='yes'){
|
|
|
+ $('.chat').modal('show');
|
|
|
+ };
|
|
|
+ },
|
|
|
+ complete: setTimeout(function() {poll()}, 5000),
|
|
|
+ timeout: 2000,
|
|
|
+ error: function ( xhr, tStatus, err ) {
|
|
|
+ request.abort();
|
|
|
+ console.log('this is an error');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ })();
|
|
|
+ };
|
|
|
+
|
|
|
+ function txt_dave () {
|
|
|
+ $.ajax({
|
|
|
+ url: 'http://davidawindham.com/wha/phony/sms.php',
|
|
|
+ dataType: 'json',
|
|
|
+ success: function(data){
|
|
|
+
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
</script>
|
|
|
<?php }
|
|
|
|