github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

benstein / fluid-dock-badge-for-tumblr

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 3
    • 0
  • Source
  • Commits
  • Network (0)
  • Issues (0)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Display a Fluid dock badge for the Tumblr Dashboard with the number of new posts — Read more

  cancel

http://benjaminste.in/post/45434560/fluid-dock-badges-for-tumblr-dashboard

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

update readme 
benstein (author)
Sat Jan 17 10:10:38 -0800 2009
commit  04aa4d1970f10452a5b96d7c41ed77bb98554e45
tree    13eb0d50852b5770487e5514ed86992bb9e5ddf8
parent  570f1874341368d23c8f407f61712e7904800726
fluid-dock-badge-for-tumblr / fluid_dock_badge_for_tumblr.js fluid_dock_badge_for_tumblr.js
100644 44 lines (39 sloc) 1.143 kb
edit raw blame history
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// ==UserScript==
// @name Fluid Dock Badge for Tumblr
// @namespace http://fluidapp.com
// @description Display a dock badge for the Tumblr Dashboard with the number of new posts (works with Tumblr v5)
// @include *.tumblr.com/dashboard
// @author Benjamin Stein
// ==/UserScript==
if (!window.fluid) {
return;
}
 
try {
doBadgeUpdates(60000);
} catch(e) {
window.console.log(e);
}
 
/****************
This is the HTML from the Dashboard we need to parse
<div id="new_post_notice_container">
<a class="new_post_notice" title="3 new posts" href="/dashboard">
3
<img alt="" src="/images/new_post_alert_arrow.png"/>
</a>
</div>
*************/
 
function doBadgeUpdates(timeout) {
//just regex for a digit. easy!
updateBadge("new_post_notice_container", /(\d+)/);
setTimeout(doBadgeUpdates, timeout);
}
 
function updateBadge(id, new_post_regex) {
notice_divs = document.getElementById(id).getElementsByTagName('a');
if (notice_divs.length > 0) {
new_post_html = notice_divs[0].innerHTML;
count = new_post_regex.exec(new_post_html)[0];
window.fluid.dockBadge = count;
} else {
window.fluid.dockBadge = "";
}
}
 
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server