Skip to content

Commit e1ae3bc

Browse files
author
zzz
committed
Merge branch 'susimail-markdown' into 'master'
Susimail: Add markdown js for plain text content See merge request i2p-hackers/i2p.i2p!161
2 parents fc8cdfc + e25ce7f commit e1ae3bc

File tree

7 files changed

+1696
-0
lines changed

7 files changed

+1696
-0
lines changed

LICENSE.txt

+7
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,13 @@ Applications:
336336
GPLv2 (or any later version)
337337
See licenses/LICENSE-GPLv2.txt
338338

339+
SusiMail Pagedown:
340+
Original Markdown Copyright (c) 2004-2005 John Gruber
341+
Original Showdown code copyright (c) 2007 John Fraser
342+
Modifications and bugfixes (c) 2009 Dana Robinson
343+
Modifications and bugfixes (c) 2009-2014 Stack Exchange Inc.
344+
See licenses/LICENSE-pagedown.txt
345+
339346
Systray (systray.jar):
340347
Public domain.
341348

apps/susimail/src/js/Markdown.Converter.js

+1,623
Large diffs are not rendered by default.

apps/susimail/src/js/markdown.js

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/* @license http://www.gnu.org/licenses/gpl-2.0.html GPL-2.0 */
2+
/* see also licenses/LICENSE-GPLv2.txt */
3+
4+
function initMarkdown() {
5+
var mailbodies = document.getElementsByClassName("mailbody");
6+
for(index = 0; index < mailbodies.length; index++)
7+
{
8+
var mailbody = mailbodies[index];
9+
if (mailbody.nodeName === "P") {
10+
var converter = new Markdown.Converter();
11+
mailbody.innerHTML = converter.makeHtml(mailbody.innerHTML);
12+
}
13+
}
14+
}
15+
16+
document.addEventListener("DOMContentLoaded", function() {
17+
initMarkdown();
18+
}, true);
19+
20+
/* @license-end */

apps/susimail/src/src/i2p/susi/webmail/WebMail.java

+4
Original file line numberDiff line numberDiff line change
@@ -2419,6 +2419,10 @@ private void processRequest( HttpServletRequest httpRequest, HttpServletResponse
24192419
// TODO JS?
24202420
out.println("<meta http-equiv=\"refresh\" content=\"5;url=" + myself + "\">");
24212421
// TODO we don't need the form below
2422+
} else if (state == State.SHOW) {
2423+
out.println("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + sessionObject.themePath + "markdown.css?" + CoreVersion.VERSION + "\">");
2424+
out.println("<script src=\"/susimail/js/markdown.js?" + CoreVersion.VERSION + "\" type=\"text/javascript\"></script>");
2425+
out.println("<script src=\"/susimail/js/Markdown.Converter.js?" + CoreVersion.VERSION + "\" type=\"text/javascript\"></script>");
24222426
}
24232427
out.println("<script src=\"/susimail/js/notifications.js?" + CoreVersion.VERSION + "\" type=\"text/javascript\"></script>");
24242428
out.print("</head>\n<body>");
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
blockquote {
2+
border-left: 2px dotted #888;
3+
padding-left: 5px;
4+
background: #d0f0ff;
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
blockquote {
2+
border-left: 2px dotted #888;
3+
padding-left: 5px;
4+
background: #d0f0ff;
5+
}

licenses/LICENSE-pagedown.txt

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
A javascript port of Markdown, as used on Stack Overflow
2+
and the rest of Stack Exchange network.
3+
4+
Largely based on showdown.js by John Fraser (Attacklab).
5+
6+
Original Markdown Copyright (c) 2004-2005 John Gruber
7+
<http://daringfireball.net/projects/markdown/>
8+
9+
10+
Original Showdown code copyright (c) 2007 John Fraser
11+
12+
Modifications and bugfixes (c) 2009 Dana Robinson
13+
Modifications and bugfixes (c) 2009-2014 Stack Exchange Inc.
14+
15+
Permission is hereby granted, free of charge, to any person obtaining a copy
16+
of this software and associated documentation files (the "Software"), to deal
17+
in the Software without restriction, including without limitation the rights
18+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
19+
copies of the Software, and to permit persons to whom the Software is
20+
furnished to do so, subject to the following conditions:
21+
22+
The above copyright notice and this permission notice shall be included in
23+
all copies or substantial portions of the Software.
24+
25+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
30+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
31+
THE SOFTWARE.
32+

0 commit comments

Comments
 (0)