Regensburger Tagebuch

Notizen von der nördlichsten Stadt Italiens

Montag, 8. Juni 2015

Daily Picture aus Regensburg 365


<script type="text/javaScript">
function last_post_thumbnail(json) {

        var entry = json.feed.entry[0];
        var posttitle = entry.title.$t;

        var posturl;
        for (var k = 0; k < entry.link.length; k++) {
            if (entry.link[k].rel == 'replies' && entry.link[k].type == 'text/html') {
                var commenttext = entry.link[k].title;
                var commenturl = entry.link[k].href;
            }
            if (entry.link[k].rel == 'alternate') {
                posturl = entry.link[k].href;
                break;
            }
        }

        var thumburl;
        try {
            thumburl = entry.media$thumbnail.url;
             thumburl=thumburl.replace("s72-c","s170");
        } catch (error) {
            s = entry.content.$t;
            a = s.indexOf("<img");
            b = s.indexOf("src=\"", a);
            c = s.indexOf("\"", b + 5);
            d = s.substr(b + 5, c - b - 5);
            if ((a != -1) && (b != -1) && (c != -1) && (d != "")) {
                thumburl = d;
            } else thumburl = 'https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh56d4qCfTq1iiQK984wYSsB4sleXOgE2Ta0xl42C-tpm-VR3kfKIwflaQfzPkbHY-6ro1jpU5LEo1-ja05yW0Gjrf9tz7MZUpcRb6_0P-On0yjC-2v6wegnxfzw7dYUa9pXGfeLa4953c/s1600/No+Image+1.gif';
        }

  document.write('<a href="' + posturl + '" target ="_blank"><img  src="' + thumburl + '"/></a>');

}
</script>
<div style="text-align:center">
<script type="text/javascript" src="http://regensburg-365.blogspot.de/feeds/posts/default?orderby=published&alt=json-in-script&max-results=1&callback=last_post_thumbnail"></script><br /><a href="http://regensburg-365.blogspot.de" target="_blank" style="font-size:9px">Das letzte Bild aus Regensburg-365</a>
</div>

<br><hr><br>
Wer auch so ein Daily-Picture aus regensburg-365 in seine Webseite einbinden will, kann das tun. Gleichgültig ob Wordpress, blogspot oder eigenes System - nötig ist ein HTML/Javascript-Text-Block mit folgendem Quellcode (der aber nicht durch Umschalten auf Wysiwyg-Modus zerstört werden darf, wie es manche Editoren tun):


<script type="text/javaScript">
function last_post_thumbnail(json) {

        var entry = json.feed.entry[0];
        var posttitle = entry.title.$t;

        var posturl;
        for (var k = 0; k < entry.link.length; k++) {
            if (entry.link[k].rel == 'replies' && entry.link[k].type == 'text/html') {
                var commenttext = entry.link[k].title;
                var commenturl = entry.link[k].href;
            }
            if (entry.link[k].rel == 'alternate') {
                posturl = entry.link[k].href;
                break;
            }
        }

        var thumburl;
        try {
            thumburl = entry.media$thumbnail.url;
             thumburl=thumburl.replace("s72-c","s170");
        } catch (error) {
            s = entry.content.$t;
            a = s.indexOf("<img");
            b = s.indexOf("src=\"", a);
            c = s.indexOf("\"", b + 5);
            d = s.substr(b + 5, c - b - 5);
            if ((a != -1) && (b != -1) && (c != -1) && (d != "")) {
                thumburl = d;
            } else thumburl = 'https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh56d4qCfTq1iiQK984wYSsB4sleXOgE2Ta0xl42C-tpm-VR3kfKIwflaQfzPkbHY-6ro1jpU5LEo1-ja05yW0Gjrf9tz7MZUpcRb6_0P-On0yjC-2v6wegnxfzw7dYUa9pXGfeLa4953c/s1600/No+Image+1.gif';
        }

  document.write('<a href="' + posturl + '" target ="_blank"><img  src="' + thumburl + '"/></a>');

}
</script>
<div style="text-align:center">
<script type="text/javascript" src="http://regensburg-365.blogspot.de/feeds/posts/default?orderby=published&alt=json-in-script&max-results=1&callback=last_post_thumbnail"></script><br /><a href="http://regensburg-365.blogspot.de" target="_blank" style="font-size:9px">Das letzte Bild aus Regensburg-365</a>
</div>