From c46f2dd8e7b6c987e04219f84f34f0e59d8c9609 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Sat, 16 Jun 2012 02:22:44 +0200 Subject: [PATCH] Farbwechsler im Firefox! --- html/force.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/html/force.js b/html/force.js index f5dbf0f..a8a975b 100644 --- a/html/force.js +++ b/html/force.js @@ -1,3 +1,5 @@ +var style; + function switch_style(s) { var el = document.getElementsByTagName("link") for (var i = 0; i < el.length; i++ ) { @@ -29,12 +31,15 @@ var w = window.innerWidth - offset.left, h = window.innerHeight - offset.top - 1 function next_style() { - var s = d3.select("head link[title]:not([disabled]) * link[title]") + var s; + if (style !== undefined) + s = d3.select("head link[title=" + style + "] + link") - if (s[0][0] == null) - s = d3.select("head link[title][disabled]") + if (s == null || s[0][0] == null) + s = d3.select("head link[title]") - switch_style(s[0][0].getAttribute("title")) + style = s[0][0].getAttribute("title") + switch_style(style) } var cp = d3.select("header").append("div")