4 # Copyright (C) 2006 - 2012 Joachim Breitner
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 <style type="text/css">
58 background-color:aqua;
68 <script type="text/javascript">
72 ta = document.getElementById("textarea");
73 test = document.getElementById("test");
75 test.innerHTML=ta.value;
76 // Otherwise, the newline would not be counted.
77 if (ta.value[ta.value.length-1] == "\n") {
78 test.innerHTML += '.';
81 ratioX = (window.innerWidth) / test.offsetWidth;
82 ratioY = (window.innerHeight) / test.offsetHeight;
83 ratio = Math.min(ratioX,ratioY);
84 fontSize = Math.floor(30 * ratio) + "px"
85 ta.style.fontSize = fontSize;
86 newHeight = Math.ceil(test.offsetHeight * ratio);
87 //ta.style.height = newHeight + "px";
88 //ta.style.top = Math.floor((window.innerHeight - newHeight)/2) + "px";
89 ta.style.paddingTop = Math.floor((window.innerHeight - newHeight)/2) + "px";
90 ta.style.paddingBottom = Math.floor((window.innerHeight - newHeight)/2) + "px";
91 newWidth = Math.ceil(test.offsetWidth * ratio);
92 //ta.style.width = newWidth + "px";
93 ta.style.paddingLeft = Math.max(0,Math.floor((window.innerWidth - newWidth)/2)) + "px";
94 ta.style.paddingRight = Math.max(0,Math.floor((window.innerWidth - newWidth)/2)) + "px";
96 //test.innerHTML = newHeight + " " + window.innerHeight + " " + fontSize;
98 href = window.location.hash = "#t=" + encodeURIComponent(ta.value);
102 ta = document.getElementById("textarea");
105 var queryString = {};
106 window.location.href.replace(
107 new RegExp("([^?=&;#]+)(=([^&;]*))", "g"),
108 function($0, $1, $2, $3) {queryString[$1] = decodeURIComponent($3); }
110 if (queryString['t']) {
111 ta.value = queryString['t'];
115 function showFocusDummy() {
116 window.clearTimeout(timeout);
117 document.getElementById("focusdummy").style.display = "block";
119 function hideFocusDummy() {
120 timeout = window.setTimeout(function () {
121 document.getElementById("focusdummy").style.display = "none";
124 function clearText() {
125 ta = document.getElementById("textarea");
131 <body onload="init()" onresize="adjust()">
132 <textarea id="textarea" onfocus="showFocusDummy()" onblur="hideFocusDummy()" onKeyUp="adjust()" onpaste="adjust()" oninput="adjust()">:-)</textarea>
133 <span id="test"></span>
134 <div id="focusdummy" >
136 <tr><td align="left" width="30%" align="left">
137 <a href="http://sm.nomeata.de/" target="blank">screen message<br/>on the web</a>
138 </td><td width="40%" align="center">
139 <a href="#" onclick="return false">Hide Keyboard</a>
140 </td><td width="30%" align="right">
141 <a href="#" onclick="clearText(); return false;">Clear Text</a>