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!
|
That is a great idea!
|
||||||
username,17May2021 08:29:10;GREEN
|
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>
|
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
|
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>!</
|
<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
|
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>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="contentBody">
|
<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>
|
<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-01T15:59:35.326694Z gitpod 77</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-01T15:59:35.214694Z gitpod 2635</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-01T15:59:35.258694Z gitpod 88370</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-01T15:59:35.218694Z gitpod 1092</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-01T15:59:35.262694Z gitpod 1627</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-01T15:59:35.262694Z gitpod 1707</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-01T15:59:35.246694Z gitpod 10595</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-01T15:59:35.262694Z gitpod 1672</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> <!--End Content Body-->
|
||||||
<div class="codeForeground" id="codeForeground"></div>
|
<div class="codeForeground" id="codeForeground"></div>
|
||||||
|
@ -17,13 +17,13 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="contentBody">
|
<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>
|
<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-01T15:59:34.742695Z gitpod 497</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-01T15:59:34.770695Z gitpod 730</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-01T15:59:35.210694Z gitpod 80858</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-01T15:59:35.278694Z gitpod 8626</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-01T15:59:35.306694Z gitpod 8835</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-01T15:59:35.318694Z gitpod 88935</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> <!--End Content Body-->
|
||||||
<div class="codeForeground" id="codeForeground"></div>
|
<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;
|
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) {
|
function insert(c1,c2) {
|
||||||
if (document.getElementById("msg").selectionStart==document.getElementById("msg").selectionEnd) {
|
if (document.getElementById("msg").selectionStart==document.getElementById("msg").selectionEnd) {
|
||||||
//No highlighting. Insert here.
|
//No highlighting. Insert here.
|
||||||
if (c2!=undefined) {
|
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 {
|
} 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)
|
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;
|
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) {
|
function insert(c1,c2) {
|
||||||
if (document.getElementById("msg").selectionStart==document.getElementById("msg").selectionEnd) {
|
if (document.getElementById("msg").selectionStart==document.getElementById("msg").selectionEnd) {
|
||||||
//No highlighting. Insert here.
|
//No highlighting. Insert here.
|
||||||
if (c2!=undefined) {
|
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 {
|
} 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)
|
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;
|
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) {
|
function insert(c1,c2) {
|
||||||
if (document.getElementById("msg").selectionStart==document.getElementById("msg").selectionEnd) {
|
if (document.getElementById("msg").selectionStart==document.getElementById("msg").selectionEnd) {
|
||||||
//No highlighting. Insert here.
|
//No highlighting. Insert here.
|
||||||
if (c2!=undefined) {
|
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 {
|
} 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)
|
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>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="contentBody">
|
<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>
|
<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-01T15:59:34.738695Z gitpod 781</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-01T15:59:34.742695Z gitpod 994</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-01T15:59:35.266694Z gitpod 9154</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-01T15:59:35.274694Z gitpod 8850</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-01T15:59:35.278694Z gitpod 9063</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> <!--End Content Body-->
|
||||||
<div class="codeForeground" id="codeForeground"></div>
|
<div class="codeForeground" id="codeForeground"></div>
|
||||||
|
@ -72,11 +72,32 @@
|
|||||||
document.getElementById("msg").disabled=false;
|
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) {
|
function insert(c1,c2) {
|
||||||
if (document.getElementById("msg").selectionStart==document.getElementById("msg").selectionEnd) {
|
if (document.getElementById("msg").selectionStart==document.getElementById("msg").selectionEnd) {
|
||||||
//No highlighting. Insert here.
|
//No highlighting. Insert here.
|
||||||
if (c2!=undefined) {
|
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 {
|
} 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)
|
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;
|
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) {
|
function insert(c1,c2) {
|
||||||
if (document.getElementById("msg").selectionStart==document.getElementById("msg").selectionEnd) {
|
if (document.getElementById("msg").selectionStart==document.getElementById("msg").selectionEnd) {
|
||||||
//No highlighting. Insert here.
|
//No highlighting. Insert here.
|
||||||
if (c2!=undefined) {
|
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 {
|
} 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)
|
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;
|
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) {
|
function insert(c1,c2) {
|
||||||
if (document.getElementById("msg").selectionStart==document.getElementById("msg").selectionEnd) {
|
if (document.getElementById("msg").selectionStart==document.getElementById("msg").selectionEnd) {
|
||||||
//No highlighting. Insert here.
|
//No highlighting. Insert here.
|
||||||
if (c2!=undefined) {
|
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 {
|
} 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)
|
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;
|
String filename=null;
|
||||||
OutputStream stream = null;
|
OutputStream stream = null;
|
||||||
requestLine=in.readLine(); //Read the first line, this should be our request.
|
requestLine=in.readLine(); //Read the first line, this should be our request.
|
||||||
System.out.println(requestLine);
|
|
||||||
if (requestLine!=null) {
|
if (requestLine!=null) {
|
||||||
String[] splitter = requestLine.split(Pattern.quote(" "));
|
String[] splitter = requestLine.split(Pattern.quote(" "));
|
||||||
boolean ISPOST = splitter[0].equals("POST");
|
boolean ISPOST = splitter[0].equals("POST");
|
||||||
@ -38,3 +37,4 @@
|
|||||||
System.out.println(line);
|
System.out.println(line);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
File myFile = new File(new File(sigPlace.OUTDIR,sigPlace.UPLOADSDIR),filename);
|
||||||
|
@ -28,11 +28,32 @@
|
|||||||
document.getElementById("msg").disabled=false;
|
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) {
|
function insert(c1,c2) {
|
||||||
if (document.getElementById("msg").selectionStart==document.getElementById("msg").selectionEnd) {
|
if (document.getElementById("msg").selectionStart==document.getElementById("msg").selectionEnd) {
|
||||||
//No highlighting. Insert here.
|
//No highlighting. Insert here.
|
||||||
if (c2!=undefined) {
|
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 {
|
} 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)
|
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")) {
|
if (location.equals("COMMENTS")&&requestParams.containsKey("message")&&requestParams.containsKey("name")&&requestParams.containsKey("color")) {
|
||||||
//System.out.println(requestParams);
|
//System.out.println(requestParams);
|
||||||
String finalMsg = requestParams.get("message").replaceAll(Pattern.quote("%0A"),"<br/>").replaceAll(Pattern.quote("%3C"),"<");
|
String finalMsg = requestParams.get("message").replaceAll(Pattern.quote("%0A"),"<br/>").replaceAll(Pattern.quote("%3C"),"<");
|
||||||
boolean boldBlock=false;
|
if (finalMsg.length()>0) {
|
||||||
boolean italicBlock=false;
|
boolean boldBlock=false;
|
||||||
boolean underlineBlock=false;
|
boolean italicBlock=false;
|
||||||
boolean codeBlock=false;
|
boolean underlineBlock=false;
|
||||||
boolean linkBlock=false;
|
boolean codeBlock=false;
|
||||||
StringBuilder storedLink=new StringBuilder();
|
boolean linkBlock=false;
|
||||||
StringBuilder codeBlockMsg = new StringBuilder();
|
StringBuilder storedLink=new StringBuilder();
|
||||||
StringBuilder buildMsg = new StringBuilder();
|
StringBuilder codeBlockMsg = new StringBuilder();
|
||||||
for (int i=0;i<finalMsg.length();i++) {
|
StringBuilder buildMsg = new StringBuilder();
|
||||||
if (i<finalMsg.length()-1&&finalMsg.charAt(i)=='~'&&finalMsg.charAt(i+1)=='~') {
|
for (int i=0;i<finalMsg.length();i++) {
|
||||||
if (codeBlock) {
|
if (i<finalMsg.length()-1&&finalMsg.charAt(i)=='~'&&finalMsg.charAt(i+1)=='~') {
|
||||||
codeBlockMsg.append("~~");
|
if (codeBlock) {
|
||||||
String storedCodeBlock="";
|
codeBlockMsg.append("~~");
|
||||||
String s = URLDecoder.decode(codeBlockMsg.toString(),StandardCharsets.UTF_8.toString());
|
String storedCodeBlock="";
|
||||||
boolean keyword=false;
|
String s = URLDecoder.decode(codeBlockMsg.toString(),StandardCharsets.UTF_8.toString());
|
||||||
boolean inString=false;
|
boolean keyword=false;
|
||||||
boolean inComment=false;
|
boolean inString=false;
|
||||||
boolean inMultiLineComment=false;
|
boolean inComment=false;
|
||||||
char stringChar=' ';
|
boolean inMultiLineComment=false;
|
||||||
boolean canBeNumericalConstant=false;
|
char stringChar=' ';
|
||||||
int lengthOfConstant=0;
|
boolean canBeNumericalConstant=false;
|
||||||
storedCodeBlock+=s.substring(0,s.indexOf("~~"));
|
int lengthOfConstant=0;
|
||||||
storedCodeBlock=storedCodeBlock.replaceAll(Pattern.quote("<"),"\2");
|
storedCodeBlock+=s.substring(0,s.indexOf("~~"));
|
||||||
storedCodeBlock+="</pre>";
|
storedCodeBlock=storedCodeBlock.replaceAll(Pattern.quote("<"),"\2");
|
||||||
int startPos=0;
|
storedCodeBlock+="</pre>";
|
||||||
String endText=s.substring(s.indexOf("~~")+"~~".length(),s.length());
|
int startPos=0;
|
||||||
s="";
|
String endText=s.substring(s.indexOf("~~")+"~~".length(),s.length());
|
||||||
for (int j=0;j<storedCodeBlock.length()-1;j++) {
|
s="";
|
||||||
if (storedCodeBlock.charAt(j)=='\n'&&inString) {
|
for (int j=0;j<storedCodeBlock.length()-1;j++) {
|
||||||
inString=false;
|
if (storedCodeBlock.charAt(j)=='\n'&&inString) {
|
||||||
s+="</span>";
|
inString=false;
|
||||||
} 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;
|
|
||||||
s+="</span>";
|
s+="</span>";
|
||||||
|
} else
|
||||||
|
if (storedCodeBlock.charAt(j)=='\n'&&inComment) {
|
||||||
|
inComment=false;
|
||||||
|
s+=SPAN("comment")+storedCodeBlock.substring(startPos,j)+"</span>";
|
||||||
startPos=j+1;
|
startPos=j+1;
|
||||||
}
|
}
|
||||||
} else
|
if (!inComment&&!inMultiLineComment&&(j>0&&storedCodeBlock.charAt(j-1)!='\\'&&(!inString&&(storedCodeBlock.charAt(j)=='"'||storedCodeBlock.charAt(j)=='\'')||inString&&(storedCodeBlock.charAt(j)==stringChar)))) {
|
||||||
if (!inString) {
|
inString=!inString;
|
||||||
if (canBeNumericalConstant&&validNumericalConstantCharacters(storedCodeBlock,lengthOfConstant, j)) {
|
if (inString) {
|
||||||
lengthOfConstant++;
|
stringChar=storedCodeBlock.charAt(j);
|
||||||
//System.out.println("Length of Constant now "+lengthOfConstant);
|
s+=SPAN("string")+stringChar;
|
||||||
}
|
|
||||||
if (j>0&&storedCodeBlock.charAt(j)=='/'&&storedCodeBlock.charAt(j+1)=='*'||inMultiLineComment) {
|
|
||||||
if (!inMultiLineComment) {
|
|
||||||
inMultiLineComment=true;
|
|
||||||
} else {
|
} else {
|
||||||
if (storedCodeBlock.charAt(j-1)=='*'&&storedCodeBlock.charAt(j)=='/') {
|
s+=stringChar;
|
||||||
inMultiLineComment=false;
|
s+="</span>";
|
||||||
s+=SPAN("comment")+storedCodeBlock.substring(startPos,j)+storedCodeBlock.charAt(j)+"</span>";
|
startPos=j+1;
|
||||||
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 {
|
||||||
} else
|
s+=storedCodeBlock.charAt(j);
|
||||||
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;
|
startPos=j+1;
|
||||||
}
|
}
|
||||||
} else {
|
if (canBeNumericalConstant&&lengthOfConstant==0&&!(storedCodeBlock.charAt(j)>='0'&&storedCodeBlock.charAt(j)<='9')) {
|
||||||
s+=storedCodeBlock.charAt(j);
|
canBeNumericalConstant=false;
|
||||||
startPos=j+1;
|
}
|
||||||
|
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')) {
|
for (int j=0;j<s.length();j++) {
|
||||||
canBeNumericalConstant=false;
|
if (s.charAt(j)=='\2') {
|
||||||
}
|
s=s.substring(0,j)+"<"+s.substring(j+1,s.length());
|
||||||
if (!canBeNumericalConstant&&!isAlphanumeric(storedCodeBlock,j)) {
|
}
|
||||||
canBeNumericalConstant=true;
|
|
||||||
lengthOfConstant=0;
|
|
||||||
//System.out.println("Found "+storedCodeBlock.charAt(j)+", can be numeric...");
|
|
||||||
}
|
}
|
||||||
|
s="<pre>"+s;
|
||||||
|
s+=endText;
|
||||||
|
buildMsg.append(s);
|
||||||
|
} else {
|
||||||
|
codeBlockMsg=codeBlockMsg.delete(0, codeBlockMsg.length());
|
||||||
}
|
}
|
||||||
for (int j=0;j<s.length();j++) {
|
i+=1;
|
||||||
if (s.charAt(j)=='\2') {
|
codeBlock=!codeBlock;
|
||||||
s=s.substring(0,j)+"<"+s.substring(j+1,s.length());
|
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;
|
boldBlock=!boldBlock;
|
||||||
s+=endText;
|
i+=5;
|
||||||
buildMsg.append(s);
|
continue;
|
||||||
} else {
|
|
||||||
codeBlockMsg=codeBlockMsg.delete(0, codeBlockMsg.length());
|
|
||||||
}
|
}
|
||||||
i+=1;
|
if (i<finalMsg.length()-1&&finalMsg.charAt(i)=='*'&&finalMsg.charAt(i+1)=='*') {
|
||||||
codeBlock=!codeBlock;
|
if (italicBlock) {
|
||||||
continue;
|
buildMsg.append("</i>");
|
||||||
} else
|
} else {
|
||||||
if (codeBlock) {
|
buildMsg.append("<i>");
|
||||||
codeBlockMsg.append(finalMsg.charAt(i));continue;
|
}
|
||||||
}
|
italicBlock=!italicBlock;
|
||||||
if (foundSub("%5E%5E",finalMsg,i)) {
|
i+=1;
|
||||||
if (boldBlock) {
|
continue;
|
||||||
buildMsg.append("</b>");
|
|
||||||
} else {
|
|
||||||
buildMsg.append("<b>");
|
|
||||||
}
|
}
|
||||||
boldBlock=!boldBlock;
|
if (i<finalMsg.length()-1&&finalMsg.charAt(i)=='_'&&finalMsg.charAt(i +1)=='_') {
|
||||||
i+=5;
|
if (underlineBlock) {
|
||||||
continue;
|
buildMsg.append("</u>");
|
||||||
}
|
} else {
|
||||||
if (i<finalMsg.length()-1&&finalMsg.charAt(i)=='*'&&finalMsg.charAt(i+1)=='*') {
|
buildMsg.append("<u>");
|
||||||
if (italicBlock) {
|
}
|
||||||
buildMsg.append("</i>");
|
underlineBlock=!underlineBlock;
|
||||||
} else {
|
i+=1;
|
||||||
buildMsg.append("<i>");
|
continue;
|
||||||
}
|
}
|
||||||
italicBlock=!italicBlock;
|
if (foundSub("%5B%5B",finalMsg,i)||foundSub("%5D%5D",finalMsg,i)) {
|
||||||
i+=1;
|
if (linkBlock) {
|
||||||
continue;
|
buildMsg.append("\">").append(storedLink).append("</a>");
|
||||||
}
|
} else {
|
||||||
if (i<finalMsg.length()-1&&finalMsg.charAt(i)=='_'&&finalMsg.charAt(i +1)=='_') {
|
storedLink.delete(0,storedLink.length());
|
||||||
if (underlineBlock) {
|
buildMsg.append("<a href=\"");
|
||||||
buildMsg.append("</u>");
|
}
|
||||||
} else {
|
linkBlock=!linkBlock;
|
||||||
buildMsg.append("<u>");
|
i+=5;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
underlineBlock=!underlineBlock;
|
|
||||||
i+=1;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (foundSub("%5B%5B",finalMsg,i)||foundSub("%5D%5D",finalMsg,i)) {
|
|
||||||
if (linkBlock) {
|
if (linkBlock) {
|
||||||
buildMsg.append("\">").append(storedLink).append("</a>");
|
storedLink.append(finalMsg.charAt(i));
|
||||||
} else {
|
|
||||||
storedLink.delete(0,storedLink.length());
|
|
||||||
buildMsg.append("<a href=\"");
|
|
||||||
}
|
}
|
||||||
linkBlock=!linkBlock;
|
buildMsg.append(finalMsg.charAt(i));
|
||||||
i+=5;
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
if (linkBlock) {
|
if (Files.exists(Paths.get(sigPlace.COMMENTSDIR,requestParams.get("article")))) {
|
||||||
storedLink.append(finalMsg.charAt(i));
|
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));
|
CreateRequest(client,"200","OK",Paths.get(sigPlace.OUTDIR,"testfile.html"));
|
||||||
}
|
|
||||||
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 {
|
} else {
|
||||||
List<String> data = new ArrayList<String>();
|
CreateRequest(client,"304","Not Modified",Paths.get(sigPlace.OUTDIR,"testfile.html"));
|
||||||
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,"200","OK",Paths.get(sigPlace.OUTDIR,"testfile.html"));
|
|
||||||
} else {
|
} else {
|
||||||
if (modifiedDate==null||Files.exists(file)&&modifiedDate.isBefore(GetLastModifiedDate(file)))
|
if (modifiedDate==null||Files.exists(file)&&modifiedDate.isBefore(GetLastModifiedDate(file)))
|
||||||
{
|
{
|
||||||
@ -476,6 +480,7 @@ public class sigServer {
|
|||||||
if (contentType!=null&&contentType.equals("text/html")) {
|
if (contentType!=null&&contentType.equals("text/html")) {
|
||||||
clientOutput.write(("<div class=\"generateTime\">Webpage generated in "+(System.currentTimeMillis()-startTime)+"ms</div>\r\n").getBytes());
|
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.write("\r\n\r\n".getBytes());
|
||||||
clientOutput.flush();
|
clientOutput.flush();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user