Merge branch 'develop' into feature/seconds

Conflicts:
	.gitignore
	manifest.appcache
	showcase/index.html
	uhr.js
This commit is contained in:
Manuel Friedli 2014-08-11 23:04:28 +02:00
commit 020fc96036
41 changed files with 12138 additions and 575 deletions

72
.jshintrc Normal file
View file

@ -0,0 +1,72 @@
{
// Settings
"passfail" : false, // Stop on first error.
"maxerr" : 100, // Maximum error before stopping.
// Predefined globals whom JSHint will ignore.
"browser" : true, // Standard browser globals e.g. `window`, `document`.
"node" : false,
"rhino" : false,
"couch" : false,
"wsh" : true, // Windows Scripting Host.
"jquery" : true,
"ender" : true,
"prototypejs" : false,
"mootools" : false,
"dojo" : false,
"predef" : [
"suite",
"test"
],
// Development.
"debug" : false, // Allow debugger statements e.g. browser breakpoints.
"devel" : true, // Allow developments statements e.g. `console.log();`.
// ECMAScript 5.
"es5" : true, // Allow ECMAScript 5 syntax.
"strict" : true, // Require `use strict` pragma in every file.
"globalstrict" : false, // Allow global "use strict" (also enables 'strict').
// The Good Parts.
"asi" : false, // Tolerate Automatic Semicolon Insertion (no semicolons).
"laxbreak" : true, // Tolerate unsafe line breaks e.g. `return [\n] x` without semicolons.
"bitwise" : true, // Prohibit bitwise operators (&, |, ^, etc.).
"boss" : false, // Tolerate assignments inside if, for & while. Usually conditions & loops are for comparison, not assignments.
"curly" : true, // Require {} for every new block or scope.
"eqeqeq" : true, // Require triple equals i.e. `===`.
"eqnull" : false, // Tolerate use of `== null`.
"evil" : false, // Tolerate use of `eval`.
"expr" : false, // Tolerate `ExpressionStatement` as Programs.
"forin" : false, // Tolerate `for in` loops without `hasOwnPrototype`.
"immed" : true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );`
"latedef" : true, // Prohipit variable use before definition.
"loopfunc" : false, // Allow functions to be defined within loops.
"noarg" : true, // Prohibit use of `arguments.caller` and `arguments.callee`.
"regexp" : true, // Prohibit `.` and `[^...]` in regular expressions.
"regexdash" : false, // Tolerate unescaped last dash i.e. `[-...]`.
"scripturl" : true, // Tolerate script-targeted URLs.
"shadow" : false, // Allows re-define variables later in code e.g. `var x=1; x=2;`.
"supernew" : false, // Tolerate `new function () { ... };` and `new Object;`.
"undef" : true, // Require all non-global variables be declared before they are used.
// Personal styling preferences.
"newcap" : true, // Require capitalization of all constructor functions e.g. `new F()`.
"noempty" : true, // Prohibit use of empty blocks.
"nonew" : true, // Prohibit use of constructors for side-effects.
"nomen" : true, // Prohibit use of initial or trailing underbars in names.
"onevar" : false, // Allow only one `var` statement per function.
"plusplus" : false, // Prohibit use of `++` & `--`.
"sub" : false, // Tolerate all forms of subscript notation besides dot notation e.g. `dict['key']` instead of `dict.key`.
"trailing" : true, // Prohibit trailing whitespaces.
"white" : true, // Check against strict whitespace and indentation rules.
"indent" : 0 // Specify indentation spacing
}

View file

@ -9,10 +9,11 @@ Du willst Bärneruhr auf deiner Website verwenden? Dank des jQuery-Plugins geht
* uhr.css * uhr.css
* Binde zusätzlich mindestens eine der folgenden CSS-Dateien im HTML ein, je nach dem, welche Farben deine Uhr unterstützen soll: * Binde zusätzlich mindestens eine der folgenden CSS-Dateien im HTML ein, je nach dem, welche Farben deine Uhr unterstützen soll:
* uhr-black.css * uhr-black.css
* uhr-blue.css
* uhr-green.css
* uhr-red.css
* uhr-white.css * uhr-white.css
* uhr-red.css
* uhr-yellow.css
* uhr-green.css
* uhr-blue.css
* uhr-pink.css * uhr-pink.css
Beim Einbinden muss das attribut `data-class` angegeben werden, welches die CSS-Klasse des Themes definiert. Optional kann mit `data-name` ein im Dropdown anzuzeigender Name angegeben werden. Beispiel: Beim Einbinden muss das attribut `data-class` angegeben werden, welches die CSS-Klasse des Themes definiert. Optional kann mit `data-name` ein im Dropdown anzuzeigender Name angegeben werden. Beispiel:
@ -25,7 +26,7 @@ Beim Einbinden muss das attribut `data-class` angegeben werden, welches die CSS-
* Von jquery-ui werden die Komponenten 'core' und 'widget' benötigt. * Von jquery-ui werden die Komponenten 'core' und 'widget' benötigt.
* jquery-cookie-1.4.0.js (Falls nicht bereits vorhanden) * jquery-cookie-1.4.0.js (Falls nicht bereits vorhanden)
* uhr.js * uhr.js
* Binde mindestens eine der folgenden Javascript-Dateien im HTML ein, je nach dem, welche Sprachen deine Uhr unterstützen soll: * Binde mindestens eine der folgenden Javascript-Dateien im HTML nach uhr.js ein, je nach dem, welche Sprachen deine Uhr unterstützen soll:
* uhr-de_CH.js * uhr-de_CH.js
* uhr-de_CH_genau.js * uhr-de_CH_genau.js
* uhr-de.js * uhr-de.js
@ -33,7 +34,7 @@ Beim Einbinden muss das attribut `data-class` angegeben werden, welches die CSS-
* uhr-fr.js * uhr-fr.js
* uhr-it.js * uhr-it.js
`uhr-de_CH_genau.js` ist eine Variante von Berndeutsch, bei der zur vollen Stunde zusätlich das Wort "genau" angezeigt wird (also z.B. "ES ISCH GENAU DRÜ"). `uhr-de_CH_genau.js` ist eine Variante von Berndeutsch, bei der zur vollen Stunde zusätlich das Wort "genau" angezeigt wird (also z.B. um 15:00 Uhr "ES ISCH GENAU DRÜ").
2. Uhr-Element im HTML-Dokument einfügen 2. Uhr-Element im HTML-Dokument einfügen
---------------------------------------- ----------------------------------------
@ -55,6 +56,8 @@ Damit wird eine Uhr in der Standardkonfiguration erzeugt. Das heisst:
* Die Uhr ist eingeschaltet * Die Uhr ist eingeschaltet
* Die Bedienelemente werden angezeigt * Die Bedienelemente werden angezeigt
Mit den Bedienelementen kannst du die Uhr ein- und ausschalten sowie Sprache und Farbe wechseln.
Wie du diese Optionen ändern kannst, verrät der nächte Abschnitt. Wie du diese Optionen ändern kannst, verrät der nächte Abschnitt.
Es kann natürlich auch eine Collection von Elementen übergeben werden. Mit Es kann natürlich auch eine Collection von Elementen übergeben werden. Mit
@ -69,8 +72,8 @@ Der uhr()-Methode kann ein Options-Objekt mitgegeben werden:
jQuery('#uhrcontainer').uhr({ jQuery('#uhrcontainer').uhr({
status: 'on', // 'on' (default) oder 'off' status: 'on', // 'on' (default) oder 'off'
theme: 'black', // 'black' (default), 'red', 'blue', 'green' oder 'white' theme: 'black', // 'black' (default), 'white', 'red', 'yellow', 'green', 'blue' oder 'pink' (je nach eingebundenen Theme-Stylesheets)
language: 'de_CH', // 'de_CH' (default), 'de' oder 'en' (je nach eingebundenen Sprachdateien) language: 'de_CH', // 'de_CH' (default), 'de_CH_genau', 'de', 'en', 'fr' oder 'it' (je nach eingebundenen Sprachdateien)
width: '100%', // eine CSS-Grössenangabe (default: 100%) width: '100%', // eine CSS-Grössenangabe (default: 100%)
force: false, // false (default): Falls ein Cookie im Browser besteht, werden dessen Konfigurationswerte übernommen; force: false, // false (default): Falls ein Cookie im Browser besteht, werden dessen Konfigurationswerte übernommen;
// true: immer die angegebene Konfiguration verwenden // true: immer die angegebene Konfiguration verwenden
@ -80,7 +83,7 @@ Der uhr()-Methode kann ein Options-Objekt mitgegeben werden:
5. Sonderfunktionen 5. Sonderfunktionen
------------------- -------------------
Es gibt noch einen zusätzlichen Konfigurationsparameter. Mit Es gibt noch einen zusätzlichen Konfigurationsparameter. Mittels
{ {
time: new Date() time: new Date()

View file

@ -14,7 +14,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
@font-face { @font-face {
font-family: 'Uhrenfont'; font-family: 'Uhrenfont';
src: url('uhr.woff') format('woff'); src: url('../resources/uhr.woff') format('woff');
} }
body { body {
font-family: 'Uhrenfont', sans-serif; font-family: 'Uhrenfont', sans-serif;
@ -164,7 +164,54 @@ body {
} }
.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-switch { .onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-switch {
right: 0px; right: 0;
}
a.uhr-configlink {
cursor: pointer;
background: url("../resources/settings.png") no-repeat;
width: 24px;
height: 24px;
display: inline-block;
margin: 2px;
}
.uhr-controlpanel {
background-color: rgba(0,0,0,0.5);
position: fixed;
width: 100%;
height: 100%;
top: 0;
left: 0;
}
@media (max-width: 400px) {
.uhr-controlpanel .content {
height: 100%;
}
}
@media (min-width: 401px) {
.uhr-controlpanel .content {
margin-left: auto;
margin-right: auto;
width: 10em;
top : 1em;
border-radius: 0.5em;
box-shadow: 0 0 1em black;
}
}
.uhr-controlpanel .content {
background-color: #fff;
padding: 2em;
position: relative;
}
a.uhr-closecontrolpanel {
cursor: pointer;
display: inline-block;
position: absolute;
right: 3px;
top: 3px;
width: 24px;
height: 24px;
background: url("../resources/close.png") no-repeat;
} }
#disclaimer { #disclaimer {
font-size: 0.5em; font-size: 0.5em;

View file

@ -21,31 +21,52 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<meta name="apple-mobile-web-app-status-bar-style" content="black" /> <meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="apple-mobile-web-app-title" content="Bärneruhr" /> <meta name="apple-mobile-web-app-title" content="Bärneruhr" />
<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1" /> <meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1" />
<link rel="stylesheet" type="text/css" href="uhr.css" /> <link rel="stylesheet" type="text/css" href="css/uhr.css" />
<link rel="stylesheet" type="text/css" href="uhr-black.css" data-class="black" data-name="Schwarz" /> <link rel="stylesheet" type="text/css" href="css/uhr-black.css" data-class="black" data-name="Schwarz" />
<link rel="shortcut icon" type="image/png" href="favicon.png" /> <link rel="stylesheet" type="text/css" href="css/uhr-white.css" data-class="white" data-name="Weiss" />
<link rel="apple-touch-icon-precomposed" href="apple-touch-icon-precomposed.png" /> <link rel="stylesheet" type="text/css" href="css/uhr-red.css" data-class="red" data-name="Rot" />
<script type="text/javascript" src="jquery-2.1.0.min.js"></script> <link rel="stylesheet" type="text/css" href="css/uhr-yellow.css" data-class="yellow" data-name="Gelb" />
<script type="text/javascript" src="jquery-ui-1.10.4.custom.min.js"></script> <link rel="stylesheet" type="text/css" href="css/uhr-green.css" data-class="green" data-name="Grün" />
<script type="text/javascript" src="jquery-cookie-1.4.0.js"></script> <link rel="stylesheet" type="text/css" href="css/uhr-blue.css" data-class="blue" data-name="Blau" />
<script type="text/javascript" src="uhr.js"></script> <link rel="stylesheet" type="text/css" href="css/uhr-pink.css" data-class="pink" data-name="Pink" />
<link rel="shortcut icon" type="image/png" href="resources/favicon.png" />
<link rel="apple-touch-icon-precomposed" href="resources/apple-touch-icon-precomposed.png" />
<script type="text/javascript" src="lib/jquery-2.1.0.min.js"></script>
<script type="text/javascript" src="lib/jquery-ui-1.10.4.custom.min.js"></script>
<script type="text/javascript" src="lib/jquery-cookie-1.4.0.js"></script>
<script type="text/javascript" src="js/uhr.js"></script>
<script type="text/javascript" src="js/uhr-de_CH.js"></script>
<script type="text/javascript" src="js/uhr-de_CH_genau.js"></script>
<script type="text/javascript" src="js/uhr-de.js"></script>
<script type="text/javascript" src="js/uhr-en.js"></script>
<script type="text/javascript" src="js/uhr-fr.js"></script>
<script type="text/javascript" src="js/uhr-it.js"></script>
</head> </head>
<body style="padding:0;margin:0;"> <body style="padding:0;margin:0;">
<div id="uhr"></div> <div id="uhr"></div>
<p id="disclaimer">Created by <a href="http://www.fritteli.ch/">fritteli</a>, inspired by <a href="http://www.qlocktwo.com/">QLOCKTWO</a>. <a href="info/">Read more!</a> - <a href="showcase">View full showcase!</a></p> <p id="disclaimer">Created by <a href="http://www.fritteli.ch/">fritteli</a>, inspired by <a href="http://www.qlocktwo.com/">QLOCKTWO</a>. <a href="info/">Read more!</a> - <a href="showcase">View full showcase!</a></p>
<script type="text/javascript" src="uhr-de_CH.js"></script>
<script type="text/javascript"> <script type="text/javascript">
(function($) { (function($) {
var width = $(window).width(); var width = $(window).width();
var height = $(window).height(); var height = $(window).height();
var size = (width < height ? width : height) + 'px'; var size = Math.min(width, height) + 'px';
$('#uhr').uhr({ $('#uhr').uhr({
width: size, width: size,
color: 'black', color: 'black',
language: 'de_CH', language: 'de_CH',
force: true, controls: true
controls: false
}); });
$(window).on('resize', function (event) {
var $uhr = $('#uhr');
var $parent = $uhr.parent();
var $window = $(window);
var parentWidth = $parent.width();
var parentHeight = $parent.height();
var windowWidth = $window.width();
var windowHeight = $window.height();
var size = Math.min(parentWidth, parentHeight, windowWidth, windowHeight) + 'px';
$uhr.uhr("width", size);
});
})(jQuery); })(jQuery);
</script> </script>
</body> </body>

View file

@ -18,19 +18,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<title>Die Zeit im Wort - Informationen</title> <title>Die Zeit im Wort - Informationen</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width,user-scalable=yes,initial-scale=1" /> <meta name="viewport" content="width=device-width,user-scalable=yes,initial-scale=1" />
<link rel="stylesheet" type="text/css" href="../uhr.css" /> <link rel="stylesheet" type="text/css" href="../css/uhr.css" />
<link rel="stylesheet" type="text/css" href="../uhr-black.css" data-class="black" /> <link rel="stylesheet" type="text/css" href="../css/uhr-black.css" data-class="black" />
<link rel="stylesheet" type="text/css" href="info.css" /> <link rel="stylesheet" type="text/css" href="info.css" />
<link rel="shortcut icon" type="image/png" href="../favicon.png" /> <link rel="shortcut icon" type="image/png" href="../resources/favicon.png" />
<script type="text/javascript" src="../jquery-2.1.0.min.js"></script> <script type="text/javascript" src="../lib/jquery-2.1.0.min.js"></script>
<script type="text/javascript" src="../jquery-ui-1.10.4.custom.min.js"></script> <script type="text/javascript" src="../lib/jquery-ui-1.10.4.custom.min.js"></script>
<script type="text/javascript" src="../jquery-cookie-1.4.0.js"></script> <script type="text/javascript" src="../lib/jquery-cookie-1.4.0.js"></script>
<script type="text/javascript" src="../uhr.js"></script> <script type="text/javascript" src="../js/uhr.js"></script>
<script type="text/javascript" src="../uhr-de_CH.js"></script> <script type="text/javascript" src="../js/uhr-de_CH.js"></script>
</head> </head>
<body> <body>
<h1 id="main-title">Die Zeit im Wort</h1> <h1 id="main-title">Die Zeit im Wort</h1>
<nav>Inhalt: <nav><span id="toc">Inhalt:</span>
<ol> <ol>
<li><a href="#about">Was soll das?</a></li> <li><a href="#about">Was soll das?</a></li>
<li><a href="#the-clock">Die Uhr</a> <li><a href="#the-clock">Die Uhr</a>
@ -50,7 +50,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<li><a href="#license">Lizenzbestimmungen</a></li> <li><a href="#license">Lizenzbestimmungen</a></li>
</ol> </ol>
</nav> </nav>
<h2 id="about">Was soll das?</h2> <h2 id="about">Was soll das?<a href="#toc" class="toclink">Zum Inhalt</a></h2>
<p>Hallo, Besucher!</p> <p>Hallo, Besucher!</p>
<p>Hier gibt's vertiefte Informationen über diese Uhr, die dir sagt, <p>Hier gibt's vertiefte Informationen über diese Uhr, die dir sagt,
wie spät es ist. Hier erfährt du, wie du sie selber auf deiner wie spät es ist. Hier erfährt du, wie du sie selber auf deiner
@ -58,11 +58,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
dich dabei an die Regeln der <a href="#lizenz">Lizenz</a> hältst.</p> dich dabei an die Regeln der <a href="#lizenz">Lizenz</a> hältst.</p>
<p><a href="..">Das interessiert mich nicht, ich will zurück zur grossen Uhr!</a></p> <p><a href="..">Das interessiert mich nicht, ich will zurück zur grossen Uhr!</a></p>
<h2 id="the-clock">Die Uhr</h2> <h2 id="the-clock">Die Uhr<a href="#toc" class="toclink">Zum Inhalt</a></h2>
<a href="../"> <a href="../">
<div id="uhr1"></div> <div id="uhr1"></div>
</a> </a>
<h3 id="requirements">Benötigte Bibliotheken</h3> <h3 id="requirements">Benötigte Bibliotheken<a href="#toc" class="toclink">Zum Inhalt</a></h3>
<ul> <ul>
<li><a href="http://jquery.com/download/">jQuery</a> (getestet mit Version 2.1.0)</li> <li><a href="http://jquery.com/download/">jQuery</a> (getestet mit Version 2.1.0)</li>
<li><a href="http://jqueryui.com/download/">jQuery-UI</a> (getestet mit Version 1.10.4) mit folgenden Komponenten: <li><a href="http://jqueryui.com/download/">jQuery-UI</a> (getestet mit Version 1.10.4) mit folgenden Komponenten:
@ -73,15 +73,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</li> </li>
<li><a href="https://github.com/carhartl/jquery-cookie/releases">jQuery-cookie</a> (getestet mit Version 1.4.0)</li> <li><a href="https://github.com/carhartl/jquery-cookie/releases">jQuery-cookie</a> (getestet mit Version 1.4.0)</li>
</ul> </ul>
<h3 id="include-in-html">Einbinden in HTML</h3> <h3 id="include-in-html">Einbinden in HTML<a href="#toc" class="toclink">Zum Inhalt</a></h3>
<h4 id="js-and-css-in-head">Javascript- und CSS-Dateien im <code>&lt;head&gt;</code></h4> <h4 id="js-and-css-in-head">Javascript- und CSS-Dateien im <code>&lt;head&gt;</code><a href="#toc" class="toclink">Zum Inhalt</a></h4>
<p>Füge folgende Zeilen im <code>&lt;head&gt;</code>-Tag deines HTML-Dokumentes ein. <strong>Beachte dabei, dass die CSS-Dateien <em>vor</em> den Javascript eingebunden werden</strong>.<br/> <p>Füge folgende Zeilen im <code>&lt;head&gt;</code>-Tag deines HTML-Dokumentes ein. <strong>Beachte dabei, dass die CSS-Dateien <em>vor</em> den Javascript eingebunden werden</strong>.<br/>
<code>&lt;link rel="stylesheet" type="text/css" href="uhr.css" /&gt; <code>&lt;link rel="stylesheet" type="text/css" href="uhr.css" /&gt;
&lt;link rel="stylesheet" type="text/css" href="uhr-black.css" data-class="black" data-name="Schwarz" /&gt; &lt;link rel="stylesheet" type="text/css" href="uhr-black.css" data-class="black" data-name="Schwarz" /&gt;
&lt;link rel="stylesheet" type="text/css" href="uhr-blue.css" data-class="blue" data-name="Blau" /&gt;
&lt;link rel="stylesheet" type="text/css" href="uhr-green.css" data-class="green" data-name="Grün" /&gt;
&lt;link rel="stylesheet" type="text/css" href="uhr-red.css" data-class="red" data-name="Rot" /&gt;
&lt;link rel="stylesheet" type="text/css" href="uhr-white.css" data-class="white" data-name="Weiss" /&gt; &lt;link rel="stylesheet" type="text/css" href="uhr-white.css" data-class="white" data-name="Weiss" /&gt;
&lt;link rel="stylesheet" type="text/css" href="uhr-red.css" data-class="red" data-name="Rot" /&gt;
&lt;link rel="stylesheet" type="text/css" href="uhr-yellow.css" data-class="yellow" data-name="Gelb" /&gt;
&lt;link rel="stylesheet" type="text/css" href="uhr-green.css" data-class="green" data-name="Grün" /&gt;
&lt;link rel="stylesheet" type="text/css" href="uhr-blue.css" data-class="blue" data-name="Blau" /&gt;
&lt;link rel="stylesheet" type="text/css" href="uhr-pink.css" data-class="pink" data-name="Pink" /&gt; &lt;link rel="stylesheet" type="text/css" href="uhr-pink.css" data-class="pink" data-name="Pink" /&gt;
&lt;script type="text/javascript" src="jquery-2.1.0.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="jquery-2.1.0.min.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="jquery-ui-1.10.4.custom.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="jquery-ui-1.10.4.custom.min.js"&gt;&lt;/script&gt;
@ -95,12 +96,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
&lt;script type="text/javascript" src="uhr-it.js"&gt;&lt;/script&gt;</code> &lt;script type="text/javascript" src="uhr-it.js"&gt;&lt;/script&gt;</code>
</p> </p>
<p>Von den Stylesheets zwingend ist <code>uhr.css</code> und mindestens eines der Farbschema-Stylesheets. Die Attribute <code>data-class</code> bzw. <code>data-name</code> definieren dabei die im Stylesheet deklarierte Klasse bzw. den im Auswahlmenu anzuzeigenden Namen. Der Name kann frei gewählt werden, die Style-Klasse muss mit der im Stylesheet definierten übereinstimmen.</p> <p>Von den Stylesheets zwingend ist <code>uhr.css</code> und mindestens eines der Farbschema-Stylesheets. Die Attribute <code>data-class</code> bzw. <code>data-name</code> definieren dabei die im Stylesheet deklarierte Klasse bzw. den im Auswahlmenu anzuzeigenden Namen. Der Name kann frei gewählt werden, die Style-Klasse muss mit der im Stylesheet definierten übereinstimmen.</p>
<p><code>uhr-de_CH_genau.js</code> ist eine Variante von Berndeutsch, bei der zur vollen Stunde zusätlich das Wort <tt>genau</tt> angezeigt wird (also z.B. <tt>ES ISCH GENAU DRÜ</tt>).</p> <p><code>uhr-de_CH_genau.js</code> ist eine Variante von Berndeutsch, bei der zur vollen Stunde zusätlich das Wort <tt>genau</tt> angezeigt wird (also z.B. um 15:00 Uhr <tt>ES ISCH GENAU DRÜ</tt>).</p>
<h4 id="clock-element">Uhr-Element auf der Seite</h4> <h4 id="clock-element">Uhr-Element auf der Seite<a href="#toc" class="toclink">Zum Inhalt</a></h4>
<p>Definiere an der Stelle, wo die Uhr angezeigt werden soll, ein leeres <code>&lt;div&gt;</code>-Element:<br/> <p>Definiere an der Stelle, wo die Uhr angezeigt werden soll, ein leeres <code>&lt;div&gt;</code>-Element:<br/>
<code>&lt;div id="meine-uhr"&gt;&lt;/div&gt;</code> <code>&lt;div id="meine-uhr"&gt;&lt;/div&gt;</code>
</p> </p>
<h4 id="initialize">Uhr initialisieren</h4> <h4 id="initialize">Uhr initialisieren<a href="#toc" class="toclink">Zum Inhalt</a></h4>
<p>Definiere im HTML-Dokument (<code>&lt;head&gt;</code> oder <code>&lt;body&gt;</code>) ein Javascript-Snippet, um die Uhr zu initialisieren:<br/> <p>Definiere im HTML-Dokument (<code>&lt;head&gt;</code> oder <code>&lt;body&gt;</code>) ein Javascript-Snippet, um die Uhr zu initialisieren:<br/>
<code>&lt;script type="text/javascript"&gt; <code>&lt;script type="text/javascript"&gt;
jQuery(document).ready(function() { jQuery(document).ready(function() {
@ -114,7 +115,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
theme: 'red' theme: 'red'
});</code> });</code>
</p> </p>
<h3 id="configuration">Konfiguration</h3> <h3 id="configuration">Konfiguration<a href="#toc" class="toclink">Zum Inhalt</a></h3>
<p>Es existieren die folgenden Konfigurationsoptionen:</p> <p>Es existieren die folgenden Konfigurationsoptionen:</p>
<dl> <dl>
<dt><code>width</code></dt> <dt><code>width</code></dt>
@ -153,11 +154,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
}); });
})(jQuery); })(jQuery);
</script> </script>
<h2 id="information">Informationen</h2> <h2 id="information">Informationen<a href="#toc" class="toclink">Zum Inhalt</a></h2>
<p>Programmiert von <a href="mailto:manuel@fritteli.ch">Manuel Friedli</a> mit Inspiration von <a href="http://www.qlocktwo.com/">QLOCKTWO</a>.<br/> <p>Programmiert von <a href="mailto:manuel@fritteli.ch">Manuel Friedli</a> mit Inspiration von <a href="http://www.qlocktwo.com/">QLOCKTWO</a>.<br/>
Diese Uhr ist aus Freude am Programmieren und am Konzept einer die Zeit in Worten ausdrückenden Uhr entstanden. Sollte daraus jemandem Schaden oder ein gravierender Nachteil erwachsen, so soll sich diese Person bei mir melden und wir werden bestimmt eine Lösung finden, die für alle beteiligten angemessen ist. Allen anderen Personen wünsche ich viel Freude mit der Zeit im Wort.</p> Diese Uhr ist aus Freude am Programmieren und am Konzept einer die Zeit in Worten ausdrückenden Uhr entstanden. Sollte daraus jemandem Schaden oder ein gravierender Nachteil erwachsen, so soll sich diese Person bei mir melden und wir werden bestimmt eine Lösung finden, die für alle beteiligten angemessen ist. Allen anderen Personen wünsche ich viel Freude mit der Zeit im Wort.</p>
<p>Der Quellcode ist frei zugänglich unter <a href="https://git.friedli.info/manuel/uhr">https://git.friedli.info/manuel/uhr</a>.</p> <p>Der Quellcode ist frei zugänglich unter <a href="https://git.friedli.info/manuel/uhr">https://git.friedli.info/manuel/uhr</a>.</p>
<h2 id="license">Lizenzbestimmungen</h2> <h2 id="license">Lizenzbestimmungen<a href="#toc" class="toclink">Zum Inhalt</a></h2>
<p>Der komplette Sourcecode ist unter der GNU GPL 3.0 lizenziert und darf nach deren Vorgaben verwendet, kopiert, weitergegeben und verändert werden. Die GNU GPL 3.0 findest Du unter folgendem Link: <a href="https://www.gnu.org/licenses/gpl-3.0">GNU GPL 3.0</a>. Und direkt hier:</p> <p>Der komplette Sourcecode ist unter der GNU GPL 3.0 lizenziert und darf nach deren Vorgaben verwendet, kopiert, weitergegeben und verändert werden. Die GNU GPL 3.0 findest Du unter folgendem Link: <a href="https://www.gnu.org/licenses/gpl-3.0">GNU GPL 3.0</a>. Und direkt hier:</p>
<h3 id="gpl-v3" style="text-align: center;">GNU GENERAL PUBLIC LICENSE</h3> <h3 id="gpl-v3" style="text-align: center;">GNU GENERAL PUBLIC LICENSE</h3>
<p style="text-align: center;">Version 3, 29 June 2007</p> <p style="text-align: center;">Version 3, 29 June 2007</p>

View file

@ -2,7 +2,8 @@ body {
font-size: 120%; font-size: 120%;
} }
code { code {
white-space: pre; white-space: pre-line;
display: inline-block;
} }
ol { ol {
counter-reset: item; counter-reset: item;
@ -15,3 +16,9 @@ ol li:before {
content: counters(item, ".") ". "; content: counters(item, ".") ". ";
counter-increment: item; counter-increment: item;
} }
a.toclink {
font-size: 25%;
}
a.toclink:before {
content: "▲ ";
}

74
js/uhr-de.js Normal file
View file

@ -0,0 +1,74 @@
/*
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 3 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, see <http://www.gnu.org/licenses/>.
*/
(function () {
'use strict';
var es_ist = {1: [1, 2, 4, 5, 6]};
var uhr = {10: [9, 10, 11]};
var nach = {4: [8, 9, 10, 11]};
var vor = {4: [1, 2, 3]};
var halb = {5: [1, 2, 3, 4]};
var fuenf = {1: [8, 9, 10, 11]};
var zehn = {2: [1, 2, 3, 4]};
var viertel = {3: [5, 6, 7, 8, 9, 10, 11]};
var zwanzig = {2: [5, 6, 7, 8, 9, 10, 11]};
var dreiviertel = {3: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]};
var layout = {
"version": 2,
"language": 'Deutsch',
"letters": [
'ESKISTAFÜNF',
'ZEHNZWANZIG',
'DREIVIERTEL',
'VORFUNKNACH',
'HALBAELFÜNF',
'EINSXAMZWEI',
'DREIPMJVIER',
'SECHSNLACHT',
'SIEBENZWÖLF',
'ZEHNEUNKUHR'
],
"permanent": es_ist,
"minutes": {
"0,1,2,3,4": uhr,
"5,6,7,8,9": [fuenf, nach],
"10,11,12,13,14": [zehn, nach],
"15,16,17,18,19": [viertel, nach],
"20,21,22,23,24": [zwanzig, nach],
"25,26,27,28,29": [fuenf, vor, halb],
"30,31,32,33,34": halb,
"35,36,37,38,39": [fuenf, nach, halb],
"40,41,42,43,44": [zwanzig, vor],
"45,46,47,48,49": dreiviertel,
"50,51,52,53,54": [zehn, vor],
"55,56,57,58,59": [fuenf, vor]
},
"hours": {
"0,12": {9: [7, 8, 9, 10, 11]},
"1,13": {6: [1, 2, 3, 4]},
"2,14": {6: [8, 9, 10, 11]},
"3,15": {7: [1, 2, 3, 4]},
"4,16": {7: [8, 9, 10, 11]},
"5,17": {5: [8, 9, 10, 11]},
"6,18": {8: [1, 2, 3, 4, 5]},
"7,19": {9: [1, 2, 3, 4, 5, 6]},
"8,20": {8: [8, 9, 10, 11]},
"9,21": {10: [4, 5, 6, 7]},
"10,22": {10: [1, 2, 3, 4]},
"11,23": {5: [6, 7, 8]}
}
};
$.fritteli.uhr.register('de', layout);
}());

97
js/uhr-de_CH.js Normal file
View file

@ -0,0 +1,97 @@
/*
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 3 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, see <http://www.gnu.org/licenses/>.
*/
(function () {
'use strict';
// hilfsvariablen
var es_isch = {1: [1, 2, 4, 5, 6, 7]};
var ab = {4: [1, 2]};
var vor = {3: [9, 10, 11]};
var haubi = {4: [4, 5, 6, 7, 8]};
var fuef = {1: [9, 10, 11]};
var zae = {2: [9, 10, 11]};
var viertu = {2: [1, 2, 3, 4, 5, 6]};
var zwaenzg = {3: [1, 2, 3, 4, 5, 6]};
var layout = {
// version: zur Zeit immer 2 (Pflichtattribut)
"version": 2,
// Sprechender Name der Sprache
"language": 'Bärndütsch',
// Buchstabenfeld als Array von Strings.
"letters": [
'ESKISCHAFÜF',
'VIERTUBFZÄÄ',
'ZWÄNZGSIVOR',
'ABOHAUBIEGE',
'EISZWÖISDRÜ',
'VIERIFÜFIQT',
'SÄCHSISIBNI',
'ACHTINÜNIEL',
'ZÄNIERBEUFI',
'ZWÖUFINAUHR'
],
// Permanent aktive Buchstaben. <array-or-object>, vgl. ausführliche Beschreibung bei "minutes".
"permanent": es_isch,
/*
* Minuten: Objekt im folgenden Format:
* {
* <minuten>: <array-or-object>,
* ...
* }
* <minuten>: String von Komma-separierten Minutenwerten, zu welchem die in <array-or-object> angegebenen Buchstaben aktiv sein sollen
* <array-or-object> : [ <object>, ...] | <object>
* <object>: { <zeile> : [ <spalte>, ... ] }
* <zeile>: Die Zeile, in welcher die Buchstaben liegen; von oben gezählt, oben ist 1.
* <spalte>: Die Spalte, in der ein einzelner Buchstabe liegt; von links gezählt, links ist 1.
* Beispiel:
* "minutes": {
* "0,1": {1: [6, 7, 9]},
* "5": [ {3: [1, 2]}, {4: [10, 11]} ]
* }
* Erklärung:
* Bei Minuten 0 und 1 sind die Buchstaben 6, 7 und 9 der ersten Zeile aktiv.
* Bei Minute 5 sind die Buchstaben 1 und 2 der Zeile 3 sowie die Buchstaben 10 und 11 der Zeile 4 aktiv.
*/
"minutes": {
"5,6,7,8,9": [fuef, ab],
"10,11,12,13,14": [zae, ab],
"15,16,17,18,19": [viertu, ab],
"20,21,22,23,24": [zwaenzg, ab],
"25,26,27,28,29": [fuef, vor, haubi],
"30,31,32,33,34": haubi,
"35,36,37,38,39": [fuef, ab, haubi],
"40,41,42,43,44": [zwaenzg, vor],
"45,46,47,48,49": [viertu, vor],
"50,51,52,53,54": [zae, vor],
"55,56,57,58,59": [fuef, vor]
},
// Die Stunden; gleiches Format wie bei den Minuten
"hours": {
"0,12": {10: [1, 2, 3, 4, 5, 6]},
"1,13": {5: [1, 2, 3]},
"2,14": {5: [4, 5, 6, 7]},
"3,15": {5: [9, 10, 11]},
"4,16": {6: [1, 2, 3, 4, 5]},
"5,17": {6: [6, 7, 8, 9]},
"6,18": {7: [1, 2, 3, 4, 5, 6]},
"7,19": {7: [7, 8, 9, 10, 11]},
"8,20": {8: [1, 2, 3, 4, 5]},
"9,21": {8: [6, 7, 8, 9]},
"10,22": {9: [1, 2, 3, 4]},
"11,23": {9: [8, 9, 10, 11]}
}
};
// Das Layout bei der Uhr unter dem Code "de_CH" registrieren.
$.fritteli.uhr.register('de_CH', layout);
}());

72
js/uhr-de_CH_genau.js Normal file
View file

@ -0,0 +1,72 @@
/*
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 3 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, see <http://www.gnu.org/licenses/>.
*/
(function () {
'use strict';
var es_isch = {1: [1, 2, 4, 5, 6, 7]};
var genau = {3: [7, 8, 9, 10, 11]};
var ab = {4: [4, 5]};
var vor = {4: [1, 2, 3]};
var haubi = {4: [7, 8, 9, 10, 11]};
var fuef = {1: [9, 10, 11]};
var zae = {2: [9, 10, 11]};
var viertu = {2: [1, 2, 3, 4, 5, 6]};
var zwaenzg = {3: [1, 2, 3, 4, 5, 6]};
var layout = {
"version": 2,
"language": 'Bärndütsch (genau)',
"letters": [
'ESKISCHAFÜF',
'VIERTUBFZÄÄ',
'ZWÄNZGGENAU',
'VORABOHAUBI',
'EISZWÖISDRÜ',
'VIERIFÜFIQT',
'SÄCHSISIBNI',
'ACHTINÜNIEL',
'ZÄNIERBEUFI',
'ZWÖUFINAUHR'
],
"permanent": es_isch,
"minutes": {
"0": genau,
"5,6,7,8,9": [fuef, ab],
"10,11,12,13,14": [zae, ab],
"15,16,17,18,19": [viertu, ab],
"20,21,22,23,24": [zwaenzg, ab],
"25,26,27,28,29": [fuef, vor, haubi],
"30,31,32,33,34": haubi,
"35,36,37,38,39": [fuef, ab, haubi],
"40,41,42,43,44": [zwaenzg, vor],
"45,46,47,48,49": [viertu, vor],
"50,51,52,53,54": [zae, vor],
"55,56,57,58,59": [fuef, vor]
},
"hours": {
"0,12": {10: [1, 2, 3, 4, 5, 6]},
"1,13": {5: [1, 2, 3]},
"2,14": {5: [4, 5, 6, 7]},
"3,15": {5: [9, 10, 11]},
"4,16": {6: [1, 2, 3, 4, 5]},
"5,17": {6: [6, 7, 8, 9]},
"6,18": {7: [1, 2, 3, 4, 5, 6]},
"7,19": {7: [7, 8, 9, 10, 11]},
"8,20": {8: [1, 2, 3, 4, 5]},
"9,21": {8: [6, 7, 8, 9]},
"10,22": {9: [1, 2, 3, 4]},
"11,23": {9: [8, 9, 10, 11]}
}
};
$.fritteli.uhr.register('de_CH_genau', layout);
}());

81
js/uhr-en.js Normal file
View file

@ -0,0 +1,81 @@
/*
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 3 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, see <http://www.gnu.org/licenses/>.
*/
(function () {
'use strict';
var it_is = {1: [1, 2, 4, 5]};
var half = {4: [1, 2, 3, 4]};
var to = {4: [10, 11]};
var past = {5: [1, 2, 3, 4]};
var o_clock = {10: [5, 6, 7, 8, 9, 10, 11]};
var five = {3: [7, 8, 9, 10]};
var ten = {4: [6, 7, 8]};
var a_quarter = {2: [1, 3, 4, 5, 6, 7, 8, 9]};
var twenty = {3: [1, 2, 3, 4, 5, 6]};
var twentyfive = {3: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]};
var layout = {
"version": 2,
"language": 'English',
"letters": [
'ITLISBFAMPM',
'ACQUARTERDC',
'TWENTYFIVEX',
'HALFBTENFTO',
'PASTERUNINE',
'ONESIXTHREE',
'FOURFIVETWO',
'EIGHTELEVEN',
'SEVENTWELVE',
'TENSO\'CLOCK'
],
"permanent": it_is,
"minutes": {
"0,1,2,3,4": o_clock,
"5,6,7,8,9": [five, past],
"10,11,12,13,14": [ten, past],
"15,16,17,18,19": [a_quarter, past],
"20,21,22,23,24": [twenty, past],
"25,26,27,28,29": [twentyfive, past],
"30,31,32,33,34": [half, past],
"35,36,37,38,39": [twentyfive, to],
"40,41,42,43,44": [twenty, to],
"45,46,47,48,49": [a_quarter, to],
"50,51,52,53,54": [ten, to],
"55,56,57,58,59": [five, to]
},
"hours": {
"0,12": {9: [6, 7, 8, 9, 10, 11]},
"1,13": {6: [1, 2, 3]},
"2,14": {7: [9, 10, 11]},
"3,15": {6: [7, 8, 9, 10, 11]},
"4,16": {7: [1, 2, 3, 4]},
"5,17": {7: [5, 6, 7, 8]},
"6,18": {6: [4, 5, 6]},
"7,19": {9: [1, 2, 3, 4, 5]},
"8,20": {8: [1, 2, 3, 4, 5]},
"9,21": {5: [8, 9, 10, 11]},
"10,22": {10: [1, 2, 3]},
"11,23": {8: [6, 7, 8, 9, 10, 11]}
},
"getHour": function (date) {
var hour = date.getHours();
if (date.getMinutes() >= 35) {
return (hour + 1) % 24;
}
return hour;
}
};
$.fritteli.uhr.register('en', layout);
}());

82
js/uhr-fr.js Normal file
View file

@ -0,0 +1,82 @@
/*
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 3 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, see <http://www.gnu.org/licenses/>.
*/
(function () {
'use strict';
var il_est = {1: [1, 2, 4, 5, 6]};
var et = {8: [1, 2]};
var moins = {7: [1, 2, 3, 4, 5]};
var demie = {10: [4, 5, 6, 7, 8]};
var heures = {6: [6, 7, 8, 9, 10, 11]};
var le = {7: [7, 8]};
var cinq = {9: [7, 8, 9, 10]};
var dix = {7: [9, 10, 11]};
var quart = {8: [4, 5, 6, 7, 8]};
var vingt = {9: [1, 2, 3, 4, 5]};
var vingtcinq = {9: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]};
var layout = {
"version": 2,
"language": 'Français',
"letters": [
'ILNESTODEUX',
'QUATRETROIS',
'NEUFUNESEPT',
'HUITSIXCINQ',
'MIDIXMINUIT',
'ONZERHEURES',
'MOINSOLEDIX',
'ETRQUARTPMD',
'VINGT-CINQU',
'ETSDEMIEPAM'
],
"permanent": il_est,
"minutes": {
"5,6,7,8,9": cinq,
"10,11,12,13,14": dix,
"15,16,17,18,19": [et, quart],
"20,21,22,23,24": vingt,
"25,26,27,28,29": vingtcinq,
"30,31,32,33,34": [et, demie],
"35,36,37,38,39": [moins, vingtcinq],
"40,41,42,43,44": [moins, vingt],
"45,46,47,48,49": [moins, le, quart],
"50,51,52,53,54": [moins, dix],
"55,56,57,58,59": [moins, cinq]
},
"hours": {
"0": {5: [6, 7, 8, 9, 10, 11]},
"1,13": [{3: [5, 6, 7]}, heures],
"2,14": [{1: [8, 9, 10, 11]}, heures],
"3,15": [{2: [7, 8, 9, 10, 11]}, heures],
"4,16": [{2: [1, 2, 3, 4, 5, 6]}, heures],
"5,17": [{4: [8, 9, 10, 11]}, heures],
"6,18": [{4: [5, 6, 7]}, heures],
"7,19": [{3: [8, 9, 10, 11]}, heures],
"8,20": [{4: [1, 2, 3, 4]}, heures],
"9,21": [{3: [1, 2, 3, 4]}, heures],
"10,22": [{5: [3, 4, 5]}, heures],
"11,23": [{6: [1, 2, 3, 4]}, heures],
"12": {5: [1, 2, 3, 4]}
},
"getHour": function (date) {
var hour = date.getHours();
if (date.getMinutes() >= 35) {
return (hour + 1) % 24;
}
return hour;
}
};
$.fritteli.uhr.register('fr', layout);
}());

80
js/uhr-it.js Normal file
View file

@ -0,0 +1,80 @@
/*
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 3 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, see <http://www.gnu.org/licenses/>.
*/
(function () {
'use strict';
var sono_le = {1: [1, 2, 3, 4, 6, 7]};
var e_l = {2: [1, 3, 4]};
var e = {8: [1]};
var meno = {7: [8, 9, 10, 11]};
var mezza = {10: [7, 8, 9, 10, 11]};
var cinque = {9: [6, 7, 8, 9, 10, 11]};
var dieci = {10: [1, 2, 3, 4, 5]};
var un_quarto = {8: [3, 4, 6, 7, 8, 9, 10, 11]};
var venti = {9: [1, 2, 3, 4, 5]};
var venticinque = {9: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]};
var layout = {
"version": 2,
"language": 'Italiano',
"letters": [
'SONORLEBORE',
'ÈRL\'UNASDUE',
'TREOTTONOVE',
'DIECIUNDICI',
'DODICISETTE',
'QUATTROCSEI',
'CINQUEAMENO',
'ECUNOQUARTO',
'VENTICINQUE',
'DIECIPMEZZA'
],
"permanent": [],
"minutes": {
"5,6,7,8,9": [e, cinque],
"10,11,12,13,14": [e, dieci],
"15,16,17,18,19": [e, un_quarto],
"20,21,22,23,24": [e, venti],
"25,26,27,28,29": [e, venticinque],
"30,31,32,33,34": [e, mezza],
"35,36,37,38,39": [meno, venticinque],
"40,41,42,43,44": [meno, venti],
"45,46,47,48,49": [meno, un_quarto],
"50,51,52,53,54": [meno, dieci],
"55,56,57,58,59": [meno, cinque]
},
"hours": {
"0,12": [sono_le, {5: [1, 2, 3, 4, 5, 6]}],
"1,13": [e_l, {2: [5, 6, 7]}],
"2,14": [sono_le, {2: [9, 10, 11]}],
"3,15": [sono_le, {3: [1, 2, 3]}],
"4,16": [sono_le, {6: [1, 2, 3, 4, 5, 6, 7]}],
"5,17": [sono_le, {7: [1, 2, 3, 4, 5, 6]}],
"6,18": [sono_le, {6: [9, 10, 11]}],
"7,19": [sono_le, {5: [7, 8, 9, 10, 11]}],
"8,20": [sono_le, {3: [4, 5, 6, 7]}],
"9,21": [sono_le, {3: [8, 9, 10, 11]}],
"10,22": [sono_le, {4: [1, 2, 3, 4, 5]}],
"11,23": [sono_le, {4: [6, 7, 8, 9, 10, 11]}]
},
"getHour": function (date) {
var hour = date.getHours();
if (date.getMinutes() >= 35) {
return (hour + 1) % 24;
}
return hour;
}
};
$.fritteli.uhr.register('it', layout);
}());

468
js/uhr.js Normal file
View file

@ -0,0 +1,468 @@
/*
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 3 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, see <http://www.gnu.org/licenses/>.
*/
(function ($) {
'use strict';
var uhrGlobals = {
"id": 0,
"languages": [],
"themes": [],
registerLanguage: function registerLanguage(code, language) {
var alreadyExists = uhrGlobals.languages.some(function (element) {
if (code === element.code) {
console.error("Error: Language code '" + code + "' cannot be registered for language '" + language.language + "' because it is already registered for language '" + element.language + "'!");
return true;
}
return false;
});
if (!alreadyExists) {
language.code = code;
uhrGlobals.languages.push(language);
}
}
};
// auto-detect themes
$('link[rel=stylesheet]').each(function (index, item) {
var styleSheet = $(item);
var styleClass = styleSheet.attr('data-class');
if (styleClass !== undefined) {
var name = styleSheet.attr('data-name');
if (name === undefined) {
name = styleClass;
}
uhrGlobals.themes.push({'styleClass': styleClass, 'name': name});
}
});
// fall-back if no theme was included
if (uhrGlobals.themes.length === 0) {
uhrGlobals.themes.push({});
}
// public interface methods (exported later)
var start = function start() {
if (!isOn.bind(this)()) {
this.timer = window.setInterval(function () {
this.options.time = new Date();
update.bind(this)();
}.bind(this), 1000);
update.bind(this)();
setCookie.bind(this)('uhr-status', 'on');
}
};
var stop = function stop() {
if (isOn.bind(this)()) {
window.clearInterval(this.timer);
this.timer = null;
update.bind(this)();
setCookie.bind(this)('uhr-status', 'off');
}
};
var toggle = function toggle() {
if (isOn.bind(this)()) {
this.stop();
} else {
this.start();
}
};
var setLanguage = function setLanugage(languageKey) {
if (languageKey !== this.options.language) {
this.options.language = languageKey;
var renderer = new UhrRenderer(language.bind(this)(), this.element.find('.letterarea'));
renderer.render.bind(this)(function () {
this.currentMinute = -1;
update.bind(this)();
}.bind(this));
setCookie.bind(this)('uhr-language', languageKey);
update.bind(this)();
}
};
var setTheme = function setTheme(theme) {
if (theme !== this.options.theme) {
this.element.removeClass(this.options.theme).addClass(theme);
$('#uhr-onoffswitch' + this.id).removeClass(this.options.theme).addClass(theme);
this.options.theme = theme;
setCookie.bind(this)('uhr-theme', theme);
}
};
var setTime = function setTime(time) {
this.currentMinute = -1;
if (time === null) {
this.options.time = new Date();
} else {
if (this.timer !== null) {
window.clearInterval(this.timer);
}
this.options.time = time;
}
update.bind(this)();
};
var setWidth = function setWidth(width) {
var e = this.element;
e.css('width', width);
var realWidth = e.width();
e.width(realWidth);
e.height(realWidth);
e.css('font-size', (realWidth / 40) + 'px');
};
// private interface methods
var create = function create() {
this.id = uhrGlobals.id++;
this.timer = null;
this.currentMinute = -1;
var userTime = this.options.time;
if (this.options.time === undefined) {
this.options.time = new Date();
}
setupHTML.bind(this)();
wireFunctionality.bind(this)();
if (userTime !== undefined) {
this.time(userTime);
}
};
// private helper methods (not exported)
var showConfigScreen = function showConfigScreen() {
$('#uhr-controlpanel' + this.id).show();
};
// set up
var setupHTML = function setupHTML() {
var e = this.element;
// Base clock area
e.addClass('uhr');
e.empty();
e.append('<span class="item dot dot1"></span>');
e.append('<span class="item dot dot2"></span>');
e.append('<span class="item dot dot3"></span>');
e.append('<span class="item dot dot4"></span>');
e.append('<div class="letterarea"></div>');
e.append('<div class="reflection"></div>');
setWidth.bind(this)(this.options.width);
if (this.options.controls) {
var configlink = $('<a class="uhr-configlink" id="uhr-configlink' + this.id + '"></a>');
configlink.on('click', function () {
showConfigScreen.bind(this)();
}.bind(this));
e.after(configlink);
var controlpanel = $('<div class="uhr-controlpanel" id="uhr-controlpanel' + this.id + '"></div>');
var content = $('<div class="content"></div>');
controlpanel.append(content);
// on/off switch
var toggleSwitch = $('<div class="onoffswitch" id="uhr-onoffswitch' + this.id + '"></div>');
toggleSwitch.append('<input type="checkbox" class="onoffswitch-checkbox" id="uhr-onoffswitch-checkbox' + this.id + '" checked="checked" />');
toggleSwitch.append('<label class="onoffswitch-label" for="uhr-onoffswitch-checkbox' + this.id + '">'
+ '<div class="onoffswitch-inner"></div>'
+ '<div class="onoffswitch-switch"></div>'
+ '</label>');
content.append(toggleSwitch);
// language chooser
if (uhrGlobals.languages.length > 1) {
var languageChooser = $('<select id="uhr-languagechooser' + this.id + '"></select>');
uhrGlobals.languages.forEach(function (item) {
languageChooser.append('<option value="' + item.code + '">' + item.language + '</option>');
});
content.append(languageChooser);
}
// theme chooser
if (uhrGlobals.themes.length > 1) {
var themeChooser = $('<select id="uhr-themechooser' + this.id + '"></select>');
uhrGlobals.themes.forEach(function (item) {
themeChooser.append('<option value="' + item.styleClass + '">' + item.name + '</option>');
});
content.append(themeChooser);
}
var closebutton = $('<a class="uhr-closecontrolpanel" id="uhr-closecontrolpanel' + this.id + '"></a>');
closebutton.on('click', function () {
$('#uhr-controlpanel' + this.id).hide();
}.bind(this));
content.append(closebutton);
e.after(controlpanel);
controlpanel.hide();
}
};
var wireFunctionality = function wireFunctionality() {
// on/off switch
var toggleSwitch = $('#uhr-onoffswitch-checkbox' + this.id);
toggleSwitch.on('click', function () {
this.toggle();
}.bind(this));
var status = $.cookie('uhr-status' + this.id);
if (status === undefined || this.options.force) {
status = this.options.status;
}
toggleSwitch.prop('checked', status === 'on');
if (status === 'on') {
this.start();
} else {
this.stop();
}
// language chooser
var languageChooser = $('#uhr-languagechooser' + this.id);
languageChooser.on('change', function () {
var languageKey = $('#uhr-languagechooser' + this.id).val();
this.language(languageKey);
}.bind(this));
var selectedLanguage = $.cookie('uhr-language' + this.id);
if (selectedLanguage === undefined || this.options.force) {
selectedLanguage = this.options.language;
}
var found = uhrGlobals.languages.some(function (item) {
return selectedLanguage === item.code;
});
if (!found) {
var fallbackLanguage;
if (uhrGlobals.languages.length > 0) {
fallbackLanguage = uhrGlobals.languages[0].code;
} else {
fallbackLanguage = '';
}
console.warn("Language '" + selectedLanguage + "' not found! Using fallback '" + fallbackLanguage + "'");
selectedLanguage = fallbackLanguage;
}
languageChooser.val(selectedLanguage);
this.options.language = "";
this.language(selectedLanguage);
// theme chooser
var themeChooser = $('#uhr-themechooser' + this.id);
themeChooser.on('change', function () {
var themeKey = $('#uhr-themechooser' + this.id).val();
this.theme(themeKey);
}.bind(this));
var selectedTheme = $.cookie('uhr-theme' + this.id);
if (selectedTheme === undefined || this.options.force) {
selectedTheme = this.options.theme;
}
found = uhrGlobals.themes.some(function (item) {
return selectedTheme === item.styleClass;
});
if (!found) {
var fallbackTheme = uhrGlobals.themes[0].styleClass;
console.warn("Theme '" + selectedTheme + "' not found! Using fallback '" + fallbackTheme + "'");
selectedTheme = fallbackTheme;
}
themeChooser.val(selectedTheme);
this.options.theme = "";
this.theme(selectedTheme);
};
var setCookie = function setCookie(cookieName, cookieValue) {
var options = {};
if (this.options.cookiePath !== undefined) {
options = {expires: 365, path: this.options.cookiePath};
} else {
options = {expires: 365};
}
$.cookie(cookieName + this.id, cookieValue, options);
};
// business logic
var isOn = function isOn() {
return this.timer !== null;
};
var update = function update() {
if (isOn.bind(this)()) {
var time = this.options.time;
if (time.getMinutes() === this.currentMinute) {
return;
}
this.currentMinute = time.getMinutes();
show.bind(this)(time);
} else {
clear.bind(this)();
this.currentMinute = -1;
}
};
var show = function show(time) {
var dotMinute = getDotMinute.bind(this)(time);
var hour = getHour.bind(this)(time);
var coarseMinute = getCoarseMinute.bind(this)(time);
clear.bind(this)();
highlight.bind(this)('on');
for (var i = 1; i <= dotMinute; i++) {
highlight.bind(this)('dot' + i);
}
highlight.bind(this)('minute' + coarseMinute);
highlight.bind(this)('hour' + hour);
};
var highlight = function highlight(itemClass) {
this.element.find('.item.' + itemClass).addClass('active');
};
var clear = function clear() {
this.element.find('.item').removeClass('active');
};
var getDotMinute = function getDotMinute(date) {
if (typeof language.bind(this)().getDotMinute === 'function') {
return language.bind(this)().getDotMinute(date);
}
var minutes = date.getMinutes();
return minutes % 5;
};
var getCoarseMinute = function getCoarseMinute(date) {
if (typeof language.bind(this)().getCoarseMinute === 'function') {
return language.bind(this)().getCoarseMinute(date);
}
return date.getMinutes();
};
var getHour = function getHour(date) {
if (typeof language.bind(this)().getHour === 'function') {
return language.bind(this)().getHour(date);
}
var hour = date.getHours();
if (date.getMinutes() >= 25) {
return (hour + 1) % 24;
}
return hour;
};
var language = function language() {
var matchingLanguages = uhrGlobals.languages.filter(function (element) {
return (element.code === this.options.language);
}, this);
if (matchingLanguages.length > 0) {
return matchingLanguages[0];
}
// fallback: return empty object
return {};
};
$.widget("fritteli.uhr", {
"options": {
width: '100%',
status: 'on',
language: 'de_CH',
theme: uhrGlobals.themes[0].styleClass,
force: false,
controls: true,
cookiePath: undefined
},
"start": start,
"stop": stop,
"toggle": toggle,
"language": setLanguage,
"theme": setTheme,
"time": setTime,
"width": setWidth,
// constructor method
"_create": create
});
$.fritteli.uhr.register = uhrGlobals.registerLanguage;
/**
* Hilfsklasse zum Rendern der Uhr.
* @param layout Layout-Objekt, das gerendert werden soll.
* @param renderarea Das jQuery-gewrappte HTML-Element, auf dem gerendert werden soll.
*/
function UhrRenderer(layout, renderarea) {
this.render = function render(beforeshow) {
if (layout.parsed === undefined) {
switch (layout.version) {
case 2:
var delegate = new UhrRendererV2Delegate(layout);
var parsedLayout = delegate.parse();
Object.defineProperty(layout, "parsed", {"value": parsedLayout, "writable": false, "configurable": false});
break;
default:
console.warn("Unknown layout version: '" + layout.version + "'");
return;
}
}
var letters = layout.parsed;
renderarea.fadeOut('fast', function () {
renderarea.empty();
letters.forEach(function (line, index, array) {
line.forEach(function (letter) {
renderarea.append(letter.toString());
});
if (index < array.length - 1) {
renderarea.append('<br/>');
}
});
if (typeof beforeshow === 'function') {
beforeshow();
}
renderarea.fadeIn('fast');
});
};
}
function UhrRendererV2Delegate(layout) {
function parseArrayOrObject(letters, styleClass, input) {
if (Array.isArray(input)) {
input.forEach(function (item) {
parseObject(letters, styleClass, item);
});
} else {
parseObject(letters, styleClass, input);
}
}
function parseObject(letters, styleClass, object) {
Object.keys(object).forEach(function (y) {
var highlightLetters = object[y];
highlightLetters.forEach(function (x) {
letters[y - 1][x - 1].addStyle(styleClass);
});
});
}
function parseTimeDefinition(letters, styleClass, definition) {
Object.keys(definition).forEach(function (listString) {
var array = listString.split(',');
var highlightLetters = definition[listString];
array.forEach(function (item) {
parseArrayOrObject(letters, styleClass + item, highlightLetters);
});
});
}
this.parse = function parse() {
var letters = [];
layout.letters.forEach(function (string) {
var line = [];
for (var c = 0; c < string.length; c++) {
var character = new Letter(string[c]);
line.push(character);
}
letters.push(line);
});
parseArrayOrObject(letters, 'on', layout.permanent);
parseTimeDefinition(letters, 'minute', layout.minutes);
parseTimeDefinition(letters, 'hour', layout.hours);
return letters;
};
}
/**
* Ein Buchstabe. Hilfsklasse für den Renderer und Inhalt der Layout-Arrays.
* @param value Der Buchstabe, der Dargestellt werden soll.
* @param style Die CSS-Styleklassen des Buchstabens.
*/
function Letter(value, style) {
var myValue = value;
var myStyle = style || '';
this.addStyle = function (style) {
if (myStyle === '') {
myStyle = style;
} else {
myStyle += ' ' + style;
}
};
this.toString = function () {
return '<span class="item letter ' + myStyle + '">' + myValue + '</span>';
};
}
})(jQuery);

View file

@ -1,31 +1,34 @@
CACHE MANIFEST CACHE MANIFEST
# 6.3-alpha # 7.0-alpha
COPYING css/uhr.css
README.md css/uhr-black.css
apple-touch-icon-precomposed.png css/uhr-blue.css
favicon.png css/uhr-green.css
index.html css/uhr-pink.css
jquery-2.1.0.min.js css/uhr-red.css
jquery-cookie-1.4.0.js css/uhr-white.css
jquery-ui-1.10.4.custom.min.js css/uhr-yellow.css
uhr-black.css
uhr-blue.css
uhr-de.js
uhr-de_CH.js
uhr-de_CH-seconds.js
uhr-de_CH_genau.js
uhr-en.js
uhr-fr.js
uhr-green.css
uhr-it.js
uhr-pink.css
uhr-red.css
uhr-white.css
uhr-yellow.css
uhr.css
uhr.js
uhr.woff
info/index.html info/index.html
info/info.css info/info.css
js/uhr.js
js/uhr-de.js
js/uhr-de_CH.js
uhr-de_CH-seconds.js
js/uhr-de_CH_genau.js
js/uhr-en.js
js/uhr-fr.js
js/uhr-it.js
lib/jquery-2.1.0.min.js
lib/jquery-cookie-1.4.0.js
lib/jquery-ui-1.10.4.custom.min.js
resources/apple-touch-icon-precomposed.png
resources/close.png
resources/favicon.png
resources/settings.png
resources/uhr.woff
showcase/index.html showcase/index.html
COPYING
README.md
index.html
uhr-de_CH.js

View file

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

BIN
resources/close.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 407 B

View file

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
resources/settings.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 435 B

View file

@ -21,31 +21,31 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<meta name="apple-mobile-web-app-status-bar-style" content="black" /> <meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="apple-mobile-web-app-title" content="Bärneruhr" /> <meta name="apple-mobile-web-app-title" content="Bärneruhr" />
<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1" /> <meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1" />
<link rel="stylesheet" type="text/css" href="../uhr.css" /> <link rel="stylesheet" type="text/css" href="../css/uhr.css" />
<link rel="stylesheet" type="text/css" href="../uhr-black.css" data-class="black" data-name="Schwarz" /> <link rel="stylesheet" type="text/css" href="../css/uhr-black.css" data-class="black" data-name="Schwarz" />
<link rel="stylesheet" type="text/css" href="../uhr-white.css" data-class="white" data-name="Weiss" /> <link rel="stylesheet" type="text/css" href="../css/uhr-white.css" data-class="white" data-name="Weiss" />
<link rel="stylesheet" type="text/css" href="../uhr-red.css" data-class="red" data-name="Rot" /> <link rel="stylesheet" type="text/css" href="../css/uhr-red.css" data-class="red" data-name="Rot" />
<link rel="stylesheet" type="text/css" href="../uhr-green.css" data-class="green" data-name="Grün" /> <link rel="stylesheet" type="text/css" href="../css/uhr-green.css" data-class="green" data-name="Grün" />
<link rel="stylesheet" type="text/css" href="../uhr-yellow.css" data-class="yellow" data-name="Gelb" /> <link rel="stylesheet" type="text/css" href="../css/uhr-yellow.css" data-class="yellow" data-name="Gelb" />
<link rel="stylesheet" type="text/css" href="../uhr-blue.css" data-class="blue" data-name="Blau" /> <link rel="stylesheet" type="text/css" href="../css/uhr-blue.css" data-class="blue" data-name="Blau" />
<link rel="stylesheet" type="text/css" href="../uhr-pink.css" data-class="pink" data-name="Pink" /> <link rel="stylesheet" type="text/css" href="../css/uhr-pink.css" data-class="pink" data-name="Pink" />
<link rel="shortcut icon" type="image/png" href="favicon.png" /> <link rel="shortcut icon" type="image/png" href="favicon.png" />
<link rel="apple-touch-icon-precomposed" href="apple-touch-icon-precomposed.png" /> <link rel="apple-touch-icon-precomposed" href="apple-touch-icon-precomposed.png" />
<script type="text/javascript" src="../jquery-2.1.0.min.js"></script> <script type="text/javascript" src="../lib/jquery-2.1.0.min.js"></script>
<script type="text/javascript" src="../jquery-ui-1.10.4.custom.min.js"></script> <script type="text/javascript" src="../lib/jquery-ui-1.10.4.custom.min.js"></script>
<script type="text/javascript" src="../jquery-cookie-1.4.0.js"></script> <script type="text/javascript" src="../lib/jquery-cookie-1.4.0.js"></script>
<script type="text/javascript" src="../uhr.js"></script> <script type="text/javascript" src="../js/uhr.js"></script>
</head> </head>
<body style="padding:0;margin:0;"> <body style="padding:0;margin:0;">
<div id="uhr"></div> <div id="uhr"></div>
<p ><a href="..">Go back to the main page</a></p> <p ><a href="..">Go back to the main page</a></p>
<script type="text/javascript" src="../uhr-de_CH.js"></script> <script type="text/javascript" src="../js/uhr-de_CH.js"></script>
<script type="text/javascript" src="../uhr-de_CH-seconds.js"></script> <script type="text/javascript" src="../js/uhr-de_CH_genau.js"></script>
<script type="text/javascript" src="../uhr-de_CH_genau.js"></script> <script type="text/javascript" src="../uhr-de_CH-seconds.js"></script>
<script type="text/javascript" src="../uhr-de.js"></script> <script type="text/javascript" src="../js/uhr-de.js"></script>
<script type="text/javascript" src="../uhr-en.js"></script> <script type="text/javascript" src="../js/uhr-en.js"></script>
<script type="text/javascript" src="../uhr-fr.js"></script> <script type="text/javascript" src="../js/uhr-fr.js"></script>
<script type="text/javascript" src="../uhr-it.js"></script> <script type="text/javascript" src="../js/uhr-it.js"></script>
<script type="text/javascript"> <script type="text/javascript">
(function($) { (function($) {
var width = $(window).width(); var width = $(window).width();

270
test/css/mocha.css Normal file
View file

@ -0,0 +1,270 @@
@charset "utf-8";
body {
margin:0;
}
#mocha {
font: 20px/1.5 "Helvetica Neue", Helvetica, Arial, sans-serif;
margin: 60px 50px;
}
#mocha ul,
#mocha li {
margin: 0;
padding: 0;
}
#mocha ul {
list-style: none;
}
#mocha h1,
#mocha h2 {
margin: 0;
}
#mocha h1 {
margin-top: 15px;
font-size: 1em;
font-weight: 200;
}
#mocha h1 a {
text-decoration: none;
color: inherit;
}
#mocha h1 a:hover {
text-decoration: underline;
}
#mocha .suite .suite h1 {
margin-top: 0;
font-size: .8em;
}
#mocha .hidden {
display: none;
}
#mocha h2 {
font-size: 12px;
font-weight: normal;
cursor: pointer;
}
#mocha .suite {
margin-left: 15px;
}
#mocha .test {
margin-left: 15px;
overflow: hidden;
}
#mocha .test.pending:hover h2::after {
content: '(pending)';
font-family: arial, sans-serif;
}
#mocha .test.pass.medium .duration {
background: #c09853;
}
#mocha .test.pass.slow .duration {
background: #b94a48;
}
#mocha .test.pass::before {
content: '✓';
font-size: 12px;
display: block;
float: left;
margin-right: 5px;
color: #00d6b2;
}
#mocha .test.pass .duration {
font-size: 9px;
margin-left: 5px;
padding: 2px 5px;
color: #fff;
-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.2);
-moz-box-shadow: inset 0 1px 1px rgba(0,0,0,.2);
box-shadow: inset 0 1px 1px rgba(0,0,0,.2);
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
-ms-border-radius: 5px;
-o-border-radius: 5px;
border-radius: 5px;
}
#mocha .test.pass.fast .duration {
display: none;
}
#mocha .test.pending {
color: #0b97c4;
}
#mocha .test.pending::before {
content: '◦';
color: #0b97c4;
}
#mocha .test.fail {
color: #c00;
}
#mocha .test.fail pre {
color: black;
}
#mocha .test.fail::before {
content: '✖';
font-size: 12px;
display: block;
float: left;
margin-right: 5px;
color: #c00;
}
#mocha .test pre.error {
color: #c00;
max-height: 300px;
overflow: auto;
}
/**
* (1): approximate for browsers not supporting calc
* (2): 42 = 2*15 + 2*10 + 2*1 (padding + margin + border)
* ^^ seriously
*/
#mocha .test pre {
display: block;
float: left;
clear: left;
font: 12px/1.5 monaco, monospace;
margin: 5px;
padding: 15px;
border: 1px solid #eee;
max-width: 85%; /*(1)*/
max-width: calc(100% - 42px); /*(2)*/
word-wrap: break-word;
border-bottom-color: #ddd;
-webkit-border-radius: 3px;
-webkit-box-shadow: 0 1px 3px #eee;
-moz-border-radius: 3px;
-moz-box-shadow: 0 1px 3px #eee;
border-radius: 3px;
}
#mocha .test h2 {
position: relative;
}
#mocha .test a.replay {
position: absolute;
top: 3px;
right: 0;
text-decoration: none;
vertical-align: middle;
display: block;
width: 15px;
height: 15px;
line-height: 15px;
text-align: center;
background: #eee;
font-size: 15px;
-moz-border-radius: 15px;
border-radius: 15px;
-webkit-transition: opacity 200ms;
-moz-transition: opacity 200ms;
transition: opacity 200ms;
opacity: 0.3;
color: #888;
}
#mocha .test:hover a.replay {
opacity: 1;
}
#mocha-report.pass .test.fail {
display: none;
}
#mocha-report.fail .test.pass {
display: none;
}
#mocha-report.pending .test.pass,
#mocha-report.pending .test.fail {
display: none;
}
#mocha-report.pending .test.pass.pending {
display: block;
}
#mocha-error {
color: #c00;
font-size: 1.5em;
font-weight: 100;
letter-spacing: 1px;
}
#mocha-stats {
position: fixed;
top: 15px;
right: 10px;
font-size: 12px;
margin: 0;
color: #888;
z-index: 1;
}
#mocha-stats .progress {
float: right;
padding-top: 0;
}
#mocha-stats em {
color: black;
}
#mocha-stats a {
text-decoration: none;
color: inherit;
}
#mocha-stats a:hover {
border-bottom: 1px solid #eee;
}
#mocha-stats li {
display: inline-block;
margin: 0 5px;
list-style: none;
padding-top: 11px;
}
#mocha-stats canvas {
width: 40px;
height: 40px;
}
#mocha code .comment { color: #ddd; }
#mocha code .init { color: #2f6fad; }
#mocha code .string { color: #5890ad; }
#mocha code .keyword { color: #8a6343; }
#mocha code .number { color: #2f6fad; }
@media screen and (max-device-width: 480px) {
#mocha {
margin: 60px 0px;
}
#mocha #stats {
position: absolute;
}
}

4782
test/lib/chai.js Normal file

File diff suppressed because it is too large Load diff

5842
test/lib/mocha.js Normal file

File diff suppressed because it is too large Load diff

28
test/test.html Normal file
View file

@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>Test</title>
<link rel="stylesheet" type="text/css" href="css/mocha.css"/>
<link rel="stylesheet" type="text/css" href="../css/uhr.css"/>
<link rel="stylesheet" type="text/css" href="../css/uhr-black.css" data-class="black"/>
</head>
<body>
<div id="mocha"></div>
<script src="lib/mocha.js"></script>
<script src="lib/chai.js"></script>
<script>mocha.setup('tdd');</script>
<script src="../lib/jquery-2.1.0.min.js"></script>
<script src="../lib/jquery-ui-1.10.4.custom.min.js"></script>
<script src="../lib/jquery-cookie-1.4.0.js"></script>
<script src="../js/uhr.js"></script>
<script src="../js/uhr-de_CH.js"></script>
<script src="test.js"></script>
<div id="u"></div>
<script>
mocha.checkLeaks();
mocha.run();
// $('#u').uhr({'width':'200px'});
</script>
</body>
</html>

8
test/test.js Normal file
View file

@ -0,0 +1,8 @@
/**
* Created by u203395 on 04.07.2014.
*/
suite('Bärneruhr', function () {
"use strict";
test('dummy', function () {
});
});

View file

@ -1,70 +0,0 @@
/*
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 3 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, see <http://www.gnu.org/licenses/>.
*/
var h = {
"_es_ist": {1:[1,2,4,5,6]},
"_nach": {4:[8,9,10,11]},
"_vor": {4:[1,2,3]},
"_halb": {5:[1,2,3,4]},
"_5": {1:[8,9,10,11]},
"_10": {2:[1,2,3,4]},
"_15": {3:[5,6,7,8,9,10,11]},
"_20": {2:[5,6,7,8,9,10,11]},
"_45": {3:[1,2,3,4,5,6,7,8,9,10,11]}
};
var layout = {
"version": 2,
"language": 'Deutsch',
"letters": [
'ESKISTAFÜNF',
'ZEHNZWANZIG',
'DREIVIERTEL',
'VORFUNKNACH',
'HALBAELFÜNF',
'EINSXAMZWEI',
'DREIPMJVIER',
'SECHSNLACHT',
'SIEBENZWÖLF',
'ZEHNEUNKUHR'
],
"permanent": h._es_ist,
"minutes": {
"5,6,7,8,9": [h._5, h._nach],
"10,11,12,13,14": [h._10, h._nach],
"15,16,17,18,19": [h._15, h._nach],
"20,21,22,23,24": [h._20, h._nach],
"25,26,27,28,29": [h._5, h._vor, h._halb],
"30,31,32,33,34": h._halb,
"35,36,37,38,39": [h._5, h._nach, h._halb],
"40,41,42,43,44": [h._20, h._vor],
"45,46,47,48,49": h._45,
"50,51,52,53,54": [h._10, h._vor],
"55,56,57,58,59": [h._5, h._vor]
},
"hours": {
"0,12": {9:[7,8,9,10,11]},
"1,13": {6:[1,2,3,4]},
"2,14": {6:[8,9,10,11]},
"3,15": {7:[1,2,3,4]},
"4,16": {7:[8,9,10,11]},
"5,17": {5:[8,9,10,11]},
"6,18": {8:[1,2,3,4,5]},
"7,19": {9:[1,2,3,4,5,6]},
"8,20": {8:[8,9,10,11]},
"9,21": {10:[4,5,6,7]},
"10,22": {10:[1,2,3,4]},
"11,23": {5:[6,7,8]}
}
};
window,_uhr.register('de', layout);

View file

@ -1,96 +0,0 @@
/*
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 3 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, see <http://www.gnu.org/licenses/>.
*/
// hilfsvariablen
var h = {
"_es_isch": {1:[1,2,4,5,6,7]},
"_ab": {4:[1,2]},
"_vor": {3:[9,10,11]},
"_haubi": {4:[4,5,6,7,8]},
"_5": {1:[9,10,11]},
"_10": {2:[9,10,11]},
"_15": {2:[1,2,3,4,5,6]},
"_20": {3:[1,2,3,4,5,6]}
};
var layout = {
// version: zur Zeit immer 2 (Pflichtattribut)
"version": 2,
// Sprechender Name der Sprache
"language": 'Bärndütsch',
// Buchstabenfeld als Array von Strings.
"letters": [
'ESKISCHAFÜF',
'VIERTUBFZÄÄ',
'ZWÄNZGSIVOR',
'ABOHAUBIEGE',
'EISZWÖISDRÜ',
'VIERIFÜFIQT',
'SÄCHSISIBNI',
'ACHTINÜNIEL',
'ZÄNIERBEUFI',
'ZWÖUFINAUHR'
],
// Permanent aktive Buchstaben. <array-or-object>, vgl. ausführliche Beschreibung bei "minutes".
"permanent": h._es_isch,
/*
* Minuten: Objekt im folgenden Format:
* {
* <minuten>: <array-or-object>,
* ...
* }
* <minuten>: String von Komma-separierten Minutenwerten, zu welchem die in <array-or-object> angegebenen Buchstaben aktiv sein sollen
* <array-or-object> : [ <object>, ...] | <object>
* <object>: { <zeile> : [ <spalte>, ... ] }
* <zeile>: Die Zeile, in welcher die Buchstaben liegen; von oben gezählt, oben ist 1.
* <spalte>: Die Spalte, in der ein einzelner Buchstabe liegt; von links gezählt, links ist 1.
* Beispiel:
* "minutes": {
* "0,1": {1: [6, 7, 9]},
* "5": [ {3: [1, 2]}, {4: [10, 11]} ]
* }
* Erklärung:
* Bei Minuten 0 und 1 sind die Buchstaben 6, 7 und 9 der ersten Zeile aktiv.
* Bei Minute 5 sind die Buchstaben 1 und 2 der Zeile 3 sowie die Buchstaben 10 und 11 der Zeile 4 aktiv.
*/
"minutes": {
"5,6,7,8,9": [h._5, h._ab],
"10,11,12,13,14": [h._10, h._ab],
"15,16,17,18,19": [h._15, h._ab],
"20,21,22,23,24": [h._20, h._ab],
"25,26,27,28,29": [h._5, h._vor, h._haubi],
"30,31,32,33,34": h._haubi,
"35,36,37,38,39": [h._5, h._ab, h._haubi],
"40,41,42,43,44": [h._20, h._vor],
"45,46,47,48,49": [h._15, h._vor],
"50,51,52,53,54": [h._10, h._vor],
"55,56,57,58,59": [h._5, h._vor]
},
// Die Stunden; gleiches Format wie bei den Minuten
"hours": {
"0,12": {10:[1,2,3,4,5,6]},
"1,13": {5:[1,2,3]},
"2,14": {5:[4,5,6,7]},
"3,15": {5:[9,10,11]},
"4,16": {6:[1,2,3,4,5]},
"5,17": {6:[6,7,8,9]},
"6,18": {7:[1,2,3,4,5,6]},
"7,19": {7:[7,8,9,10,11]},
"8,20": {8:[1,2,3,4,5]},
"9,21": {8:[6,7,8,9]},
"10,22": {9:[1,2,3,4]},
"11,23": {9:[8,9,10,11]}
}
};
// Das Layout bei der Uhr unter dem Code "de_CH" registrieren.
window,_uhr.register('de_CH', layout);

View file

@ -1,71 +0,0 @@
/*
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 3 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, see <http://www.gnu.org/licenses/>.
*/
var h = {
"_es_isch": {1:[1,2,4,5,6,7]},
"_genau": {3:[7,8,9,10,11]},
"_ab": {4:[4,5]},
"_vor": {4:[1,2,3]},
"_haubi": {4:[7,8,9,10,11]},
"_5": {1:[9,10,11]},
"_10": {2:[9,10,11]},
"_15": {2:[1,2,3,4,5,6]},
"_20": {3:[1,2,3,4,5,6]}
};
var layout = {
"version": 2,
"language": 'Bärndütsch (genau)',
"letters": [
'ESKISCHAFÜF',
'VIERTUBFZÄÄ',
'ZWÄNZGGENAU',
'VORABOHAUBI',
'EISZWÖISDRÜ',
'VIERIFÜFIQT',
'SÄCHSISIBNI',
'ACHTINÜNIEL',
'ZÄNIERBEUFI',
'ZWÖUFINAUHR'
],
"permanent": h._es_isch,
"minutes": {
"0": h._genau,
"5,6,7,8,9": [h._5, h._ab],
"10,11,12,13,14": [h._10, h._ab],
"15,16,17,18,19": [h._15, h._ab],
"20,21,22,23,24": [h._20, h._ab],
"25,26,27,28,29": [h._5, h._vor, h._haubi],
"30,31,32,33,34": h._haubi,
"35,36,37,38,39": [h._5, h._ab, h._haubi],
"40,41,42,43,44": [h._20, h._vor],
"45,46,47,48,49": [h._15, h._vor],
"50,51,52,53,54": [h._10, h._vor],
"55,56,57,58,59": [h._5, h._vor]
},
"hours": {
"0,12": {10:[1,2,3,4,5,6]},
"1,13": {5:[1,2,3]},
"2,14": {5:[4,5,6,7]},
"3,15": {5:[9,10,11]},
"4,16": {6:[1,2,3,4,5]},
"5,17": {6:[6,7,8,9]},
"6,18": {7:[1,2,3,4,5,6]},
"7,19": {7:[7,8,9,10,11]},
"8,20": {8:[1,2,3,4,5]},
"9,21": {8:[6,7,8,9]},
"10,22": {9:[1,2,3,4]},
"11,23": {9:[8,9,10,11]}
}
};
window,_uhr.register('de_CH_genau', layout);

View file

@ -1,79 +0,0 @@
/*
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 3 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, see <http://www.gnu.org/licenses/>.
*/
var h = {
"_it_is": {1:[1,2,4,5]},
"_half": {4:[1,2,3,4]},
"_to": {4:[10,11]},
"_past": {5:[1,2,3,4]},
"_o_clock": {10:[6,7,8,9,10,11]},
"_5": {3:[7,8,9,10]},
"_10": {4:[6,7,8]},
"_15": {2:[1,3,4,5,6,7,8,9]},
"_20": {3:[1,2,3,4,5,6]},
"_25": {3:[1,2,3,4,5,6,7,8,9,10]}
};
var layout = {
"version": 2,
"language": 'English',
"letters": [
'ITLISBFAMPM',
'ACQUARTERDC',
'TWENTYFIVEX',
'HALFBTENFTO',
'PASTERUNINE',
'ONESIXTHREE',
'FOURFIVETWO',
'EIGHTELEVEN',
'SEVENTWELVE',
'TENSEOCLOCK'
],
"permanent": h._it_is,
"minutes": {
"0,1,2,3,4": h._o_clock,
"5,6,7,8,9": [h._5, h._past],
"10,11,12,13,14": [h._10, h._past],
"15,16,17,18,19": [h._15, h._past],
"20,21,22,23,24": [h._20, h._past],
"25,26,27,28,29": [h._25, h._past],
"30,31,32,33,34": [h._half, h._past],
"35,36,37,38,39": [h._25, h._to],
"40,41,42,43,44": [h._20, h._to],
"45,46,47,48,49": [h._15, h._to],
"50,51,52,53,54": [h._10, h._to],
"55,56,57,58,59": [h._5, h._to]
},
"hours": {
"0,12": {9:[6,7,8,9,10,11]},
"1,13": {6:[1,2,3]},
"2,14": {7:[9,10,11]},
"3,15": {6:[7,8,9,10,11]},
"4,16": {7:[1,2,3,4]},
"5,17": {7:[5,6,7,8]},
"6,18": {6:[4,5,6]},
"7,19": {9:[1,2,3,4,5]},
"8,20": {8:[1,2,3,4,5]},
"9,21": {5:[8,9,10,11]},
"10,22": {10:[1,2,3]},
"11,23": {8:[6,7,8,9,10,11]}
},
"getHour": function(date) {
var hour = date.getHours();
if (date.getMinutes() >= 35) {
return (hour + 1) % 24;
}
return hour;
}
};
window,_uhr.register('en', layout);

View file

@ -1,81 +0,0 @@
/*
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 3 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, see <http://www.gnu.org/licenses/>.
*/
var h = {
"_il_est": {1:[1,2,4,5,6]},
"_et": {8:[1,2]},
"_moins": {7:[1,2,3,4,5]},
"_demie": {10:[4,5,6,7,8]},
"_heures": {6:[6,7,8,9,10,11]},
"_le": {7:[7,8]},
"_5": {9:[7,8,9,10]},
"_10": {7:[9,10,11]},
"_15": {8:[4,5,6,7,8]},
"_20": {9:[1,2,3,4,5]},
"_25": {9:[1,2,3,4,5,6,7,8,9,10]}
};
var layout = {
"version": 2,
"language": 'Français',
"letters": [
'ILNESTODEUX',
'QUATRETROIS',
'NEUFUNESEPT',
'HUITSIXCINQ',
'MIDIXMINUIT',
'ONZERHEURES',
'MOINSOLEDIX',
'ETRQUARTPMD',
'VINGT-CINQU',
'ETSDEMIEPAM'
],
"permanent": h._il_est,
"minutes": {
"5,6,7,8,9": h._5,
"10,11,12,13,14": h._10,
"15,16,17,18,19": [h._et, h._15],
"20,21,22,23,24": h._20,
"25,26,27,28,29": h._25,
"30,31,32,33,34": [h._et, h._demie],
"35,36,37,38,39": [h._moins, h._25],
"40,41,42,43,44": [h._moins, h._20],
"45,46,47,48,49": [h._moins, h._le, h._15],
"50,51,52,53,54": [h._moins, h._10],
"55,56,57,58,59": [h._moins, h._5]
},
"hours": {
"0": {5:[6,7,8,9,10,11]},
"1,13": [{3:[5,6,7]}, h._heures],
"2,14": [{1:[8,9,10,11]}, h._heures],
"3,15": [{2:[7,8,9,10,11]}, h._heures],
"4,16": [{2:[1,2,3,4,5,6]}, h._heures],
"5,17": [{4:[8,9,10,11]}, h._heures],
"6,18": [{4:[5,6,7]}, h._heures],
"7,19": [{3:[8,9,10,11]}, h._heures],
"8,20": [{4:[1,2,3,4]}, h._heures],
"9,21": [{3:[1,2,3,4]}, h._heures],
"10,22": [{5:[3,4,5]}, h._heures],
"11,23": [{6:[1,2,3,4]}, h._heures],
"12": {5:[1,2,3,4]}
},
"getHour": function(date) {
var hour = date.getHours();
if (date.getMinutes() >= 35) {
return (hour + 1) % 24;
}
return hour;
}
};
window,_uhr.register('fr', layout);

View file

@ -1,78 +0,0 @@
/*
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 3 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, see <http://www.gnu.org/licenses/>.
*/
var h = {
"_sono_le": {1:[1,2,3,4,6,7]},
"_e_l": {2:[1,3,4]},
"_e": {8:[1]},
"_meno": {7:[8,9,10,11]},
"_mezza": {10:[7,8,9,10,11]},
"_5": {9:[6,7,8,9,10,11]},
"_10": {10:[1,2,3,4,5]},
"_un_quarto": {8:[3,4,6,7,8,9,10,11]},
"_20": {9:[1,2,3,4,5]},
"_25": {9:[1,2,3,4,5,6,7,8,9,10,11]}
};
var layout = {
"version": 2,
"language": 'Italiano',
"letters": [
'SONORLEBORE',
'ÈRL\'UNASDUE',
'TREOTTONOVE',
'DIECIUNDICI',
'DODICISETTE',
'QUATTROCSEI',
'CINQUEAMENO',
'ECUNOQUARTO',
'VENTICINQUE',
'DIECIPMEZZA'
],
"permanent": [],
"minutes": {
"5,6,7,8,9": [h._e, h._5],
"10,11,12,13,14": [h._e, h._10],
"15,16,17,18,19": [h._e, h._un_quarto],
"20,21,22,23,24": [h._e, h._20],
"25,26,27,28,29": [h._e, h._25],
"30,31,32,33,34": [h._e, h._mezza],
"35,36,37,38,39": [h._meno, h._25],
"40,41,42,43,44": [h._meno, h._20],
"45,46,47,48,49": [h._meno, h._un_quarto],
"50,51,52,53,54": [h._meno, h._10],
"55,56,57,58,59": [h._meno, h._5]
},
"hours": {
"0,12": [h._sono_le, {5:[1,2,3,4,5,6]}],
"1,13": [h._e_l, {2:[5,6,7]}],
"2,14": [h._sono_le, {2:[9,10,11]}],
"3,15": [h._sono_le, {3:[1,2,3]}],
"4,16": [h._sono_le, {6:[1,2,3,4,5,6,7]}],
"5,17": [h._sono_le, {7:[1,2,3,4,5,6]}],
"6,18": [h._sono_le, {6:[9,10,11]}],
"7,19": [h._sono_le, {5:[7,8,9,10,11]}],
"8,20": [h._sono_le, {3:[4,5,6,7]}],
"9,21": [h._sono_le, {3:[8,9,10,11]}],
"10,22": [h._sono_le, {4:[1,2,3,4,5]}],
"11,23": [h._sono_le, {4:[6,7,8,9,10,11]}]
},
"getHour": function(date) {
var hour = date.getHours();
if (date.getMinutes() >= 35) {
return (hour + 1) % 24;
}
return hour;
}
};
window,_uhr.register('it', layout);