PirateBoxScripts_Webserver/piratebox/piratebox/www/scripts.js

54 lines
1.2 KiB
JavaScript
Raw Normal View History

$(document).ready(function() {
// do stuff when DOM is ready
$.get('forum.html', function(data) {
$('div#forum_link').html(data);
});
$.get('forban_link.html', function(data) {
$('div#forban_link').html(data);
});
2013-05-23 08:52:26 +02:00
$.get('station_cnt.txt', function(data) {
$('div#station').html(data);
});
$('div#shoutbox').ajaxError(function() {
$(this).text( "Triggered ajaxError handler on shoutbox" );
});
$("#sb_form").submit(function(event) {
/* stop form from submitting normally */
event.preventDefault();
post_shoutbox();
});
display_shoutbox();
2013-05-23 08:52:26 +02:00
});
function refresh_shoutbox () {
$.get('chat_content.html', function(data) {
$('div#shoutbox').html(data);
});
2013-05-23 08:52:26 +02:00
}
2013-05-23 08:52:26 +02:00
function refresh_time_sb () {
// Refresh rate in milli seconds
mytime=setTimeout('display_shoutbox()', 10000);
2013-05-23 08:52:26 +02:00
}
function post_shoutbox () {
$.post("/cgi-bin/psowrte.py" , $("#sb_form").serialize())
.success(function() {
refresh_shoutbox();
});
$('#shoutbox_message').val('');
2013-05-23 08:52:26 +02:00
}
function display_shoutbox() {
refresh_shoutbox();
refresh_time_sb();
}
function fnGetDomain(url) {
return url.match(/:\/\/(.[^/]+)/)[1];
}