WordMord/initial_transformations.html

139 lines
3.6 KiB
HTML
Raw Permalink Normal View History

2022-01-13 14:57:57 +01:00
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>
</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<link rel="stylesheet" href="style.css">
</head>
<body>
<table>
<tr>
<td>
<div id="squawk">
<iframe src="https://pad.vvvvvvaria.org/WordMord.%CE%B7.%CE%B6%CE%BF%CF%85%CE%BC%CE%B9%CE%AC"></iframe>
</div>
</td>
<td>
<div id="distorted">
<button type="button" onclick="no_spaces()">no spaces</button>
<br><br>
<div id="no_spaces"></div>
<br><br>
<button type="button" onclick="blind_spots()">blind spots</button>
<br><br>
<div id="blind_spots"></div>
</div>
</td>
<td>
<div id="pdf">
</div>
</td>
<td>
<div id="urla"></div>
</td>
<!-- <td>
<div id="notouch"></div>
</td> -->
</tr>
</table>
<script>
var clicked1 = 0;
var clicked2 = 0;
function no_spaces() {
var distorted = httpGet('https://pad.vvvvvvaria.org/WordMord.%CE%B7.%CE%B6%CE%BF%CF%85%CE%BC%CE%B9%CE%AC/export/txt');
if (clicked1 == 0) {
document.getElementById("no_spaces").innerHTML = distorted.replace(/\s+/g, '');
clicked1 = 1;
} else {
document.getElementById("no_spaces").innerHTML = "";
clicked1 = 0;
}
}
function blind_spots() {
var distorted = httpGet('https://pad.vvvvvvaria.org/WordMord.%CE%B7.%CE%B6%CE%BF%CF%85%CE%BC%CE%B9%CE%AC/export/txt');
if (clicked2 == 0) {
var keep=['γλώσσα','ΓΛΩΣΣΑ','Κώδικα','κώδικα','code', 'Mord'];
console.log(keep);
// var repl_char = '--------';
var repl_char = '|||||||||';
// extracting words
var temp = distorted.split(" ");
// console.log(temp);
for (idx in temp){
var ele = temp[idx];
console.log(temp[idx]);
// replace non keep with repl_char
// if (ele !== keep){
// temp[idx] = repl_char;
// }
// if (ele !== keep){
if (!keep.includes(ele)){
temp[idx] = repl_char;
}
};
// joining result
var distorted = temp.join("");
document.getElementById("blind_spots").innerHTML = distorted;
// document.getElementById("blind_spots").innerHTML = distorted.replaceAll(/[^γλώσσα]+/g, '--------');
clicked2 = 1;
} else {
document.getElementById("blind_spots").innerHTML = "";
clicked2 = 0;
}
}
function httpGet(theUrl) {
var xmlHttp = new XMLHttpRequest();
xmlHttp.open("GET", theUrl, false); // false for synchronous request
xmlHttp.send(null);
return xmlHttp.responseText;
}
// var squawk = httpGet('https://pad.vvvvvvaria.org/WordMord.%CE%B7.%CE%B6%CE%BF%CF%85%CE%BC%CE%B9%CE%AC/export/html');
var urla = httpGet('https://pad.vvvvvvaria.org/WordMord.references/export/html');
// var notouch = httpGet('https://pad.xpub.nl/p/WordMord.images/export/txt');
var pdf = httpGet('https://pad.vvvvvvaria.org/WordMord.pdf/export/html');
// distorted = distorted.replace(/\s+/g, '');
// document.getElementById("squawk").innerHTML = squawk;
// document.getElementById("notouch").innerHTML = notouch;
document.getElementById("urla").innerHTML = urla;
document.getElementById("pdf").innerHTML = pdf;
// document.getElementById("distorted").innerHTML = distorted;
//document.styleSheets[1].disabled = true;
// $('a').click(function(){
// window.open('url', 'window name', 'window settings');
// return false;
// });
</script>
</body>
</html>