/* formular.js * * Diese Datei enthält Javascripte zu Formularen. */ function form_submit_check() { // Formular senden Check var form = document.getElementById("formular"); if((form.kategorie && form.kategorie.value == 0) || (form.titel && form.titel.value == "") || (form.nachricht && form.nachricht.value == "") || (form.bereich && form.bereich.value == 0) || (form.content && form.content.value == "")) { alert('Du musst alle Felder korrekt ausfuellen.'); return false; } return true; } function hidePixelgrafik() { // Pixelgrafik ausblenden this.style.backgroundImage = "url(/images/login.gif)"; } function showPixelgrafik() { // wenn nix im Feld steht Pixelgrafik wieder einblenden if(this.value == "") this.style.backgroundImage = "url(/images/login_"+this.name+".gif)"; } function initPixelgrafik(loginbox) { // wenn beim Laden der Seite schon was in den Feldern steht Pixelgrafik ausblenden if(loginbox.value != "") loginbox.style.backgroundImage = "url(/images/login.gif)"; } function users_edit_uncheck(element) { // Anderes Element der Gruppe deselecten if(element.checked == 1) { // wenn feld ausgewählt ist... var flagElement; var flag = element.value; // Flag bilden if(flag == 'g' || flag == 'G') { // DJ Teams oder GastDJs... Streamleiter und DJ deselecten... flagElement = document.getElementById('D'); if(flagElement) flagElement.checked = 0; flagElement = document.getElementById('d'); if(flagElement) flagElement.checked = 0; } else if(flag == 'd' || flag == 'D') { // Streamleiter oder DJ... DJ Teams und GastDJs deselecten... flagElement = document.getElementById('g'); if(flagElement) flagElement.checked = 0; flagElement = document.getElementById('G'); if(flagElement) flagElement.checked = 0; } else if(flag == 't' || flag == 'T') { // Technische Leitung oder Techniker... Grafiker deselecten... flagElement = document.getElementById('b'); if(flagElement) flagElement.checked = 0; } else if(flag == 'b') { // Grafiker... Technische Leitung und Techniker deselecten... flagElement = document.getElementById('T'); if(flagElement) flagElement.checked = 0; flagElement = document.getElementById('t'); if(flagElement) flagElement.checked = 0; } // flag umkehren... flag = (flag.charCodeAt(0) > 64 && flag.charCodeAt(0) < 90) ? flag.toLowerCase() : flag.toUpperCase(); flagElement = document.getElementById(flag); if(flagElement) flagElement.checked = 0; // anderes Element deselecten } } function initBewerbungsformular() { // initiiert die Javascripte für das Bewerbungsformular var posten = document.getElementById('posten'); if(posten) { posten.onchange = function() { document.getElementById('dj1').style.display = (posten.value == 'dj') ? 'table-row' : 'none'; document.getElementById('dj2').style.display = (posten.value == 'dj') ? 'table-row' : 'none'; }; if(posten.value == 'dj') { document.getElementById('dj1').style.display = 'table-row'; document.getElementById('dj2').style.display = 'table-row'; } } } function initDeleteForm() { // initiiert das Userprofillöschen Formular var delete_nein = document.getElementById("delete_nein"); if(delete_nein) { delete_nein.onclick = function() { window.history.back(1); }; } } function initNewsCheck() { // initiiert den NewsCheck var news_einleitung = document.getElementById("einleitung"); if(news_einleitung) { news_einleitung.onkeyup = function() { if(news_einleitung.value.length >= 200) { news_einleitung.disabled = true; news_einleitung.value = news_einleitung.value.substr(0, 200); news_einleitung.disabled = false; } document.getElementById("einleitung_count").value = 200-news_einleitung.value.length; }; document.getElementById("einleitung_count").value = 200-news_einleitung.value.length; } } function initProfilEditCheck() { // initiiert den NewsCheck var profil_zusatzinfo = document.getElementById("zusatzinfo"); if(profil_zusatzinfo) { profil_zusatzinfo.onkeyup = function() { if(profil_zusatzinfo.value.length >= 5000) { profil_zusatzinfo.disabled = true; profil_zusatzinfo.value = profil_zusatzinfo.value.substr(0, 5000); profil_zusatzinfo.disabled = false; } document.getElementById("zusatzinfo_count").value = 5000-profil_zusatzinfo.value.length; }; document.getElementById("zusatzinfo_count").value = 5000-profil_zusatzinfo.value.length; } } function initLoginbox() { // initiiert die Loginboxen var loginbox_username = document.getElementById("login_username"); var loginbox_password = document.getElementById("login_password"); if(loginbox_username && loginbox_password) { initPixelgrafik(loginbox_username); initPixelgrafik(loginbox_password); loginbox_username.onfocus = hidePixelgrafik; loginbox_password.onfocus = hidePixelgrafik; loginbox_username.onblur = showPixelgrafik; loginbox_password.onblur = showPixelgrafik; loginbox_username.focus(); } } /* * icq_status.js * * Copyright (c) 2007 by Szymon 'polemon' Bereziak * - for JustBase.FM webradio * * icq class and namespace definitions * * This script works in conjunction with icq.cgi, you can get that * from my site as well. * * When instanced with a UIN, the script checks what status the user * has. * * Create an instance with the form: * * new icq.Status("09001",1); * * the script checks the given UIN for its status. * First Argument is the UIN, second is how often the check should * occur. If the second argument is left out, 1 is implied. * * Your content page should have something like this: * * checking ICQ status... * * Note how the 'id' attribute is composed. The HTML object *should* * be an image-tag, howver everything else is fine, as long as you * change it every where else in this script. * * This file is distributed under MIT-License * */ // Namespace object var icq = new Object(); // Images resources icq.online = new Image(); icq.online.src = "/images/icq_online.gif"; icq.online.alt = "user is online!"; icq.unknown = new Image(); icq.unknown.src = "/images/icq_unknown.gif"; icq.unknown.alt = "unknown user status"; icq.offline = new Image(); icq.offline.src = "/images/icq_offline.gif"; icq.offline.alt = "user is offline"; icq.icqnum = 0; icq.count = 1; icq.req = null; // Constructor, will make the request on instance icq.Status = function(uin, c) { this.icqnum = uin; this.count = c || 1; // Connection setup var method = "GET"; var url = "/cgi-bin/icq.cgi?icq=" + this.icqnum; // Requires net namespace this.req = new net.GetXMLObject(); if(this.req.request) { var dies = this; this.req.request.onreadystatechange = function() { // Method has to call itself with itself as argument dies.readyStateHandler.call(dies); }; this.req.request.open(method, url, true); this.req.request.setRequestHeader("Content-type", "text/html"); this.req.request.send(null); } }; // This method is called on every state change icq.Status.prototype = { readyStateHandler:function() { var state = this.req.request.readyState; var data = null; // This checks for COMPLETE (4) state, other states are possible if(state == net.COMPLETE) { // This corresponds to the occurance of UINs in the HTML doc for(var i = 1; i <= this.count; i++) { // get current image object var icq_status = document.getElementById("icq_" + this.icqnum + "_" + i); // change image accordingly to response switch(this.req.request.responseText) { case "0": icq_status.src = icq.offline.src; icq_status.alt = icq.offline.alt; break; case "1": icq_status.src = icq.online.src; icq_status.alt = icq.online.alt; break; case "2": icq_status.src = icq.unknown.src; icq_status.alt = icq.unknown.alt; break; } } } } }; /* * interxml.js * * Copyright (c) 2007-2008 by Szymon 'polemon' Bereziak * - for JustBase.FM webradio * * This file provides the xml class definition, for the 'xml' namespace * that returns an Ajax request as XML-Object. * * Usage: * * var reqobj = new xml.InterXml(, , []); * * First and second parameter is required. * If no parameter is given, the request is performed as * a simple HTTP GET request, an HTTP POST is performed if there is * any data supplied. * * Context is always the XML-Object itself, you can access the content * of the responce with 'this.responseText', for instace. * * This file is distributed under MIT-License * */ /* --- GetXMLObjekt -------------- */ // Namespace object for XMLHttpRequests var net = new Object(); // Friendly names for return states net.UNINITIALIZED = 0; net.LOADING = 1; net.LOADED = 2; net.INTERACTIVE = 3; net.COMPLETE = 4; // container for the XMLHttpRequest objekt net.request = null; // GetXMLObjekt class - creates the XMLHttpRequest objekt net.GetXMLObject = function() { if(window.XMLHttpRequest) this.request = new XMLHttpRequest(); else if(typeof ActiveXObject != "undefined") this.request = new ActiveXObject("Microsoft.XMLHTTP"); }; /* --- XML retrieve -------------- */ // Namesspace objekt for XML retrieve var xml = new Object(); // xml Properties xml.url = ""; xml.callback = null; xml.postdata = null; // Request container xml.req = null; // Construktor - c_target is the targeted callback function xml.InterXml = function(url, c_target, post_params) { this.url = url; this.callback = c_target; this.postdata = (post_params) ? post_params.toString() : null; // Stringify params this.loadXml(url); }; // InterXml.loadXml() - Method for loading an XML structure xml.InterXml.prototype = { loadXml:function(url) { this.req = new net.GetXMLObject(); if(this.req.request) { var method = (this.postdata != null) ? 'POST' : 'GET'; // Objekt copy var retobj = this; this.req.request.onreadystatechange = function() { // Callback handler gives itself to its own handler retobj.returnCall.call(retobj); }; this.req.request.open(method, this.url, true); this.req.request.send(this.postdata); } }, // Callback handler - calls defined function returnCall:function() { var state = this.req.request.readyState; // Do on COMPLETE, can be anything else, though if(state == net.COMPLETE) { var retr = this.req.request; var HTTPret = retr.status; if(HTTPret == 200 || HTTPret == 0) // Callback in XMLHttpRequest context this.callback.call(retr); else { // alert("ERROR AT XML REQUEST\nHTTP: " + HTTPret // + "\nSTATE: " + state // + "\nURL: " + this.url // + "\nCALLBACK: " + this.callback // + "\nHeaders: " + this.req.request.getAllResponseHeaders()); } } } }; /* main.js * * Diese Datei enthält allgemeine Javascripte. * */ function externalLinks() { // öffnet externe links in einem neuen Fenster/Tab var anchors = document.getElementsByTagName('a'); for(var i = 0; i < anchors.length; i++) if(anchors[i].getAttribute('href') && anchors[i].getAttribute('rel') == 'external') anchors[i].target = '_blank'; anchors = document.getElementsByTagName('area'); for(i = 0; i < anchors.length; i++) if(anchors[i].getAttribute('href') && anchors[i].getAttribute('class') == 'external') anchors[i].target = '_blank'; } function replaceDot(fieldName) { // ersetzt in Element mit ID fildName . gegen , document.getElementById(fieldName).value = document.getElementById(fieldName).value.split(',').join('.'); } function popup(url) { // Popup ofennen var popup_name = "jb_popup"; var popup_definitionen = "toolbar=no,location=no,status=no,menubar=no,width=800,height=450,scrollbars=yes"; window.open(url, popup_name, popup_definitionen); } function openFlashPlayer(url) { // öffnet den Flashplayer in einem Popup window.open(url, 'jb_flashplayer', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=no,width=470,height=77'); } function link_action_confirm(msg, link_true) { // Linkaction Bestätigung if(confirm(msg)) window.location.href = link_true; } function generateCode(modul, element) { var code = ''; if(modul == 'linkus') code = 'JustBase.FM - The Area Of Sound'; else if(modul == 'streambox') { var style = element.value; code = "\n"; code += "\n"; document.getElementById('sb_preview').innerHTML = code; } document.getElementById('generatedCode').value = code; } function galerie_seitenwechsel(seite) { var prev = location.hash.slice(1); // get previous box id if(prev == '') // try to get page from normal url, if it is present... if((found = location.href.match(/\/(\d+)\/?$/)) != null) prev = 'gal_seite' + found[1]; if(prev == '') // set previous box id to box 1 if empty... prev = 'gal_seite1'; document.getElementById(prev).style.display = 'none'; // hide previous box document.getElementById('gal_seite' + seite).style.display = ''; // make next box visible var prev_element = document.getElementById('page_' + prev); // get element of previous page label var prev_content = prev_element.firstChild; // get content of previous page label // create link for previous page label... var link = document.createElement('a'); link.href = '#' + prev; link.onclick = function(e) { galerie_seitenwechsel(prev_content.nodeValue); }; link.appendChild(document.createTextNode(prev_content.nodeValue)); prev_element.replaceChild(link, prev_content); // replace content of prevoius page label with link var cur_element = document.getElementById('page_gal_seite' + seite); // get element of current page label var cur_content = cur_element.firstChild; // get content of current page label cur_element.replaceChild(document.createTextNode(cur_content.firstChild.nodeValue), cur_content); // replace content of current page label with tex } function umfrage(umfrageid) { var umfrage = document.getElementById("umfrage_"+umfrageid).style; if(umfrage.display == "none") umfrage.display = "inline"; else if(umfrage.display == "inline") umfrage.display = "none"; } function loadCSS(cssfile) { // loads the style css file // create css link tag with selected style and add it to the document... var styletag = document.createElement('link'); styletag.type = 'text/css'; styletag.rel = 'stylesheet'; styletag.media = 'all'; styletag.href = cssfile; document.getElementsByTagName('head').item(0).appendChild(styletag); } window.onload = function() { // onLoad Funktionen initLoginbox(); // initiiert die Loginboxen externalLinks(); // ermoeglicht externe Links icq_status(); // ICQ-Status ermitteln und anzeigen initDeleteForm(); // initiiert die Callbacks für das Useraccountlöschen Formular initNewsCheck(); // initiiert den NewsChecker initProfilEditCheck(); // initiiert den ProfilEditCheck initBewerbungsformular(); // initiiert die JavaScripte für das Bewerbungsformular init_schedule(); // Nächste-shows Subsystem init_nowplaying(); // Now-Playing Subsystem init_trackupdate(); // TrackUpdate Subsystem init_user(); // User-Online Subsystem init_stats(); // Statistik Subsystem load_voteus(); // Voteus-Bilder Subsystem // shit_load(); // Werbeflashbanner laden }; /* * nowplaying.js * * Copyright (c) 2007-2008 by Szymon 'polemon' Bereziak * - for JustBase.FM webradio * * This subsystem loads and refreshes the current DJ display. * * Requires interxml.js as well as a backend to retreive an XML structure from. * * HTML element is expected to be some sort of box element, with the id "on_air". * * This is how the XML structure should look, any of this is optional, except * the root element: * * * DJ BuZZ-dEE * images/buzzdees_pic.jpg * BuZZ-dEEs huppy tiem * * 13:50h * 900 * * * The link attribute in , and are optional; they should point * to a page with info about the DJ. * The content of should point to a picture of said DJ. * should contain a description of the DJs show, this tag accepts any HTML * substructure. This MIGHT pose a security risc, when a