Skip to content

Instantly share code, notes, and snippets.

@fearphage
Created December 9, 2009 17:25
Show Gist options
  • Select an option

  • Save fearphage/252612 to your computer and use it in GitHub Desktop.

Select an option

Save fearphage/252612 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name lighthouse: Edit your comments
// @description Adds ability to edit your own ticket comments.
// @include https://*.lighthouseapp.com/projects/*/tickets/*
//
// Mouseover the comment and an edit button will appear to the
// top-right of the comment.
// ==/UserScript==
(function(global, form) {
form = document.forms &&
form.length > 1 &&
(form = form[2].action) &&
global.$$('ul.info .tticket').each(function(element, i) {
var version, match = element.readAttribute('id').match(/-\d+-(\d+)$/);
if (match && !element.hasClassName('attachment')) {
version = match[1];
element
.insert("<a href='" + form + "/versions/" + version + "' class='edit' style='display:none'>edit</a>")
.observe('mouseover', function() {
element.down('.edit').show();
})
.observe('mouseout', function() {
element.down('.edit').hide();
});
}
});
})(this.unsafeWindow || this);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment