/** * technikum29.de | page wide javascripts * * Dies ist eine Sammlung von kleinen jQuery-Funktionen, die jeweils kleine * Anpassungen und Verbesserungen an der www.technikum29.de-Website bieten. * Fuer seitenspezifische Scripts siehe common.js. * Per Default werden alle Funktionen am Ende dieses Scripts beim Seitenladen * ausgefuehrt. * Dieses Script benoetigt eine aktuelle jquery.js. * * 2010 Sven Koeppel $Id: tools.js 242 2011-06-05 20:45:52Z heribert $ * Released under the public domain * **/ var t29 = {}; // the t29 namespace /** * Common helper functions **/ // get the language of the current document t29.language = function(){ return $("h1").hasClass("de") ? "de" : "en"; } // T29 Gettext. Usage: // t29.gettext("deutscher text", "englsischer text"); // t29.gettext({ de: "deutscher Text", en: "englischer Text" }); // t29.gettext(anything, null) wont work, use t29.gettext({ de: anything, en: null}); t29.gettext = function(de, en) { if(!en){ en=de.en; de = de.de; } return t29.language()=="de" ? de : en; } /** * technikum29.de | javascript: Unobstructive copyright information * * Since there are so many people copying pictures from the website without * even knowing ot the copyright statements on the imprint, we tested some * jQuery-powered ways to inform them in an "unobstructive" way: * * - hovering a picture replaces it with the "hotlinking picture" * (see http://dev.technikum29.de/src/hotlinking), that is, an embedded * watermark / copyright tag * - hovering some more time over the picture yields a small informative * box (containing the alt-label of the picture) that informs about the * copyright message * * See Revision 169 for these features. They have been completely developed, * but removed again for a much smaller and lighter solution (just some black * box at the bottom corner of the picture). * * 2010 Sven Koeppel **/ t29.img_license = {}; // img license namespace t29.img_license.settings = { // enable or disable system (e.g. used as API in Translation subsystem) enabled : true, // content for the license tags (depending on language) text : { de: '© technikum29. Lizenzbestimmungen', en: '© technikum29. Licensing terms', }, // min size of pictures to display the license tag treshold_size : [255,100], // [w,h] // selector to exclude images from being license tagged exclude : "img.no-copyright, .no-copyright img, .start img, .impressum img" }; // configuration end // helper elements in t29.img_license namespace: // * hover_in, hover_out: functions called by apply() // * img: The current image element where the license tag is shown // * tag: The jquery element of the image license tag // * tag_top: helper function for css top setting for tag. t29.img_license.hover_in = function(){ if(!t29.img_license.settings.enabled || this.width < t29.img_license.settings.treshold_size[0] || this.height < t29.img_license.settings.treshold_size[1]) return; t29.img_license.img = $(this); t29.img_license.tag.css({ left: $(this).offset().left, // top: tag_top(); width: $(this).width(), display: "block" }); t29.img_license.tag_top(); t29.img_license.tag.css("margin-top", -t29.img_license.tag.height()); // erst in zweitem schritt }; t29.img_license.hover_out = function(){ t29.img_license.tag.hide(); t29.img_license.img = null; }; t29.img_license.tag_top = function() { if(t29.img_license.img) t29.img_license.tag.css("top", Math.min( t29.img_license.img.offset().top + t29.img_license.img.height(), $(window).scrollTop()+$(window).height())); }; // use this function from outer, see onload for help. // improvement possibility: converse to $.fn so can call $("img#my").img_license(); t29.img_license.apply = function($elem) { $elem.hover(t29.img_license.hover_in, t29.img_license.hover_out); }; t29.img_license.onload = function() { $("body").append('
'+ // detect language by heading language (ripped from t29_gmaps...) t29.img_license.settings.text[t29.language()]+'
bla bla bla
*Simply click on any paragraph to correct it. Thank you!
" +" "; t29.tr.preloader.start = function(success_function) { // kruder Hack, um die Ladezeit zu ueberstehen: schon mal Designaenderung $("body").toggleClass("tr-enabled tr-disabled"); $.getScript('/en/dev/translation/editor.js', function(){ t29.tr.set_enabled(true); if(success_function) success_function(); }); $.get('/en/dev/translation/editor.css', function(css) { $("").html(css).appendTo("head"); }); // text, nur einmal und so. bessere bedingung - schauen ob schon mal gestartet wurde. if(!$("#sidebar-tr .tr-enabled").length) { $("").html(t29.tr.preloader.enabled_string).appendTo('#sidebar-tr'); } }; t29.tr.preloader.onload = function() { $("#sidebar-tr a").click(function() { t29.tr.preloader.start(); return false; }).attr('href', '#help_with_mistakes'); // startup tr system with query string like ?tr or ...tr-... // or for people who opened link in another tab if(location.search.match(/tr-|^tr/i) || location.hash.match(/help_with_mistakes/)) { t29.tr.preloader.start(function(){ t29.tr.display_startup_notice('querystring'); }); } else if(location.hostname.match(/^edit/i)) { t29.tr.preloader.start(function(){ t29.tr.display_startup_notice('editdomain'); }); } } $(t29.auto_bildbreite); $(t29.hostinfo); $(t29.window_size); $(t29.img_license.onload); $(t29.heading_links); $(t29.tr.preloader.onload); $(t29.lightbox);