4 # Copyright (C) 2006 - 2010 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
21 <title>Screen message</title>
22 <style type="text/css">
37 This used to be here. Not sure why, but eventually,
38 it broke Firefox (newlines not wrapping lines)
43 /* disable focus border at Chrome */
65 background-color:gray;
70 <script type="text/javascript">
73 ta = document.getElementById("textarea");
74 test = document.getElementById("test");
76 test.textContent=ta.value;
77 // Otherwise, the newline would not be counted.
78 if (ta.value[ta.value.length-1] == "\n") {
79 test.innerHTML += '.';
82 ratioX = (window.innerWidth) / test.offsetWidth;
83 ratioY = (window.innerHeight) / test.offsetHeight;
84 ratio = Math.min(ratioX,ratioY);
85 fontSize = Math.floor(30 * ratio) + "px"
86 ta.style.fontSize = fontSize;
87 newHeight = Math.ceil(test.offsetHeight * ratio);
88 //ta.style.height = newHeight + "px";
89 //ta.style.top = Math.floor((window.innerHeight - newHeight)/2) + "px";
90 ta.style.paddingTop = Math.floor((window.innerHeight - newHeight)/2) + "px";
91 ta.style.paddingBottom = Math.floor((window.innerHeight - newHeight)/2) + "px";
92 newWidth = Math.ceil(test.offsetWidth * ratio);
93 //ta.style.width = newWidth + "px";
94 ta.style.paddingLeft = Math.max(0,Math.floor((window.innerWidth - newWidth)/2)) + "px";
95 ta.style.paddingRight = Math.max(0,Math.floor((window.innerWidth - newWidth)/2)) + "px";
97 //test.innerHTML = newHeight + " " + window.innerHeight + " " + fontSize;
99 href = "#t=" + encodeURIComponent(ta.value);
100 if (ta.style.color) {
101 href += ";f=" + encodeURIComponent(ta.style.color);
103 if (ta.style.backgroundColor) {
104 href += ";b=" + encodeURIComponent(ta.style.backgroundColor);
106 window.location.hash = href;
111 window.clearTimeout(timeout);
117 timeout = window.setTimeout("fadeOut()",20);
123 function setOpacity() {
124 about = document.getElementById("about");
125 about.style.opacity = opacity/100;
126 about.style.filter = "alpha(opacity="+Math.round(opacity)+")";
129 function parseHash() {
130 ta = document.getElementById("textarea");
133 var queryString = {};
134 window.location.href.replace(
135 new RegExp("([^?=&;#]+)(=([^&;]*))", "g"),
136 function($0, $1, $2, $3) {queryString[$1] = decodeURIComponent($3); }
138 if (queryString['t']) {
139 ta.value = queryString['t'];
141 if (queryString['f']) {
142 ta.style.color = queryString['f'];
144 if (queryString['b']) {
145 ta.style.backgroundColor = queryString['b'];
148 timeout = window.setTimeout("fadeOut();",1000);
153 if (window.navigator.mozApps) {
154 document.getElementById("firefox").style.display = "block";
159 <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
160 <meta name="apple-mobile-web-app-capable" content="yes">
161 <meta name="format-detection" content="telephone=no">
163 <body onload="init()" onhashchange="parseHash()" onresize="adjust()">
164 <textarea id="textarea" onKeyUp="adjust()" onpaste="adjust()" oninput="adjust()">:-)</textarea>
165 <span id="test"></span>
166 <div id="about" onMouseOver="showBox()" onMouseOut="fadeOut()">
168 This is an online-version of the program <strong>screen-message</strong> for Linux.
170 <p id="firefox" style="display:none">
171 You can <a href="#" onclick="window.navigator.mozApps.install('http://sm.nomeata.de/sm.webapp')">install it as a FireFox app</a>.
174 For more information about the original program, see what <a href="http://debaday.debian.net/2007/07/18/screen-message-use-your-screen-to-communicate/">Deb-a-Day</a> writes about it. You can download it from <a href="http://packages.debian.org/sid/sm">Debian</a> or <a href="http://darcs.nomeata.de/screen-message/">fetch the sourcecode</a>.
177 <strong>screen-message</strong> was created by <a href="http://www.joachim-breitner.de/">Joachim Breitner</a>.
178 If you like it, then <a href="http://flattr.com/thing/330186/screen-message" target="_blank">flattr this</a>.