summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjetil Ørbekk <kjetil.orbekk@gmail.com>2011-08-03 23:24:22 -0400
committerKjetil Ørbekk <kjetil.orbekk@gmail.com>2011-08-03 23:25:56 -0400
commit42728bfe059e0a89cf7978a5bcfefb7c51d43989 (patch)
treeff87c5863a2b1b7ad7edb4ec10001b452bff99b0
parent3d7f6a41a072111009d22f70be88463792b3dbee (diff)
Add rage button.
-rw-r--r--html/quotes.jsp14
-rw-r--r--src/lq/Printer.java46
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;
+}
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000" link="#000000" vlink="#000000">
@@ -61,7 +73,7 @@ for (lq.Quote quote : quotes) {
%>
<center>
<br>
-<p>linoquotes v.2 © 2004-2010 Erlend Hamberg, Vidar Holen, Kjetil Ørbekk, John H. Anthony.
+<p>linoquotes v.2 © 2004-2011 Erlend Hamberg, Vidar Holen, Kjetil Ørbekk, John H. Anthony.
<br>See <a href="http://github.com/orbekk/linoquotes">http://github.com/orbekk/linoquotes</a>
for details.</p>
<p>The quotes on this page are copyright their respective owners and submitters.</p>
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("\'", "&quot;")
+ .replaceAll("(http://[^ \r\n]+)","<a href=\"$1\">$1</a>")
+ .replaceAll("\n","<br>\n");
+
+ }
+
+ public String escapeRage(String content) {
+ return Strings.escape(content).replaceAll("\'", "&quot;");
+ }
+
public void printQuote(Quote quote, Long displayIndex) {
if (displayIndex == null) {
displayIndex = quote.getId();
}
out.println("<br>");
- out.println("<a href=\"/view_quote?id=" + quote.getId() + "\">" +
+ out.print("<a href=\"/view_quote?id=" + quote.getId() + "\">" +
"#" + displayIndex +
"</a>"+
- ", lagt til av " + Strings.escape(quote.getAuthor()) + "<br>");
-
+ ", lagt til av " + Strings.escape(quote.getAuthor()));
+ out.println("<br>");
String date = DateUtil.dateFormat.format(quote.getQuoteDate());
out.println("Dato: " + date + ", Score: ");
-
out.println("<span id=\"v" + quote.getId() + "\">");
- out.println(QuoteUtil.formatScore(quote));
- out.println("<br> Vote: <font size=\"-1\">");
+ out.print(QuoteUtil.formatScore(quote));
+ out.println(", Vote: <font size=\"-1\">");
for(int nv=1; nv<=5; nv++)
- out.println("<a href=\"javascript:vote(" + quote.getId() + ","+nv+")\">"+nv+"</a> ");
- out.println("</font> </span>");
-
+ out.print(" <a href=\"javascript:vote(" + quote.getId() + ","+nv+")\">"+nv+"</a>");
+ out.print("</font></span>");
+ out.print(", ");
+ printRageButton(quote);
+ out.println("<br>");
out.println("<br> <br>");
out.println();
- String content = Strings.escape(quote.getContent());
- out.println(content
- .replaceAll("(http://[^ \r\n]+)","<a href=\"$1\">$1</a>")
- .replaceAll("\n","<br>\n"));
+ out.println(escapeDisplay(quote.getContent()));
out.println("");
out.println("<hr>");
}
+
+ public void printRageButton(Quote quote) {
+ out.print(
+ "<form method=\"post\" style=\"display: inline;\"" +
+ "action=\"http://www.vidarholen.net/contents/rage/index.php\">" +
+ "<input type=\"hidden\" name=\"irc\" value=\"");
+ out.print(escapeRage(quote.getContent()));
+ out.print("\"/>");
+ out.print("<input type=\"submit\" class=\"ragebutton\" value=\"Rage it\"/></form>");
+ }
}