-
Notifications
You must be signed in to change notification settings - Fork 10
/
index.html
81 lines (72 loc) · 2.44 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width">
<title>The world's tinest CMS using txti.es</title>
<!-- these styles just included to show how you can style everything how you wish -->
<style>
body {
font-family: sans-serif;
background: #eee;
max-width: 50em;
margin: auto;
padding: 1em;
line-height: 1.5;
font-size: 100%;
}
img {
max-width: 100%;
box-sizing: border-box;
display: block;
margin: .5em auto;
padding: .5em;
border: 1px solid #ccc;
background: #fff;
}
h1 { color: green }
a {
color: inherit;
text-decoration: none;
border-bottom: 1px solid green;
}
a:hover { color: green; }
</style>
</head>
<body>
<h1>The world's smallest CMS using txti.es</h1>
<hr>
<h2>This content comes from txti.es/hipster</h2>
<!-- include the data-src attribute pointing to the txti of your choice on any element -->
<div data-src="http://txti.es/hipster/html">JavaScript seems to be disabled. View this content at <a href="http://txti.es/hipster">txti.es/hipster</a></div>
<hr>
<h2>This content comes from txti.es/riker</h2>
<!-- notice the helpful text inside the element in case JavaScript is disabled -->
<div data-src="http://txti.es/riker/html">JavaScript seems to be disabled. View this content at <a href="http://txti.es/riker">txti.es/riker</a></div>
<!-- paste this script right before the closing body tag -->
<script>
//the TXTI CMS
(function(){
function putTxti(u, l){
var xhr= new XMLHttpRequest();
xhr.open('GET', u, true);
xhr.onreadystatechange = function() {
if (this.readyState < 4) {
return;
}else if (this.readyState == 4){
l.innerHTML = this.responseText;
}
};
xhr.send();
}
var all = document.getElementsByTagName("*"),
i = 0;
while(i < all.length){
if(all[i].hasAttribute('data-src')){
putTxti(all[i].getAttribute('data-src'), all[i]);
}
i++;
}
})();
</script>
</body>
</html>