metanohi-misc-subsites/old-projects/algo/js/themes.js

66 lines
2.2 KiB
JavaScript
Raw Normal View History

2011-08-02 19:57:57 +02:00
/*
Algo: a dekstop environment look-a-like in your web browser
Copyright (C) 2009 Niels Serup
This file is part of Algo.
Algo is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Algo is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Algo. If not, see <http://www.gnu.org/licenses/>.
*/
/*
This is the themes file. The two functions in this file manage loading
themes and changing object properties
*/
function settheme(what) {
/* Sets the url of the themes css file. In this case it links to a PHP file
that has an index of names and urls. */
theme.href = 'themes/links.php?title=' + what + '&type=css' + '&r=' + Math.random()
var http = new httpobj() // Creates a new httpobj object
http.url = 'themes/links.php' // Sets the url
http.method = 'get' // Sets the method
http.param['title'] = what // Sets the title
http.param['type'] = 'js' // Sets the type
http.param['r'] = Math.random() // Fix for i.e. IE (maybe other browsers too)
http.func = "themevars(text)" // Will pass received text to that function
http.send() // Sends it
}
function themevars(vars) {
// This function updates everything possible updating.
eval(vars) // Execute the string
for (var i = 0; i < navi.length; i++) {
navi[i].update()
}
// Reshow everything
scr.rethink()
scr.update()
for (var i = 0; i < scr.len; i++) {
wnds[i].update()
wnds[i].update_appbox()
}
// Some browsers are a bit slow, so waiting half a second or so is smart.
setTimeout("wrapper.style.display = 'block'", 500)
setTimeout("navi[posis['appboxes']].check_abs_height(false)", 1000)
if (!theme_set) {
theme_set = true
// Open a small welcome window
setTimeout("scr.setwindow('Welcome', true, -1, -1, 300, 200)", 1000)
}
}