windhamdavid 10 years ago
parent
commit
833367d715
4 changed files with 59 additions and 205 deletions
  1. 1 2
      gruntfile.js
  2. 8 147
      inc/tweaks.php
  3. 50 56
      js/chat_func.js
  4. 0 0
      js/chat_func.min.js

+ 1 - 2
gruntfile.js

@@ -53,8 +53,7 @@ module.exports = function(grunt) {
 				'js/init-o.min.js': ['js/init-o.js'],
 				'js/init.min.js': ['js/init.js'],
 				'js/front.min.js' : ['js/front-page.min.js'], 
-				'js/chat.min.js' : ['js/chat.js'],
-				'js/chat_func.min.js' : ['js/chat_func.js'],  
+				'js/chat.min.js' : ['js/chat.js'], 
 		      }
 		    }
 		  }

+ 8 - 147
inc/tweaks.php

@@ -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 }
 }

+ 50 - 56
js/chat_func.js

@@ -1,8 +1,51 @@
-/*! Chat Page Stuff */
+/*! Front Page */
+$(function() {
+	var i;i = 0;
+	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){},
+	});
+}
+
+/*! Chat Page */
 
+Messenger.options = {extraClasses: "messenger-fixed messenger-on-bottom messenger-on-left",theme: "flat"};
 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...', 
@@ -29,11 +72,11 @@ function get_dave() {
 					cache: false, 
 					success: function (data) {
 						online = data.online;
-						if(online=='yes'){
+						if (online=='yes') {
 							$('.chat').modal('show');
 							x = x+5;
 						};
-						if(online=='no'){
+						if (online=='no') {
 							dave_connecting();
 						};
 					},
@@ -51,7 +94,6 @@ function get_dave() {
 }
 
 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',
@@ -67,7 +109,6 @@ function dave_connecting(){
 }		
 
 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',
@@ -75,7 +116,7 @@ function dave_not_available(){
 		showCloseButton: true,
 		actions:{
 			cancel: {
-				label: '<a href="../">Leave me a message</a>',
+				label: 'Leave me a message',
 				action: function(){
 					window.location.href = '../';	
 				}
@@ -85,7 +126,6 @@ function dave_not_available(){
 }
 
 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',
@@ -93,7 +133,7 @@ function dave_error(){
 		showCloseButton: true,
 		actions:{
 			cancel: {
-				label: '<a href="../">Leave me a message</a>',
+				label: 'Leave me a message',
 				action: function(){
 					window.location.href = '../';	
 				}
@@ -105,50 +145,4 @@ $(function() {
     if (window.location.hash.indexOf("chat") !== -1) {
         $('.chat').modal('show');
     }
-});
-
-
-
-/*! Front Page Stuff */
-
-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){},
-	});
-}
+});

File diff suppressed because it is too large
+ 0 - 0
js/chat_func.min.js


Some files were not shown because too many files changed in this diff