Created
October 10, 2023 15:09
-
-
Save Zodiac1978/5e51fe0d2ecb2343614cb0e565602c01 to your computer and use it in GitHub Desktop.
WordPress plugin preview for from Roy Tanck modified to support Enter key for submit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>WordPress plugin preview</title> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<link rel="stylesheet" type="text/css" href="style.css"> | |
</head> | |
<body> | |
<div id="container"> | |
<div id="content"> | |
<p>Enter the plugin's slug, for example 'hello-dolly'.</p> | |
<form id="form"> | |
<input type="text" id="slug"><br> | |
<input type="submit" id="submit" value="Preview"> | |
</form> | |
</div> | |
<p id="credits">© <a href="https://roytanck.com">Roy Tanck</a></p> | |
</div> | |
<script> | |
document.querySelector( '#form' ).addEventListener( 'submit', ( event ) => { | |
event.preventDefault(); | |
let slug = document.querySelector( '#slug' ).value; | |
let url = 'https://playground.wordpress.net/?plugin=' + slug + '&login=1&url=/wp-admin/plugins.php'; | |
document.location = url; | |
} ); | |
document.querySelector( '#submit' ).addEventListener( 'click', ( event ) => { | |
event.preventDefault(); | |
let slug = document.querySelector( '#slug' ).value; | |
let url = 'https://playground.wordpress.net/?plugin=' + slug + '&login=1&url=/wp-admin/plugins.php'; | |
document.location = url; | |
} ); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment