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 180 181 182
|
<html>
<!--
# sm.html
# Copyright (C) 2006 - 2010 Joachim Breitner
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-->
<head>
<title>Screen message</title>
<style type="text/css">
#textarea {
position:absolute;
top:0px;
left:0px;
width:100%;
height:100%;
font-family: sans;
padding:0px;
margin:0px;
border:0px;
text-align:center;
overflow:hidden;
resize:none;
/*
This used to be here. Not sure why, but eventually,
it broke Firefox (newlines not wrapping lines)
white-space:nowrap;
*/
}
/* disable focus border at Chrome */
#textarea:focus {
outline: none;
}
#test {
position:absolute;
visibility:hidden;
top:0px;
left:0px;
font-size:30px;
white-space:pre;
font-family: sans;
border:0px;
padding:0.1em;
margin:0px;
}
#about {
position:absolute;
width:20em;
top:30px;
right:30px;
background-color:gray;
padding:1em;
}
</style>
<script type="text/javascript">
opacity = 100;
function adjust() {
ta = document.getElementById("textarea");
test = document.getElementById("test");
test.textContent=ta.value;
// Otherwise, the newline would not be counted.
if (ta.value[ta.value.length-1] == "\n") {
test.innerHTML += '.';
}
ratioX = (window.innerWidth) / test.offsetWidth;
ratioY = (window.innerHeight) / test.offsetHeight;
ratio = Math.min(ratioX,ratioY);
fontSize = Math.floor(30 * ratio) + "px"
ta.style.fontSize = fontSize;
newHeight = Math.ceil(test.offsetHeight * ratio);
//ta.style.height = newHeight + "px";
//ta.style.top = Math.floor((window.innerHeight - newHeight)/2) + "px";
ta.style.paddingTop = Math.floor((window.innerHeight - newHeight)/2) + "px";
ta.style.paddingBottom = Math.floor((window.innerHeight - newHeight)/2) + "px";
newWidth = Math.ceil(test.offsetWidth * ratio);
//ta.style.width = newWidth + "px";
ta.style.paddingLeft = Math.max(0,Math.floor((window.innerWidth - newWidth)/2)) + "px";
ta.style.paddingRight = Math.max(0,Math.floor((window.innerWidth - newWidth)/2)) + "px";
//test.innerHTML = newHeight + " " + window.innerHeight + " " + fontSize;
href = "#t=" + encodeURIComponent(ta.value);
if (ta.style.color) {
href += ";f=" + encodeURIComponent(ta.style.color);
}
if (ta.style.backgroundColor) {
href += ";b=" + encodeURIComponent(ta.style.backgroundColor);
}
window.location.hash = href;
}
function showBox() {
opacity = 100;
window.clearTimeout(timeout);
setOpacity();
}
function fadeOut() {
opacity *= 0.985;
if (opacity > 1) {
timeout = window.setTimeout("fadeOut()",20);
} else {
opacity = 0;
}
setOpacity();
}
function setOpacity() {
about = document.getElementById("about");
about.style.opacity = opacity/100;
about.style.filter = "alpha(opacity="+Math.round(opacity)+")";
}
function parseHash() {
ta = document.getElementById("textarea");
ta.focus();
var queryString = {};
window.location.href.replace(
new RegExp("([^?=&;#]+)(=([^&;]*))", "g"),
function($0, $1, $2, $3) {queryString[$1] = decodeURIComponent($3); }
);
if (queryString['t']) {
ta.value = queryString['t'];
}
if (queryString['f']) {
ta.style.color = queryString['f'];
}
if (queryString['b']) {
ta.style.backgroundColor = queryString['b'];
}
adjust();
timeout = window.setTimeout("fadeOut();",1000);
setOpacity();
}
function init() {
if (window.navigator.mozApps) {
document.getElementById("firefox").style.display = "block";
}
parseHash();
}
</script>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
</head>
<body onload="init()" onhashchange="parseHash()" onresize="adjust()">
<textarea id="textarea" onKeyUp="adjust()" onpaste="adjust()" oninput="adjust()">:-)</textarea>
<span id="test"></span>
<div id="about" onMouseOver="showBox()" onMouseOut="fadeOut()">
<p>
This is an online-version of the program <strong>screen-message</strong> for Linux.
</p>
<p id="firefox" style="display:none">
You can <a href="#" onclick="window.navigator.mozApps.install('http://sm.nomeata.de/sm.webapp')">install it as a FireFox app</a>.
</p>
<p>
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://github.com/nomeata/screen-message/">fetch the sourcecode</a>.
</p>
<p>
<strong>screen-message</strong> was created by <a href="http://www.joachim-breitner.de/">Joachim Breitner</a>.
If you like it, then <a href="http://flattr.com/thing/330186/screen-message" target="_blank">flattr this</a>.
</p>
</div>
</body>
</html>
|