Skip to content

Commit

Permalink
POC for novacast
Browse files Browse the repository at this point in the history
  • Loading branch information
novafurry committed May 14, 2024
1 parent 98e2999 commit e137578
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 1 deletion.
32 changes: 32 additions & 0 deletions libraries/Novacast Test Lib/r.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>

<body>
<input type="text" id="Example Text">
<button id="hello" onclick="alert('Hello!')"></button>
<script type="module">
import '../peer.js'
var peer = new Peer()
peer.on('open', (id) => {
prompt("heres the id fag",id)
})
peer.on('connection', (conn) => {
conn.on('data', (data) => {
console.log(data)
if(data[0] == "click"){
document.getElementById(data[1]).click();
} else if (data[0] =="input"){
document.getElementById(data[1]).value = data[2];
}
})
})
</script>
</body>

</html>
39 changes: 39 additions & 0 deletions libraries/Novacast Test Lib/send.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!DOCTYPE html>
<html lang="en" id="html">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>

<body id="body">
<input type="text" id="Example Text">
<button id="hello" onclick="alert('Hello!')">Hi</button>
<script type="module">
import '../peer.js';
var client = prompt("Open r.html (in same dir) and paste the id from it here (it can take a while to get sometimes)")
var peer = new Peer()
peer.on('open', (peerId) => {
console.log(peerId)
});
document.addEventListener("click", function (e) {
e.preventDefault()
var conn = peer.connect(client);
conn.on('open', function () {
conn.send([e.type,e.srcElement.id]);
});
if(e.srcElement.hasOwnProperty("click") ){
eval(e.srcElement.click)
}
})
document.addEventListener("input", function (e) {
var conn = peer.connect(client);
conn.on('open', function () {
conn.send([e.type,e.srcElement.id,e.srcElement.value]);
});
})
</script>
</body>

</html>
1 change: 0 additions & 1 deletion libraries/foxydrop.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e137578

Please sign in to comment.