My favorites
▼
|
Sign in
hefdoeshwk
Code exercises for the blog Hef Does Homework.
Project Home
Downloads
Wiki
Issues
Source
Checkout
Browse
Changes
Source path:
svn
/
trunk
/
googlegadgets
/
flipper
/
flipper.xml
‹r17
r24
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
<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs
title="Flipper"
author="Jonathan Hefner"
author_location="Austin, TX"
description="Flips text upside down."
render_inline="optional"
width="400"
height="150"
scrolling="false"
/>
<Content type="html"><![CDATA[
<script type="text/javascript">
var flipped = {
'a': '\u0250',
'b': 'q',
'c': '\u0254',
'd': 'p',
'e': '\u01DD',
'f': '\u025F',
'g': '\u0431', // hef
'h': '\u0265',
'i': '!', // hef
'j': '\u0157', // hef
// 'j': '\u017F', ...better shape, but has no dot
'k': '\u029E',
'l': '\u05DA', // hef
'm': '\u026F',
'n': 'u',
'o': 'o',
// 'p': 'd', ...generated below
// 'q': 'b', ...generated below
'r': '\u0279',
's': 's',
't': '\u0287',
// 'u': 'n', ...generated below
'v': '\u028C',
'w': '\u028D',
'x': 'x',
'y': '\u028E',
'z': 'z',
'[': ']',
// ']': '[', ...generated below
'(': ')',
// ')': '(', ...generated below
'{': '}',
// '}': '{', ...generated below
'<': '>',
// '>': '<', ...generated below
'?': '\u00BF',
'!': '\u00A1',
"'": ',',
',': "'",
'.': '\u06EC', // hef
'0': '\u0030', // hef
'1': '\u05C0', // hef
'2': '\uFEA1', // hef
'3': '\u03B5', // hef
'4': '\u0402', // hef
'5': '\u03C2', // hef
'6': '\u0039', // hef
'7': '\u0141', // hef
'8': '\u0038', // hef
'9': '\u0036', // hef
'_': '\u203E'
};
// let's go both ways
for (f in flipped)
flipped[flipped[f]] = f;
function flip()
{
var text = document.getElementById("subject").value;
if (/\S/.test(text))
{
var result = '';
for (var i = text.length - 1; i >= 0; i -= 1)
{
var oldC = text.substr(i, 1);
var newC = flipped[oldC.toLowerCase()];
result += newC ? newC : oldC;
}
var el = document.getElementById("result");
el.innerHTML = result;
el.style.display = "block";
}
}
</script>
<input
type="text"
id="subject"
value="Flip this text."
style="width: 70%; margin-left: 2%; margin-top: 2%; margin-right: 3px; color: silver;"
onclick="if (!this.clicked) { this.value = ''; this.style.color = null; this.clicked = true; }"
/>
<input
type="button"
value="Flip!"
onclick="flip();"
/>
<div
id="result"
style="display: none; width: 90%; margin-left: 2%; margin-top: 10px; text-align: center; font-size: larger; font-family: monospace; border: 3px solid navy; background-color: #99CCFF;"
></div>
]]></Content>
</Module>
Show details
Hide details
Change log
r20
by jonathan.hefner on Jul 14, 2008
Diff
[No log message]
Go to:
...ooglegadgets/flipper/flipper.xml
...adgets/sloganizer/sloganizer.xml
Project members,
sign in
to write a code review
Older revisions
r17
by jonathan.hefner on Jul 14, 2008
Diff
[No log message]
r16
by jonathan.hefner on Jul 14, 2008
Diff
[No log message]
All revisions of this file
File info
Size: 3148 bytes, 115 lines
View raw file
Powered by
Google Project Hosting