Skip to content
This repository has been archived by the owner. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Support for staying in webapp
  • Loading branch information
briandunnigan authored and briandunnigan committed Jan 28, 2016
1 parent 2ea83c5 commit 47bf981
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 6 deletions.
8 changes: 7 additions & 1 deletion functions.php
Expand Up @@ -6,6 +6,11 @@ function theme_enqueue_styles() {
wp_enqueue_script( 'sis-js', get_stylesheet_directory_uri() . '/sistertalk.js', array( 'cs' ));
}

function enqueue_mobile_js(){
wp_enqueue_script( 'sis-mobile-js', get_stylesheet_directory_uri() . '/sistertalk-mobile.js');
}
add_action( 'init', 'enqueue_mobile_js', 0 );

function show_people(){
if ( !is_plugin_active('uc-people/uc-people.php') ) {
activate_plugin('uc-people/uc-people.php');
Expand Down Expand Up @@ -54,6 +59,7 @@ function addToHead() {
<link rel="apple-touch-icon-precomposed" href="'. get_stylesheet_directory_uri() .'/57.png">
<link rel="shortcut icon" href="'. get_stylesheet_directory_uri() .'/img/144.png">
<link rel="manifest" href="'. get_stylesheet_directory_uri() .'/manifest.json">';
}

}

?>
Binary file added img/loading.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions sistertalk-mobile.js
@@ -0,0 +1,21 @@
(function(document,navigator,standalone) {
// prevents links from apps from oppening in mobile safari
// this javascript must be the first script in your <head>
if ((standalone in navigator) && navigator[standalone]) {
var curnode, location=document.location, stop=/^(a|html)$/i;
document.addEventListener('click', function(e) {
curnode=e.target;
while (!(stop).test(curnode.nodeName)) {
curnode=curnode.parentNode;
}
// Conditions to do this only on links to your own app
// if you want all links, use if('href' in curnode) instead.
if('href' in curnode && ( curnode.href.indexOf('http') || ~curnode.href.indexOf(location.host) ) ) {
e.preventDefault();
location.href = curnode.href;
}
},false);
}
})(document,window.navigator,'standalone');


8 changes: 3 additions & 5 deletions sistertalk.js
Expand Up @@ -30,7 +30,8 @@ jQuery(document).ready(function($) {
var id = $(this).attr('id');
writeToLocal(id, this.value);
});
$('.gform_button').after('<div class="alert alert-success" role="alert"><strong>Answers saved.</strong><br /> You may now continue on to the next section or close this window.</div>');
$('.gform_button').after('<div class="alert alert-success save-msg" role="alert"><strong>Answers saved.</strong><br /> You may now continue on to the next section or close this window.</div>');
setTimeout(function(){$('.save-msg').fadeOut(200, function() { $(this).remove(); });}, 5000);
}
function loadAnswersFromLocal(){
$('.gform_wrapper input').each(function(index, element) {
Expand Down Expand Up @@ -63,9 +64,8 @@ jQuery(document).ready(function($) {







// on submit...

// for each input...
Expand All @@ -80,8 +80,6 @@ jQuery(document).ready(function($) {





/*
*
* debugging only
Expand Down

0 comments on commit 47bf981

Please sign in to comment.