Deletes 5 year old, unused JQuery code.

It seems like the developer planned to do something with it, but never did. Removing it seems like the only reasonable action.
This commit is contained in:
Meerkov
2018-04-17 16:14:35 -07:00
parent 64b98a84f5
commit 72baafe4f2
6 changed files with 0 additions and 9775 deletions

View File

@@ -1,100 +0,0 @@
<html>
<head>
<title>Tail-based by Web Sockets</title>
<link href="css/core.css" media="all" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="js/observable.js"></script>
<script type="text/javascript" src="js/socket.js"></script>
<script type='text/javascript' src="js/main.js"></script>
</head>
<body>
<div class="wrap">
<div class="title">
<span>Your server: <b>ws://</b></span>
<input id="ws_uri" type="text" value="localhost:81/" name="uri"/>
<button id="connect" name="connect" class="cn">Connect</button>
<button id="disconn" name="disconn" class="dc" disabled="disabled">Disconnect</button>
</div>
<ul class="messages" id='messages'></ul>
<div class="packets" id='input'>
<span>Raw text to send:</span>
<input type="text" name="packet" value="" />
<button id="send" class="send">Send</button>
</div>
</div>
<script type="text/javascript">
if (!window.WebSocket)
alert("WebSocket not supported by this browser");
var server = Socket();
var listener = {
onOpen : function() {
$('#input').slideDown();
},
onMessage : function(m) {
if (m.data) {
addLi("incoming", m.data);
}
},
onClose : function(m) {
addLi("error", "Connection was closed (" + m.code + "): " + m.reason);
onDisconnectClicked();
$('#input').fadeOut();
}
};
server.addObserver(listener);
function addLi(className, text) {
var spanText = document.createElement('li');
spanText.className = className;
spanText.innerHTML = text;
var messageBox = $('#messages')[0];
messageBox.appendChild(spanText);
messageBox.scrollTop = messageBox.scrollHeight - messageBox.clientHeight;
}
function onConnectClicked() {
var uri = $("#ws_uri").val()
addLi("connecting", "Connecting to ws://" + uri + " ..." )
server.connect(uri);
$('#connect').attr("disabled", "disabled")
$('#disconn').removeAttr("disabled")
}
function onDisconnectClicked() {
server.close();
$('#disconn').attr("disabled", "disabled")
$('#connect').removeAttr("disabled")
}
function onSendClicked() {
var toSend = $("#input input").val();
$("#input input").val("");
addLi("outcoming", toSend);
server.send(toSend)
}
function onInputKey(event) {
if( event.keyCode == 13 )
onSendClicked();
}
function onReady() {
$('#connect').on("click", onConnectClicked);
$('#disconn').on("click", onDisconnectClicked);
$('#send').on("click", onSendClicked);
$("#input input").on("keypress", onInputKey);
}
$(onReady)
</script>
</body>
</html>

View File

@@ -1,23 +0,0 @@
ul, ol { margin: 0; }
div { border: 0px solid black; }
div.wrap { width: 640px; margin: 100px auto;}
.title { height: 24px; background-color: #ddd; padding: 4px; border: 1px solid black; border-bottom: 0px }
.title input {width: 300px; }
.title span { display: inline-block; width: 120px; text-align: right; }
.messages { height: 30ex; overflow: auto; background-color: #fff; padding: 4px; border: 1px solid black; list-style: none; }
.messages .incoming { color: #006; }
.messages .incoming:before { content: "<< "}
.messages .outcoming { color: #060; }
.messages .outcoming:before { content: ">> "}
.messages .error { color: #600; }
.messages li:nth-child(2n) { background-color: #f7f7f7; }
.packets { padding: 4px; background-color: #ddd; border: 1px solid black; border-top: 0px; display: none; }
.packets span { display: inline-block; width: 120px; text-align: right; }
.packets input {width: 400px; }
.packets button { width: 100px; }
span.alert { font-style: italic; }

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -1,23 +0,0 @@
var Observable = function(eventNames) {
var _t = {};
var observers = {};
_t.addObserver = function(obj) {
for(var i = 0; i < eventNames.length; i++) {
var evName = eventNames[i]
var method = obj["on" + evName];
if( typeof(method) === 'function') {
var handlers = observers[evName]
if( 'undefined' === typeof(handler))
handlers = observers[evName] = [];
handlers.push(obj);
}
}
}
_t.fireEvent = function() { // usually invoked as .apply(EventName, args)
var q = observers[this]
if ( q ) for( var i = 0; i < q.length; i++ ) q[i]['on'+ this].apply(q[i], arguments);
}
return _t;
}

View File

@@ -1,27 +0,0 @@
// There should be some kind of fallback to Flash-powered sockets (IE 9-, Opera with sockets switched off)
var Socket = function() {
var _t = Observable(["Open", "Message", "Close", "Error"]);
function onOpen() { _t.fireEvent.apply("Open", arguments); }
function onClose() { _t.fireEvent.apply("Close", arguments); }
function onError() { _t.fireEvent.apply("Error", arguments); }
function onMessage() { _t.fireEvent.apply("Message", arguments); }
var ws;
_t.connect = function(location) {
ws = new WebSocket("ws://" + location);
ws.onopen = onOpen;
ws.onmessage = onMessage;
ws.onclose = onClose;
ws.onerror = onError;
}
// _t.getWs = function() { return ws; }
_t.isOpen = function() { return ws && ws.readyState == ws.OPEN; }
_t.close = function() { ws && ws.close(); }
_t.send = function(text) { text != null && text.length > 0 && ws && ws.send(text); };
return _t;
};