-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomlink.html
91 lines (81 loc) · 4.53 KB
/
comlink.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;700&display=swap" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="https://unpkg.com/augmented-ui@2/augmented-ui.min.css">
<link rel="stylesheet" href="comlink.css">
<title>Shadowrun Comlink</title>
<script src="https://code.jquery.com/jquery-3.1.1.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/markdown-it/12.2.0/markdown-it.min.js"></script>
<script src="comlink.js"></script>
</head>
<body>
<!-- Sidebar -->
<div class="sidebar" data-augmented-ui="border tl-clip br-clip">
<h2>Create Message</h2>
<label for="alias-input">User:</label>
<input type="text" id="alias-input" placeholder="Enter Alias">
<label for="profile-pic-input">Profile Picture:</label>
<input type="file" id="profile-pic-input" accept="image/*">
<button id="add-user-btn">Add User</button>
<div class="user-selection">
<label for="alias-select">Alias:</label>
<select id="alias-select">
<option value="">Select User...</option>
<option value="Admin">Admin</option> <!-- Add Admin as an option -->
</select>
<button id="delete-user-btn" class="user-delete-btn">x</button>
</div>
<label for="alignment-select">Message Alignment:</label>
<select id="alignment-select">
<option value="left">Left</option>
<option value="right">Right</option>
</select>
<label for="message-input">Message:</label>
<textarea name="content" class="editor" data-editor></textarea>
<!--- <label for="timestamp-input">Date & Time:</label> --->
<!--- <input type="text" id="timestamp-input" placeholder="yyyy-mm-dd hh:mm:ss"> --->
<button id="send-message-btn">Send Message</button>
</div>
<!-- Main content area -->
<div class="comlink-container" data-augmented-ui="tl-clip tr-clip br-clip bl-clip border">
<!-- Your message content -->
</div>
<script>
// Your existing JavaScript code for the Shadowrun Comlink project
</script>
<script>
$(document).on("mousedown", "[data-bbcode]", function() {
var editor = $("." + $(this).parent(".btn-group").parent(".editor-buttons").attr("data-parent"));
var str = $(editor).val();
var selection = getInputSelection($(editor));
if (selection.length > 0) {
$(editor).val(str.replace(selection, "[" + $(this).attr("data-bbcode") + "]" + selection + "[/" + $(this).attr("data-bbcode") + "]"));
} else {
$(editor).val(str + "[" + $(this).attr("data-bbcode") + "]" + "[/" + $(this).attr("data-bbcode") + "]");
}
});
$(document).ready(function() {
var editors = $("[data-editor]");
$(editors).each(function(i, el) {
var buttons = '<div class="editor-buttons btn-toolbar" data-parent="editor-' + i + '"><div class="btn-group mr-2"><button type="button" class="btn btn-dark" data-bbcode="b"><i class="fa fa-bold"></i></button><button type="button" class="btn btn-dark" data-bbcode="i"><i class="fa fa-italic"></i></button><button type="button" class="btn btn-dark" data-bbcode="u"><i class="fa fa-underline"></i></button></div><div class="btn-group mr-2"><button type="button" class="btn btn-dark" data-bbcode="left"><i class="fa fa-align-left"></i></button><button type="button" class="btn btn-dark" data-bbcode="center"><i class="fa fa-align-center"></i></button><button type="button" class="btn btn-dark" data-bbcode="right"><i class="fa fa-align-right"></i></button></div><div class="btn-group mr-2"><button type="button" class="btn btn-dark" data-bbcode="img"><i class="fa fa-picture-o"></i></button></div></div>';
$(el).before(buttons);
$(el).addClass("editor-" + i);
});
});
function getInputSelection(elem) {
if (typeof elem != "undefined") {
s = elem[0].selectionStart;
e = elem[0].selectionEnd;
return elem.val().substring(s, e);
} else {
return '';
}
}
</script>
</body>
</html>