web-narrowcast/narrowcast-playground.html

168 lines
5.0 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>NARROWCAST</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" type="text/css" media="all" href="narrowstyle.css"></link>
</head>
<body>
<div class="about"><a>back<span></span><br>↬ stage </a></div>
<div id="side" class="sidebar sidemin">
<button class="minimize" onclick="fside()"></button>
<div class="sidetop">
<a href="">Event Last not Least</a>
<a href="">Event Date Before Last</a>
<a href="">Event Date Later Later</a>
<a href="">Event Date Later</a>
<a href="">Event Date Day After</a>
<a href="">Event Date Tomorrow</a>
</div>
<div class="middle">
<p>⇈ Will be awesome ↟ </p>
<p id="livetitle">LIVE ↝ N↻W ⇶ </p>
<p>⇊ Was amazing ↷ </p>
</div>
<div class="sidebottom">
<a href="">Event 000020</a>
<a href="">Event 000019</a>
<a href="">Event 000018</a>
<a href="">Event 000017</a>
<a href="">Event 000016</a>
<a href="">Event 000015</a>
<a href="">Event 000014</a>
<a href="">Event 000013</a>
<a href="">Event 000012</a>
<a href="">Event 000011</a>
<a href="">Event 000010</a>
<a href="">Event 000009</a>
<a href="">Event 000008</a>
<a href="">Event 000007</a>
<a href="">Event 000006</a>
<a href="">Event 000005</a>
<a href="">Event 000004</a>
<a href="">Event 000003</a>
<a href="">Event 000002</a>
<a href="">Event 000001</a>
</div>
</div>
<div class="live">
<video class="resize-drag" autoplay="" loop="">
<!-- <source src="https://commons.wikimedia.org/wiki/File:Clear_to_cloudy_hot_Jupiters_(heic1524a).webm"
type="video/webm"> type="video/mp4" -->
<source src="https://ia600703.us.archive.org/3/items/vjmorph_pack1/BWdotSphereAVS01_1_640_512kb.mp4"
type="video/mp4">
</video>
<iframe class="resize-drag" src="https://meet.jit.si/varia.broadcats" allow="camera; microphone" idth="640" height="480" frameborder="0" webkitallowfullscreen="true" mozallowfullscreen="true" allowfullscreen>
</iframe>
<iframe class="resize-drag" src="https://etherdump.vvvvvvaria.org/"></iframe>
<audio controls loop="" class="resize-drag" src="https://ia803201.us.archive.org/31/items/md_music_ecco_the_dolphin/08%20-%20Island%20Zone%20-%20Andr%C3%A1s%20Magyari%2C%20Spencer%20Nilsen%2C%20Brian%20Coburn.mp3" type="audio/mp3">
</audio>
</div>
<!-- drag and resize library: https://interactjs.io/docs/installation#cdn-streamlined -->
<script src="https://cdn.jsdelivr.net/npm/interactjs/dist/interact.min.js"></script>
<!-- also found this other options:
https://www.webcomponents.org/element/jifalops/drag-resize
https://codepen.io/zz85/pen/gbOoVP -->
<script type="text/javascript">
function fside() {
var element = document.getElementById("side");
element.classList.toggle("sideminclicked");
}
interact('.resize-drag')
.resizable({
// resize from all edges and corners
edges: { left: true, right: true, bottom: true, top: true },
listeners: {
move (event) {
var target = event.target
var x = (parseFloat(target.getAttribute('data-x')) || 0)
var y = (parseFloat(target.getAttribute('data-y')) || 0)
// update the element's style
target.style.width = event.rect.width + 'px'
target.style.height = event.rect.height + 'px'
// translate when resizing from top or left edges
x += event.deltaRect.left
y += event.deltaRect.top
target.style.webkitTransform = target.style.transform =
'translate(' + x + 'px,' + y + 'px)'
target.setAttribute('data-x', x)
target.setAttribute('data-y', y)
target.textContent = Math.round(event.rect.width) + '\u00D7' + Math.round(event.rect.height)
}
},
modifiers: [
// keep the edges inside the parent
interact.modifiers.restrictEdges({
outer: 'parent'
}),
// minimum size
interact.modifiers.restrictSize({
min: { width: 100, height: 50 }
})
],
inertia: true
})
.draggable({
listeners: { move: window.dragMoveListener },
inertia: true,
modifiers: [
interact.modifiers.restrictRect({
restriction: 'parent',
endOnly: true
})
]
})
function dragMoveListener (event) {
var target = event.target
// keep the dragged position in the data-x/data-y attributes
var x = (parseFloat(target.getAttribute('data-x')) || 0) + event.dx
var y = (parseFloat(target.getAttribute('data-y')) || 0) + event.dy
// translate the element
target.style.webkitTransform =
target.style.transform =
'translate(' + x + 'px, ' + y + 'px)'
// update the posiion attributes
target.setAttribute('data-x', x)
target.setAttribute('data-y', y)
}
reset.onclick = () => location.reload()
window.onunload = () => {
interact.debug().interactables.list.filter(i => {
try {
return document.contains(i.context())
} catch (e) {}
}).forEach(i => i.unset())
}
</script>
</body>
</html>