beautify html
This commit is contained in:
parent
ecf1478e7e
commit
5342f628da
354 changed files with 13965 additions and 9486 deletions
|
@ -1,38 +1,43 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head><meta charset="utf-8"></head>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<button onclick="loadPhones()" id="button">Загрузить phones.json!</button>
|
||||
<button onclick="loadPhones()" id="button">Загрузить phones.json!</button>
|
||||
|
||||
<script>
|
||||
function loadPhones() {
|
||||
<script>
|
||||
function loadPhones() {
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
|
||||
xhr.open('GET', 'phones.json', true);
|
||||
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState != 4) return;
|
||||
|
||||
button.innerHTML = 'Готово!';
|
||||
var xhr = new XMLHttpRequest();
|
||||
|
||||
if (xhr.status != 200) {
|
||||
// обработать ошибку
|
||||
alert(xhr.status + ': ' + xhr.statusText);
|
||||
} else {
|
||||
// вывести результат
|
||||
alert(xhr.responseText);
|
||||
xhr.open('GET', 'phones.json', true);
|
||||
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState != 4) return;
|
||||
|
||||
button.innerHTML = 'Готово!';
|
||||
|
||||
if (xhr.status != 200) {
|
||||
// обработать ошибку
|
||||
alert(xhr.status + ': ' + xhr.statusText);
|
||||
} else {
|
||||
// вывести результат
|
||||
alert(xhr.responseText);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
xhr.send();
|
||||
|
||||
button.innerHTML = 'Загружаю...';
|
||||
button.disabled = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
xhr.send();
|
||||
|
||||
button.innerHTML = 'Загружаю...';
|
||||
button.disabled = true;
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
</html>
|
|
@ -1,53 +1,58 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head><meta charset="utf-8"></head>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<button onclick="loadPhones()" id="button">Загрузить phones.json!</button>
|
||||
<button onclick="loadPhones()" id="button">Загрузить phones.json!</button>
|
||||
|
||||
<ul id="list"></ul>
|
||||
<ul id="list"></ul>
|
||||
|
||||
<script>
|
||||
function loadPhones() {
|
||||
<script>
|
||||
function loadPhones() {
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
|
||||
xhr.open('GET', 'phones.json', true);
|
||||
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState != 4) return;
|
||||
|
||||
button.parentNode.removeChild(button);
|
||||
var xhr = new XMLHttpRequest();
|
||||
|
||||
xhr.open('GET', 'phones.json', true);
|
||||
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState != 4) return;
|
||||
|
||||
button.parentNode.removeChild(button);
|
||||
|
||||
if (xhr.status != 200) {
|
||||
// обработать ошибку
|
||||
alert(xhr.status + ': ' + xhr.statusText);
|
||||
} else {
|
||||
try {
|
||||
var phones = JSON.parse(xhr.responseText);
|
||||
} catch (e) {
|
||||
alert("Некорректный ответ " + e.message);
|
||||
}
|
||||
showPhones(phones);
|
||||
}
|
||||
|
||||
if (xhr.status != 200) {
|
||||
// обработать ошибку
|
||||
alert(xhr.status + ': ' + xhr.statusText);
|
||||
} else {
|
||||
try {
|
||||
var phones = JSON.parse(xhr.responseText);
|
||||
} catch(e) {
|
||||
alert("Некорректный ответ " + e.message);
|
||||
}
|
||||
showPhones(phones);
|
||||
|
||||
xhr.send();
|
||||
|
||||
button.innerHTML = 'Загружаю...';
|
||||
button.disabled = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
xhr.send();
|
||||
function showPhones(phones) {
|
||||
|
||||
button.innerHTML = 'Загружаю...';
|
||||
button.disabled = true;
|
||||
}
|
||||
phones.forEach(function(phone) {
|
||||
var li = list.appendChild(document.createElement('li'));
|
||||
li.innerHTML = phone.name;
|
||||
});
|
||||
|
||||
function showPhones(phones) {
|
||||
|
||||
phones.forEach(function(phone) {
|
||||
var li = list.appendChild(document.createElement('li'));
|
||||
li.innerHTML = phone.name;
|
||||
});
|
||||
|
||||
}
|
||||
</script>
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
</html>
|
|
@ -1,40 +1,45 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head><meta charset="utf-8"></head>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<button onclick="loadPhones()" id="button">Загрузить phones.json!</button>
|
||||
<button onclick="loadPhones()" id="button">Загрузить phones.json!</button>
|
||||
|
||||
<script>
|
||||
function loadPhones() {
|
||||
<script>
|
||||
function loadPhones() {
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
|
||||
xhr.open('GET', 'phones.json', true);
|
||||
var xhr = new XMLHttpRequest();
|
||||
|
||||
xhr.open('GET', 'phones.json', true);
|
||||
|
||||
|
||||
xhr.send();
|
||||
xhr.send();
|
||||
|
||||
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState != 4) return;
|
||||
|
||||
button.innerHTML = 'Готово!';
|
||||
|
||||
if (xhr.status != 200) {
|
||||
// обработать ошибку
|
||||
alert(xhr.status + ': ' + xhr.statusText);
|
||||
} else {
|
||||
// вывести результат
|
||||
alert(xhr.responseText);
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState != 4) return;
|
||||
|
||||
button.innerHTML = 'Готово!';
|
||||
|
||||
if (xhr.status != 200) {
|
||||
// обработать ошибку
|
||||
alert(xhr.status + ': ' + xhr.statusText);
|
||||
} else {
|
||||
// вывести результат
|
||||
alert(xhr.responseText);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
button.innerHTML = 'Загружаю...';
|
||||
button.disabled = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
button.innerHTML = 'Загружаю...';
|
||||
button.disabled = true;
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
</html>
|
|
@ -1,26 +1,31 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head><meta charset="utf-8"></head>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<button onclick="loadPhones()">Загрузить phones.json!</button>
|
||||
<button onclick="loadPhones()">Загрузить phones.json!</button>
|
||||
|
||||
<script>
|
||||
function loadPhones() {
|
||||
var xhr = new XMLHttpRequest();
|
||||
<script>
|
||||
function loadPhones() {
|
||||
var xhr = new XMLHttpRequest();
|
||||
|
||||
xhr.open('GET', 'phones.json', false);
|
||||
xhr.send();
|
||||
xhr.open('GET', 'phones.json', false);
|
||||
xhr.send();
|
||||
|
||||
if (xhr.status != 200) {
|
||||
// обработать ошибку
|
||||
alert('Ошибка ' + xhr.status + ': ' + xhr.statusText);
|
||||
} else {
|
||||
// вывести результат
|
||||
alert(xhr.responseText);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
if (xhr.status != 200) {
|
||||
// обработать ошибку
|
||||
alert('Ошибка ' + xhr.status + ': ' + xhr.statusText);
|
||||
} else {
|
||||
// вывести результат
|
||||
alert(xhr.responseText);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
</html>
|
|
@ -1,33 +1,38 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head><meta charset="utf-8"></head>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<button onclick="run()">Загрузить digits</button>
|
||||
<button onclick="run()">Загрузить digits</button>
|
||||
|
||||
<ul id="log"></ul>
|
||||
<ul id="log"></ul>
|
||||
|
||||
<script>
|
||||
function run() {
|
||||
<script>
|
||||
function run() {
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
write(xhr.readyState);
|
||||
|
||||
xhr.open('GET', 'digits', true);
|
||||
write(xhr.readyState);
|
||||
|
||||
xhr.onreadystatechange = function() {
|
||||
write(xhr.readyState + " получено символов:" + xhr.responseText.length);
|
||||
};
|
||||
var xhr = new XMLHttpRequest();
|
||||
write(xhr.readyState);
|
||||
|
||||
xhr.send();
|
||||
}
|
||||
xhr.open('GET', 'digits', true);
|
||||
write(xhr.readyState);
|
||||
|
||||
function write(text) {
|
||||
var li = log.appendChild(document.createElement('li'));
|
||||
li.innerHTML = text;
|
||||
}
|
||||
</script>
|
||||
xhr.onreadystatechange = function() {
|
||||
write(xhr.readyState + " получено символов:" + xhr.responseText.length);
|
||||
};
|
||||
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
function write(text) {
|
||||
var li = log.appendChild(document.createElement('li'));
|
||||
li.innerHTML = text;
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue