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

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

t29Host-Webroot-System entwickelt.

Damit können Installationen der technikum29-Website ab nun auch in Unterverzeichnissen
(bislang allerdings nur unterhalb des DocumentRoots) installiert werden, was einem
größere Flexibilität beim lokalen Aufsetzen der Seite liefert

File size: 872 bytes
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
13t29.load.css = function(file) {
14        file = t29.load.get_path(file);
15        $("<style type='text/css'/>").html('@import url("'+file+'")').appendTo("head");
16};
17
18t29.load.js = function(file, callback) {
19        file = t29.load.get_path(file);
20        $.getScript(file, callback);
21};
22
23/**
24 * Convert a t29 relative path like /shared/css/foo to
25 * a path converting the webroot, like /path/to/t29/site/shared/css/foo
26 * @return string
27 **/
28t29.load.get_path = function(file) {
29        return t29.conf.web_prefix + file;
30};
31
32t29.load.setup = function() {
33        if(!t29.conf.web_prefix) t29.conf.web_prefix = "";
34};
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