From 38df0a87c9b52b5348ad7fed2026e4a833d8d2c3 Mon Sep 17 00:00:00 2001 From: Manuel Friedli Date: Sat, 28 Jun 2014 02:00:34 +0200 Subject: [PATCH] integrate detection in main file --- index.html | 1 - uhr.js | 8 ++++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 6f42614..3a09367 100644 --- a/index.html +++ b/index.html @@ -27,7 +27,6 @@ along with this program. If not, see . - diff --git a/uhr.js b/uhr.js index 325cbc8..a2f3110 100644 --- a/uhr.js +++ b/uhr.js @@ -24,6 +24,14 @@ along with this program. If not, see . 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%',