Update the cam images
authorSteve Sutton <steve@gaslightmedia.com>
Wed, 6 Sep 2017 19:18:24 +0000 (15:18 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Wed, 6 Sep 2017 19:19:11 +0000 (15:19 -0400)
Use time instead of random number.

functions.php
js/app.js
js/custom/pageSetup.js

index 4db978d..94f1f21 100644 (file)
@@ -25,7 +25,7 @@ if (!function_exists('glm_quicksite_widget_init')) {
             'id'          => 'slideshow',
             'description' => __('Meta Slider/Slideshow Area')
         ));
-        
+
     }
 
 }
@@ -72,9 +72,9 @@ function woo_product_tab_edits( $tabs ) {
     );
     $tabs['description']['title'] = __('Details');
     unset( $tabs[ 'reviews' ]);
-    
+
     unset( $tabs[ 'additional_information' ]);
-//    
+//
     $tabs[ 'photos_tab' ][ 'priority' ] = 5;
     $tabs[ 'description' ][ 'priority' ] = 10;
     $tabs[ 'itinerary_tab' ][ 'priority' ] = 20;
@@ -82,7 +82,7 @@ function woo_product_tab_edits( $tabs ) {
     $tabs[ 'product_inquiry_tab' ][ 'priority' ] = 40;
 
     return $tabs;
-    
+
 }
 
 function woo_product_inquiry_content() {
@@ -97,27 +97,27 @@ function woo_itinerary_content() {
 
 function woo_photos_content() {
     global $product;
-    
+
     $attachment_ids = $product->get_gallery_attachment_ids();
     echo "<ul class='product_gallery_images'>";
-    foreach( $attachment_ids as $attachment_id ) 
-    {   
+    foreach( $attachment_ids as $attachment_id )
+    {
         $full_url = wp_get_attachment_image_src( $attachment_id, 'full' )[0];
-        
+
         echo '<li class="products_image_container">
             <a class="product_image_link" rel="gallery1" href="' . $full_url .'" style="background: url('.$full_url.')no-repeat center center;background-size: cover;">
-          
+
             </a>
-        </li>';   
+        </li>';
     }
     echo "</ul>";
 }
 
 add_filter( 'gform_field_value_product_name', 'gform_add_product_name_field' );
 function gform_add_product_name_field( $value ) {
-    
+
     global $product, $post, $woocommerce;
-    
+
     if ( ! empty($_GET) && isset($_GET)){
         $title = $_GET['title'];
     } else {
@@ -136,7 +136,7 @@ function gform_add_product_name_field( $value ) {
 add_filter( 'gform_field_value_product_sku', 'gform_add_product_sku_field' );
 function gform_add_product_sku_field( $value ) {
     global $product, $post, $woocommerce;
-    
+
     if ( ! empty($_GET) && isset($_GET)){
         $sku = $_GET['sku'];
     } else {
@@ -168,7 +168,7 @@ remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_r
 add_action('woocommerce_after_shop_loop_item_title','woocommerce_template_single_excerpt', 5);
 
 function shareThis(){
-    echo '<span class="st_sharethis" st_title="'. get_the_title().'" st_url="'. get_the_permalink() .'"></span>';   
+    echo '<span class="st_sharethis" st_title="'. get_the_title().'" st_url="'. get_the_permalink() .'"></span>';
 }
 add_action( 'woocommerce_single_product_summary', 'shareThis', 20);
 
@@ -198,7 +198,7 @@ function glm_site_scripts()
         'glm_foundation',
         get_template_directory_uri() . '/js/app.js',
         'jquery',
-        '1.0',
+        '1.1',
         true
     );
     wp_enqueue_style('jquery-style', '//ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css');
@@ -227,10 +227,10 @@ function glm_get_header() {
     }
     echo '<div class="header-image-background"';
     if ( has_post_thumbnail($post_id) && is_post_type('page')) {
-        
+
             $image_data = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), "full");
             echo ' style="background-image: url('.$image_data[0].');padding:0 0 25%;background-position:  center center;background-repeat:no-repeat;max-height: 300px;background-size: cover;margin: 0 auto; "';
-        
+
     } else {
             echo ' style="background-image: url('.get_template_directory_uri().'/assets/DI-00889-132-1-3600x1800.jpg);padding:0 0 25%;background-position:  center center;background-repeat:no-repeat;max-height: 300px;background-size: cover;margin: 0 auto; "';
             echo ' class="no-featured"';
@@ -322,14 +322,14 @@ add_action( 'gform_after_submission', 'set_post_content', 10, 2 );
 function set_post_content( $entry, $form ) {
 //    echo '<pre>', print_r($entry), '</pre>';
     if($form['id'] === 4){
-        
+
         if ( $entry['36.3'] > 1){
             $qty = $entry['36.3'] - 1;
             $qty = ($qty * 2) + 3;
             $entry['38.2'] = '$' . $qty;
             $entry['38.2'] = 2;
         }
-        
+
     }
 
     if ( $form['gfpdf_form_settings'] ){
@@ -359,19 +359,19 @@ function change_post_content( $form ) {
         'input_16_2'=>'input_16_3'
     );
     foreach($fields as $key=>$value){
-        
+
         $prod_quantity = $_POST[$value];
-        
+
         if( $prod_quantity ){
             $populated_fields[$key] = array('price'=>$_POST[$key], 'qty'=>$_POST[$value]);
-        } 
+        }
     }
     // loop through the populated fields to calc the qty
     $quantity = 0;
 //    foreach($populated_fields as $price=>$info){
 //        $quantity += $info['qty'];
 //    }
-//    
+//
 //    // logic to determine the discount rate, every 4 gets $10 off
 //    if($quantity % 4 === 0){
 //       $discount_qty = $quantity / 4;
@@ -382,24 +382,24 @@ function change_post_content( $form ) {
 //       $discount_qty = floor($quantity / 4);
 //       $discount_price = $discount_qty * 10;
 //       $price_total = ($quantity * 10) - $discount_price;
-//     
+//
 //    } else if( $quantity < 4){
 //       $price_total = $quantity * 10;
 //    }
-//    
+//
 //    $new_price = $price_total / $quantity;
-//    
+//
 //    // set the newly calulated price for pdf form
 //    foreach($populated_fields as $price=>$info){
 //        $_POST[$price] = $new_price;
 //    }
-    
+
 }
 add_action( 'gfpdf_post_html_fields', function( $entry, $config ) {
         if($entry['form_id'] === '2'){
             echo "<div class='gf_right_half' style='font-weight: bold;width: 200px;margin-right: 74px;color: black;'> DISCOUNTED TOTAL: " . $entry['20'] . "</div>";
         }
-       
-    
+
+
 }, 10, 2 );
-?>
\ No newline at end of file
+?>
index 199f05d..cece319 100644 (file)
--- a/js/app.js
+++ b/js/app.js
@@ -47,10 +47,11 @@ $(document).ready(function () {
         }
     });
     setInterval(function(){
-        $('#cam1').attr('src','http://cams.gaslightmedia.com/cameras/images/MacBridge_image2_large.jpg?b=' + Math.random());
-        $('#cam2').attr('src','http://cams.gaslightmedia.com/cameras/images/MacBridge_image1_medium.jpg?b=' + Math.random());
-        $('#cam3').attr('src','http://cams.gaslightmedia.com/cameras/images/MacBridge_image3_medium.jpg?b=' + Math.random());
-        $('#cam4').attr('src','http://cams.gaslightmedia.com/cameras/images/MacBridge_image4_medium.jpg?b=' + Math.random());
+        var d = new Date();
+        $('#cam1').attr('src','http://cams.gaslightmedia.com/cameras/images/MacBridge_image2_large.jpg?b=' + d.getTime());
+        $('#cam2').attr('src','http://cams.gaslightmedia.com/cameras/images/MacBridge_image1_medium.jpg?b=' + d.getTime());
+        $('#cam3').attr('src','http://cams.gaslightmedia.com/cameras/images/MacBridge_image3_medium.jpg?b=' + d.getTime());
+        $('#cam4').attr('src','http://cams.gaslightmedia.com/cameras/images/MacBridge_image4_medium.jpg?b=' + d.getTime());
     }, 60000);
 
     var pdf_form = page.find( $(".pdf-form") );
index 38f2715..5788632 100644 (file)
@@ -38,10 +38,11 @@ $(document).ready(function () {
         }
     });
     setInterval(function(){
-        $('#cam1').attr('src','http://cams.gaslightmedia.com/cameras/images/MacBridge_image2_large.jpg?b=' + Math.random());
-        $('#cam2').attr('src','http://cams.gaslightmedia.com/cameras/images/MacBridge_image1_medium.jpg?b=' + Math.random());
-        $('#cam3').attr('src','http://cams.gaslightmedia.com/cameras/images/MacBridge_image3_medium.jpg?b=' + Math.random());
-        $('#cam4').attr('src','http://cams.gaslightmedia.com/cameras/images/MacBridge_image4_medium.jpg?b=' + Math.random());
+        var d = new Date();
+        $('#cam1').attr('src','http://cams.gaslightmedia.com/cameras/images/MacBridge_image2_large.jpg?b=' + d.getTime());
+        $('#cam2').attr('src','http://cams.gaslightmedia.com/cameras/images/MacBridge_image1_medium.jpg?b=' + d.getTime());
+        $('#cam3').attr('src','http://cams.gaslightmedia.com/cameras/images/MacBridge_image3_medium.jpg?b=' + d.getTime());
+        $('#cam4').attr('src','http://cams.gaslightmedia.com/cameras/images/MacBridge_image4_medium.jpg?b=' + d.getTime());
     }, 60000);
 
     var pdf_form = page.find( $(".pdf-form") );