labs.bartheq.com

chrome extensions & jQuery stuff (;

scroll tab title
for easy reading of long page titles
REALLY fast way of showing/hiding large numbers of elements using jQuery

works on all browsers and can be modified for other style changes.

$.fn.extend({
 mytoggle: function (selector) {
  ($('#'+(id = selector.replace(/[^a-z0-9]/g,'_'))).size() > 0)
   ? $('#'+id).remove()
   : $('<style type="text/css" id="'+id+'">'+selector+' { display: none !important; }</style>')
      .appendTo('head');
 }
});

$().mytoggle('.firstclass,.secondclass,...');

test it here.

compact footer for gmail
smaller and better footer. no javascript = less memory used.
hide chat & invites for gmail
get rid of chat and invite boxes in gmail. no javascript.
sidebar cleanup for gmail
get rid of mail/contacts/tasks and compose button. no javascript.
quick jQuery "onenter" and "onescape" events

useful for inline content editing or other similar stuff.

$.fn.extend({
 enter:function (callback) {
  return $(this).keydown(function(e){
   if (e.keyCode == 13) {
    e.preventDefault();
    callback($(this));
   }
  });
 },
 escape: function (callback) {
  return $(this).keydown(function(e){
   if (e.keyCode == 27) {
    e.preventDefault();
    callback($(this));
   }
  });
 }
});

$('input').enter(function(o){// do sth with o.val();}).escape(function(o){// do sth with o.val();});

test here:

webkit focus/select bug

fix for value losing selection on focus in chrome/safari.

$.fn.extend({
 myselect: function () {
  return $(this).mouseup(function(e){
   e.preventDefault();
  }).focus(function(){
   $(this).select();
  });
 }
});

$('input').focus(function(){$(this).select()}); // bad
$('input').myselect(); // good

bad: doesn't work on chrome & safari

good: works everywhere (:

got questions? need an extension?
labs@bartheq.com