Skip to content

Commit

Permalink
Bump version to 1.13
Browse files Browse the repository at this point in the history
  • Loading branch information
oskosk committed Jun 8, 2020
1 parent e391826 commit b87ff6f
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions companion.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: Companion Plugin
Plugin URI: https://github.com/Automattic/companion
Description: Helps keep the launched WordPress in order.
Version: 1.12
Version: 1.13
Author: Osk
*/

Expand Down Expand Up @@ -126,11 +126,22 @@ function jurassic_ninja_clippy( str ) {
field.addEventListener( 'click', function( e ) {
e.preventDefault();
e.stopPropagation();
const str =
e.target.getAttribute( 'target' ) ?
document.getElementById( e.target.getAttribute( 'target' ) ).innerText :
document.getElementById( e.target.parentNode.getAttribute( 'target' ) ).innerText;
// These html entities are represented by images in the end
// So we need to figure out if the target of the click is a link or an img
const isChild = ! e.target.getAttribute( 'target' );
const el = ! isChild ?
document.getElementById( e.target.getAttribute( 'target' ) ) :
document.getElementById( e.target.parentNode.getAttribute( 'target' ) );
const str = el.innerText;
jurassic_ninja_clippy( str );
// Transition to checkmark and back
if ( isChild ) {
const parent = e.target.parentNode;
parent.innerHTML = '✔';
setTimeout( () => {
parent.innerHTML= '📋';
}, 1000 );
}
} );
} );
</script>
Expand Down

0 comments on commit b87ff6f

Please sign in to comment.