From 42728bfe059e0a89cf7978a5bcfefb7c51d43989 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kjetil=20=C3=98rbekk?= Date: Wed, 3 Aug 2011 23:24:22 -0400 Subject: Add rage button. --- html/quotes.jsp | 14 +++++++++++++- src/lq/Printer.java | 46 +++++++++++++++++++++++++++++++++------------- 2 files changed, 46 insertions(+), 14 deletions(-) diff --git a/html/quotes.jsp b/html/quotes.jsp index bd2f1f7..1ba6d8e 100644 --- a/html/quotes.jsp +++ b/html/quotes.jsp @@ -13,6 +13,18 @@ hr { border-color: black; border-width: 1px; } +.ragebutton { + font-family: monospace; + text-align: left; + text-decoration: underline; + color: black; + background: none; + margin: 0; + padding: 0; + border: none; + cursor: pointer; + -moz-user-select: text; +} @@ -61,7 +73,7 @@ for (lq.Quote quote : quotes) { %>

-

linoquotes v.2 © 2004-2010 Erlend Hamberg, Vidar Holen, Kjetil Ørbekk, John H. Anthony. +

linoquotes v.2 © 2004-2011 Erlend Hamberg, Vidar Holen, Kjetil Ørbekk, John H. Anthony.
See http://github.com/orbekk/linoquotes for details.

The quotes on this page are copyright their respective owners and submitters.

diff --git a/src/lq/Printer.java b/src/lq/Printer.java index 14d08f9..f547bfb 100644 --- a/src/lq/Printer.java +++ b/src/lq/Printer.java @@ -14,33 +14,53 @@ public class Printer { printQuote(quote, null); } + public String escapeDisplay(String content) { + return Strings.escape(content) + .replaceAll("\'", """) + .replaceAll("(http://[^ \r\n]+)","$1") + .replaceAll("\n","
\n"); + + } + + public String escapeRage(String content) { + return Strings.escape(content).replaceAll("\'", """); + } + public void printQuote(Quote quote, Long displayIndex) { if (displayIndex == null) { displayIndex = quote.getId(); } out.println("
"); - out.println("" + + out.print("" + "#" + displayIndex + ""+ - ", lagt til av " + Strings.escape(quote.getAuthor()) + "
"); - + ", lagt til av " + Strings.escape(quote.getAuthor())); + out.println("
"); String date = DateUtil.dateFormat.format(quote.getQuoteDate()); out.println("Dato: " + date + ", Score: "); - out.println(""); - out.println(QuoteUtil.formatScore(quote)); - out.println("
Vote: "); + out.print(QuoteUtil.formatScore(quote)); + out.println(", Vote: "); for(int nv=1; nv<=5; nv++) - out.println(""+nv+" "); - out.println("
"); - + out.print(" "+nv+""); + out.print(""); + out.print(", "); + printRageButton(quote); + out.println("
"); out.println("

"); out.println(); - String content = Strings.escape(quote.getContent()); - out.println(content - .replaceAll("(http://[^ \r\n]+)","$1") - .replaceAll("\n","
\n")); + out.println(escapeDisplay(quote.getContent())); out.println(""); out.println("
"); } + + public void printRageButton(Quote quote) { + out.print( + "
" + + ""); + out.print("
"); + } } -- cgit v1.2.3