Plugin Directory

Changeset 1527556


Ignore:
Timestamp:
11/03/2016 04:01:36 PM (9 years ago)
Author:
johansylvan
Message:

add author angrycreative

Location:
custom-cookie-message/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • custom-cookie-message/trunk/README.txt

    r1525243 r1527556  
    11=== Plugin Name ===
    2 Contributors: johansylvan
     2Contributors: johansylvan, angrycreative
    33Tags:  custom, cookie, message, consent, cookie bar, cookie compliance, cookie law, cookie notice, cookie notification, cookie notification bar, cookie notify, cookies, eu, eu cookie, eu cookie law, notice, notification, notify, custom cookie message, WPML, Polylang, Multisite, multisites
    44Requires at least: 1.0
    5 Tested up to: 1.1
    6 Stable tag: 1.1
     5Tested up to: 1.0
     6Stable tag: 1.0
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
  • custom-cookie-message/trunk/css/cookies.css

    r1525170 r1527556  
    2828}
    2929
    30 #opacity_slider {
    31     width: 180px;
    32 }
    33 
    34 #opacity_slider_amount {
    35     width: 180px;
    36     color: #555 !important;
    37 }
    38 
    39 #message_size_slider {
    40     width: 180px;
    41 }
    42 
    43 #message_size_slider_amount {
    44     width: 180px;
    45     color: #555 !important;
    46 }
    47 
    48 #button_size_slider {
    49     width: 180px;
    50 }
    51 
    52 #button_size_slider_amount {
    53     width: 180px;
    54     color: #555 !important;
    55 }
    5630
    5731.container-cookies
     
    6438    display: none;
    6539    height: auto;
     40    opacity: 0.95;
    6641    padding: 10px 0 10px 0;
    6742}
     
    8964    line-height: 20px;
    9065    margin-bottom: 0;
    91     margin-top: 0;
    9266    -webkit-box-flex: 1;
    9367    -ms-flex: 1;
  • custom-cookie-message/trunk/custom-cookie-message.php

    r1525243 r1527556  
    55 * Plugin URI: https://angrycreative.se/
    66 * Description: A customizable cookie message.
    7  * Version: 1.1
    8  * Author: johansylvan
     7 * Version: 1.0
     8 * Author: Johan Sylvan, angrycreative
    99 * Author URI: https://angrycreative.se/
    1010 **/
  • custom-cookie-message/trunk/includes/ac-cookie-message.php

    r1525170 r1527556  
    7272    public function register_plugin_styles(){
    7373        wp_register_style('product_variation', CUSTOM_COOKIE_MESSAGE_PLUGIN_URL . '/css/cookies.css');
    74 
    7574        wp_enqueue_style('product_variation');
    7675    }
    7776
    7877    public function register_plugin_scripts(){
     78        //wp_enqueue_script('variation-custom-cookie-script', CUSTOM_COOKIE_MESSAGE_PLUGIN_URL . '/js/ac-custom-cookie-message-frontend.js', ['jquery']);
    7979
    8080        // embed the javascript file that makes the AJAX request
     
    8686
    8787    public function register_backend_plugin_styles(){
    88         wp_enqueue_style('jquery-   style', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css');
    89         wp_register_style('product_variation', CUSTOM_COOKIE_MESSAGE_PLUGIN_URL . '/css/cookies.css');
    90         wp_enqueue_style('product_variation');
    9188        wp_enqueue_style( 'wp-color-picker' );
    9289    }
     
    154151
    155152    public function cookie_setcookie() {
    156        // setcookie( 'cookie-warning-message', 15, 30 * DAYS_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN );
    157         //wp_send_json( 1 );
     153        setcookie( 'cookie-warning-message', 15, 30 * DAYS_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN );
     154        wp_send_json( 1 );
    158155    }
    159156
     
    333330            'styling_options_section' );
    334331
     332        /*add_settings_field(
     333            'Opacity Slider',
     334            __('Opacity Slider', 'cookie-message'),
     335            array( $this, 'cookies_opacity_slider_callback' ),
     336            'cookies_styling_options',
     337            'styling_options_section' );*/
     338
    335339        add_settings_field(
    336340            'Button Color',
     
    360364            'cookies_styling_options',
    361365            'styling_options_section' );
    362 
    363         /*add_settings_field(
    364             'Opacity',
    365             __('Opacity', 'cookie-message'),
    366             array( $this, 'cookies_opacity_slider_callback' ),
    367             'cookies_styling_options',
    368             'styling_options_section' );
    369 
    370         add_settings_field(
    371             'Message Size',
    372             __('Message Size', 'cookie-message'),
    373             array( $this, 'cookies_message_size_slider_callback' ),
    374             'cookies_styling_options',
    375             'styling_options_section' );
    376 
    377         add_settings_field(
    378             'button_size_',
    379             __('Button Size', 'cookie-message'),
    380             array( $this, 'cookies_button_size_slider_callback' ),
    381             'cookies_styling_options',
    382             'styling_options_section' );*/
    383366
    384367        register_setting(
     
    456439    }
    457440
     441    /*function cookies_opacity_slider_callback() {
     442        $options = get_option('cookies_styling_options');
     443
     444        $val = ( isset( $options['opacity_slider_amount'] ) ) ? $options['opacity_slider_amount'] : '';
     445        echo '<input type="text" id="opacity_slider_amount" name="cookies_styling_options[opacity_slider_amount]" value="' . $val . '" readonly style="border:0; color:#f6931f; font-weight:bold;">';
     446        echo '<div id="opacity_slider"></div>';
     447    }*/
     448
    458449    function cookies_button_color_picker_callback() {
    459450        $options = get_option('cookies_styling_options');
     
    466457        $options = get_option('cookies_styling_options');
    467458
    468         //$val = ( isset( $options['button_text_color_picker'] ) ) ? $options['button_text_color_picker'] : '';
    469         $val = $options['button_text_color_picker'];
     459        $val = ( isset( $options['button_text_color_picker'] ) ) ? $options['button_text_color_picker'] : '';
    470460        echo '<input type="text" id="button_text_color_picker" name="cookies_styling_options[button_text_color_picker]" value="' . $val . '" class="cpa-color-picker" >';
    471461    }
     
    484474        echo '<input type="text" id="link_color_picker" name="cookies_styling_options[link_color_picker]" value="' . $val . '" class="cpa-color-picker" >';
    485475    }
    486 
    487     /*function cookies_opacity_slider_callback() {
    488         $options = get_option('cookies_styling_options');
    489 
    490         $val = ( isset( $options['opacity_slider_amount'] ) ) ? $options['opacity_slider_amount'] : '95';
    491         echo '<input type="text" id="opacity_slider_amount" name="cookies_styling_options[opacity_slider_amount]" value="' . $val . '" readonly style="border:0; color:#f6931f; font-weight:bold;">';
    492         echo '<div id="opacity_slider"></div>';
    493     }
    494 
    495     function cookies_message_size_slider_callback() {
    496         $options = get_option('cookies_styling_options');
    497 
    498         //print_r($options);
    499         $val = ( isset( $options['message_size_slider_amount'] ) ) ? $options['message_size_slider_amount'] : '90';
    500         //var_dump($val);
    501         echo '<input type="text" id="message_size_slider_amount" name="cookies_styling_options[message_size_slider_amount]" value="' . $val . '" readonly style="border:0; color:#f6931f; font-weight:bold;">';
    502         echo '<div id="message_size_slider"></div>';
    503     }
    504 
    505     function cookies_button_size_slider_callback() {
    506         $options = get_option('cookies_styling_options');
    507 
    508         $val = ( isset( $options['button_size_slider_amount'] ) ) ? $options['button_size_slider_amount'] : '90';
    509         echo '<input type="text" id="button_size_slider_amount" name="cookies_styling_options[button_size_slider_amount]" value="' . $val . '" readonly style="border:0; color:#f6931f; font-weight:bold;">';
    510         echo '<div id="button_size_slider"></div>';
    511     }*/
    512476
    513477    // Iterates through every part of the input string and sanitizes it
  • custom-cookie-message/trunk/js/ac-custom-cookie-message-backend.js

    r1525170 r1527556  
    1111        $( '.cpa-color-picker' ).wpColorPicker();
    1212
    13         /*$( "#opacity_slider" ).slider({
     13
     14        $( "#opacity_slider" ).slider({
    1415            range: "min",
    15             value: parseInt($("#opacity_slider_amount").val()),
    16             min: 50,
     16            value: 37,
     17            min: 1,
    1718            max: 100,
    1819            slide: function( event, ui ) {
    19                 $( "#opacity_slider_amount" ).val( ui.value + "%");
     20                $( "#opacity_slider_amount" ).val( "$" + ui.value );
    2021            }
    2122        });
     23        $( "#opacity_slider_amount" ).val( "$" + $( "#opacity_slider" ).slider( "value" ) );
    2224
    23         $( "#message_size_slider" ).slider({
    24             range: "min",
    25             //value:  parseInt(message_slider_value),
    26             value: parseInt($("#message_size_slider_amount").val()),
    27             min: 50,
    28             max: 100,
    29             slide: function( event, ui ) {
    30                 $( "#message_size_slider_amount" ).val( ui.value );
    31             }
    32         });
    33 
    34         $( "#button_size_slider" ).slider({
    35             range: "min",
    36             value: parseInt($("#button_size_slider_amount").val()),
    37             //value: 78,
    38             min: 50,
    39             max: 100,
    40             slide: function( event, ui ) {
    41                 $( "#button_size_slider_amount" ).val( ui.value );
    42             }
    43         });*/
    4425    });
    4526});
  • custom-cookie-message/trunk/js/ac-custom-cookie-message-frontend.js

    r1525243 r1527556  
    44 */
    55
    6 //Debounce from David Walsh https://davidwalsh.name/javascript-debounce-function
    7 function debounce(func, wait, immediate) {
    8     var timeout;
    9     return function() {
    10         var context = this, args = arguments;
    11         var later = function() {
    12             timeout = null;
    13             if (!immediate) func.apply(context, args);
    14         };
    15         var callNow = immediate && !timeout;
    16         clearTimeout(timeout);
    17         timeout = setTimeout(later, wait);
    18         if (callNow) func.apply(context, args);
    19     };
    20 };
    21 
    22 
    236jQuery(document).ready(function($) {
    24     // Hide Header on on scroll
    25     var didScroll;
    26     var lastScrollTop = 0;
    27     var lastScrollBot = 0;
    28     var delta = 5;
    29     var navbarHeight = $('#custom-cookie-message-container').outerHeight();
    30 
    31     var storage = (function() {
    32         var uid = new Date;
    33         var storage;
    34         var result;
    35         try {
    36             (storage = window.localStorage).setItem(uid, uid);
    37             result = storage.getItem(uid) == uid;
    38             storage.removeItem(uid);
    39             return result && storage;
    40         } catch (exception) {}
    41     }());
    42 
    43     $(window).on('scroll', debounce( function () {
    44         hasScrolled();
    45     }, 250));
    467
    478    setTimeout(function() {
    48         if(storage) {
    49             var fallback = storage.getItem("ac-cookie-fallback");
    50             if(fallback !== "fallback") {
    51 
    52                 $('#custom-cookie-message-container').slideToggle(400, function () {
    53                     $(this).find('.form-control').focus();
    54                 });
    55             }
    56 
    57         } else {
    58             $('#custom-cookie-message-container').slideToggle(400, function () {
    59                 $(this).find('.form-control').focus();
    60             });
    61         }
     9        $( '#custom-cookie-message-container' ).slideToggle( 400, function() {
     10            $( this ).find( '.form-control' ).focus();
     11        } );
    6212    },10);
    6313
     
    7323        })
    7424        .done(function( data ) {
    75             storage.setItem("ac-cookie-fallback", "fallback")
    7625            $('#custom-cookie-message-container').hide();
    7726        })
     
    8130        });
    8231    });
    83    
     32
     33    // Hide Header on on scroll down
     34    var didScroll;
     35    var lastScrollTop = 0;
     36    var lastScrollBot = 0;
     37    var delta = 5;
     38    var navbarHeight = $('#custom-cookie-message-container').outerHeight();
     39
     40    $(window).scroll(function(event){
     41        didScroll = true;
     42    });
     43
     44    setInterval(function() {
     45        if (didScroll) {
     46            hasScrolled();
     47            didScroll = false;
     48        }
     49    }, 250);
     50
    8451    function hasScrolled() {
    8552        var st = $(this).scrollTop();
     
    9057            return;
    9158
     59        // If they scrolled down and are past the navbar, add class .nav-up.
     60        // This is necessary so you never see what is "behind" the navbar.
    9261        if (st > lastScrollTop && st > navbarHeight){
    9362            // Scroll Down
  • custom-cookie-message/trunk/views/cookie-notice.php

    r1525170 r1527556  
    1010$styling_options = get_option('cookies_styling_options');
    1111?>
    12 <?php //echo $styling_options['opacity_amount']/100;?>
    1312<?php if($general_options['location_options'] == 'top-fixed') { ?>
    1413    <style>
     
    5453        background-color: <?php echo $styling_options['message_color_picker'];?>;
    5554        color: <?php echo $styling_options['text_color_picker'];?>;
    56         //opacity: <?php echo $styling_options['opacity_amount']/100;?>;
    5755    }
    5856
Note: See TracChangeset for help on using the changeset viewer.