Changeset 2447509
- Timestamp:
- 12/29/2020 04:52:57 PM (5 years ago)
- Location:
- wp-clickable-background/trunk
- Files:
-
- 1 added
- 4 edited
-
includes/WpClickableBackgroundFrontend.php (modified) (3 diffs)
-
js/clickable.js (modified) (1 diff)
-
js/clickable.min.js (added)
-
readme.txt (modified) (2 diffs)
-
wp-clickable-background.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-clickable-background/trunk/includes/WpClickableBackgroundFrontend.php
r2417143 r2447509 7 7 if( get_option('wp-clickable-background-active') ){ 8 8 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' ));12 9 } 13 10 if(get_option('wp-clickable-background-javascript')){ … … 17 14 18 15 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 )); 20 23 } 21 24 … … 27 30 <?php 28 31 } 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 <?php34 }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 <?php40 }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 <?php46 }47 32 } 48 33 } -
wp-clickable-background/trunk/js/clickable.js
r2417143 r2447509 1 1 (function(){ 2 const elemntClass = document.getElementById('wp-clickable-background-class').value;3 2 4 document.querySelector('.' + elemntClass).onclick = function (event) { 3 const elementClass = wp_clickable_bg_data.elementClass; 4 5 document.querySelector('.' + elementClass).onclick = function (event) { 5 6 if (event.target !== this) 6 7 return; 7 8 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; 10 11 11 12 switch(mode) { -
wp-clickable-background/trunk/readme.txt
r2417167 r2447509 3 3 Tags: click, background, clickable, javascript 4 4 Requires at least: 4.5.13 5 Tested up to: 5. 5.35 Tested up to: 5.6 6 6 Stable tag: trunk 7 7 Requires PHP: 5.6 … … 41 41 == Changelog == 42 42 43 = 1.0.1 = 44 * Cleaning code 45 * Minify JS 46 * Sending data to JS through WP_LOCALIZE 47 43 48 = 1.0.0 = 44 49 * Creating settings from -
wp-clickable-background/trunk/wp-clickable-background.php
r2417143 r2447509 4 4 * Plugin URI: https://github.com/webmarcello8080/wp-clickable-background 5 5 * Description: Wordpress Plugin in order to make the background of your website clickable. 6 * Version: 1.0. 06 * Version: 1.0.1 7 7 * Requires at least: 4.5.13 8 8 * Requires PHP: 5.6 … … 22 22 function wp_clickable_background_loader(){ 23 23 if( is_admin() ){ 24 $WpClickableBackgroundAdmin =new WpClickableBackgroundAdmin;24 new WpClickableBackgroundAdmin; 25 25 } 26 $WpClickableBackgroundFrontend =new WpClickableBackgroundFrontend;26 new WpClickableBackgroundFrontend; 27 27 } 28 28 add_action('plugins_loaded', 'wp_clickable_background_loader');
Note: See TracChangeset
for help on using the changeset viewer.