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
20 <style type="text/css">
53 background-color:gray;
58 <script type="text/javascript">
61 ta = document.getElementById("textarea");
62 test = document.getElementById("test");
64 test.innerHTML=ta.value;
65 // Otherwise, the newline would not be counted.
66 if (ta.value[ta.value.length-1] == "\n") {
67 test.innerHTML += '.';
70 ratioX = (window.innerWidth) / test.offsetWidth;
71 ratioY = (window.innerHeight) / test.offsetHeight;
72 ratio = Math.min(ratioX,ratioY);
73 fontSize = Math.floor(30 * ratio) + "px"
74 ta.style.fontSize = fontSize;
75 newHeight = Math.ceil(test.offsetHeight * ratio);
76 //ta.style.height = newHeight + "px";
77 //ta.style.top = Math.floor((window.innerHeight - newHeight)/2) + "px";
78 ta.style.paddingTop = Math.floor((window.innerHeight - newHeight)/2) + "px";
79 ta.style.paddingBottom = Math.floor((window.innerHeight - newHeight)/2) + "px";
80 newWidth = Math.ceil(test.offsetWidth * ratio);
81 //ta.style.width = newWidth + "px";
82 ta.style.paddingLeft = Math.max(0,Math.floor((window.innerWidth - newWidth)/2)) + "px";
83 ta.style.paddingRight = Math.max(0,Math.floor((window.innerWidth - newWidth)/2)) + "px";
85 //test.innerHTML = newHeight + " " + window.innerHeight + " " + fontSize;
87 href = window.location.hash = "#t=" + encodeURIComponent(ta.value);
92 window.clearTimeout(timeout);
98 timeout = window.setTimeout("fadeOut()",20);
104 function setOpacity() {
105 about = document.getElementById("about");
106 about.style.opacity = opacity/100;
107 about.style.filter = "alpha(opacity="+Math.round(opacity)+")";
111 ta = document.getElementById("textarea");
114 var queryString = {};
115 window.location.href.replace(
116 new RegExp("([^?=&;#]+)(=([^&;]*))", "g"),
117 function($0, $1, $2, $3) {queryString[$1] = decodeURIComponent($3); }
119 if (queryString['t']) {
120 ta.value = queryString['t'];
123 timeout = window.setTimeout("fadeOut();",1000);
126 if (window.navigator.mozApps) {
127 document.getElementById("firefox").style.display = "block";
131 <body onload="init()">
132 <textarea id="textarea" onKeyUp="adjust()">:-)</textarea>
133 <span id="test"></span>
134 <div id="about" onMouseOver="showBox()" onMouseOut="fadeOut()">
136 This is an online-version of the program <strong>screen-message</strong> for Linux.
138 <p id="firefox" style="display:none">
139 You can <a href="#" onclick="window.navigator.mozApps.install('http://sm.nomeata.de/sm.webapp')">install it as a FireFox app</a>.
142 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.upstream/">fetch the sourcecode</a>.
145 <strong>screen-message</strong> was created by <a href="http://www.joachim-breitner.de/">Joachim Breitner</a>.
146 If you like it, then <a href="http://flattr.com/thing/330186/screen-message" target="_blank">flattr this</a>.