Last active
September 21, 2022 09:57
-
-
Save aronbudinszky/cb0616ae6dfa2152dc61f21ddb06490b to your computer and use it in GitHub Desktop.
A php file to easily transfer stuff to iOS simulator. This is a workaround for the bug in Xcode 13 where the clipboard sync does not work between Simulator and macOS M1.
This file contains 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
<?php | |
###### CONFIG ###### | |
# Here is a link | |
$link = <<<EOF | |
https://www.google.com/ | |
EOF; | |
# And some text to copy | |
$text = <<<EOF | |
Text to copy | |
EOF; | |
###### LAYOUT ###### | |
?> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Clippy</title> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> | |
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/css/bulma.min.css"> | |
<script> | |
function copyTextToClipboard(text) { | |
navigator.clipboard.writeText(text).then(function() { | |
console.log('Async: Copying to clipboard was successful!'); | |
}, function(err) { | |
console.error('Async: Could not copy text: ', err); | |
}); | |
} | |
</script> | |
<style> | |
html, body { height: 100%; } | |
body { padding: 30px; } | |
</style> | |
</head> | |
<body class="has-background-info-light"> | |
<div class="container"> | |
<h2 class="is-size-4">iOS Virtual Clipboard</h2> | |
<p>Workaround for Xcode clipboard bug.</p> | |
<br> | |
<div class="notification is-link"> | |
<h2 class="is-size-4">Link to click</h2> | |
<br/> | |
<a class="button" href="<?php print $link; ?>">Click me!</a> | |
</div> | |
<div class="notification is-warning"> | |
<h2 class="is-size-4">Text to copy</h2> | |
<br/> | |
<div class="box"> | |
<?php print trim($text); ?> | |
</div> | |
<button class="button" onclick="copyTextToClipboard('<?php print str_replace("'", "\\'", trim($text)); ?>');">Copy to clipboard</button> | |
</div> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment