Plugin Directory

Changeset 2447509


Ignore:
Timestamp:
12/29/2020 04:52:57 PM (5 years ago)
Author:
webmarcello
Message:

version 1.0.1 released

Location:
wp-clickable-background/trunk
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • wp-clickable-background/trunk/includes/WpClickableBackgroundFrontend.php

    r2417143 r2447509  
    77            if( get_option('wp-clickable-background-active') ){
    88                add_action( 'wp_enqueue_scripts', array( $this, 'includeJs' ) );
    9                 add_action('wp_footer', array( $this, 'addLink' ));
    10                 add_action('wp_footer', array( $this, 'addClass' ));
    11                 add_action('wp_footer', array( $this, 'addMode' ));
    129            }
    1310            if(get_option('wp-clickable-background-javascript')){
     
    1714
    1815        public function includeJs(){
    19             wp_enqueue_script('wp-clickable-background-js', PLUGIN_WCB_URL . 'js/clickable.js', array(), false, true );
     16            wp_enqueue_script('wp-clickable-background-js', PLUGIN_WCB_URL . 'js/clickable.min.js', array(), false, true );
     17            wp_localize_script('wp-clickable-background-js', 'wp_clickable_bg_data',
     18            array(
     19                'elementClass' => esc_attr(get_option('wp-clickable-background-class')),
     20                'link' => esc_url(get_option('wp-clickable-background-link')),
     21                'mode' => esc_attr(get_option('wp-clickable-background-new')),
     22            ));
    2023        }
    2124
     
    2730            <?php
    2831        }
    29 
    30         public function addLink(){
    31             ?>
    32                 <input type="hidden" name="hidden-link" id="wp-clickable-background-link" value="<?= esc_url(get_option('wp-clickable-background-link')); ?>" />
    33             <?php
    34         }
    35 
    36         public function addMode(){
    37             ?>
    38                 <input type="hidden" name="hidden-mode" id="wp-clickable-background-mode" value="<?= esc_attr(get_option('wp-clickable-background-new')); ?>" />
    39             <?php
    40         }
    41 
    42         public function addClass(){
    43             ?>
    44                 <input type="hidden" name="hidden-class" id="wp-clickable-background-class" value="<?= esc_attr(get_option('wp-clickable-background-class')); ?>" />
    45             <?php
    46         }
    4732    }
    4833}
  • wp-clickable-background/trunk/js/clickable.js

    r2417143 r2447509  
    11(function(){
    2     const elemntClass = document.getElementById('wp-clickable-background-class').value;
    32
    4     document.querySelector('.' + elemntClass).onclick = function (event) {
     3    const elementClass = wp_clickable_bg_data.elementClass;
     4
     5    document.querySelector('.' + elementClass).onclick = function (event) {
    56        if (event.target !== this)
    67            return;
    78       
    8         const link = document.getElementById('wp-clickable-background-link').value;
    9         const mode = document.getElementById('wp-clickable-background-mode').value;
     9        const link = wp_clickable_bg_data.link;
     10        const mode = wp_clickable_bg_data.mode;
    1011       
    1112        switch(mode) {
  • wp-clickable-background/trunk/readme.txt

    r2417167 r2447509  
    33Tags: click, background, clickable, javascript
    44Requires at least: 4.5.13
    5 Tested up to: 5.5.3
     5Tested up to: 5.6
    66Stable tag: trunk
    77Requires PHP: 5.6
     
    4141== Changelog ==
    4242
     43= 1.0.1 =
     44* Cleaning code
     45* Minify JS
     46* Sending data to JS through WP_LOCALIZE
     47
    4348= 1.0.0 =
    4449* Creating settings from
  • wp-clickable-background/trunk/wp-clickable-background.php

    r2417143 r2447509  
    44 * Plugin URI:        https://github.com/webmarcello8080/wp-clickable-background
    55 * Description:       Wordpress Plugin in order to make the background of your website clickable.
    6  * Version:           1.0.0
     6 * Version:           1.0.1
    77 * Requires at least: 4.5.13
    88 * Requires PHP:      5.6
     
    2222    function wp_clickable_background_loader(){
    2323        if( is_admin() ){
    24             $WpClickableBackgroundAdmin = new WpClickableBackgroundAdmin;
     24            new WpClickableBackgroundAdmin;
    2525        }
    26         $WpClickableBackgroundFrontend = new WpClickableBackgroundFrontend;
     26        new WpClickableBackgroundFrontend;
    2727    }
    2828    add_action('plugins_loaded', 'wp_clickable_background_loader');
Note: See TracChangeset for help on using the changeset viewer.