final
This commit is contained in:
parent
af95477935
commit
1b02121e6b
@ -15,28 +15,29 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input class="form-check-input" type="radio" name="radio" id="radioBold" checked>
|
<input class="form-check-input" type="radio" name="radio" id="radioUppercase" checked>
|
||||||
<label class="form-check-label" for="radioBold">Undercase</label>
|
<label class="form-check-label" for="radioUppercase">Undercase</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input class="form-check-input" type="radio" name="radio" id="radioCursive">
|
<input class="form-check-input" type="radio" name="radio" id="radioLowcase">
|
||||||
<label class="form-check-label" for="radioCursive">Lowcase</label>
|
<label class="form-check-label" for="radioLowcase">Lowcase</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input class="form-check-input" type="radio" name="radio" id="radioUnderline">
|
<input class="form-check-input" type="radio" name="radio" id="radioSplit">
|
||||||
<label class="form-check-label" for="radioUnderline">Split</label>
|
<label class="form-check-label" for="radioSplit">Split</label>
|
||||||
<label for="input" class="form-label">Split by</label>
|
|
||||||
<input type="text" class="form-control" id="inputSplitBy">
|
<input type="text" class="form-control" id="inputSplitBy">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input class="form-check-input" type="radio" name="radio" id="radioCrossed">
|
<input class="form-check-input" type="radio" name="radio" id="radioReplace">
|
||||||
<label class="form-check-label" for="radioCrossed">Перечеркнутый</label>
|
<label class="form-check-label" for="radioReplace">Replace</label>
|
||||||
|
<input type="text" class="form-control" id="inputReplaceOld" maxlength="1">
|
||||||
|
<input type="text" class="form-control" id="inputReplaceNew" maxlength="1">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="btn btn-primary">Обработать</button>
|
<button type="submit" class="btn btn-primary">Обработать</button>
|
||||||
|
@ -15,27 +15,23 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||||||
|
|
||||||
document.getElementsByClassName("needs-validation")[0].addEventListener('submit', function(event) {
|
document.getElementsByClassName("needs-validation")[0].addEventListener('submit', function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
if (document.getElementById("radioBold").checked) {
|
if (document.getElementById("radioUppercase").checked) {
|
||||||
fetch("http://localhost:8080/uppercase?value=" + document.getElementById("input").value)
|
fetch("http://localhost:8080/uppercase?value=" + document.getElementById("input").value)
|
||||||
.then(resp => {return resp.text()})
|
.then(resp => {return resp.text()})
|
||||||
.then(resBody => {document.getElementById("result").innerHTML = resBody})
|
.then(resBody => {document.getElementById("result").innerHTML = resBody})
|
||||||
}
|
}
|
||||||
if (document.getElementById("radioCursive").checked) {
|
if (document.getElementById("radioLowcase").checked) {
|
||||||
fetch("http://localhost:8080/lovercase?value=" + document.getElementById("input").value)
|
fetch("http://localhost:8080/lowercase?value=" + document.getElementById("input").value)
|
||||||
.then(resp => {return resp.text()})
|
.then(resp => {return resp.text()})
|
||||||
.then(resBody => {document.getElementById("result").innerHTML = resBody})
|
.then(resBody => {document.getElementById("result").innerHTML = resBody})
|
||||||
}
|
}
|
||||||
if (document.getElementById("radioUnderline").checked) {
|
if (document.getElementById("radioSplit").checked) {
|
||||||
fetch("http://localhost:8080/split?value=" + document.getElementById("input").value + "&splitBy=" + document.getElementById("inputSplitBy").value)
|
fetch("http://localhost:8080/split?value=" + document.getElementById("input").value + "&splitBy=" + document.getElementById("inputSplitBy").value)
|
||||||
.then(resp => {return resp.text()})
|
.then(resp => {return resp.text()})
|
||||||
.then(resBody => {
|
.then(resBody => {document.getElementById("result").innerHTML = resBody})
|
||||||
for (i = 0; i < resBody.length; i++) {
|
|
||||||
document.getElementById("result").innerHTML += resBody[i]
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if (document.getElementById("radioCrossed").checked) {
|
if (document.getElementById("radioReplace").checked) {
|
||||||
fetch("http://localhost:8080/crossed?value=" + document.getElementById("input").value)
|
fetch("http://localhost:8080/replace?value=" + document.getElementById("input").value + "&old=" + document.getElementById("inputReplaceOld").value + "&new=" + document.getElementById("inputReplaceNew").value)
|
||||||
.then(resp => {return resp.text()})
|
.then(resp => {return resp.text()})
|
||||||
.then(resBody => {document.getElementById("result").innerHTML = resBody})
|
.then(resBody => {document.getElementById("result").innerHTML = resBody})
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,8 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
public class ReplaceController {
|
public class ReplaceController {
|
||||||
@GetMapping("/replace")
|
@GetMapping("/replace")
|
||||||
public String replace(@RequestParam(value = "value", defaultValue = "None") String value,
|
public String replace(@RequestParam(value = "value", defaultValue = "None") String value,
|
||||||
@RequestParam(value = "old", defaultValue = " ") char oldChar,
|
@RequestParam(value = "old", defaultValue = "") char oldChar,
|
||||||
@RequestParam(value = "new", defaultValue = " ") char newChar) {
|
@RequestParam(value = "new", defaultValue = "") char newChar) {
|
||||||
return value.replace(oldChar, newChar);
|
return value.replace(oldChar, newChar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,14 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
@RestController
|
@RestController
|
||||||
public class SplitController {
|
public class SplitController {
|
||||||
@GetMapping("/split")
|
@GetMapping("/split")
|
||||||
public String[] split(@RequestParam(value = "value", defaultValue = "None") String value,
|
public String split(@RequestParam(value = "value", defaultValue = "None") String value,
|
||||||
@RequestParam(value = "splitBy", defaultValue = " ") String splitBy) {
|
@RequestParam(value = "splitBy", defaultValue = " ") String splitBy) {
|
||||||
return value.split(splitBy);
|
String[] temp = value.split(splitBy);
|
||||||
|
String res = "";
|
||||||
|
for (int i = 0; i < temp.length; i++) {
|
||||||
|
res += temp[i];
|
||||||
|
res += "; ";
|
||||||
|
}
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user