1 | /** |
---|
2 | * technikum29.de | Unobstructive Copyright Information |
---|
3 | * |
---|
4 | * Since there are so many people copying pictures from the website without |
---|
5 | * even knowing ot the copyright statements on the imprint, this jquery based |
---|
6 | * script implements some rather "unobstructive" ways of informing them: |
---|
7 | * |
---|
8 | * - hovering a picture replaces it with the "hotlinking picture" |
---|
9 | * (see http://dev.technikum29.de/src/hotlinking), that is, an embedded |
---|
10 | * watermark / copyright tag |
---|
11 | * |
---|
12 | * - hovering some more time over the picture yields a small informative |
---|
13 | * box (containing the alt-label of the picture) that informs about the |
---|
14 | * copyright message |
---|
15 | * |
---|
16 | * 2010 Sven Koeppel $Id: licensing.js 172 2010-08-08 19:42:25Z sven $ |
---|
17 | * Released under the public domain |
---|
18 | **/ |
---|
19 | |
---|
20 | var t29_img_license = { |
---|
21 | // content for the license tags (depending on language) |
---|
22 | text : { |
---|
23 | de: '© technikum29. <a href="/de/impressum.shtm">Lizenzbestimmungen</a>', |
---|
24 | en: '© technikum29. <a href="/en/imprint.shtm">Licensing terms</a>', |
---|
25 | }, |
---|
26 | |
---|
27 | // min size of pictures to display the license tag |
---|
28 | treshold_size : [255,100], // [w,h] |
---|
29 | |
---|
30 | // selector to exclude images from being license tagged |
---|
31 | exclude : "img.no-copyright, .no-copyright img, .start img, .impressum img" |
---|
32 | }; |
---|
33 | |
---|
34 | // configuration end |
---|
35 | |
---|
36 | t29_img_license.init = function() { |
---|
37 | $("body").append('<div id="img-license-tag"><p>'+ |
---|
38 | // detect language by heading language (ripped from t29_gmaps...) |
---|
39 | t29_img_license.text[$("h1").hasClass("de") ? "de" : "en"]+'</p></div>'); |
---|
40 | var tag = $("#img-license-tag"); |
---|
41 | var tag_top = function() { if(t29_img_license.img) tag.css("top", Math.min(t29_img_license.img.offset().top + t29_img_license.img.height(), $(window).scrollTop()+$(window).height())); }; |
---|
42 | $("img").not(t29_img_license.exclude).hover(function(){ |
---|
43 | if(this.width < t29_img_license.treshold_size[0] |
---|
44 | || this.height < t29_img_license.treshold_size[1]) |
---|
45 | return; |
---|
46 | t29_img_license.img = $(this); |
---|
47 | tag.css({ |
---|
48 | left: $(this).offset().left, |
---|
49 | // top: tag_top(); |
---|
50 | width: $(this).width(), |
---|
51 | display: "block" |
---|
52 | }); |
---|
53 | tag_top(); |
---|
54 | tag.css("margin-top", -tag.height()); // erst in zweitem schritt |
---|
55 | }, function(){ tag.hide(); t29_img_license.img = null; }); |
---|
56 | $(window).scroll(tag_top); |
---|
57 | tag.hover(function(){ $(this).show(); }, function(){ $(this).hide(); }); |
---|
58 | }; |
---|
59 | |
---|
60 | $(t29_img_license.init); |
---|
61 | |
---|
62 | // kleine zweckentfremdung: Auch andere tolle JS-Teile mal hierreinschreiben |
---|
63 | function t29_inform_window_size() { |
---|
64 | var width = window.innerWidth; |
---|
65 | $("body").toggleClass("lesser1024", width <= 1024); |
---|
66 | $("body").toggleClass("greater1024", width >= 1024); |
---|
67 | $("body").toggleClass("greater1280", width >= 1280); |
---|
68 | } |
---|
69 | |
---|
70 | $(function(){ |
---|
71 | t29_inform_window_size(); |
---|
72 | $(window).resize(t29_inform_window_size); |
---|
73 | }); |
---|
74 | |
---|
75 | // und noch eine kleine zweckentfremdung: Domain-Infos. |
---|
76 | $(function(){ |
---|
77 | if(location.hostname != "www.technikum29.de") { |
---|
78 | $.get("/hostinfo.shtm", function(data) { |
---|
79 | $("#sidebar").append("<div id='sidebar-hostinfo'/>"); |
---|
80 | $("#sidebar-hostinfo").html(data); |
---|
81 | }); |
---|
82 | } |
---|
83 | }); |
---|