Now a Chrome app
This commit is contained in:
parent
2a0c9231d7
commit
3c698cf678
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"appName": {
|
||||
"message": "wIRC Chat Client",
|
||||
"description": "Application name"
|
||||
},
|
||||
"appShortName": {
|
||||
"message": "wIRC",
|
||||
"description": "Short application name"
|
||||
},
|
||||
"appDesc": {
|
||||
"message": "Chat client for the wIRC bouncer thingamajiggy",
|
||||
"description": "Application description for app store listing"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
chrome.app.runtime.onLaunched.addListener(function() {
|
||||
chrome.app.window.create('wirc.html', {
|
||||
'state': 'normal'
|
||||
})
|
||||
})
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"manifest_version": 2,
|
||||
"version": "1.0.0",
|
||||
|
||||
"name": "__MSG_appName__",
|
||||
"short_name": "__MSG_appShortName__",
|
||||
"description": "__MSG_appDesc__",
|
||||
"author": "Neale Pickett <neale@woozle.org>",
|
||||
"icons": {"128": "wirc.png"},
|
||||
"app": {
|
||||
"background": {
|
||||
"scripts": ["background.js"]
|
||||
}
|
||||
},
|
||||
"permissions": [
|
||||
"storage",
|
||||
"fileSystem",
|
||||
"https://woozle.org/"
|
||||
],
|
||||
"default_locale": "en"
|
||||
}
|
|
@ -2,9 +2,9 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>#tron</title>
|
||||
<link rel="icon" type="image/png" sizes="64x64" href="chat.png">
|
||||
<script type="application/javascript" src="wirc.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="wirc.css">
|
||||
<link rel="icon" href="wirc.png">
|
||||
<link rel="stylesheet" href="wirc.css">
|
||||
<script src="wirc.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="foraButtons"></div>
|
||||
|
@ -14,7 +14,7 @@
|
|||
<input type="hidden" name="auth" value="" id="authtok">
|
||||
<input type="hidden" name="type" value="command">
|
||||
<input type="hidden" name="target" id="target">
|
||||
<input name="text" autofocus>
|
||||
<input name="text" id="text" autofocus>
|
||||
<input type="Submit" value="Send">
|
||||
</form>
|
||||
<div id="kiboze"></div>
|
|
@ -4,6 +4,12 @@ var urlRe = /[a-z]+:\/\/[^ ]*/;
|
|||
|
||||
var nick = "Mme. M";
|
||||
|
||||
if (String.prototype.startsWith == null) {
|
||||
String.prototype.startsWith = function(needle) {
|
||||
return this.lastIndexOf(needle, 0) == 0;
|
||||
}
|
||||
}
|
||||
|
||||
function isinView(oObject) {
|
||||
return (oObject.offsetParent.clientHeight <= oObject.offsetTop);
|
||||
}
|
||||
|
@ -13,7 +19,6 @@ function selectForum(fe) {
|
|||
|
||||
for (i = 0; i < kids.length; i += 1) {
|
||||
e = kids[i];
|
||||
console.log(i, e);
|
||||
if (e == fe) {
|
||||
e.style.display = "block";
|
||||
} else {
|
||||
|
@ -166,12 +171,21 @@ function newmsg(event) {
|
|||
}
|
||||
|
||||
function handleCommand(event) {
|
||||
window.evt = event;
|
||||
var oReq = new XMLHttpRequest();
|
||||
function reqListener() {
|
||||
}
|
||||
|
||||
var txt = document.getElementById("text").value;
|
||||
if (txt.startsWith("/connect ")) {
|
||||
// XXX: should allow tokens with spaces
|
||||
var parts = txt.split(" ");
|
||||
|
||||
connect(parts[1], parts[2], parts[3]);
|
||||
return;
|
||||
}
|
||||
|
||||
oReq.onload = reqListener;
|
||||
oReq.open("POST", "wirc.cgi", true);
|
||||
oReq.open("POST", window.postURL, true);
|
||||
oReq.send(new FormData(event.target));
|
||||
|
||||
event.target.reset();
|
||||
|
@ -179,14 +193,16 @@ function handleCommand(event) {
|
|||
return false;
|
||||
}
|
||||
|
||||
function init() {
|
||||
var server = document.getElementById("server").value;
|
||||
var authtok = prompt("Auth token", "");
|
||||
function connect(url, server, authtok) {
|
||||
window.postURL = url;
|
||||
document.getElementById("server").value = server;
|
||||
document.getElementById("authtok").value = authtok;
|
||||
|
||||
var source = new EventSource("wirc.cgi?server=" + server + "&auth=" + authtok);
|
||||
var pullURL = url + "?server=" + server + "&auth=" + authtok
|
||||
var source = new EventSource(pullURL);
|
||||
source.onmessage = newmsg;
|
||||
}
|
||||
|
||||
function init() {
|
||||
document.getElementById("command").onsubmit = handleCommand;
|
||||
}
|
||||
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
Loading…
Reference in New Issue