source: t29-www/shared/js-v6/modules/load.js @ 398

Last change on this file since 398 was 398, checked in by sven, 11 years ago

Exemplarisches Anmeldesystem adaptiert für Startseite, mit einem kleinen Button
zum Anmelden unten.

File size: 1.2 KB
Line 
1/**
2 * A Css and JavaScript load system for t29v6.
3 *
4 * This is needed because the t29Host web_prefix system, so the website can be
5 * loaded at some different point than the document root.
6 *
7 * Sven Koeppel, 08.03.2013, GPL
8 **/
9
10if(!t29) window.t29 = {}; // the t29 namespace
11t29.load = {};
12
13/**
14 * Load the CSS file for a specific seiten_id. This is done by the t29Template on
15 * server side automatically but can be useful for modular pagescripts loading parts
16 * of other pages via AJAX.
17 **/
18t29.load.pagestyle = function(seiten_id) {
19        path = "/shared/css-v6/pagestyles/" + seiten_id + ".css";
20        t29.load.css(path);
21};
22
23t29.load.css = function(file) {
24        file = t29.load.get_path(file);
25        $("<style type='text/css'/>").html('@import url("'+file+'")').appendTo("head");
26};
27
28t29.load.js = function(file, callback) {
29        file = t29.load.get_path(file);
30        $.getScript(file, callback);
31};
32
33/**
34 * Convert a t29 relative path like /shared/css/foo to
35 * a path converting the webroot, like /path/to/t29/site/shared/css/foo
36 * @return string
37 **/
38t29.load.get_path = function(file) {
39        return t29.conf.web_prefix + file;
40};
41
42t29.load.setup = function() {
43        if(!t29.conf.web_prefix) t29.conf.web_prefix = "";
44};
Note: See TracBrowser for help on using the repository browser.
© 2008 - 2013 technikum29 • Sven Köppel • Some rights reserved
Powered by Trac
Expect where otherwise noted, content on this site is licensed under a Creative Commons 3.0 License