Plugin Directory

Changeset 2942233


Ignore:
Timestamp:
07/24/2023 12:32:25 AM (3 years ago)
Author:
srikat
Message:

v1.0.1

Location:
visual-hook-guide-for-kadence
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • visual-hook-guide-for-kadence/trunk/main.js

    r2368222 r2942233  
     1'use strict';
     2
    13window.onload = function () {
    2   var clickSelector = document.querySelectorAll('.kadence-hook input[type=text]');
    3   for (var i = 0; i < clickSelector.length; i++) {
    4     clickSelector[i].addEventListener('click', function(){
    5       this.select();
     4  const copyContent = async (text) => {
     5    try {
     6      await navigator.clipboard.writeText(text);
     7      // console.log('Content copied to clipboard');
     8    } catch (err) {
     9      console.error('Failed to copy: ', err);
     10    }
     11  }
     12
     13  document.querySelectorAll('.kadence-hook input[type=text]').forEach(el => {
     14    el.addEventListener('click', function(e){
     15      // Store the original input's text
     16      let inputText = e.target.value;
     17
     18      // Copy the input's text
     19      copyContent(inputText);
     20
     21      // Show confirmation
     22      e.target.value = 'Copied ✓';
     23
     24      // Restore the original text
     25      setTimeout(() => {
     26        e.target.value = inputText;
     27      }, 1000)
    628    });
    7   };
     29  });
    830}
  • visual-hook-guide-for-kadence/trunk/readme.txt

    r2368222 r2942233  
    55License: GPLv3
    66License URI: http://www.gnu.org/licenses/gpl.html
    7 Tested up to: 5.5
     7Tested up to: 6.2.2
    88Stable tag: trunk
    9 Requires PHP: 5.6.20
     9Requires PHP: 7.4
    1010
    11 Find Kadence action hooks quick and easily by seeing their actual locations inside your Kadence theme.
     11Find Kadence action hooks quickly and easily by seeing their actual locations inside your Kadence theme.
    1212
    1313== Description ==
     
    1717Clicking `Action Hooks` item in the submenu will display the currently available Kadence action hooks on that page. `Clear` clears the hooks.
    1818
    19 Clicking anywhere on a hook selects the hook name ready to be easily copied.
     19Clicking anywhere on a hook copies the hook name to your clipboard.
    2020
    2121The hook name is also shown as the tooltip when hovering on a hook.
    2222
    2323**Kadence theme required.**
    24 
    25 == Kadence Visual Hook Guide Hooks Live Demo ==
    26 
    27 [Live Demo](https://kadence-hook-guide.wpdemo.dev/)
    2824
    2925== Frequently Asked Questions ==
     
    6056== Changelog ==
    6157
     58= 1.0.1 =
     59Added copy to clipboard function.
     60
    6261= 1.0 =
    6362Initial Release.
  • visual-hook-guide-for-kadence/trunk/visual-hook-guide-kadence.php

    r2368222 r2942233  
    22/**
    33 * Plugin Name: Visual Hook Guide for Kadence
    4  * Plugin URI: https://buildonlineweb.com/visual-hook-guide-kadence
    5  * Description: Find Kadence action hooks easily and select them by a single click at their actual locations in your Kadence theme.
    6  * Version: 1.0.0
     4 * Plugin URI: https://profiles.wordpress.org/srikat/
     5 * Description: Find Kadence action hooks easily and copy them by a single click at their actual locations in your Kadence theme.
     6 * Version: 1.0.1
    77 * Author: Sridhar Katakam
    8  * Author URI: https://buildonlineweb.com/
     8 * Author URI: https://profiles.wordpress.org/srikat/
    99 * Text Domain: visual-hook-guide-kadence
    1010 * License: GPL v3
    11  * Requires at least: 5.4
    12  * Requires PHP: 5.6.20
     11 * Requires at least: 6.2.2
     12 * Requires PHP: 7.4
    1313 *
    1414 * This program is free software: you can redistribute it and/or modify
     
    3737    $theme_info = wp_get_theme();
    3838
    39     $kadence_flavors = array(
     39    $kadence_flavors = [
    4040        'kadence',
    41     );
     41    ];
    4242
    4343    if ( ! in_array( $theme_info->Template, $kadence_flavors, true ) ) {
    4444        deactivate_plugins( plugin_basename( __FILE__ ) ); // Deactivate ourself.
     45
    4546        $message = sprintf(
    4647            /* translators: %s: URL to Kadence Framework. */
     
    4849            esc_url( 'https://www.kadencewp.com/kadence-theme/' )
    4950        );
     51
    5052        wp_die( $message );
    5153    }
     
    6466
    6567    $wp_admin_bar->add_menu(
    66         array(
     68        [
    6769            'id'       => 'kvhg',
    6870            'title'    => __( 'Kadence Hooks', 'visual-hook-guide-kadence' ),
    6971            'href'     => '',
    7072            'position' => 0,
    71         )
     73        ]
    7274    );
     75
    7376    $wp_admin_bar->add_menu(
    74         array(
     77        [
    7578            'id'       => 'kvhg_action',
    7679            'parent'   => 'kvhg',
     
    7881            'href'     => esc_url( add_query_arg( 'kvhg_hooks', 'show' ) ),
    7982            'position' => 10,
    80         )
     83        ]
    8184    );
     85
    8286    $wp_admin_bar->add_menu(
    83         array(
     87        [
    8488            'id'       => 'kvhg_clear',
    8589            'parent'   => 'kvhg',
     
    8791            'href'     => esc_url(
    8892                remove_query_arg(
    89                     array(
     93                    [
    9094                        'kvhg_hooks',
    91                     )
     95                    ]
    9296                )
    9397            ),
    9498            'position' => 10,
    95         )
     99        ]
    96100    );
    97101
     
    108112    if ( 'show' === filter_input( INPUT_GET, 'kvhg_hooks', FILTER_SANITIZE_STRING ) ) {
    109113        wp_enqueue_style( 'kvhg-styles', $kvhg_plugin_css_url, null, '1.0.0', false );
    110         wp_enqueue_script( 'kvhg-scripts', $kvhg_plugin_js_url, null, '1.0.0', true );
     114        wp_enqueue_script( 'kvhg-scripts', $kvhg_plugin_js_url, null, '1.0.1', true );
    111115    }
    112116}
Note: See TracChangeset for help on using the changeset viewer.