This repository was archived by the owner on Jul 25, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathxfn-xoxo-blogroll.html
More file actions
executable file
·179 lines (155 loc) · 7.84 KB
/
xfn-xoxo-blogroll.html
File metadata and controls
executable file
·179 lines (155 loc) · 7.84 KB
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<div style="padding:3ex;">
<script type="text/javascript">
//<![CDATA[
function GetElementsWithClassName(elementName, className) {
var allElements = document.getElementsByTagName(elementName);
var elemColl = new Array();
for (i = 0; i < allElements.length; i++) {
if (allElements[i].className == className) {
elemColl[elemColl.length] = allElements[i];
}
}
return elemColl;
}
function meChecked()
{
var undefined;
var eMe = document.getElementById('me');
if (eMe == undefined) return false;
else return eMe.checked;
}
function upit() {
var isMe = meChecked(); //document.getElementById('me').checked;
var inputColl = GetElementsWithClassName('input', 'valinp');
var results = document.getElementById('xfnResult');
var linkText, linkUrl, inputs = '';
linkText = document.getElementById('linkText').value;
linkUrl = document.getElementById('linkUrl').value;
for (i = 0; i < inputColl.length; i++) {
inputColl[i].disabled = isMe;
inputColl[i].parentNode.className = isMe ? 'disabled' : '';
if (!isMe && inputColl[i].checked && inputColl[i].value != '') {
inputs += inputColl[i].value + ' ';
}
}
inputs = inputs.substr(0,inputs.length - 1);
if (isMe) inputs='me';
results.childNodes[0].nodeValue = '<a class="fn url" href="' + linkUrl + '" rel="' + inputs + '">' + linkText + '<\/a>';
}
function blurry() {
if (!document.getElementById) return;
var aInputs = document.getElementsByTagName('input');
for (var i = 0; i < aInputs.length; i++) {
aInputs[i].onclick = aInputs[i].onkeyup = upit;
}
}
function resetstuff() {
if (meChecked()) document.getElementById('me').checked='';
upit();
document.getElementById('xfnResult').childNodes[0].nodeValue = '<a href="" rel=""><\/a>';
}
window.onload = blurry;
var xoxoList = [];
function addLink() {
upit();
xoxoList.push(document.getElementById('xfnResult').innerHTML);
buildXOXO();
}//end function addLink
function removeLink(idx) {
delete xoxoList[idx];
buildXOXO();
}//end function removeLink
function buildXOXO(final) {
var txt = '<ul class="xoxo blogroll"><br \/>\n';
for(var i in xoxoList) {
txt += ' <li class="vcard">' + xoxoList[i];
if(!final) txt += ' <a href="javascript:removeLink("' + i + '");" style="font-family:sans-serif;text-decoration:none;" title="Remove from list">X</a> ';
txt += '<\/li><br \/>\n';
}//end for i in xoxoList
txt += '<\/ul><br \/>\n';
if(!final) {txt = txt.replace(/<br \/>/g, '').replace(/</g,'<').replace(/>/g,'>').replace(/ /g,' ');}
var block = document.getElementById('xoxoResult');
block.innerHTML = txt;
}//end function buildXOXO
//]]>
</script>
<h2><abbr title="XHTML Friends Network">XFN</abbr> <abbr title="Extensible Open XHTML Outlines">XOXO</abbr> Blogroll Creator (with hCards)</h2>
<form action="" onreset="resetstuff();">
<table cellspacing="0">
<tr>
<th scope="row">
Name
</th>
<td>
<input type="text" id="linkText" />
</td>
</tr>
<tr>
<th scope="row">
URL
</th>
<td>
<input type="text" id="linkUrl" /> <label for="me"><input type="checkbox" name="identity" value="me" id="me" /> another web address of mine</label>
</td>
</tr>
<tr>
<th scope="row">
friendship
</th>
<td>
<label for="friendship-contact"><input class="valinp" type="radio" name="friendship" value="contact" id="friendship-contact" /> contact </label><label for="friendship-aquaintance"><input class="valinp" type="radio" name="friendship" value="acquaintance" id="friendship-aquaintance" /> acquaintance </label> <label for="friendship-friend"><input class="valinp" type="radio" name="friendship" value="friend" id="friendship-friend" /> friend </label> <label for="friendship-none"><input class="valinp" type="radio" name="friendship" value="" id="friendship-none" /> none</label>
</td>
</tr>
<tr>
<th scope="row">
physical
</th>
<td>
<label for="met"><input class="valinp" type="checkbox" name="physical" value="met" id="met" /> met</label>
</td>
</tr>
<tr>
<th scope="row">
professional
</th>
<td>
<label for="co-worker"><input class="valinp" type="checkbox" name="professional" value="co-worker" id="co-worker" /> co-worker </label> <label for="colleague"><input class="valinp" type="checkbox" name="professional" value="colleague" id="colleague" /> colleague</label>
</td>
</tr>
<tr>
<th scope="row">
geographical
</th>
<td>
<label for="co-resident"><input class="valinp" type="radio" name="geographical" value="co-resident" id="co-resident" /> co-resident </label> <label for="neighbor"><input class="valinp" type="radio" name="geographical" value="neighbor" id="neighbor" /> neighbor </label> <label for="geographical-none"><input class="valinp" type="radio" name="geographical" value="" id="geographical-none" /> none</label>
</td>
</tr>
<tr>
<th scope="row">
family
</th>
<td>
<label for="family-child"><input class="valinp" type="radio" name="family" value="child" id="family-child" /> child </label> <label for="family-parent"><input class="valinp" type="radio" name="family" value="parent" id="family-parent" /> parent </label> <label for="family-sibling"><input class="valinp" type="radio" name="family" value="sibling" id="family-sibling" /> sibling </label> <label for="family-spouse"><input class="valinp" type="radio" name="family" value="spouse" id="family-spouse" /> spouse </label> <label for="family-kin"><input class="valinp" type="radio" name="family" value="kin" id="family-kin" /> kin </label>
<label for="family-none"><input class="valinp" type="radio" name="family" value="" id="family-none" /> none</label>
</td>
</tr>
<tr>
<th scope="row">
romantic
</th>
<td>
<label for="muse"><input class="valinp" type="checkbox" name="romantic" value="muse" id="muse" /> muse </label> <label for="crush"><input class="valinp" type="checkbox" name="romantic" value="crush" id="crush" /> crush </label> <label for="date"><input class="valinp" type="checkbox" name="romantic" value="date" id="date" /> date </label> <label for="sweetheart"><input class="valinp" type="checkbox" name="romantic" value="sweetheart" id="sweetheart" /> sweetheart</label>
</td>
</tr>
</table>
<p>
<button onclick="addLink(); return false;">Add Link to List</button> <input type="reset" />
<button onclick="buildXOXO(true); return false;">Generate Final List</button>
</p>
</form>
<div id="xfnResult" style="display:none;">
<a href="" rel=""></a>
</div>
<div id="xoxoResult">
</div>
</div>