integrate detection in main file

This commit is contained in:
Manuel Friedli 2014-06-28 02:00:34 +02:00
parent 09a53b0883
commit 38df0a87c9
2 changed files with 8 additions and 1 deletions

View file

@ -27,7 +27,6 @@ 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" src="detector.js"></script>
<link rel="shortcut icon" type="image/png" href="favicon.png" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link rel="apple-touch-icon-precomposed" href="apple-touch-icon-precomposed.png" />

8
uhr.js
View file

@ -24,6 +24,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
languages: [],
themes: []
};
// auto-detect themes
var uhrCSSs = $('head link[rel=stylesheet][href^=uhr-]');
var matcher = /^(.*)uhr-(.+).css$/;
for (var i = 0; i < uhrCSSs.length; i++) {
var name = $(uhrCSSs[i]).attr('href');
var code = name.match(matcher)[2];
window._uhr.themes.push(code);
}
$.widget("fritteli.uhr", {
options: {
width: '100%',