mirror of
https://github.com/gigirassy/gigirassy.github.io/
synced 2024-09-29 07:45:38 +00:00
Update button.html
This commit is contained in:
parent
2c1c99a908
commit
19f3752817
47
button.html
47
button.html
|
@ -4,56 +4,13 @@
|
|||
<!-- Required meta tags -->
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="Page showing questions you may or may not wanna ask Nune.">
|
||||
<meta name="description" content="Button page for Nune's site">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<meta name="author" content="Blitzwing">
|
||||
<title>Blitzwing: Maybe Asked Questions</title>
|
||||
<title>Blitzwing: Button page</title>
|
||||
<!--====== Favicon Icon ======-->
|
||||
<link rel="shortcut icon" href="img/2.png" type="image/png">
|
||||
<link rel="stylesheet" href="/style.css">
|
||||
<script>
|
||||
function CopyClassText(){
|
||||
//select the element with ID = "CopyMeID", can be a div, p, or a span, possibly others
|
||||
var textToCopy = document.getElementById("CopyMeID");
|
||||
|
||||
//you can target the same element using querySelector() as well
|
||||
//example below:
|
||||
//var textToCopy = document.querySelector('.CopyMeClass');
|
||||
|
||||
//check and see if the user had a text selection range
|
||||
var currentRange;
|
||||
if(document.getSelection().rangeCount > 0)
|
||||
;{
|
||||
//the user has a text selection range, store it
|
||||
currentRange = document.getSelection().getRangeAt(0);
|
||||
//remove the current selection
|
||||
window.getSelection().removeRange(currentRange);
|
||||
}
|
||||
else
|
||||
{
|
||||
//they didn't have anything selected
|
||||
currentRange = false;
|
||||
}
|
||||
|
||||
//create a selection range
|
||||
var CopyRange = document.createRange();
|
||||
//choose the element we want to select the text of
|
||||
CopyRange.selectNode(textToCopy);
|
||||
//select the text inside the range
|
||||
window.getSelection().addRange(CopyRange);
|
||||
//copy the text to the clipboard
|
||||
document.execCommand("copy");
|
||||
|
||||
//remove our selection range
|
||||
window.getSelection().removeRange(CopyRange);
|
||||
|
||||
//return the old selection range
|
||||
if(currentRange)
|
||||
{
|
||||
window.getSelection().addRange(currentRange);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>pre{font-size:75%;font-family:cortana;border-style:2px solid #e6cbe6;}</style>
|
||||
</head>
|
||||
|
||||
|
|
Loading…
Reference in a new issue