PageSourceSearch

https://vanstockum.blog/wp-content/plugins/momo-venmo/assets/js/copy.js

js vanstockum.blog collected 2026-10-04 06:36:45 UTC 2,632 bytes, 87 lines download raw bytes

1window.onload = function () {
2	// console.log("window.onload copy.js");
3	copyjs();
4	document
5		.querySelector("body")
6		.addEventListener("updated_checkout", async function () {
7			// console.log("updated_checkout copy.js");
8			copyjs();
9		});
10	var copyButtons = document.getElementsByClassName("copybtn");
11	for (var i = 0; i < copyButtons.length; i++) {
12		copyButtons[i].onclick = function () {
13			// console.log("click copy.js");
14			copyjs();
15		};
16	}
17};
18jQuery(document).ready(function ($) {
19	copyjs();
20	$("body").on("updated_checkout", function () {
21		copyjs();
22	});
23	$(".copybtn").on("click", function () {
24		copyjs();
25	});
26});
27
28function copyjs() {
29	var copyButtons = document.getElementsByClassName("copybtn");
30	// console.log(copyButtons);
31	for (var i = 0; i < copyButtons.length; i++) {
32		copyButtons[i].addEventListener("click", function () {
33			try {
34				var copyText =
35					this?.parentElement?.getElementsByClassName("copytxt")[0];
36				console.log(copyText);
37				copyText.removeAttribute("readonly");
38				copyText.removeAttribute("disabled");
39				if (copyText.type == "password") {
40					copyText.setAttribute("type", "text");
41				}
42				copyText.focus();
43				copyText.select();
44				var successful = document.execCommand("copy");
45				var msg = successful ? "successful" : "unsuccessful";
46				console.log("Copying text " + msg);
47				this.innerText = "Copied!";
48				this.classList.add("success");
49				copyText.setAttribute("readonly", "readonly");
50			} catch (err) {
51				this.innerText = "Failed!";
52				this.classList.add("error");
53				console.log("Oops, unable to copy");
54				console.log(err);
55			}
56		});
57	}
58
59	var copyInputs = document.getElementsByClassName("copytxt");
60	// console.log(copyInputs);
61	for (var i = 0; i < copyInputs.length; i++) {
62		copyInputs[i].addEventListener("click", function () {
63			var copyBtn = this?.parentElement?.getElementsByClassName("copybtn")[0];
64			console.log(copyBtn);
65			try {
66				this.removeAttribute("readonly");
67				this.removeAttribute("disabled");
68				if (this.type == "password") {
69					this.setAttribute("type", "text");
70				}
71				this.focus();
72				this.select();
73				var successful = document.execCommand("copy");
74				var msg = successful ? "successful" : "unsuccessful";
75				console.log("Copying text " + msg);
76				copyBtn.innerText = "Copied!";
77				copyBtn.classList.add("success");
78				this.setAttribute("readonly", "readonly");
79			} catch (err) {
80				copyBtn.innerText = "Failed!";
81				copyBtn.classList.add("error");
82				console.log("Oops, unable to copy");
83			}
84		});
85	}
86	return true;
87}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.