Plugin Directory

Changeset 1880716


Ignore:
Timestamp:
05/24/2018 11:19:47 AM (8 years ago)
Author:
basticom
Message:

Fixed caching problem for scripts and cookie bar

Location:
basticom-framework/trunk/admin/modules
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • basticom-framework/trunk/admin/modules/bstcmfw-cookie.php

    r1880646 r1880716  
    1010
    1111// Load and parse cookie HTML
    12 function bstcmfw_cookie_wrapper () { 
     12function bstcmfw_cookie_wrapper () {
    1313
    1414    // If bstcmfw cookie is enabled, add cookie HTML to WP footer, check if current page != readmore url
    15     if ( !is_admin() && get_option('bstcmfw-cookie-enable') == 1 && !isset( $_COOKIE['bstcmfw_cookie_accept'] ) && !is_page( get_option( 'bstcmfw-cookie-read-more-link', false, 0 ) ) ) {
     15    if ( !is_admin() && get_option('bstcmfw-cookie-enable') == 1 && !is_page( get_option( 'bstcmfw-cookie-read-more-link', false, 0 ) ) ) { //!isset( $_COOKIE['bstcmfw_cookie_accept'] ) &&
    1616
    1717        // Get content of HTML file
     
    104104add_action('wp_ajax_nopriv_get_scripts_hook', 'bstmcfw_get_scripts');
    105105
    106 
     106/* This shit aint gonna fly */
    107107function bstcmfw_output_default_scripts_header() {
    108108    if(get_option('bstcmfw-cookie-enable') == 1) {
     
    114114    }
    115115}
    116 add_action('wp_head', 'bstcmfw_output_default_scripts_header');
     116//add_action('wp_head', 'bstcmfw_output_default_scripts_header');
    117117
    118 
     118/* This shit aint gonna fly */
    119119function bstcmfw_output_default_scripts_footer() {
    120120    if(get_option('bstcmfw-cookie-enable') == 1) {
     
    126126    }
    127127}
    128 add_action('wp_footer', 'bstcmfw_output_default_scripts_footer');
     128//add_action('wp_footer', 'bstcmfw_output_default_scripts_footer');
    129129
    130130
  • basticom-framework/trunk/admin/modules/includes/bstcmfw-cookie.css

    r1880646 r1880716  
    1111    padding: 20px;
    1212    border-radius: 2px;
     13    display: none;
    1314}
    1415
     
    1920        display: block;
    2021        padding: 0;
     22        display: block;
    2123}
    2224
     
    5557    background: rgba(0, 0, 0, 0.6);
    5658    z-index: 2147483646;
     59    display: none;
    5760}
    5861
  • basticom-framework/trunk/admin/modules/includes/bstcmfw-cookie.js

    r1880646 r1880716  
    66}
    77
     8// Set default scripts based on cookie settings (1: print accept scripts, 0: print decline scripts)
     9jQuery( document ).ready(
     10    function() {
     11        'use strict';
     12
     13        jQuery.ajax(
     14            {
     15                type: "POST",
     16                url: bstcmfw_ajax_cookie.ajaxurl,
     17                dataType: "JSON",
     18                data: {
     19                action: 'get_scripts_hook',
     20                cookie_accept: bstcmfw_get_cookie( 'bstcmfw_cookie_accept' )
     21            },
     22            success: function( data ) {
     23                    jQuery( data.header ).appendTo( "head" );
     24                    jQuery( data.footer ).appendTo( "body" );
     25
     26                    if ( 1 != bstcmfw_get_cookie( 'bstcmfw_cookie_accept' ) ) {
     27                        jQuery('.bstcmfw-cookie-wrapper').show();
     28                        jQuery('.bstcmfw-cookie-overlay').show();
     29                    }
     30
     31                }
     32            }
     33        );
     34
     35    }
     36);
    837
    938// Set cookie
Note: See TracChangeset for help on using the changeset viewer.