sync/www/assets/js/client.js

689 lines
21 KiB
JavaScript
Raw Normal View History

2013-03-24 02:28:20 +00:00
/*
The MIT License (MIT)
Copyright (c) 2013 Calvin Montgomery
2013-03-24 02:28:20 +00:00
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
2013-03-24 02:28:20 +00:00
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
2013-03-24 02:28:20 +00:00
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
2013-02-16 17:19:59 +00:00
var socket;
2013-02-16 05:02:42 +00:00
var LEADER = false;
2013-05-14 15:19:03 +00:00
var PLAYER = new Media();
var MEDIATYPE = "null";
2013-02-16 05:02:42 +00:00
var POSITION = -1;
2013-05-22 19:38:16 +00:00
var RANK = -1;
2013-03-16 20:39:58 +00:00
var OPENQUEUE = false;
var CHANNELOPTS = {};
2013-05-22 19:38:16 +00:00
var CHANPERMS = {};
var GRABBEDLI = null;
var OLDINDEX = -1;
2013-03-29 18:15:46 +00:00
var CHATHIST = [];
var CHATHISTIDX = 0;
var FOCUSED = true;
var SCROLLCHAT = true;
2013-05-09 21:59:02 +00:00
var LASTCHATNAME = "";
var LASTCHATTIME = 0;
var PAGETITLE = "Sync";
var TITLE_BLINK;
var VWIDTH = $("#ytapiplayer").parent().css("width").replace("px", "");//670
2013-05-13 01:15:05 +00:00
var VHEIGHT = ""+parseInt(parseInt(VWIDTH) * 9 / 16);
$("#messagebuffer").css("height", (VHEIGHT - 31) + "px");
$("#userlist").css("height", (VHEIGHT - 31) + "px");
var IGNORED = [];
2013-04-14 17:38:00 +00:00
var KICKED = false;
var CHANNEL = "";
2013-05-06 16:24:55 +00:00
var CUSTOMJS = "";
var uname = readCookie("sync_uname");
var session = readCookie("sync_session");
2013-05-12 20:15:39 +00:00
var PROFILE = {
image: "",
text: ""
2013-05-12 20:15:39 +00:00
};
2013-04-28 22:36:06 +00:00
function parseBool(x) {
if(typeof x == "boolean")
return x;
else if(x == "true")
return true;
else if(x == "false")
return false;
else return Boolean(x);
}
2013-05-03 03:02:25 +00:00
function getOrDefault(cookie, def) {
var cook = readCookie(cookie);
if(cook === null) {
return def;
}
return cook;
}
2013-04-28 17:57:08 +00:00
var USEROPTS = {
2013-05-03 03:02:25 +00:00
theme : getOrDefault("cytube_theme", "default"),
css : getOrDefault("cytube_css", ""),
layout : getOrDefault("cytube_layout", "default"),
synch : parseBool(getOrDefault("cytube_synch", true)),
hidevid : parseBool(getOrDefault("cytube_hidevid", false)),
show_timestamps : parseBool(getOrDefault("cytube_show_timestamps", false)),
modhat : parseBool(getOrDefault("cytube_modhat", false)),
2013-05-10 20:31:04 +00:00
blink_title : parseBool(getOrDefault("cytube_blink_title", false)),
2013-05-17 15:23:11 +00:00
sync_accuracy : parseFloat(getOrDefault("cytube_sync_accuracy", 2)) || 2,
chatbtn : parseBool(getOrDefault("cytube_chatbtn", false))
2013-04-28 17:57:08 +00:00
};
applyOpts();
$("#optlink").click(showUserOpts);
2013-04-30 16:13:06 +00:00
$("#sitefooter").load("footer.html");
2013-02-16 05:02:42 +00:00
var Rank = {
Guest: 0,
Member: 1,
Moderator: 2,
Owner: 3,
2013-02-16 05:02:42 +00:00
Siteadmin: 255
};
$(window).focus(function() {
FOCUSED = true;
onWindowFocus();
})
.blur(function() {
FOCUSED = false;
});
$(window).resize(function() {
VWIDTH = $("#ytapiplayer").parent().css("width").replace("px", "");
2013-05-13 01:15:05 +00:00
var VHEIGHT = ""+parseInt(parseInt(VWIDTH) * 9 / 16);
$("#messagebuffer").css("height", (VHEIGHT - 31) + "px");
$("#userlist").css("height", (VHEIGHT - 31) + "px");
$("#ytapiplayer").attr("width", VWIDTH);
2013-05-13 01:15:05 +00:00
$("#ytapiplayer").attr("height", VHEIGHT);
});
// Match URLs of the form http://site.tld/r/channel
var loc = document.location+"";
2013-05-11 19:21:14 +00:00
var m = loc.match(/\/r\/([a-zA-Z0-9-_]+)$/);
if(m) {
CHANNEL = m[1];
2013-02-16 05:02:42 +00:00
}
else {
var main = $($(".container")[1]);
var container = $("<div/>").addClass("container").insertBefore(main);
var row = $("<div/>").addClass("row").appendTo(container);
var div = $("<div/>").addClass("span6").appendTo(row);
main.css("display", "none");
var label = $("<label/>").text("Enter Channel:").appendTo(div);
var entry = $("<input/>").attr("type", "text").appendTo(div);
entry.keydown(function(ev) {
var host = ""+document.location;
host = host.replace("http://", "");
host = host.substring(0, host.indexOf("/"));
if(ev.keyCode == 13) {
document.location = "http://" + host + "/r/" + entry.val();
socket.emit("joinChannel", {
name: entry.val()
});
container.remove();
main.css("display", "");
}
});
2013-03-20 23:10:23 +00:00
}
2013-02-16 05:02:42 +00:00
// Load the youtube iframe API
2013-05-14 15:19:03 +00:00
if(!USEROPTS.hidevid) {
var tag = document.createElement("script");
tag.src = "http://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName("script")[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
}
2013-02-16 05:02:42 +00:00
var sendVideoUpdate = function() { }
setInterval(function() {
sendVideoUpdate();
}, 5000);
function queueEnd() {
var urls = $("#mediaurl").val().split(",");
for(var i = 0; i < urls.length; i++) {
if(!urls[i].trim())
continue;
var parsed = parseVideoURL(urls[i].trim());
var id = parsed[0];
var type = parsed[1];
if(id) {
$("#mediaurl").val("");
}
socket.emit("queue", {
id: id,
pos: "end",
type: type
});
2013-02-16 05:02:42 +00:00
}
}
$("#queue_end").click(queueEnd);
$("#mediaurl").keydown(function(ev) {
if(ev.keyCode == 13) {
queueEnd();
}
2013-02-16 05:02:42 +00:00
});
$("#queue_next").click(function() {
var urls = $("#mediaurl").val().split(",");
for(var i = 0; i < urls.length; i++) {
if(!urls[i].trim())
continue;
var parsed = parseVideoURL(urls[i].trim());
var id = parsed[0];
var type = parsed[1];
if(id) {
$("#mediaurl").val("");
}
socket.emit("queue", {
id: id,
pos: "next",
type: type
});
2013-02-16 05:02:42 +00:00
}
});
$("#play_next").click(function() {
socket.emit("playNext");
2013-02-16 05:02:42 +00:00
});
2013-04-02 19:07:22 +00:00
$("#voteskip").click(function() {
socket.emit("voteskip");
$("#voteskip").attr("disabled", true);
});
$("#qlockbtn").click(function() {
socket.emit("queueLock", {
2013-03-16 20:39:58 +00:00
locked: OPENQUEUE
});
});
$("#login").click(showLoginFrame);
2013-02-16 05:02:42 +00:00
function guestLogin() {
uname = $("#guestname").val();
socket.emit("login", {
name: $("#guestname").val()
});
}
$("#guestlogin").click(guestLogin);
$("#guestname").keydown(function(ev) {
if(ev.keyCode == 13) {
guestLogin();
}
});
$("#logout").click(function() {
eraseCookie("sync_uname");
eraseCookie("sync_session");
2013-02-16 05:02:42 +00:00
document.location.reload(true);
});
2013-04-01 01:29:39 +00:00
$("#chatline").keydown(function(ev) {
if(ev.keyCode == 13 && $("#chatline").val() != "") {
if($("#chatline").val().trim() == "/poll") {
newPollMenu();
$("#chatline").val("");
}
else {
2013-04-28 17:57:08 +00:00
var msg = $("#chatline").val();
2013-04-29 16:08:06 +00:00
if(USEROPTS.modhat && RANK >= Rank.Moderator) {
2013-04-28 17:57:08 +00:00
msg = "/m " + msg
}
socket.emit("chatMsg", {
2013-04-28 17:57:08 +00:00
msg: msg
});
}
2013-04-01 01:29:39 +00:00
CHATHIST.push($("#chatline").val());
if(CHATHIST.length > 10)
CHATHIST.shift();
CHATHISTIDX = CHATHIST.length;
$("#chatline").val("");
}
else if(ev.keyCode == 9) { // Tab completion
var words = $("#chatline").val().split(" ");
var current = words[words.length - 1].toLowerCase();
var users = $("#userlist").children();
var match = null;
for(var i = 0; i < users.length; i++) {
var name = users[i].children[1].innerHTML.toLowerCase();
if(name.indexOf(current) == 0 && match == null) {
match = users[i].children[1].innerHTML;
2013-03-18 01:24:28 +00:00
}
2013-04-01 01:29:39 +00:00
else if(name.indexOf(current) == 0) {
match = null;
break;
2013-03-18 01:24:28 +00:00
}
}
2013-04-01 01:29:39 +00:00
if(match != null) {
words[words.length - 1] = match;
if(words.length == 1)
words[0] += ": ";
else
words[words.length - 1] += " ";
$("#chatline").val(words.join(" "));
2013-03-29 18:15:46 +00:00
}
2013-04-01 01:29:39 +00:00
ev.preventDefault();
return false;
}
else if(ev.keyCode == 38) {
if(CHATHISTIDX == CHATHIST.length) {
CHATHIST.push($("#chatline").val());
2013-03-29 18:15:46 +00:00
}
2013-04-01 01:29:39 +00:00
if(CHATHISTIDX > 0) {
CHATHISTIDX--;
$("#chatline").val(CHATHIST[CHATHISTIDX]);
}
2013-04-01 01:29:39 +00:00
ev.preventDefault();
return false;
}
else if(ev.keyCode == 40) {
if(CHATHISTIDX < CHATHIST.length - 1) {
CHATHISTIDX++;
$("#chatline").val(CHATHIST[CHATHISTIDX]);
}
2013-04-01 01:29:39 +00:00
ev.preventDefault();
return false;
}
});
$("#messagebuffer").mouseenter(function() { SCROLLCHAT = false; });
$("#messagebuffer").mouseleave(function() { SCROLLCHAT = true; });
2013-02-16 05:02:42 +00:00
2013-04-22 20:37:42 +00:00
$("#clearplaylist").click(function() {
socket.emit("clearqueue");
});
$("#shuffleplaylist").click(function() {
socket.emit("shufflequeue");
});
2013-04-17 19:05:45 +00:00
$("#getplaylist").click(function() {
var callback = function(data) {
socket.listeners("playlist").splice(
socket.listeners("playlist").indexOf(callback));
var list = [];
for(var i = 0; i < data.pl.length; i++) {
var entry = idToURL(data.pl[i]);
2013-04-17 19:05:45 +00:00
list.push(entry);
}
var urls = list.join(",");
var modal = $("<div/>").addClass("modal hide fade")
.appendTo($("body"));
var head = $("<div/>").addClass("modal-header")
.appendTo(modal);
$("<button/>").addClass("close")
.attr("data-dismiss", "modal")
.attr("aria-hidden", "true")
.appendTo(head)[0].innerHTML = "&times;";
$("<h3/>").text("Playlist URLs").appendTo(head);
var body = $("<div/>").addClass("modal-body").appendTo(modal);
$("<input/>").attr("type", "text")
.val(urls)
.appendTo(body);
$("<div/>").addClass("modal-footer").appendTo(modal);
modal.on("hidden", function() {
modal.remove();
});
modal.modal();
}
socket.on("playlist", callback);
socket.emit("requestPlaylist");
});
$("#opt_submit").click(function() {
var ptitle = $("#opt_pagetitle").val();
if(ptitle == "")
ptitle = $("#opt_pagetitle").attr("placeholder")
var css = $("#opt_customcss").val();
var ratio = +$("#opt_voteskip_ratio").val() || 0.5;
opts = {
2013-04-02 19:07:22 +00:00
allow_voteskip: $("#opt_allow_voteskip").prop("checked"),
voteskip_ratio: ratio,
pagetitle: ptitle,
customcss: css,
2013-04-23 19:17:42 +00:00
customjs: $("#opt_customjs").val(),
2013-05-01 22:49:34 +00:00
chat_antiflood: $("#opt_chat_antiflood").prop("checked"),
show_public: $("#opt_show_public").prop("checked")
};
socket.emit("channelOpts", opts);
});
2013-04-01 21:02:09 +00:00
$("#updatemotd").click(function() {
var motd = $("#motdtext").val();
socket.emit("updateMotd", {
motd: motd
});
});
$("#show_chancontrols").click(function() {
$("#modnav li").each(function() {
$(this).removeClass("active");
});
2013-04-01 21:02:09 +00:00
$(".modonly").hide();
$("#show_chancontrols").parent().addClass("active");
$("#chancontrols").show();
2013-03-24 03:45:10 +00:00
});
2013-05-22 19:38:16 +00:00
$("#show_chanperms").click(function() {
$("#modnav li").each(function() {
$(this).removeClass("active");
});
$(".modonly").hide();
$("#show_chanperms").parent().addClass("active");
$("#chanperms").show();
});
$("#show_banlist").click(function() {
$("#modnav li").each(function() {
$(this).removeClass("active");
});
2013-04-01 21:02:09 +00:00
$(".modonly").hide();
$("#show_banlist").parent().addClass("active");
$("#banlist").show();
2013-04-01 21:02:09 +00:00
});
2013-04-29 23:59:51 +00:00
$("#show_loginlog").click(function() {
$("#modnav li").each(function() {
$(this).removeClass("active");
});
$(".modonly").hide();
$("#show_loginlog").parent().addClass("active");
$("#loginlog").show();
socket.emit("requestSeenlogins");
});
2013-04-01 21:02:09 +00:00
$("#show_motdeditor").click(function() {
$("#modnav li").each(function() {
$(this).removeClass("active");
});
2013-04-01 21:02:09 +00:00
$(".modonly").hide();
$("#show_motdeditor").parent().addClass("active");
2013-04-01 21:02:09 +00:00
$("#motdeditor").show();
});
2013-05-15 15:34:27 +00:00
$("#show_csseditor").click(function() {
$("#modnav li").each(function() {
$(this).removeClass("active");
});
$(".modonly").hide();
$("#show_csseditor").parent().addClass("active");
$("#csseditor").show();
});
$("#updatecss").click(function() {
socket.emit("setChannelCSS", {
css: $("#csstext").val()
});
});
$("#show_jseditor").click(function() {
$("#modnav li").each(function() {
$(this).removeClass("active");
});
$(".modonly").hide();
$("#show_jseditor").parent().addClass("active");
$("#jseditor").show();
});
$("#updatejs").click(function() {
socket.emit("setChannelJS", {
js: $("#jstext").val()
});
});
2013-04-01 21:02:09 +00:00
$("#show_filtereditor").click(function() {
2013-05-22 19:38:16 +00:00
$("#modnav li").each(function() {
$(this).removeClass("active");
});
$(".modonly").hide();
$("#show_filtereditor").parent().addClass("active");
$("#filtereditor").show();
2013-03-24 03:45:10 +00:00
});
2013-02-16 05:02:42 +00:00
$("#show_acl").click(function() {
if(RANK >= Rank.Owner) {
$("#modnav li").each(function() {
$(this).removeClass("active");
});
$(".modonly").hide();
$("#show_acl").parent().addClass("active");
$("#channelranks").show();
socket.emit("requestAcl");
}
else {
alert("Only channel administrators can use the ACL");
}
});
2013-05-13 19:41:29 +00:00
$("#drop_channel").click(function() {
var res = confirm("You are about to unregister your channel. This will PERMANENTLY delete your channel data, including ranks, bans, and library videos. This cannot be undone. Are you sure you want to continue?");
if(res) {
socket.emit("unregisterChannel");
}
});
2013-04-30 16:09:32 +00:00
function splitreEntry(str) {
var split = [];
var current = [];
for(var i = 0; i < str.length; i++) {
if(str[i] == "\\" && i+1 < str.length && str[i+1].match(/\s/)) {
current.push(str[i+1]);
i++;
continue;
}
else if(str[i].match(/\s/)) {
split.push(current.join(""));
current = [];
}
else {
current.push(str[i]);
}
}
split.push(current.join(""));
return split;
}
$("#multifilter").click(function() {
var input = $("#multifiltereditor").val();
var lines = input.split("\n");
for(var i = 0; i < lines.length; i++) {
var fields = splitreEntry(lines[i]);
var name = "";
var regex = "";
var flags = "";
var replace = "";
if(fields.length < 3) {
alert("Minimum of 3 fields per filter: (optional: name), regex, flags, replacement");
return;
}
else if(fields.length == 3) {
regex = fields[0];
flags = fields[1];
replace = fields[2];
}
else if(fields.length == 4) {
name = fields[0];
regex = fields[1];
flags = fields[2];
replace = fields[3];
}
else {
alert("Too many paramters: " + fields.join(" "));
return;
}
try {
new RegExp(regex, flags);
}
catch(e) {
alert("Invalid regex: " + e);
return;
}
socket.emit("chatFilter", {
cmd: "update",
filter: {
name: name,
source: regex,
flags: flags,
replace: replace,
active: true
}
});
}
});
2013-02-16 05:02:42 +00:00
function searchLibrary() {
socket.emit("searchLibrary", {
query: $("#library_query").val()
2013-02-16 05:02:42 +00:00
});
}
$("#library_search").click(searchLibrary);
$("#library_query").keydown(function(ev) {
if(ev.keyCode == 13)
2013-02-16 05:02:42 +00:00
searchLibrary();
});
$("#youtube_search").click(function() {
socket.emit("searchLibrary", {
query: $("#library_query").val(),
yt: true
});
});
2013-05-27 02:45:50 +00:00
$("#search_clear").click(function() {
clearSearchResults();
});
2013-05-13 01:15:05 +00:00
function fluidLayout() {
$(".row").each(function() {
$(this).removeClass("row").addClass("row-fluid");
});
$(".container").each(function() {
$(this).removeClass("container").addClass("container-fluid");
});
VWIDTH = $("#ytapiplayer").parent().css("width").replace("px", "");
VHEIGHT = ""+parseInt(parseInt(VWIDTH) * 9 / 16);
2013-05-13 01:15:05 +00:00
$("#messagebuffer").css("height", (VHEIGHT - 31) + "px");
$("#userlist").css("height", (VHEIGHT - 31) + "px");
$("#ytapiplayer").attr("width", VWIDTH);
$("#ytapiplayer").attr("height", VHEIGHT);
$("#chatline").removeClass().addClass("span12");
}
2013-03-31 22:30:46 +00:00
function largeLayout() {
$("#videodiv").removeClass().addClass("span8 offset2");
VWIDTH = $("#ytapiplayer").parent().css("width").replace("px", "");//770
2013-03-31 22:30:46 +00:00
VHEIGHT = "430";
$("#ytapiplayer").attr("width", VWIDTH).attr("height", "430");
2013-04-01 01:29:39 +00:00
var chat = $("#chatdiv").detach();
2013-03-31 22:30:46 +00:00
$("#layoutrow").remove();
2013-04-06 21:02:20 +00:00
var r = $("<div />").addClass("row").insertAfter($("#videodiv").parent());
2013-03-31 22:30:46 +00:00
r.attr("id", "layoutrow");
chat.removeClass().addClass("span8 offset2").appendTo(r);
2013-04-06 21:02:20 +00:00
$("#chatline").removeClass().addClass("span8");
2013-03-31 22:30:46 +00:00
$("#userlist").css("width", "200px");
}
function singleColumnLayout() {
$("#videodiv").removeClass().addClass("span12");
VWIDTH = $("#ytapiplayer").parent().css("width").replace("px", "");
VHEIGHT = parseInt(VWIDTH) * 9 / 16;
$("#ytapiplayer").attr("width", VWIDTH).attr("height", VHEIGHT);
var chat = $("#chatdiv").detach();
$("#layoutrow").remove();
var r = $("<div />").addClass("row").insertAfter($("#videodiv").parent());
r.attr("id", "layoutrow");
chat.removeClass().addClass("span12").appendTo(r);
chat.css("height", "200px");
$("#messagebuffer").css("height", "100%");
$("#userlist").css("height", "100%");
$("#chatline").removeClass().addClass("span12");
$("#userlist").css("width", "200px");
var r2d2 = $("<div/>").addClass("row").insertBefore($("#queuerow"));
r2d2.css("margin-top", "60px");
var librow = $("#queuerow").attr("id", "");
librow.css("margin-top", "5px");
r2d2.attr("id", "queuerow");
$("#pollcontainer").detach().appendTo(r2d2).removeClass().addClass("span12");
$("#queuediv").detach().appendTo(r2d2).removeClass().addClass("span12");
$(librow.find(".span5")[0]).removeClass().addClass("span12");
}
2013-03-31 22:30:46 +00:00
function hugeLayout() {
$("#videodiv").removeClass().addClass("span12");
VWIDTH = $("#ytapiplayer").parent().css("width").replace("px", "");//1170
VHEIGHT = "658";
$("#ytapiplayer").attr("width", VWIDTH).attr("height", "658");
2013-04-01 01:29:39 +00:00
var chat = $("#chatdiv").detach();
2013-03-31 22:30:46 +00:00
$("#layoutrow").remove();
2013-04-06 21:02:20 +00:00
var r = $("<div />").addClass("row").insertAfter($("#videodiv").parent());
2013-03-31 22:30:46 +00:00
r.attr("id", "layoutrow");
chat.removeClass().addClass("span12").appendTo(r);
2013-04-06 21:02:20 +00:00
$("#chatline").removeClass().addClass("span12");
2013-03-31 22:30:46 +00:00
$("#userlist").css("width", "200px").css("height", "200px");
$("#messagebuffer").css("height", "200px");
}
function narrowLayout() {
VWIDTH = $("#ytapiplayer").parent().css("width").replace("px", "");//570
2013-03-31 22:30:46 +00:00
VHEIGHT = "321";
$("#videodiv").removeClass().addClass("span6");
$("#ytapiplayer").attr("width", VWIDTH).attr("height", "321");
2013-04-01 01:29:39 +00:00
var chat = $("#chatdiv").detach();
2013-03-31 22:30:46 +00:00
$("#layoutrow").remove();
2013-04-06 21:02:20 +00:00
var r = $("<div />").addClass("row").insertAfter($("#videodiv").parent());
2013-03-31 22:30:46 +00:00
r.attr("id", "layoutrow");
chat.removeClass().addClass("span6").appendTo(r);
2013-04-06 21:02:20 +00:00
$("#chatline").removeClass().addClass("span6");
2013-03-31 22:30:46 +00:00
$("#userlist").css("width", "150px");
}
function synchtubeLayout() {
2013-04-01 01:29:39 +00:00
$("#videodiv").detach().insertBefore($("#chatdiv"));
$("#queuediv").detach().prependTo($("#queuerow"));
2013-03-31 22:30:46 +00:00
}
2013-02-16 05:02:42 +00:00
function onYouTubeIframeAPIReady() {
if(PLAYER.type == "null")
2013-04-07 19:38:50 +00:00
PLAYER = new Media({id: "", type: "yt"});
2013-05-13 02:13:28 +00:00
if(USEROPTS.layout == "fluid") {
fluidLayout();
}
2013-02-16 05:02:42 +00:00
}
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(";");
2013-02-16 05:02:42 +00:00
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==" ") c = c.substring(1,c.length);
2013-02-16 05:02:42 +00:00
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
function eraseCookie(name) {
createCookie(name,"",-1);
}