source: t29-www/shared/js/licensing.js @ 171

Last change on this file since 171 was 171, checked in by sven, 14 years ago

Kleine Fixes am licensing.js-System

  • Property svn:keywords set to Id
File size: 2.3 KB
Line 
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 171 2010-08-08 02:29:09Z sven $
17 * Released under the public domain
18 **/
19
20var t29_img_license = {
21        // content for the license tags (depending on language)
22        text : {
23                de: '&copy; technikum29. <a href="/de/impressum.shtm">Lizenzbestimmungen</a>',
24                en: '&copy; 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
36t29_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);
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