find all stylesheets, not only those defined in the head.

This commit is contained in:
Manuel Friedli 2014-06-28 23:12:20 +02:00
parent 0461411c6a
commit bd3fb48b0d
2 changed files with 91 additions and 1 deletions

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>

2
uhr.js
View file

@ -35,7 +35,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
} }
}; };
// auto-detect themes // auto-detect themes
var styleSheets = $('head link[rel=stylesheet]'); var styleSheets = $('link[rel=stylesheet]');
for (var i = 0; i < styleSheets.length; i++) { for (var i = 0; i < styleSheets.length; i++) {
var styleSheet = $(styleSheets[i]); var styleSheet = $(styleSheets[i]);
var styleClass = styleSheet.attr('data-class'); var styleClass = styleSheet.attr('data-class');