added script which should convert normal links into javascript links

This commit is contained in:
Manuel Friedli 2014-07-02 19:21:50 +02:00
parent 340669c5eb
commit e316557ac8
2 changed files with 109 additions and 0 deletions

View File

@ -29,6 +29,25 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<script type="text/javascript" src="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="uhr.js"></script>
<script type="text/javascript">
(function(doc, nav, standalone) {
if ((standalone in nav) && nav[standalone]) {
var curnode;
var loc = doc.location;
var stop = /^(a|html)$/i;
doc.addEventListener('click', function(e) {
curnode = e.target;
while (!(stop).test(curnode.nodeName)) {
curnode = curnode.parentNode;
}
if ('href' in curnode && (curnode.href.indexOf('http') || ~curnode.href.indexOf(location.host)) {
e.preventDefault();
location.href=curnode.href;
}
}, false);
}
}(document, window.navigator, 'standalone'));
</script>
</head>
<body style="padding:0;margin:0;">
<div id="uhr"></div>

90
test.html Normal file
View File

@ -0,0 +1,90 @@
<!DOCTYPE html>
<!--
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/>.
-->
<html>
<head>
<title>Bärneruhr - TEST</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="apple-mobile-web-app-title" content="Bärneruhr" />
<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="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="uhr-red.css" data-class="red" data-name="Rot" />
<link rel="stylesheet" type="text/css" href="uhr-yellow.css" data-class="yellow" data-name="Gelb" />
<link rel="stylesheet" type="text/css" href="uhr-green.css" data-class="green" data-name="Grün" />
<link rel="stylesheet" type="text/css" href="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="shortcut icon" type="image/png" href="favicon.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="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="uhr.js"></script>
</head>
<body style="padding:0;margin:0;">
<div id="testuhr"></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>
<script type="text/javascript" src="uhr-de_CH.js"></script>
<script type="text/javascript" src="uhr-de_CH_genau.js"></script>
<script type="text/javascript" src="uhr-de.js"></script>
<script type="text/javascript" src="uhr-en.js"></script>
<script type="text/javascript" src="uhr-fr.js"></script>
<script type="text/javascript" src="uhr-it.js"></script>
<script type="text/javascript">
(function($) {
$('#testuhr').uhr({
width: '200px',
color: 'black',
language: 'it',
force: true,
controls: true
});
})(jQuery);
var intervall = 1000;
var hours = 1000;
if (intervall > 0) {
var h = 0;
var m = 0;
var timer = window.setInterval(function(){
var date = new Date(0,0,0,h,m);
$('#testuhr').uhr('time', date);
m++;
if (m >= 60) {
m = 0;
h++;
}
if (h >= 24) {
h = 0;
}
}, intervall);
}
if (hours > 0 && intervall == 0) {
var h = 0;
var m = 0;
var timer = window.setInterval(function() {
var date = new Date(0,0,0,h,m);
$('#testuhr').uhr('time', date);
h++;
if (h >= 24) {
h = 0;
}
}, hours);
}
</script>
</body>
</html>