Merge branch 'susimail-markdown' into 'master'

Susimail: Add markdown js for plain text content

See merge request i2p-hackers/i2p.i2p!161
pull/46/merge i2p-2.4.03
zzz 2024-01-10 18:36:12 +00:00
commit e1ae3bce5a
7 changed files with 1696 additions and 0 deletions

View File

@ -336,6 +336,13 @@ Applications:
GPLv2 (or any later version)
See licenses/LICENSE-GPLv2.txt
SusiMail Pagedown:
Original Markdown Copyright (c) 2004-2005 John Gruber
Original Showdown code copyright (c) 2007 John Fraser
Modifications and bugfixes (c) 2009 Dana Robinson
Modifications and bugfixes (c) 2009-2014 Stack Exchange Inc.
See licenses/LICENSE-pagedown.txt
Systray (systray.jar):
Public domain.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,20 @@
/* @license http://www.gnu.org/licenses/gpl-2.0.html GPL-2.0 */
/* see also licenses/LICENSE-GPLv2.txt */
function initMarkdown() {
var mailbodies = document.getElementsByClassName("mailbody");
for(index = 0; index < mailbodies.length; index++)
{
var mailbody = mailbodies[index];
if (mailbody.nodeName === "P") {
var converter = new Markdown.Converter();
mailbody.innerHTML = converter.makeHtml(mailbody.innerHTML);
}
}
}
document.addEventListener("DOMContentLoaded", function() {
initMarkdown();
}, true);
/* @license-end */

View File

@ -2419,6 +2419,10 @@ public class WebMail extends HttpServlet
// TODO JS?
out.println("<meta http-equiv=\"refresh\" content=\"5;url=" + myself + "\">");
// TODO we don't need the form below
} else if (state == State.SHOW) {
out.println("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + sessionObject.themePath + "markdown.css?" + CoreVersion.VERSION + "\">");
out.println("<script src=\"/susimail/js/markdown.js?" + CoreVersion.VERSION + "\" type=\"text/javascript\"></script>");
out.println("<script src=\"/susimail/js/Markdown.Converter.js?" + CoreVersion.VERSION + "\" type=\"text/javascript\"></script>");
}
out.println("<script src=\"/susimail/js/notifications.js?" + CoreVersion.VERSION + "\" type=\"text/javascript\"></script>");
out.print("</head>\n<body>");

View File

@ -0,0 +1,5 @@
blockquote {
border-left: 2px dotted #888;
padding-left: 5px;
background: #d0f0ff;
}

View File

@ -0,0 +1,5 @@
blockquote {
border-left: 2px dotted #888;
padding-left: 5px;
background: #d0f0ff;
}

View File

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