Add placeholder text when clicking formatting tags with nothing highlighted
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
710f58b034
commit
e9693d20ab
@ -1,4 +1,4 @@
|
||||
39
|
||||
57
|
||||
That is a great idea!
|
||||
username,17May2021 08:29:10;GREEN
|
||||
That is a great idea! <p>There used to be folks I worked with who would use the same technique, and it worked great!</p>
|
||||
@ -77,3 +77,39 @@ fdsa2022-07-28T19:25:51.209453Z[Etc/UTC];GREEN
|
||||
2022-07-28T20:08:50.191504Z[Etc/UTC];GREEN
|
||||
<pre><span class="keyword">Code</span> <span class="keyword">block</span> <span class="keyword">now</span> <span class="variable">works</span>!</
|
||||
2022-07-28T20:13:09.268431Z[Etc/UTC];GREEN
|
||||
Very%20nice%2C%20thanks%20for%20sharing!
|
||||
Sig2022-08-01T16:02:59.075004Z[Etc/UTC];GREEN
|
||||
testest
|
||||
test2022-08-01T16:05:35.718759Z[Etc/UTC];GREEN
|
||||
fdasvdsavd
|
||||
dvsavda2022-08-01T16:05:46.192305Z[Etc/UTC];GREEN
|
||||
dasvavdsvsda
|
||||
ewqfewqfeqw2022-08-01T16:05:49.832914Z[Etc/UTC];GREEN
|
||||
|
||||
2022-08-01T16:05:56.667292Z[Etc/UTC];GREEN
|
||||
<b>we%20broke%20it</b>
|
||||
dvsa2022-08-01T16:06:11.783876Z[Etc/UTC];GREEN
|
||||
%20%20%20%20
|
||||
2022-08-01T16:08:10.957080Z[Etc/UTC];GREEN
|
||||
<b></b>
|
||||
2022-08-01T16:08:13.443427Z[Etc/UTC];GREEN
|
||||
fdsavdsavds
|
||||
dfsafdsa2022-08-01T16:08:18.820345Z[Etc/UTC];GREEN
|
||||
<b></b><b></b><b></b>
|
||||
2022-08-01T16:08:24.546240Z[Etc/UTC];GREEN
|
||||
fdsa
|
||||
2022-08-01T16:08:28.154518Z[Etc/UTC];GREEN
|
||||
<pre><span class="keyword">Cool</span> <span class="keyword">stuff</span> <span class="variable">man</span></
|
||||
2022-08-01T16:08:43.853845Z[Etc/UTC];GREEN
|
||||
<b>Bold%20Text</b>
|
||||
vdsavdsa2022-08-01T16:11:13.185418Z[Etc/UTC];GREEN
|
||||
<pre>//<span class="keyword">Code</span> <span class="keyword">goes</span> <span class="class">here</span>.<span class="variable"></span></
|
||||
vdsavdsav2022-08-01T16:11:23.726618Z[Etc/UTC];GREEN
|
||||
<i>Italic%20Text</i>
|
||||
vdsavdsavdsa2022-08-01T16:11:29.316553Z[Etc/UTC];GREEN
|
||||
dva<u>avsdv</u>dasv
|
||||
2022-08-01T16:11:33.383089Z[Etc/UTC];GREEN
|
||||
<a href="http%3A%2F%2Flink.%F0%9F%98%8Acom">http%3A%2F%2Flink.%F0%9F%98%8Acom</a>
|
||||
2022-08-01T16:11:42.223754Z[Etc/UTC];GREEN
|
||||
<pre>//<span class="keyword">Code</span> <span class="variable">go</span>😔<span class="keyword">es</span> <span class="class">here</span>.<span class="variable"></span></
|
||||
2022-08-01T16:11:57.246254Z[Etc/UTC];GREEN
|
||||
|
@ -17,15 +17,15 @@
|
||||
</head>
|
||||
<body>
|
||||
<div class="contentBody">
|
||||
<h2>Directory Listing for /</h2><div class="folderlisting"><a href="/.." class="icon">📁</a><a href="/..">.. </a><a href="/.." class="nounderline">(Previous Directory)</a></div><div class="folderlisting"><a href="/articles" class="icon">📁</a><a href="/articles">articles</a> 2022-08-01T15:59:35.330694Z gitpod 4096</div>
|
||||
<div class="folderlisting"><a href="/images" class="icon">📁</a><a href="/images">images</a> 2022-08-01T15:59:35.326694Z gitpod 77</div>
|
||||
<div class="filelisting"><a href="/codeBackground" class="icon">🗎</a><a href="/codeBackground">codeBackground</a> 2022-08-01T15:59:35.214694Z gitpod 2635</div>
|
||||
<div class="filelisting"><a href="/otherpage.html" class="icon">🗎</a><a href="/otherpage.html">otherpage.html</a> 2022-08-01T15:59:35.258694Z gitpod 88370</div>
|
||||
<div class="filelisting"><a href="/reset.css" class="icon">🗎</a><a href="/reset.css">reset.css</a> 2022-08-01T15:59:35.218694Z gitpod 1092</div>
|
||||
<div class="filelisting"><a href="/testfile.html" class="icon">🗎</a><a href="/testfile.html">testfile.html</a> 2022-08-01T15:59:35.262694Z gitpod 1627</div>
|
||||
<div class="filelisting"><a href="/uploadform.html" class="icon">🗎</a><a href="/uploadform.html">uploadform.html</a> 2022-08-01T15:59:35.262694Z gitpod 1707</div>
|
||||
<div class="filelisting"><a href="/sig.css" class="icon">🗎</a><a href="/sig.css">sig.css</a> 2022-08-01T15:59:35.246694Z gitpod 10595</div>
|
||||
<div class="filelisting"><a href="/error.html" class="icon">🗎</a><a href="/error.html">error.html</a> 2022-08-01T15:59:35.262694Z gitpod 1672</div>
|
||||
<h2>Directory Listing for /</h2><div class="folderlisting"><a href="/.." class="icon">📁</a><a href="/..">.. </a><a href="/.." class="nounderline">(Previous Directory)</a></div><div class="folderlisting"><a href="/articles" class="icon">📁</a><a href="/articles">articles</a> 2022-08-01T16:11:07.418073Z gitpod 4096</div>
|
||||
<div class="folderlisting"><a href="/images" class="icon">📁</a><a href="/images">images</a> 2022-08-01T16:11:07.410073Z gitpod 77</div>
|
||||
<div class="filelisting"><a href="/codeBackground" class="icon">🗎</a><a href="/codeBackground">codeBackground</a> 2022-08-01T16:11:07.174073Z gitpod 2635</div>
|
||||
<div class="filelisting"><a href="/otherpage.html" class="icon">🗎</a><a href="/otherpage.html">otherpage.html</a> 2022-08-01T16:11:07.230073Z gitpod 88370</div>
|
||||
<div class="filelisting"><a href="/reset.css" class="icon">🗎</a><a href="/reset.css">reset.css</a> 2022-08-01T16:11:07.178073Z gitpod 1092</div>
|
||||
<div class="filelisting"><a href="/testfile.html" class="icon">🗎</a><a href="/testfile.html">testfile.html</a> 2022-08-01T16:11:07.230073Z gitpod 1627</div>
|
||||
<div class="filelisting"><a href="/uploadform.html" class="icon">🗎</a><a href="/uploadform.html">uploadform.html</a> 2022-08-01T16:11:07.230073Z gitpod 1707</div>
|
||||
<div class="filelisting"><a href="/sig.css" class="icon">🗎</a><a href="/sig.css">sig.css</a> 2022-08-01T16:11:07.214073Z gitpod 10595</div>
|
||||
<div class="filelisting"><a href="/error.html" class="icon">🗎</a><a href="/error.html">error.html</a> 2022-08-01T16:11:07.230073Z gitpod 1672</div>
|
||||
|
||||
</div> <!--End Content Body-->
|
||||
<div class="codeForeground" id="codeForeground"></div>
|
||||
|
@ -17,13 +17,13 @@
|
||||
</head>
|
||||
<body>
|
||||
<div class="contentBody">
|
||||
<h2>Directory Listing for /articles/</h2><div class="folderlisting"><a href="/articles/.." class="icon">📁</a><a href="/articles/..">.. </a><a href="/articles/.." class="nounderline">(Previous Directory)</a></div><div class="folderlisting"><a href="/articles/test articles" class="icon">📁</a><a href="/articles/test articles">test articles</a> 2022-08-01T15:59:35.278694Z gitpod 147</div>
|
||||
<div class="filelisting"><a href="/articles/Love Live! Custom Arcade Controller.article" class="icon">🗎</a><a href="/articles/Love Live! Custom Arcade Controller.article">Love Live! Custom Arcade Controller.article</a> 2022-08-01T15:59:34.742695Z gitpod 497</div>
|
||||
<div class="filelisting"><a href="/articles/curabitur vel tempus ex.article" class="icon">🗎</a><a href="/articles/curabitur vel tempus ex.article">curabitur vel tempus ex.article</a> 2022-08-01T15:59:34.770695Z gitpod 730</div>
|
||||
<div class="filelisting"><a href="/articles/sigplace1.article" class="icon">🗎</a><a href="/articles/sigplace1.article">sigplace1.article</a> 2022-08-01T15:59:35.210694Z gitpod 80858</div>
|
||||
<div class="filelisting"><a href="/articles/Love Live! Custom Arcade Controller.article.html" class="icon">🗎</a><a href="/articles/Love Live! Custom Arcade Controller.article.html">Love Live! Custom Arcade Controller.article.html</a> 2022-08-01T15:59:35.278694Z gitpod 8626</div>
|
||||
<div class="filelisting"><a href="/articles/curabitur vel tempus ex.article.html" class="icon">🗎</a><a href="/articles/curabitur vel tempus ex.article.html">curabitur vel tempus ex.article.html</a> 2022-08-01T15:59:35.306694Z gitpod 8835</div>
|
||||
<div class="filelisting"><a href="/articles/sigplace1.article.html" class="icon">🗎</a><a href="/articles/sigplace1.article.html">sigplace1.article.html</a> 2022-08-01T15:59:35.318694Z gitpod 88935</div>
|
||||
<h2>Directory Listing for /articles/</h2><div class="folderlisting"><a href="/articles/.." class="icon">📁</a><a href="/articles/..">.. </a><a href="/articles/.." class="nounderline">(Previous Directory)</a></div><div class="folderlisting"><a href="/articles/test articles" class="icon">📁</a><a href="/articles/test articles">test articles</a> 2022-08-01T16:11:07.306073Z gitpod 147</div>
|
||||
<div class="filelisting"><a href="/articles/Love Live! Custom Arcade Controller.article" class="icon">🗎</a><a href="/articles/Love Live! Custom Arcade Controller.article">Love Live! Custom Arcade Controller.article</a> 2022-08-01T16:11:06.110074Z gitpod 497</div>
|
||||
<div class="filelisting"><a href="/articles/curabitur vel tempus ex.article" class="icon">🗎</a><a href="/articles/curabitur vel tempus ex.article">curabitur vel tempus ex.article</a> 2022-08-01T16:11:06.218074Z gitpod 730</div>
|
||||
<div class="filelisting"><a href="/articles/sigplace1.article" class="icon">🗎</a><a href="/articles/sigplace1.article">sigplace1.article</a> 2022-08-01T16:11:07.170073Z gitpod 80858</div>
|
||||
<div class="filelisting"><a href="/articles/Love Live! Custom Arcade Controller.article.html" class="icon">🗎</a><a href="/articles/Love Live! Custom Arcade Controller.article.html">Love Live! Custom Arcade Controller.article.html</a> 2022-08-01T16:11:07.310073Z gitpod 9152</div>
|
||||
<div class="filelisting"><a href="/articles/curabitur vel tempus ex.article.html" class="icon">🗎</a><a href="/articles/curabitur vel tempus ex.article.html">curabitur vel tempus ex.article.html</a> 2022-08-01T16:11:07.322073Z gitpod 9361</div>
|
||||
<div class="filelisting"><a href="/articles/sigplace1.article.html" class="icon">🗎</a><a href="/articles/sigplace1.article.html">sigplace1.article.html</a> 2022-08-01T16:11:07.402073Z gitpod 89461</div>
|
||||
|
||||
</div> <!--End Content Body-->
|
||||
<div class="codeForeground" id="codeForeground"></div>
|
||||
|
@ -74,11 +74,32 @@ For over a year since I first got into <u>Love Live! School Idol Festival ~after
|
||||
document.getElementById("msg").disabled=false;
|
||||
})
|
||||
}
|
||||
function bonus(str) {
|
||||
switch (str) {
|
||||
case "^^":{
|
||||
return "Bold Text"
|
||||
}break;
|
||||
case "**":{
|
||||
return "Italic Text"
|
||||
}break;
|
||||
case "__":{
|
||||
return "Underlined Text"
|
||||
}break;
|
||||
case "~~":{
|
||||
return "//Code goes here."
|
||||
}break;
|
||||
case "[[":{
|
||||
return "http://link.com"
|
||||
}break;
|
||||
}
|
||||
}
|
||||
function insert(c1,c2) {
|
||||
if (document.getElementById("msg").selectionStart==document.getElementById("msg").selectionEnd) {
|
||||
//No highlighting. Insert here.
|
||||
if (c2!=undefined) {
|
||||
document.getElementById("msg").value=document.getElementById("msg").value.substring(0,document.getElementById("msg").selectionStart)+c1+c2+document.getElementById("msg").value.substring(document.getElementById("msg").selectionStart)
|
||||
document.getElementById("msg").value=document.getElementById("msg").value.substring(0,document.getElementById("msg").selectionStart)+c1+
|
||||
bonus(c1)+
|
||||
c2+document.getElementById("msg").value.substring(document.getElementById("msg").selectionStart)
|
||||
} else {
|
||||
document.getElementById("msg").value=document.getElementById("msg").value.substring(0,document.getElementById("msg").selectionStart)+c1+document.getElementById("msg").value.substring(document.getElementById("msg").selectionStart)
|
||||
}
|
||||
|
@ -78,11 +78,32 @@ Curabitur vel tempus ex. Duis cursus sapien nisl, ut pulvinar dui porttitor ut.
|
||||
document.getElementById("msg").disabled=false;
|
||||
})
|
||||
}
|
||||
function bonus(str) {
|
||||
switch (str) {
|
||||
case "^^":{
|
||||
return "Bold Text"
|
||||
}break;
|
||||
case "**":{
|
||||
return "Italic Text"
|
||||
}break;
|
||||
case "__":{
|
||||
return "Underlined Text"
|
||||
}break;
|
||||
case "~~":{
|
||||
return "//Code goes here."
|
||||
}break;
|
||||
case "[[":{
|
||||
return "http://link.com"
|
||||
}break;
|
||||
}
|
||||
}
|
||||
function insert(c1,c2) {
|
||||
if (document.getElementById("msg").selectionStart==document.getElementById("msg").selectionEnd) {
|
||||
//No highlighting. Insert here.
|
||||
if (c2!=undefined) {
|
||||
document.getElementById("msg").value=document.getElementById("msg").value.substring(0,document.getElementById("msg").selectionStart)+c1+c2+document.getElementById("msg").value.substring(document.getElementById("msg").selectionStart)
|
||||
document.getElementById("msg").value=document.getElementById("msg").value.substring(0,document.getElementById("msg").selectionStart)+c1+
|
||||
bonus(c1)+
|
||||
c2+document.getElementById("msg").value.substring(document.getElementById("msg").selectionStart)
|
||||
} else {
|
||||
document.getElementById("msg").value=document.getElementById("msg").value.substring(0,document.getElementById("msg").selectionStart)+c1+document.getElementById("msg").value.substring(document.getElementById("msg").selectionStart)
|
||||
}
|
||||
|
@ -553,11 +553,32 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid
|
||||
document.getElementById("msg").disabled=false;
|
||||
})
|
||||
}
|
||||
function bonus(str) {
|
||||
switch (str) {
|
||||
case "^^":{
|
||||
return "Bold Text"
|
||||
}break;
|
||||
case "**":{
|
||||
return "Italic Text"
|
||||
}break;
|
||||
case "__":{
|
||||
return "Underlined Text"
|
||||
}break;
|
||||
case "~~":{
|
||||
return "//Code goes here."
|
||||
}break;
|
||||
case "[[":{
|
||||
return "http://link.com"
|
||||
}break;
|
||||
}
|
||||
}
|
||||
function insert(c1,c2) {
|
||||
if (document.getElementById("msg").selectionStart==document.getElementById("msg").selectionEnd) {
|
||||
//No highlighting. Insert here.
|
||||
if (c2!=undefined) {
|
||||
document.getElementById("msg").value=document.getElementById("msg").value.substring(0,document.getElementById("msg").selectionStart)+c1+c2+document.getElementById("msg").value.substring(document.getElementById("msg").selectionStart)
|
||||
document.getElementById("msg").value=document.getElementById("msg").value.substring(0,document.getElementById("msg").selectionStart)+c1+
|
||||
bonus(c1)+
|
||||
c2+document.getElementById("msg").value.substring(document.getElementById("msg").selectionStart)
|
||||
} else {
|
||||
document.getElementById("msg").value=document.getElementById("msg").value.substring(0,document.getElementById("msg").selectionStart)+c1+document.getElementById("msg").value.substring(document.getElementById("msg").selectionStart)
|
||||
}
|
||||
|
@ -17,12 +17,12 @@
|
||||
</head>
|
||||
<body>
|
||||
<div class="contentBody">
|
||||
<h2>Directory Listing for /articles/test articles/</h2><div class="folderlisting"><a href="/articles/test articles/.." class="icon">📁</a><a href="/articles/test articles/..">.. </a><a href="/articles/test articles/.." class="nounderline">(Previous Directory)</a></div><div class="filelisting"><a href="/articles/test articles/test1.article" class="icon">🗎</a><a href="/articles/test articles/test1.article">test1.article</a> 2022-08-01T15:59:34.738695Z gitpod 1085</div>
|
||||
<div class="filelisting"><a href="/articles/test articles/test2.article" class="icon">🗎</a><a href="/articles/test articles/test2.article">test2.article</a> 2022-08-01T15:59:34.738695Z gitpod 781</div>
|
||||
<div class="filelisting"><a href="/articles/test articles/test3.article" class="icon">🗎</a><a href="/articles/test articles/test3.article">test3.article</a> 2022-08-01T15:59:34.742695Z gitpod 994</div>
|
||||
<div class="filelisting"><a href="/articles/test articles/test1.article.html" class="icon">🗎</a><a href="/articles/test articles/test1.article.html">test1.article.html</a> 2022-08-01T15:59:35.266694Z gitpod 9154</div>
|
||||
<div class="filelisting"><a href="/articles/test articles/test2.article.html" class="icon">🗎</a><a href="/articles/test articles/test2.article.html">test2.article.html</a> 2022-08-01T15:59:35.274694Z gitpod 8850</div>
|
||||
<div class="filelisting"><a href="/articles/test articles/test3.article.html" class="icon">🗎</a><a href="/articles/test articles/test3.article.html">test3.article.html</a> 2022-08-01T15:59:35.278694Z gitpod 9063</div>
|
||||
<h2>Directory Listing for /articles/test articles/</h2><div class="folderlisting"><a href="/articles/test articles/.." class="icon">📁</a><a href="/articles/test articles/..">.. </a><a href="/articles/test articles/.." class="nounderline">(Previous Directory)</a></div><div class="filelisting"><a href="/articles/test articles/test1.article" class="icon">🗎</a><a href="/articles/test articles/test1.article">test1.article</a> 2022-08-01T16:11:06.050074Z gitpod 1085</div>
|
||||
<div class="filelisting"><a href="/articles/test articles/test2.article" class="icon">🗎</a><a href="/articles/test articles/test2.article">test2.article</a> 2022-08-01T16:11:06.102074Z gitpod 781</div>
|
||||
<div class="filelisting"><a href="/articles/test articles/test3.article" class="icon">🗎</a><a href="/articles/test articles/test3.article">test3.article</a> 2022-08-01T16:11:06.106074Z gitpod 994</div>
|
||||
<div class="filelisting"><a href="/articles/test articles/test1.article.html" class="icon">🗎</a><a href="/articles/test articles/test1.article.html">test1.article.html</a> 2022-08-01T16:11:07.234073Z gitpod 9680</div>
|
||||
<div class="filelisting"><a href="/articles/test articles/test2.article.html" class="icon">🗎</a><a href="/articles/test articles/test2.article.html">test2.article.html</a> 2022-08-01T16:11:07.302073Z gitpod 9376</div>
|
||||
<div class="filelisting"><a href="/articles/test articles/test3.article.html" class="icon">🗎</a><a href="/articles/test articles/test3.article.html">test3.article.html</a> 2022-08-01T16:11:07.306073Z gitpod 9589</div>
|
||||
|
||||
</div> <!--End Content Body-->
|
||||
<div class="codeForeground" id="codeForeground"></div>
|
||||
|
@ -72,11 +72,32 @@
|
||||
document.getElementById("msg").disabled=false;
|
||||
})
|
||||
}
|
||||
function bonus(str) {
|
||||
switch (str) {
|
||||
case "^^":{
|
||||
return "Bold Text"
|
||||
}break;
|
||||
case "**":{
|
||||
return "Italic Text"
|
||||
}break;
|
||||
case "__":{
|
||||
return "Underlined Text"
|
||||
}break;
|
||||
case "~~":{
|
||||
return "//Code goes here."
|
||||
}break;
|
||||
case "[[":{
|
||||
return "http://link.com"
|
||||
}break;
|
||||
}
|
||||
}
|
||||
function insert(c1,c2) {
|
||||
if (document.getElementById("msg").selectionStart==document.getElementById("msg").selectionEnd) {
|
||||
//No highlighting. Insert here.
|
||||
if (c2!=undefined) {
|
||||
document.getElementById("msg").value=document.getElementById("msg").value.substring(0,document.getElementById("msg").selectionStart)+c1+c2+document.getElementById("msg").value.substring(document.getElementById("msg").selectionStart)
|
||||
document.getElementById("msg").value=document.getElementById("msg").value.substring(0,document.getElementById("msg").selectionStart)+c1+
|
||||
bonus(c1)+
|
||||
c2+document.getElementById("msg").value.substring(document.getElementById("msg").selectionStart)
|
||||
} else {
|
||||
document.getElementById("msg").value=document.getElementById("msg").value.substring(0,document.getElementById("msg").selectionStart)+c1+document.getElementById("msg").value.substring(document.getElementById("msg").selectionStart)
|
||||
}
|
||||
|
@ -72,11 +72,32 @@
|
||||
document.getElementById("msg").disabled=false;
|
||||
})
|
||||
}
|
||||
function bonus(str) {
|
||||
switch (str) {
|
||||
case "^^":{
|
||||
return "Bold Text"
|
||||
}break;
|
||||
case "**":{
|
||||
return "Italic Text"
|
||||
}break;
|
||||
case "__":{
|
||||
return "Underlined Text"
|
||||
}break;
|
||||
case "~~":{
|
||||
return "//Code goes here."
|
||||
}break;
|
||||
case "[[":{
|
||||
return "http://link.com"
|
||||
}break;
|
||||
}
|
||||
}
|
||||
function insert(c1,c2) {
|
||||
if (document.getElementById("msg").selectionStart==document.getElementById("msg").selectionEnd) {
|
||||
//No highlighting. Insert here.
|
||||
if (c2!=undefined) {
|
||||
document.getElementById("msg").value=document.getElementById("msg").value.substring(0,document.getElementById("msg").selectionStart)+c1+c2+document.getElementById("msg").value.substring(document.getElementById("msg").selectionStart)
|
||||
document.getElementById("msg").value=document.getElementById("msg").value.substring(0,document.getElementById("msg").selectionStart)+c1+
|
||||
bonus(c1)+
|
||||
c2+document.getElementById("msg").value.substring(document.getElementById("msg").selectionStart)
|
||||
} else {
|
||||
document.getElementById("msg").value=document.getElementById("msg").value.substring(0,document.getElementById("msg").selectionStart)+c1+document.getElementById("msg").value.substring(document.getElementById("msg").selectionStart)
|
||||
}
|
||||
|
@ -72,11 +72,32 @@
|
||||
document.getElementById("msg").disabled=false;
|
||||
})
|
||||
}
|
||||
function bonus(str) {
|
||||
switch (str) {
|
||||
case "^^":{
|
||||
return "Bold Text"
|
||||
}break;
|
||||
case "**":{
|
||||
return "Italic Text"
|
||||
}break;
|
||||
case "__":{
|
||||
return "Underlined Text"
|
||||
}break;
|
||||
case "~~":{
|
||||
return "//Code goes here."
|
||||
}break;
|
||||
case "[[":{
|
||||
return "http://link.com"
|
||||
}break;
|
||||
}
|
||||
}
|
||||
function insert(c1,c2) {
|
||||
if (document.getElementById("msg").selectionStart==document.getElementById("msg").selectionEnd) {
|
||||
//No highlighting. Insert here.
|
||||
if (c2!=undefined) {
|
||||
document.getElementById("msg").value=document.getElementById("msg").value.substring(0,document.getElementById("msg").selectionStart)+c1+c2+document.getElementById("msg").value.substring(document.getElementById("msg").selectionStart)
|
||||
document.getElementById("msg").value=document.getElementById("msg").value.substring(0,document.getElementById("msg").selectionStart)+c1+
|
||||
bonus(c1)+
|
||||
c2+document.getElementById("msg").value.substring(document.getElementById("msg").selectionStart)
|
||||
} else {
|
||||
document.getElementById("msg").value=document.getElementById("msg").value.substring(0,document.getElementById("msg").selectionStart)+c1+document.getElementById("msg").value.substring(document.getElementById("msg").selectionStart)
|
||||
}
|
||||
|
@ -12,7 +12,6 @@
|
||||
String filename=null;
|
||||
OutputStream stream = null;
|
||||
requestLine=in.readLine(); //Read the first line, this should be our request.
|
||||
System.out.println(requestLine);
|
||||
if (requestLine!=null) {
|
||||
String[] splitter = requestLine.split(Pattern.quote(" "));
|
||||
boolean ISPOST = splitter[0].equals("POST");
|
||||
@ -38,3 +37,4 @@
|
||||
System.out.println(line);
|
||||
}
|
||||
} else {
|
||||
File myFile = new File(new File(sigPlace.OUTDIR,sigPlace.UPLOADSDIR),filename);
|
||||
|
@ -28,11 +28,32 @@
|
||||
document.getElementById("msg").disabled=false;
|
||||
})
|
||||
}
|
||||
function bonus(str) {
|
||||
switch (str) {
|
||||
case "^^":{
|
||||
return "Bold Text"
|
||||
}break;
|
||||
case "**":{
|
||||
return "Italic Text"
|
||||
}break;
|
||||
case "__":{
|
||||
return "Underlined Text"
|
||||
}break;
|
||||
case "~~":{
|
||||
return "//Code goes here."
|
||||
}break;
|
||||
case "[[":{
|
||||
return "http://link.com"
|
||||
}break;
|
||||
}
|
||||
}
|
||||
function insert(c1,c2) {
|
||||
if (document.getElementById("msg").selectionStart==document.getElementById("msg").selectionEnd) {
|
||||
//No highlighting. Insert here.
|
||||
if (c2!=undefined) {
|
||||
document.getElementById("msg").value=document.getElementById("msg").value.substring(0,document.getElementById("msg").selectionStart)+c1+c2+document.getElementById("msg").value.substring(document.getElementById("msg").selectionStart)
|
||||
document.getElementById("msg").value=document.getElementById("msg").value.substring(0,document.getElementById("msg").selectionStart)+c1+
|
||||
bonus(c1)+
|
||||
c2+document.getElementById("msg").value.substring(document.getElementById("msg").selectionStart)
|
||||
} else {
|
||||
document.getElementById("msg").value=document.getElementById("msg").value.substring(0,document.getElementById("msg").selectionStart)+c1+document.getElementById("msg").value.substring(document.getElementById("msg").selectionStart)
|
||||
}
|
||||
|
379
sigServer.java
379
sigServer.java
@ -159,215 +159,219 @@ public class sigServer {
|
||||
if (location.equals("COMMENTS")&&requestParams.containsKey("message")&&requestParams.containsKey("name")&&requestParams.containsKey("color")) {
|
||||
//System.out.println(requestParams);
|
||||
String finalMsg = requestParams.get("message").replaceAll(Pattern.quote("%0A"),"<br/>").replaceAll(Pattern.quote("%3C"),"<");
|
||||
boolean boldBlock=false;
|
||||
boolean italicBlock=false;
|
||||
boolean underlineBlock=false;
|
||||
boolean codeBlock=false;
|
||||
boolean linkBlock=false;
|
||||
StringBuilder storedLink=new StringBuilder();
|
||||
StringBuilder codeBlockMsg = new StringBuilder();
|
||||
StringBuilder buildMsg = new StringBuilder();
|
||||
for (int i=0;i<finalMsg.length();i++) {
|
||||
if (i<finalMsg.length()-1&&finalMsg.charAt(i)=='~'&&finalMsg.charAt(i+1)=='~') {
|
||||
if (codeBlock) {
|
||||
codeBlockMsg.append("~~");
|
||||
String storedCodeBlock="";
|
||||
String s = URLDecoder.decode(codeBlockMsg.toString(),StandardCharsets.UTF_8.toString());
|
||||
boolean keyword=false;
|
||||
boolean inString=false;
|
||||
boolean inComment=false;
|
||||
boolean inMultiLineComment=false;
|
||||
char stringChar=' ';
|
||||
boolean canBeNumericalConstant=false;
|
||||
int lengthOfConstant=0;
|
||||
storedCodeBlock+=s.substring(0,s.indexOf("~~"));
|
||||
storedCodeBlock=storedCodeBlock.replaceAll(Pattern.quote("<"),"\2");
|
||||
storedCodeBlock+="</pre>";
|
||||
int startPos=0;
|
||||
String endText=s.substring(s.indexOf("~~")+"~~".length(),s.length());
|
||||
s="";
|
||||
for (int j=0;j<storedCodeBlock.length()-1;j++) {
|
||||
if (storedCodeBlock.charAt(j)=='\n'&&inString) {
|
||||
inString=false;
|
||||
s+="</span>";
|
||||
} else
|
||||
if (storedCodeBlock.charAt(j)=='\n'&&inComment) {
|
||||
inComment=false;
|
||||
s+=SPAN("comment")+storedCodeBlock.substring(startPos,j)+"</span>";
|
||||
startPos=j+1;
|
||||
}
|
||||
if (!inComment&&!inMultiLineComment&&(j>0&&storedCodeBlock.charAt(j-1)!='\\'&&(!inString&&(storedCodeBlock.charAt(j)=='"'||storedCodeBlock.charAt(j)=='\'')||inString&&(storedCodeBlock.charAt(j)==stringChar)))) {
|
||||
inString=!inString;
|
||||
if (inString) {
|
||||
stringChar=storedCodeBlock.charAt(j);
|
||||
s+=SPAN("string")+stringChar;
|
||||
} else {
|
||||
s+=stringChar;
|
||||
if (finalMsg.length()>0) {
|
||||
boolean boldBlock=false;
|
||||
boolean italicBlock=false;
|
||||
boolean underlineBlock=false;
|
||||
boolean codeBlock=false;
|
||||
boolean linkBlock=false;
|
||||
StringBuilder storedLink=new StringBuilder();
|
||||
StringBuilder codeBlockMsg = new StringBuilder();
|
||||
StringBuilder buildMsg = new StringBuilder();
|
||||
for (int i=0;i<finalMsg.length();i++) {
|
||||
if (i<finalMsg.length()-1&&finalMsg.charAt(i)=='~'&&finalMsg.charAt(i+1)=='~') {
|
||||
if (codeBlock) {
|
||||
codeBlockMsg.append("~~");
|
||||
String storedCodeBlock="";
|
||||
String s = URLDecoder.decode(codeBlockMsg.toString(),StandardCharsets.UTF_8.toString());
|
||||
boolean keyword=false;
|
||||
boolean inString=false;
|
||||
boolean inComment=false;
|
||||
boolean inMultiLineComment=false;
|
||||
char stringChar=' ';
|
||||
boolean canBeNumericalConstant=false;
|
||||
int lengthOfConstant=0;
|
||||
storedCodeBlock+=s.substring(0,s.indexOf("~~"));
|
||||
storedCodeBlock=storedCodeBlock.replaceAll(Pattern.quote("<"),"\2");
|
||||
storedCodeBlock+="</pre>";
|
||||
int startPos=0;
|
||||
String endText=s.substring(s.indexOf("~~")+"~~".length(),s.length());
|
||||
s="";
|
||||
for (int j=0;j<storedCodeBlock.length()-1;j++) {
|
||||
if (storedCodeBlock.charAt(j)=='\n'&&inString) {
|
||||
inString=false;
|
||||
s+="</span>";
|
||||
} else
|
||||
if (storedCodeBlock.charAt(j)=='\n'&&inComment) {
|
||||
inComment=false;
|
||||
s+=SPAN("comment")+storedCodeBlock.substring(startPos,j)+"</span>";
|
||||
startPos=j+1;
|
||||
}
|
||||
} else
|
||||
if (!inString) {
|
||||
if (canBeNumericalConstant&&validNumericalConstantCharacters(storedCodeBlock,lengthOfConstant, j)) {
|
||||
lengthOfConstant++;
|
||||
//System.out.println("Length of Constant now "+lengthOfConstant);
|
||||
}
|
||||
if (j>0&&storedCodeBlock.charAt(j)=='/'&&storedCodeBlock.charAt(j+1)=='*'||inMultiLineComment) {
|
||||
if (!inMultiLineComment) {
|
||||
inMultiLineComment=true;
|
||||
if (!inComment&&!inMultiLineComment&&(j>0&&storedCodeBlock.charAt(j-1)!='\\'&&(!inString&&(storedCodeBlock.charAt(j)=='"'||storedCodeBlock.charAt(j)=='\'')||inString&&(storedCodeBlock.charAt(j)==stringChar)))) {
|
||||
inString=!inString;
|
||||
if (inString) {
|
||||
stringChar=storedCodeBlock.charAt(j);
|
||||
s+=SPAN("string")+stringChar;
|
||||
} else {
|
||||
if (storedCodeBlock.charAt(j-1)=='*'&&storedCodeBlock.charAt(j)=='/') {
|
||||
inMultiLineComment=false;
|
||||
s+=SPAN("comment")+storedCodeBlock.substring(startPos,j)+storedCodeBlock.charAt(j)+"</span>";
|
||||
startPos=j+1;
|
||||
s+=stringChar;
|
||||
s+="</span>";
|
||||
startPos=j+1;
|
||||
}
|
||||
} else
|
||||
if (!inString) {
|
||||
if (canBeNumericalConstant&&validNumericalConstantCharacters(storedCodeBlock,lengthOfConstant, j)) {
|
||||
lengthOfConstant++;
|
||||
//System.out.println("Length of Constant now "+lengthOfConstant);
|
||||
}
|
||||
if (j>0&&storedCodeBlock.charAt(j)=='/'&&storedCodeBlock.charAt(j+1)=='*'||inMultiLineComment) {
|
||||
if (!inMultiLineComment) {
|
||||
inMultiLineComment=true;
|
||||
} else {
|
||||
if (storedCodeBlock.charAt(j-1)=='*'&&storedCodeBlock.charAt(j)=='/') {
|
||||
inMultiLineComment=false;
|
||||
s+=SPAN("comment")+storedCodeBlock.substring(startPos,j)+storedCodeBlock.charAt(j)+"</span>";
|
||||
startPos=j+1;
|
||||
}
|
||||
}
|
||||
//Stops further execution since we're in a comment.
|
||||
} else
|
||||
if (j>0&&storedCodeBlock.charAt(j)=='/'&&storedCodeBlock.charAt(j+1)=='/'||inComment) {
|
||||
if (!inComment) {
|
||||
inComment=true;
|
||||
}
|
||||
//Stops further execution since we're in a comment.
|
||||
} else
|
||||
if (canBeNumericalConstant&&lengthOfConstant>0&&!(validNumericalConstantCharacters(storedCodeBlock,lengthOfConstant, j))) {
|
||||
s+=SPAN("number")+storedCodeBlock.substring(startPos,j)+"</span>"+storedCodeBlock.charAt(j);
|
||||
//System.out.println("Setting "+storedCodeBlock.substring(startPos,j)+storedCodeBlock.charAt(j));
|
||||
lengthOfConstant=0;
|
||||
canBeNumericalConstant=false;
|
||||
startPos=j+1;
|
||||
} else
|
||||
if (!canBeNumericalConstant&&storedCodeBlock.charAt(j)=='.') {
|
||||
//Previous section was a member.
|
||||
s+=SPAN("class")+storedCodeBlock.substring(startPos,j)+"</span>"+storedCodeBlock.charAt(j);
|
||||
startPos=j+1;
|
||||
} else
|
||||
if (j>3&&storedCodeBlock.substring(j-3,j+1).equals("true")&&!isAlphanumeric(storedCodeBlock,j-4)&&!isAlphanumeric(storedCodeBlock,j+1)) {
|
||||
s+=SPAN("number")+storedCodeBlock.substring(startPos,j)+storedCodeBlock.charAt(j)+"</span>";
|
||||
startPos=j+1;
|
||||
} else
|
||||
if (j>4&&storedCodeBlock.substring(j-4,j+1).equals("false")&&!isAlphanumeric(storedCodeBlock,j-5)&&!isAlphanumeric(storedCodeBlock,j+1)) {
|
||||
s+=SPAN("number")+storedCodeBlock.substring(startPos,j)+storedCodeBlock.charAt(j)+"</span>";
|
||||
startPos=j+1;
|
||||
} else
|
||||
if (storedCodeBlock.charAt(j)=='(') {
|
||||
s+=SPAN("function")+storedCodeBlock.substring(startPos,j)+"</span>"+storedCodeBlock.charAt(j);
|
||||
startPos=j+1;
|
||||
} else
|
||||
if (j>0&&isAlphanumeric(storedCodeBlock,j-1) && storedCodeBlock.charAt(j)==' '&&storedCodeBlock.charAt(j-1)!=' ') {
|
||||
//Previous section was a keyword.
|
||||
keyword=true;
|
||||
s+=SPAN("keyword")+storedCodeBlock.substring(startPos,j)+"</span>"+storedCodeBlock.charAt(j);
|
||||
startPos=j+1;
|
||||
} else
|
||||
if (j>0&&isAlphanumeric(storedCodeBlock,j-1) && (storedCodeBlock.charAt(j)==';'||storedCodeBlock.charAt(j)==':')) {
|
||||
//Previous section was a keyword.
|
||||
//keyword=true;
|
||||
s+=SPAN("keyword")+storedCodeBlock.substring(startPos,j)+"</span>"+storedCodeBlock.charAt(j);
|
||||
startPos=j+1;
|
||||
} else
|
||||
if (keyword&&!(storedCodeBlock.charAt(j)=='_'||storedCodeBlock.charAt(j)>='0'&&storedCodeBlock.charAt(j)<='9'||storedCodeBlock.charAt(j)>='A'&&storedCodeBlock.charAt(j)<='Z'||storedCodeBlock.charAt(j)>='a'&&storedCodeBlock.charAt(j)<='z'||storedCodeBlock.charAt(j)==' ')) {
|
||||
keyword=false;
|
||||
s+=SPAN("variable")+storedCodeBlock.substring(startPos,j)+"</span>"+storedCodeBlock.charAt(j);
|
||||
startPos=j+1;
|
||||
} else
|
||||
if (!isAlphanumeric(storedCodeBlock,j)){
|
||||
if (startPos<j) {
|
||||
s+=storedCodeBlock.substring(startPos,j)+storedCodeBlock.charAt(j);
|
||||
} else {
|
||||
s+=storedCodeBlock.charAt(j);
|
||||
}
|
||||
startPos=j+1;
|
||||
}
|
||||
//Stops further execution since we're in a comment.
|
||||
} else
|
||||
if (j>0&&storedCodeBlock.charAt(j)=='/'&&storedCodeBlock.charAt(j+1)=='/'||inComment) {
|
||||
if (!inComment) {
|
||||
inComment=true;
|
||||
}
|
||||
//Stops further execution since we're in a comment.
|
||||
} else
|
||||
if (canBeNumericalConstant&&lengthOfConstant>0&&!(validNumericalConstantCharacters(storedCodeBlock,lengthOfConstant, j))) {
|
||||
s+=SPAN("number")+storedCodeBlock.substring(startPos,j)+"</span>"+storedCodeBlock.charAt(j);
|
||||
//System.out.println("Setting "+storedCodeBlock.substring(startPos,j)+storedCodeBlock.charAt(j));
|
||||
lengthOfConstant=0;
|
||||
canBeNumericalConstant=false;
|
||||
startPos=j+1;
|
||||
} else
|
||||
if (!canBeNumericalConstant&&storedCodeBlock.charAt(j)=='.') {
|
||||
//Previous section was a member.
|
||||
s+=SPAN("class")+storedCodeBlock.substring(startPos,j)+"</span>"+storedCodeBlock.charAt(j);
|
||||
startPos=j+1;
|
||||
} else
|
||||
if (j>3&&storedCodeBlock.substring(j-3,j+1).equals("true")&&!isAlphanumeric(storedCodeBlock,j-4)&&!isAlphanumeric(storedCodeBlock,j+1)) {
|
||||
s+=SPAN("number")+storedCodeBlock.substring(startPos,j)+storedCodeBlock.charAt(j)+"</span>";
|
||||
startPos=j+1;
|
||||
} else
|
||||
if (j>4&&storedCodeBlock.substring(j-4,j+1).equals("false")&&!isAlphanumeric(storedCodeBlock,j-5)&&!isAlphanumeric(storedCodeBlock,j+1)) {
|
||||
s+=SPAN("number")+storedCodeBlock.substring(startPos,j)+storedCodeBlock.charAt(j)+"</span>";
|
||||
startPos=j+1;
|
||||
} else
|
||||
if (storedCodeBlock.charAt(j)=='(') {
|
||||
s+=SPAN("function")+storedCodeBlock.substring(startPos,j)+"</span>"+storedCodeBlock.charAt(j);
|
||||
startPos=j+1;
|
||||
} else
|
||||
if (j>0&&isAlphanumeric(storedCodeBlock,j-1) && storedCodeBlock.charAt(j)==' '&&storedCodeBlock.charAt(j-1)!=' ') {
|
||||
//Previous section was a keyword.
|
||||
keyword=true;
|
||||
s+=SPAN("keyword")+storedCodeBlock.substring(startPos,j)+"</span>"+storedCodeBlock.charAt(j);
|
||||
startPos=j+1;
|
||||
} else
|
||||
if (j>0&&isAlphanumeric(storedCodeBlock,j-1) && (storedCodeBlock.charAt(j)==';'||storedCodeBlock.charAt(j)==':')) {
|
||||
//Previous section was a keyword.
|
||||
//keyword=true;
|
||||
s+=SPAN("keyword")+storedCodeBlock.substring(startPos,j)+"</span>"+storedCodeBlock.charAt(j);
|
||||
startPos=j+1;
|
||||
} else
|
||||
if (keyword&&!(storedCodeBlock.charAt(j)=='_'||storedCodeBlock.charAt(j)>='0'&&storedCodeBlock.charAt(j)<='9'||storedCodeBlock.charAt(j)>='A'&&storedCodeBlock.charAt(j)<='Z'||storedCodeBlock.charAt(j)>='a'&&storedCodeBlock.charAt(j)<='z'||storedCodeBlock.charAt(j)==' ')) {
|
||||
keyword=false;
|
||||
s+=SPAN("variable")+storedCodeBlock.substring(startPos,j)+"</span>"+storedCodeBlock.charAt(j);
|
||||
startPos=j+1;
|
||||
} else
|
||||
if (!isAlphanumeric(storedCodeBlock,j)){
|
||||
if (startPos<j) {
|
||||
s+=storedCodeBlock.substring(startPos,j)+storedCodeBlock.charAt(j);
|
||||
} else {
|
||||
s+=storedCodeBlock.charAt(j);
|
||||
}
|
||||
} else {
|
||||
s+=storedCodeBlock.charAt(j);
|
||||
startPos=j+1;
|
||||
}
|
||||
} else {
|
||||
s+=storedCodeBlock.charAt(j);
|
||||
startPos=j+1;
|
||||
if (canBeNumericalConstant&&lengthOfConstant==0&&!(storedCodeBlock.charAt(j)>='0'&&storedCodeBlock.charAt(j)<='9')) {
|
||||
canBeNumericalConstant=false;
|
||||
}
|
||||
if (!canBeNumericalConstant&&!isAlphanumeric(storedCodeBlock,j)) {
|
||||
canBeNumericalConstant=true;
|
||||
lengthOfConstant=0;
|
||||
//System.out.println("Found "+storedCodeBlock.charAt(j)+", can be numeric...");
|
||||
}
|
||||
}
|
||||
if (canBeNumericalConstant&&lengthOfConstant==0&&!(storedCodeBlock.charAt(j)>='0'&&storedCodeBlock.charAt(j)<='9')) {
|
||||
canBeNumericalConstant=false;
|
||||
}
|
||||
if (!canBeNumericalConstant&&!isAlphanumeric(storedCodeBlock,j)) {
|
||||
canBeNumericalConstant=true;
|
||||
lengthOfConstant=0;
|
||||
//System.out.println("Found "+storedCodeBlock.charAt(j)+", can be numeric...");
|
||||
for (int j=0;j<s.length();j++) {
|
||||
if (s.charAt(j)=='\2') {
|
||||
s=s.substring(0,j)+"<"+s.substring(j+1,s.length());
|
||||
}
|
||||
}
|
||||
s="<pre>"+s;
|
||||
s+=endText;
|
||||
buildMsg.append(s);
|
||||
} else {
|
||||
codeBlockMsg=codeBlockMsg.delete(0, codeBlockMsg.length());
|
||||
}
|
||||
for (int j=0;j<s.length();j++) {
|
||||
if (s.charAt(j)=='\2') {
|
||||
s=s.substring(0,j)+"<"+s.substring(j+1,s.length());
|
||||
}
|
||||
i+=1;
|
||||
codeBlock=!codeBlock;
|
||||
continue;
|
||||
} else
|
||||
if (codeBlock) {
|
||||
codeBlockMsg.append(finalMsg.charAt(i));continue;
|
||||
}
|
||||
if (foundSub("%5E%5E",finalMsg,i)) {
|
||||
if (boldBlock) {
|
||||
buildMsg.append("</b>");
|
||||
} else {
|
||||
buildMsg.append("<b>");
|
||||
}
|
||||
s="<pre>"+s;
|
||||
s+=endText;
|
||||
buildMsg.append(s);
|
||||
} else {
|
||||
codeBlockMsg=codeBlockMsg.delete(0, codeBlockMsg.length());
|
||||
boldBlock=!boldBlock;
|
||||
i+=5;
|
||||
continue;
|
||||
}
|
||||
i+=1;
|
||||
codeBlock=!codeBlock;
|
||||
continue;
|
||||
} else
|
||||
if (codeBlock) {
|
||||
codeBlockMsg.append(finalMsg.charAt(i));continue;
|
||||
}
|
||||
if (foundSub("%5E%5E",finalMsg,i)) {
|
||||
if (boldBlock) {
|
||||
buildMsg.append("</b>");
|
||||
} else {
|
||||
buildMsg.append("<b>");
|
||||
if (i<finalMsg.length()-1&&finalMsg.charAt(i)=='*'&&finalMsg.charAt(i+1)=='*') {
|
||||
if (italicBlock) {
|
||||
buildMsg.append("</i>");
|
||||
} else {
|
||||
buildMsg.append("<i>");
|
||||
}
|
||||
italicBlock=!italicBlock;
|
||||
i+=1;
|
||||
continue;
|
||||
}
|
||||
boldBlock=!boldBlock;
|
||||
i+=5;
|
||||
continue;
|
||||
}
|
||||
if (i<finalMsg.length()-1&&finalMsg.charAt(i)=='*'&&finalMsg.charAt(i+1)=='*') {
|
||||
if (italicBlock) {
|
||||
buildMsg.append("</i>");
|
||||
} else {
|
||||
buildMsg.append("<i>");
|
||||
if (i<finalMsg.length()-1&&finalMsg.charAt(i)=='_'&&finalMsg.charAt(i +1)=='_') {
|
||||
if (underlineBlock) {
|
||||
buildMsg.append("</u>");
|
||||
} else {
|
||||
buildMsg.append("<u>");
|
||||
}
|
||||
underlineBlock=!underlineBlock;
|
||||
i+=1;
|
||||
continue;
|
||||
}
|
||||
italicBlock=!italicBlock;
|
||||
i+=1;
|
||||
continue;
|
||||
}
|
||||
if (i<finalMsg.length()-1&&finalMsg.charAt(i)=='_'&&finalMsg.charAt(i +1)=='_') {
|
||||
if (underlineBlock) {
|
||||
buildMsg.append("</u>");
|
||||
} else {
|
||||
buildMsg.append("<u>");
|
||||
if (foundSub("%5B%5B",finalMsg,i)||foundSub("%5D%5D",finalMsg,i)) {
|
||||
if (linkBlock) {
|
||||
buildMsg.append("\">").append(storedLink).append("</a>");
|
||||
} else {
|
||||
storedLink.delete(0,storedLink.length());
|
||||
buildMsg.append("<a href=\"");
|
||||
}
|
||||
linkBlock=!linkBlock;
|
||||
i+=5;
|
||||
continue;
|
||||
}
|
||||
underlineBlock=!underlineBlock;
|
||||
i+=1;
|
||||
continue;
|
||||
}
|
||||
if (foundSub("%5B%5B",finalMsg,i)||foundSub("%5D%5D",finalMsg,i)) {
|
||||
if (linkBlock) {
|
||||
buildMsg.append("\">").append(storedLink).append("</a>");
|
||||
} else {
|
||||
storedLink.delete(0,storedLink.length());
|
||||
buildMsg.append("<a href=\"");
|
||||
storedLink.append(finalMsg.charAt(i));
|
||||
}
|
||||
linkBlock=!linkBlock;
|
||||
i+=5;
|
||||
continue;
|
||||
buildMsg.append(finalMsg.charAt(i));
|
||||
}
|
||||
if (linkBlock) {
|
||||
storedLink.append(finalMsg.charAt(i));
|
||||
if (Files.exists(Paths.get(sigPlace.COMMENTSDIR,requestParams.get("article")))) {
|
||||
List<String> data = Files.readAllLines(Paths.get(sigPlace.COMMENTSDIR,requestParams.get("article")));
|
||||
data.set(0,Integer.toString(Integer.parseInt(data.get(0))+1));
|
||||
data.add(buildMsg.toString()+"\n"+requestParams.get("name")+ZonedDateTime.now()+";"+requestParams.get("color"));
|
||||
Files.write(Paths.get(sigPlace.COMMENTSDIR,requestParams.get("article")), data, StandardOpenOption.TRUNCATE_EXISTING,StandardOpenOption.WRITE);
|
||||
} else {
|
||||
List<String> data = new ArrayList<String>();
|
||||
data.add("1");
|
||||
data.add(buildMsg.toString()+"\n"+requestParams.get("name")+ZonedDateTime.now()+";"+requestParams.get("color"));
|
||||
Files.write(Paths.get(sigPlace.COMMENTSDIR,requestParams.get("article")), data, StandardOpenOption.TRUNCATE_EXISTING,StandardOpenOption.WRITE,StandardOpenOption.CREATE_NEW);
|
||||
}
|
||||
buildMsg.append(finalMsg.charAt(i));
|
||||
}
|
||||
if (Files.exists(Paths.get(sigPlace.COMMENTSDIR,requestParams.get("article")))) {
|
||||
List<String> data = Files.readAllLines(Paths.get(sigPlace.COMMENTSDIR,requestParams.get("article")));
|
||||
data.set(0,Integer.toString(Integer.parseInt(data.get(0))+1));
|
||||
data.add(buildMsg.toString()+"\n"+requestParams.get("name")+ZonedDateTime.now()+";"+requestParams.get("color"));
|
||||
Files.write(Paths.get(sigPlace.COMMENTSDIR,requestParams.get("article")), data, StandardOpenOption.TRUNCATE_EXISTING,StandardOpenOption.WRITE);
|
||||
CreateRequest(client,"200","OK",Paths.get(sigPlace.OUTDIR,"testfile.html"));
|
||||
} else {
|
||||
List<String> data = new ArrayList<String>();
|
||||
data.add("1");
|
||||
data.add(buildMsg.toString()+"\n"+requestParams.get("name")+ZonedDateTime.now()+";"+requestParams.get("color"));
|
||||
Files.write(Paths.get(sigPlace.COMMENTSDIR,requestParams.get("article")), data, StandardOpenOption.TRUNCATE_EXISTING,StandardOpenOption.WRITE,StandardOpenOption.CREATE_NEW);
|
||||
CreateRequest(client,"304","Not Modified",Paths.get(sigPlace.OUTDIR,"testfile.html"));
|
||||
}
|
||||
CreateRequest(client,"200","OK",Paths.get(sigPlace.OUTDIR,"testfile.html"));
|
||||
} else {
|
||||
if (modifiedDate==null||Files.exists(file)&&modifiedDate.isBefore(GetLastModifiedDate(file)))
|
||||
{
|
||||
@ -476,6 +480,7 @@ public class sigServer {
|
||||
if (contentType!=null&&contentType.equals("text/html")) {
|
||||
clientOutput.write(("<div class=\"generateTime\">Webpage generated in "+(System.currentTimeMillis()-startTime)+"ms</div>\r\n").getBytes());
|
||||
}
|
||||
System.out.println("Sent "+file+" with status ["+statusCode+"] "+statusMsg);
|
||||
}
|
||||
clientOutput.write("\r\n\r\n".getBytes());
|
||||
clientOutput.flush();
|
||||
|
Loading…
x
Reference in New Issue
Block a user