Mercurial Hosting > nabble
view src/nabble/view/lib/EmbedUtils.java @ 0:7ecd1a4ef557
add content
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 21 Mar 2019 19:15:52 -0600 |
parents | |
children |
line wrap: on
line source
package nabble.view.lib; import nabble.model.Node; import javax.servlet.http.HttpServletRequest; public final class EmbedUtils { private EmbedUtils() {} // never private static String url(HttpServletRequest request, Node node) { return Jtp.getBaseUrl(request) + Jtp.path(node); } private static String getRawForumSnippet(HttpServletRequest request, Node app) { return "<a id=\"nabblelink\" href=\"" +(url(request,app)) +"\">" +(app.getSubject()) +"</a>\r\n<script src=\"" +(Jtp.getBaseUrl(request)) +"/embed/f" +(app.getId()) +"\"></script>" ; } public static String getForumSnippet(HttpServletRequest request, Node app) { return getRawForumSnippet(request,app).replace("<", "<").replace(">", ">"); } public static String getTopicSnippet(HttpServletRequest request, Node rootPost) { return "<a id=\"nabblelink\" href=\"" +(url(request,rootPost)) +"\">" +(rootPost.getSubject()) +"</a>\r\n<script src=\"" +(rootPost.getSite().getBaseUrl()) +"/embed/p" +(rootPost.getId()) +"\"></script>" .replace("<", "<").replace(">", ">"); } }