Changeset 2846570
- Timestamp:
- 01/11/2023 08:01:35 AM (3 years ago)
- Location:
- share-that-cart/trunk
- Files:
-
- 3 edited
-
copy.js (modified) (1 diff)
-
readme.txt (modified) (1 diff)
-
share-that-cart.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
share-that-cart/trunk/copy.js
r2633979 r2846570 1 function copy() { 2 const input = document.getElementById('sc__link'); 3 input.focus(); 4 input.select(); 5 document.execCommand('copy'); 6 } 1 (function () { 2 function copy() { 3 const input = document.getElementById('sc__link'); 4 input.focus(); 5 input.select(); 6 document.execCommand('copy'); 7 } 7 8 8 const callback = function(mutationsList, observer) {9 const popup = document.querySelector('#sc__popup');10 const button = document.getElementById('sc__button');11 button.addEventListener('click', (e)=>{12 e.preventDefault();13 copy();14 popup.style.display = "block";15 });9 const callback = function(mutationsList, observer) { 10 const popup = document.querySelector('#sc__popup'); 11 const button = document.getElementById('sc__button'); 12 button.addEventListener('click', (e)=>{ 13 e.preventDefault(); 14 copy(); 15 popup.style.display = "block"; 16 }); 16 17 17 popup.addEventListener('click', ()=>{18 popup.style.display = "none";19 });20 };18 popup.addEventListener('click', ()=>{ 19 popup.style.display = "none"; 20 }); 21 }; 21 22 22 if (document.getElementById('sc__button')){ 23 // 24 const popup = document.querySelector('#sc__popup'); 25 const button = document.getElementById('sc__button'); 26 button.addEventListener('click', (e)=>{ 27 e.preventDefault(); 28 copy(); 29 popup.style.display = "block"; 30 }); 23 if (document.getElementById('sc__button')){ 24 const popup = document.querySelector('#sc__popup'); 25 const button = document.getElementById('sc__button'); 26 button.addEventListener('click', (e)=>{ 27 e.preventDefault(); 28 copy(); 29 popup.style.display = "block"; 30 }); 31 31 32 popup.addEventListener('click', ()=>{ 33 popup.style.display = "none"; 34 }); 35 // 32 popup.addEventListener('click', ()=>{ 33 popup.style.display = "none"; 34 }); 36 35 37 const target_block = document.querySelector('.entry-content'); 38 const config = { attributes: true, childList: true, subtree: true }; 39 const observer = new MutationObserver(callback); 40 observer.observe(target_block, config); 41 } 36 const target_block = document.querySelector('.entry-content'); 37 const config = { attributes: true, childList: true, subtree: true }; 38 const observer = new MutationObserver(callback); 39 observer.observe(target_block, config); 40 } 41 })(); -
share-that-cart/trunk/readme.txt
r2693569 r2846570 4 4 Donate link: https://www.paypal.me/Rider7991 5 5 Requires at least: 4.0 6 Tested up to: 5.96 Tested up to: 6.1 7 7 Requires PHP: 7.0 8 8 Stable tag: trunk -
share-that-cart/trunk/share-that-cart.php
r2693568 r2846570 9 9 */ 10 10 defined( 'ABSPATH' ) or die( 'No script kiddies please!' ); 11 12 if ( !defined( 'SC_VERSION' ) ) { 13 define( 'SC_VERSION', '1.0.1' ); 14 } 11 15 12 16 add_action('woocommerce_after_cart_contents', 'sc_button'); … … 27 31 function sc_load_scripts() { 28 32 if ( is_cart() ) { 29 wp_enqueue_style( 'sc-css', plugins_url('/style.css', __FILE__), '', '1.0.0', false );30 wp_enqueue_script( 'sc-js', plugins_url('/copy.js', __FILE__), '', '1.0.0', true );33 wp_enqueue_style( 'sc-css', plugins_url('/style.css', __FILE__), '', SC_VERSION, false ); 34 wp_enqueue_script( 'sc-js', plugins_url('/copy.js', __FILE__), '', SC_VERSION, true ); 31 35 } 32 36 }
Note: See TracChangeset
for help on using the changeset viewer.