diff options
| author | Jonas Kohl | 2024-07-22 20:27:11 +0200 | 
|---|---|---|
| committer | Jonas Kohl | 2024-07-22 20:27:11 +0200 | 
| commit | e163c5950aa74278401679190fb7d755f730fa04 (patch) | |
| tree | e6802d0544a569ad91e8770c76c5051327172ff4 /src/pages/guestbook.php | |
| parent | a8527ab9fdbbed6fc2014aa6be3d59720e69e5b9 (diff) | |
Add guestbook
Diffstat (limited to 'src/pages/guestbook.php')
| -rw-r--r-- | src/pages/guestbook.php | 58 | 
1 files changed, 58 insertions, 0 deletions
| diff --git a/src/pages/guestbook.php b/src/pages/guestbook.php new file mode 100644 index 0000000..f84b92d --- /dev/null +++ b/src/pages/guestbook.php @@ -0,0 +1,58 @@ +<param:title>Guestbook</param:title> +<param:active-link>guestbook</param:active-link> + +<div id="guestbook_frame"></div> + +<div id="guestbook"></div> + +<script type="text/javascript" src="/static/jquery-1.12.4.min.js"></script> +<script> +function htmlentities(str) { +    return str.replace(/&/g, "&") +        .replace(/</g, "<") +        .replace(/>/g, ">") +        .replace(/"/g, """) +        .replace(/'/g, "'"); +} + +function nl2br(str, xhtml) { +    if (typeof xhtml === "undefined") xhtml = true; +    return str.replace(/\n/g, "<br" + (xhtml ? " /" : "") + ">"); +} + +$(function() { +    $("#guestbook_frame").append( +        $("<iframe></iframe>") +            .attr("id", "gbframe") +            .attr("frameborder", "0") +            .attr("src", "//guestbook.hozyro.jkohl.link/?__e=1&__p[ok_target]=_top&__p[ok_url]=" + encodeURIComponent(location.href)) +    ); +}) + +function _gbcb(data) { +    $.each(data.entries, function(i, entry) { +        $("<div></div>") +            .addClass("guestbook-entry") +            .append( +                $("<div></div>") +                    .addClass("guestbook-header") +                    .append( +                        $("<strong></strong>") +                            .addClass("guestbook-author-name") +                            .text(entry.author.name), +                        " ", +                        $("<span></span>") +                            .addClass("guestbook-author-email") +                            .text("(" + entry.author.email + ")") +                    ), +                $("<div></div>") +                    .addClass("guestbook-date") +                    .text(entry.published), +                $("<div></div>") +                    .addClass("guestbook-content") +                    .html(nl2br(htmlentities(entry.content))) +            ).appendTo("#guestbook") +    }) +} +</script> +<script type="text/javascript" src="//guestbook.hozyro.jkohl.link/?__m=ajax&__r=jsonp&__c=_gbcb"></script> |