Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
35893ea
signalingMessage posting
TwistedPorkchop Sep 15, 2023
2ab2c43
signalingMessage basic logic
TwistedPorkchop Sep 15, 2023
25076f8
console log cleanup
TwistedPorkchop Sep 17, 2023
2093bac
Psuedo tag on signalling mesasge
TwistedPorkchop Sep 17, 2023
89ee48a
New debug iframe added wip
TwistedPorkchop Sep 22, 2023
199dc70
debug toggle added.
TwistedPorkchop Sep 22, 2023
454211b
debug styilings
TwistedPorkchop Sep 22, 2023
91e5105
debug page
TwistedPorkchop Sep 22, 2023
49a72d1
Basic index <==> debugger message passing
TwistedPorkchop Sep 22, 2023
e1a8697
Logic for index <==> debugger messaging
TwistedPorkchop Sep 22, 2023
654215e
Mae the window translucent
TwistedPorkchop Sep 28, 2023
8438f8d
Added test for bookmarklet <==> iframe comunication
TwistedPorkchop Sep 28, 2023
e695653
Some changes to acomodate objects still a WIP
TwistedPorkchop Sep 28, 2023
ebfa67d
Iframe <==> debug logic
TwistedPorkchop Sep 28, 2023
ec7a2ad
[REFACTOR][/POST] Function for Posting a new post. Feedback?
TwistedPorkchop Sep 28, 2023
3b2a989
function for /anchor made, but theres no use of it so idl if it works..
TwistedPorkchop Sep 29, 2023
3e3e7e1
any post fetch requests are now handled by postRespone()
TwistedPorkchop Sep 30, 2023
3068f83
Just changed a variable name not to class with the function
TwistedPorkchop Sep 30, 2023
eb83d36
Fixed loadPosts. Maybe not the most elegant solution but it works.
TwistedPorkchop Oct 2, 2023
8e2235c
Debugger fix to wait for dom to be loaded before trying to post
TwistedPorkchop Oct 2, 2023
300dacb
Iframe overflow fixed
TwistedPorkchop Oct 3, 2023
b1e3758
Styling changed to page for pc users.
TwistedPorkchop Oct 3, 2023
ab21230
Testing a sanitizer/URL validator
TwistedPorkchop Oct 28, 2023
4292dec
Try to sanitize in iframe
TwistedPorkchop Oct 28, 2023
7ca929b
Catching an error fromtrying to parse non parsable data
TwistedPorkchop Nov 3, 2023
ade6fb1
remove log
TwistedPorkchop Nov 3, 2023
9ed9c46
Modified Left bar styling to be softer. And more apealing using anala…
TwistedPorkchop Nov 3, 2023
edbf80c
Seamless property is no longer supported on all browsers.
TwistedPorkchop Nov 3, 2023
2d9fcea
Just modified the textbox size to fit in container better. Might need…
TwistedPorkchop Nov 3, 2023
beafa8c
More colour theory aestetic changes
TwistedPorkchop Nov 3, 2023
7eca01b
After some input changed colour scheme a bit, still analagous colour.
TwistedPorkchop Nov 4, 2023
589adc4
Put the icon info in the index so that it wouldnt repeate in the iframes
TwistedPorkchop Nov 10, 2023
b3332a3
iframes baby! replaced postConstructor logic to send to iframes inclu…
TwistedPorkchop Nov 10, 2023
86b635b
Basically since I was sending the entire stylesheet as reference for …
TwistedPorkchop Nov 10, 2023
17129e2
iframe logic to send height info to parent. needs refining
TwistedPorkchop Nov 11, 2023
80cf388
iframe stylings
TwistedPorkchop Nov 11, 2023
9292d6e
Okay so a container containing the iframe now so that author and titl…
TwistedPorkchop Nov 11, 2023
d831839
seperate iframe stylings
TwistedPorkchop Nov 11, 2023
f9d2370
seperate iframe stylings
TwistedPorkchop Nov 11, 2023
a98ae9f
TODO: Fix height property thingy for iframes
TwistedPorkchop Nov 14, 2023
055dfa9
Merge pull request #1 from TwistedPorkchop/Jerome-test-branch
TwistedPorkchop Nov 14, 2023
89ed21d
Wanted to add a scrollbar gutter, won't waste more time on it.
TwistedPorkchop Nov 16, 2023
0a88f72
Stylings moved to css
TwistedPorkchop Nov 17, 2023
0d28f07
Fixed phone view. Need opinion about ratios.
TwistedPorkchop Nov 17, 2023
cfb1309
Live post Preview area, shows only on editor toggle.
TwistedPorkchop Nov 20, 2023
4ec8ced
font-size seems off 1.5 seemed rather large?
TwistedPorkchop Nov 20, 2023
59a64e0
Post preview logic works. We have live preview.
TwistedPorkchop Nov 20, 2023
df3f89d
Default logic for post preview
TwistedPorkchop Nov 21, 2023
99041b4
Replaced setHTML logic
TwistedPorkchop Nov 23, 2023
a9de41d
removed old preview button and methods calling it
TwistedPorkchop Nov 23, 2023
4a2738f
removed old preview button
TwistedPorkchop Nov 23, 2023
a332c3c
iframe sandboxing
TwistedPorkchop Nov 23, 2023
c7a0d44
Had to turn post-container into an id rather than a class for event l…
TwistedPorkchop Nov 27, 2023
3bdfe15
hide/show first icon
TwistedPorkchop Nov 27, 2023
bfca12a
post-container is now an id
TwistedPorkchop Nov 27, 2023
36d220b
Hide button and Hide button logic
TwistedPorkchop Nov 27, 2023
5d20826
Seperate class for show and hide icons
TwistedPorkchop Nov 28, 2023
2e37dd1
hide icon
TwistedPorkchop Nov 28, 2023
0c7fa75
icon change logic
TwistedPorkchop Nov 28, 2023
76e3e69
Signalling message class
TwistedPorkchop Nov 29, 2023
f155594
Basic Signalling message hiding logic
TwistedPorkchop Nov 29, 2023
e7f057d
icons folder and new verify/revoke icons
TwistedPorkchop Nov 29, 2023
28cee6d
buttonZone + small refactor for post buttons
TwistedPorkchop Nov 29, 2023
b4637a7
icons moved
TwistedPorkchop Nov 29, 2023
9baca79
ButtonZone added
TwistedPorkchop Nov 29, 2023
5159e14
Iframe post Message works now. seperation required
TwistedPorkchop Dec 5, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions icons/hide.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
8 changes: 8 additions & 0 deletions icons/revoke.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions icons/show.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions icons/verify.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 31 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<style>
body{
background-image: url('icons/icon.svg'), url('icons/icon_text.svg'), linear-gradient(to bottom right, white, rgba(23, 11, 40, 0.3));
background-position: top left, max(12%, 20em) 2%, top left;
background-size: max(9%, 10em), 40em, 130vw 130vh;
background-repeat: no-repeat, no-repeat, no-repeat;
overflow-x: hidden;
overflow-y: hidden;
}
</style>
<meta charset="UTF-8">
<title>Catalyst</title>
<link rel="icon" href="/icon.svg">
<link rel="icon" href="icons/icon.svg">
<link rel="manifest" href="/manifest.json">
<link rel="stylesheet" href="/style.css" type="text/css">
<meta name="viewport" width="device-width" initial-scale="1" interactive-widget="resizes-content">
Expand All @@ -12,12 +22,23 @@
<div class="app-container">
<div class="left-side inkwell-container">
<div id="inkwell">
<iframe src="/inkwell/inkwell.html" seamless></iframe>
<iframe src="/inkwell/inkwell.html"></iframe>
</div>
<button id="toggle-inkwell">Toggle Inkwell</button>
</div>
<div class="post-container">
<div id="post-container">
<button class="toggle-button">Toggle Post Editor</button>
<div class="post" id="stub-post">
<div id="stub-title" class="post-title">Title</div>
<div id="stub-author" class="post-author">Author</div>
<div id="stub-iframe" class="postframe" src="about:blank">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc purus tellus, tristique vel leo eget, sagittis facilisis arcu. Fusce condimentum non magna eu condimentum. Donec sodales lorem massa, dictum convallis nibh sagittis sit amet. Duis tincidunt, enim sed feugiat venenatis, lorem erat dictum eros, vitae consectetur est felis et ex. Nullam bibendum quis quam eu tempus. Nam tincidunt finibus mi sed venenatis. Donec faucibus ante sed dui iaculis finibus non nec dolor. Maecenas condimentum justo vel sapien semper, a elementum quam varius. Nulla nec libero quis mi eleifend porttitor. Maecenas convallis, turpis at aliquam tristique, neque leo pharetra dolor, non auctor odio nunc at dui.

Nunc a ultricies sapien, molestie fringilla massa. Ut eleifend dictum ex ut mattis. Nullam ac tortor pulvinar, tincidunt nulla in, posuere felis. Sed bibendum tristique felis, vitae maximus odio tempus id. Maecenas interdum odio eget sem lobortis finibus. Nam ut lacus vel neque fringilla condimentum. Sed quis tempus ipsum. Cras vel nisi id leo laoreet efficitur sed eu mauris. Cras ac felis consectetur, tempor sapien eu, efficitur sapien. Sed mattis porta ullamcorper. Integer sed iaculis nibh. Integer leo ex, tempor et porttitor eu, dictum sed arcu. Suspendisse id aliquam lorem, ac dictum sem. Praesent rhoncus mattis odio, a consectetur mi dictum a. Integer ut eleifend leo. Proin ac purus purus.

In pulvinar dapibus arcu, vitae vehicula enim volutpat in. Proin porttitor mi varius porttitor cursus. Fusce aliquam consectetur lorem, vel convallis tortor varius ut. Maecenas augue elit, commodo eget lectus at, volutpat facilisis lacus. Vestibulum dapibus, tellus quis tincidunt ullamcorper, neque sem eleifend odio, a condimentum sem mi vel magna. Vestibulum bibendum placerat consequat. Vivamus et erat eros. Vivamus eu luctus diam, id laoreet eros. Nunc ut molestie nibh. Aenean euismod quis odio vel laoreet. Vestibulum ornare turpis sit amet mi dictum, nec pulvinar diam vulputate. Phasellus mi enim, pellentesque id scelerisque ut, accumsan a nunc.
</div>
</div>
<div id="posts-start-marker"></div>
</div>
<div class="post-editor right-side hidden">
Expand All @@ -28,7 +49,6 @@
<button class="toggle-button">Hide</button>
<button class="save-button toggle-button">Post</button>
<button id="clear-button">Clear</button>
<button class="preview-button">Preview</button>
</div>
<textarea placeholder="Write your post here" id="editor-content"></textarea>
</div>
Expand All @@ -43,9 +63,14 @@
<footer>
<a href="/src" download>src</a>
<a href="/bin" download>bin</a>
<button id="debugButton">Debug</button>
<button id="eventTest">Test</button>
<div id="debug">
<iframe id="debugIframe" src="inkwell/debugger.html" width="800" height="300" ></iframe>
</div>
</footer>
</div>
<script type="module" src="/script.js"></script>
</body>
<script type="module" src="/script.js">
</script>

</html>
114 changes: 114 additions & 0 deletions inkwell/debugger.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Debugging Tools</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #cccccc75;
}

nav {
background-color: #333;
color: #fff;
padding: 10px;
}

nav ul {
list-style-type: none;
padding: 0;
}

nav li {
display: inline;
margin-right: 10px;
}

nav a {
color: #fff;
text-decoration: none;
}

section {
margin: 20px 0;
}

h2 {
border-bottom: 1px solid #ccc;
padding-bottom: 5px;
}
</style>
</head>
<body>

<section id="console">
<h2>Console</h2>
<div id="consoleOutput">
<!-- Console output will be displayed here -->
</div>
</section>


<script type="module" src="../script.js"></script>
<script>

//Im doing this for proof of concept.
//The idea bein that when a link is generated it will be sent here and added to the list.
//And later when a user tries to post, an object will be sent to compare with the whitelist and a response sent back.
const whitelist = [];

window.addEventListener("message", function(event) {
if (event.origin === 'http://localhost:8080') {
const consoleOutput = document.getElementById('consoleOutput');
const messageData = event.data;

try {
const objMsg = JSON.parse(event.data);
if (objMsg.type === 'whitelist') {
// Access the custom event object within the message

const HTMLparser = new DOMParser();
const doc = HTMLparser.parseFromString(objMsg.links, "text/html")
const aTag = doc.querySelector('a');
const attribute = aTag.getAttribute('href');
consoleOutput.innerHTML += `<p>${updateTime()} ${attribute} </p>`;
}
}catch (e) {
if (typeof messageData === 'object') {
// If the message is an object, format it with line breaks
const formattedMessage = JSON.stringify(messageData, null, 2)
.replace(/\\n/g, '<br>')
.replace(/ /g, '&nbsp;');

consoleOutput.innerHTML += `<p>${updateTime()} ${formattedMessage}</p>`;
} else {
consoleOutput.innerHTML += `<p>${updateTime()} ${messageData}</p>`;
}
}

window.parent.postMessage('Hello from Iframe!', 'http://localhost:8080');
} else {
document.getElementById('consoleOutput').innerHTML += `<p>${updateTime()} Who are you?</p>`;
}
});

function updateTime() {
var now = new Date();

var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds();

// Format the time as HH:MM:SS
var formattedTime = hours.toString().padStart(2, '0') + ':' +
minutes.toString().padStart(2, '0') + ':' +
seconds.toString().padStart(2, '0');

// Update the content of the element with ID 'timeDisplay'
return formattedTime;
}
</script>
</body>
</html>
24 changes: 18 additions & 6 deletions inkwell/inkwell.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
let uiContainer = document.getElementById('inkwell-bottle');
uiContainer.innerHTML = `<div>Welcome to the Storyweave.</div>
<label for="hostname-port"> Will you provide your own Inkwell? Your Inkwell: </label>
<input type="text" id="inkwell-configurator">
<input type="text" id="inkwell-configurator" style="width: 80vw;">
<button class="tipholder" id="generate-link">Generate Bookmarklet</button>
<div id="bookmarklet-link"></div>
<div> You may copy the id="storyweave-script" section from this page to your own pages to create an inkwell. </div>
`
}

let maybeExtant = document.getElementById("storyweave-main-container");
let storageHost = window.storageHost ? window.storageHost : window.location.host;
if (checkForParticipatingDiv() && document.getElementById("inkwell-configurator") == null) {
Expand All @@ -35,7 +35,7 @@
// need to think of a better way to secure requests.

const { action, key, value } = event.data;
//console.log(event.data);
console.log("Message Event Data", event.data);
if (action === 'set') {
localStorage.setItem(key, JSON.stringify(value));
} else if (action === 'get') {
Expand All @@ -61,8 +61,9 @@
//use some backend for signalling as fallback/bootstrap
//let the page embedding this script handle the logic
//we just listen for their responses with an eventlistener

const signalingEvent = new CustomEvent('signalingMessage', { detail: value });
window.parent.dispatchEvent(signalingEvent);
document.getElementById("inkwell").dispatchEvent(signalingEvent);
}
});

Expand Down Expand Up @@ -244,9 +245,20 @@
e.target.classList.add("sheen-effect");
switch (clickType) {
case 'autoSignaling-button':

setTimeout(function() {
console.log("autoSignaling object :", autoSignaling);
//console.log("autoSignaling object :", autoSignaling);
const signalingEvent = new CustomEvent('signalingMessage', { detail: autoSignaling });
document.getElementById("inkwell").dispatchEvent(signalingEvent);

var iframe = window.parent.document.getElementById('debugIframe');
if (iframe) {
iframe.contentWindow.postMessage(autoSignaling, '*');
} else {
console.error('Could not find iframe with id "debugIframe".');
}
}, 0);

break
case 'top-story':
case 'back-story':
Expand Down Expand Up @@ -322,7 +334,7 @@
case 'manual-router':
let signalInput = document.getElementById("manual-router");
try {
autoSignaling.sdpManual = outeSignalingMessage(JSON.parse(signalInput.value));
autoSignaling.sdpManual = routeSignalingMessage(JSON.parse(signalInput.value));
routeSignalingMessage(JSON.parse(signalInput.value));
} catch (e) {
console.info(e);
Expand Down
Loading