JS-Inject icon indicating copy to clipboard operation
JS-Inject copied to clipboard

Userscript for MinuteDock Fluid apps

Open foca opened this issue 12 years ago • 0 comments

This works as a user-script to inject the MinuteDock script into a Fluid app, and also shows a dock badge when you need to work more time :)

var script = document.createElement("script");
script.src = "https://github.com/DrummerHead/JS-Inject/raw/master/examples/minutedock.js";
document.body.appendChild(script);

function checkTimeProgress() {
  var requiresAttention = false;

  $$(".mini_goal").each(function(goal) {
    var progress = goal.select(".progress_bar .progress").map(function(bar) {
      return parseFloat(bar.getStyle("width"));
    });
    if (progress.length > 1) {
      requiresAttention = requiresAttention || (progress[1] > progress[0]);
    }
  });

  window.fluid.dockBadge = requiresAttention ? "!" : "";
}

setInterval(checkTimeProgress, 5000);

foca avatar Jun 28 '12 23:06 foca