Commit 32151305 authored by Michael Murtaugh's avatar Michael Murtaugh

added kiwi client plugin

parent a25f934b
<style>
.collagespace {
border: none;
width: 100%;
height: 100%;
background: #AAA;
text-align: center;
position: relative;
}
.collagespace .layer {
position: absolute;
}
.collagespace .text .message {
font-family: monospace;
}
.collagespace .text {
z-index: 1;
}
.collagespace .image {
z-index: 2;
}
.collagespace .media {
z-index: 3;
}
.holotextbg {
position: absolute;
left: 0; top: 0;
width: 100%;
height: 100%;
}
.holotextbg img {
width: 100%;
}
.holotextbg video {
width: 100%;
}
.holotextbg audio {
width: 100%;
}
div.container1 {
position: absolute;
z-index: 1;
width: 100%;
}
.controlbox {
z-index: 1000;
}
</style>
<script>
(function () {
var bg = $("<div></div>")
.attr("class", "holotextbg")
.appendTo("div.panels"),
image_layer = $("<div></div>")
.attr("class", "image")
.appendTo(bg),
video_layer = $("<div></div>")
.attr("class", "video")
.appendTo(bg),
audio_layer = $("<div></div>")
.attr("class", "audio")
.appendTo(bg),
net = kiwi.components.Network(),
input = kiwi.components.ControlInput(),
hold_image = false,
hold_audio = false,
hold_video = false;
// Do our magic on any incoming message
net.on('message', function (event) {
if (event.type == "message") {
// console.log("message", event);
do_message(event.msg, event.nick);
}
});
input.on("command:msg", function (event) {
if (event.command == "msg") {
// console.log("command:msg", event);
var msg = event.params.join(" ");
do_message(msg);
}
});
function do_image (url) {
// this.$image_layer.text("");
if (!hold_image) { image_layer.text(""); }
var img = $("<img />").attr("src", url).appendTo(image_layer);
// $("<button>close</button>").click(function () {
// img.remove(); this.remove();
// }).appendTo(bg);
}
function do_audio (url) {
if (!hold_audio) { audio_layer.text(""); }
var audio= $("<audio autoplay />").attr("src", url).appendTo(audio_layer);
audio.on("ended", function () {
audio.remove();
});
// $("<button>close</button>").click(function () {
// audio.remove(); this.remove();
// }).appendTo(bg);
}
function do_video (url) {
if (!hold_video) { video_layer.text(""); }
var video = $("<video autoplay />").attr("src", url).appendTo(video_layer);
video.on("ended", function () {
video.remove();
});
}
function do_message (msg, nick) {
/* LOOK FOR CANVAS COMMANDS */
var m;
if (m = msg.match(/^pause (video|audio)/i)) {
if (m[1] == "video") {
$("video", bg).each(function () { this.pause(); });
} else if (m[1] == "audio") {
$("audio", bg).each(function () { this.pause(); });
}
} else if (m = msg.match(/^play (video|audio)/i)) {
if (m[1] == "video") {
$("video", bg).each(function () { this.play(); });
} else if (m[1] == "audio") {
$("audio", bg).each(function () { this.play(); });
}
} else if (m = msg.match(/^clear (video|audio|image)/i)) {
if (m[1] == "video") {
$("video", bg).remove();
hold_video = false;
} else if (m[1] == "audio") {
$("audio", bg).remove();
hold_audio = false;
} else if (m[1] == "image") {
$("img", bg).remove();
hold_image = false;
}
} else if (m = msg.match(/^hold (video|audio|image)/i)) {
if (m[1] == "video") {
hold_video = true;
} else if (m[1] == "audio") {
hold_audio = true;
} else if (m[1] == "image") {
hold_image = true;
}
}
/* LOOK FOR URLs */
var urls = msg.match(/https?:\/\/\S+/g);
if (urls != null) {
urls.forEach(function (url) {
if (url.match(/\.(png|gif|jpg|jpeg|svg)$/i)) {
do_image(url);
} else if (url.match(/\.(ogg|mp3|wav)$/i)) {
do_audio(url);
} else if (url.match(/\.(ogv|webm|mp4)$/i)) {
do_video(url);
}
});
}
}
if (window.location.hostname == "bot.activearchives.org") {
// Event fired after all plugins are loaded and Kiwi is ready
// AUTO LOGIN AS constantvitrine
kiwi.events.on('loaded', function() {
// console.log("kiwi.loaded!");
var nick = "vitrine_";
for (var i=0; i<5; i++) {
nick = nick+Math.floor(Math.random()*10);
}
$("#server_select_nick").val(nick);
$("#server_select_channel").val("#botopera");
$('.server_details .start button').click();
});
window.setInterval(function () {
$("textarea.inp").focus();
var s = $(".panel_container");
if (s.length) {
s = s.get(0);
s.scrollTop = s.scrollTopMax; }
var tabs = $("ul.panellist li");
if (tabs.length >= 2) {
var tab = $(tabs.get(1));
if (!tab.is(".active")) { tab.click(); }
}
}, 2000);
}
})();
</script>
\ No newline at end of file
here, the kiwi client plugin for botopera
see http://kiwiirc.com
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment