Permalink
Browse files

Initial commit

  • Loading branch information...
0 parents commit ca5eb00dbee5a2eac809ce0ead30486b067aa78b myfreeweb committed Jun 14, 2010
Showing with 42 additions and 0 deletions.
  1. +42 −0 jquery.dockbadger.js
@@ -0,0 +1,42 @@
+/*
+ DockBadger.
+ Requires jQuery (tested on 1.4.1, but no new features used).
+
+ Copyright 2010 MyFreeWeb
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+(function($){
+ $.dockBadger = {
+ init: function() {
+ window.original_title = document.title;
+ return $.dockBadger;
+ },
+ set: function(number) {
+ if (number == 0) {
+ number = '';
+ document.title = window.original_title;
+ }
+ else {
+ if (typeof(window.fluid) != 'undefined') {
+ window.fluid.dockBadge = number;
+ }
+ else if (typeof(window.platform.icon) != 'undefined') {
+ window.platform.icon().badgeText = number;
+ }
+ else {
+ document.title = '(' + number + ') ' + window.orig_title;
+ }
+ }
+ }
+})(jQuery);

0 comments on commit ca5eb00

Please sign in to comment.