Skip to content

Instantly share code, notes, and snippets.

@dheerosaur
Created December 12, 2011 07:54
Show Gist options
  • Save dheerosaur/1465764 to your computer and use it in GitHub Desktop.
Save dheerosaur/1465764 to your computer and use it in GitHub Desktop.
Hiding stuff, go directly to "My active tickets" in unfuddle
// Reusable extension for jQuery so that we can hide jQuery objects
// and hide them. We will show an arrow at the top-right corner which
// will toggle the display of these.
// Examples:
//
// For github.com.js:
// $("#header").toggleStuff();
//
// Some random site:
// $("#report_attachment").parent().next().toggleStuff()
(function ($) {
$.fn.toggleStuff = function () {
var $this = $(this);
// CSS
var anchorCss = {
'position': 'fixed',
'top': '30px',
'right': '10px',
'z-index': '999',
'font-size': '30px',
'font-weight': 'bold',
'text-decoration': 'none',
};
var anchor = $('<a>')
.text('▼')
.css(anchorCss)
.addClass("dotjsToggler")
.prependTo("body");
var upUp = function () {
$this.slideUp();
anchor.text('▼')
}
var downDown = function () {
$this.slideDown();
anchor.text('▲')
}
anchor.toggle(upUp, downDown).click();
}
})(jQuery);
jQuery(function (){
var hash = document.location.hash;
function setHash(s) {
hash = document.location.hash = s;
}
if (hash.search('/projects/1') === -1) {
// hash may vary
setHash('#/projects/1');
}
if (hash === '#/projects/1') {
// hash may vary
setHash('#/projects/1/ticket_reports/10');
}
// Unfuddle fetches content through Ajax. You may want to
// increase the timeout if your connection is slower.
setTimeout(function () {
$("#header").toggleStuff();
}, 1000);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment