Skip to content

Instantly share code, notes, and snippets.

@fearphage
Created August 4, 2009 20:10
Show Gist options
  • Select an option

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

Select an option

Save fearphage/161491 to your computer and use it in GitHub Desktop.
// Bookmaklet below
javascript:(function(d) {var mysqlID = d.cookie.match(/(?:^|\s)bugtraq:uniqueID=([^;]+)/) && RegExp.$1, elem = d.selectSingleNode('//a[starts-with(@href, "mailto:") and contains(@href, "@bugs.opera.com")]'), bugID = elem && elem.href && elem.href.match(/mailto:([^@]+)@/) && RegExp.$1 || '?', closing = '\n\nThank you,\n\nBugtraq Staff'; if (mysqlID && bugID) { d.body.appendChild(d.createElement('script')).src = 'http://opera.remcol.ath.cx/bugs/userjs.php?mysqlid=' + mysqlID + '&bugid=' + bugID; alert('Your bug has been traqed.' + closing); } else { alert('There was a problem logging your bug to the public database. Please report the failure here:\n\nhttp://my.opera.com/community/forums/topic.dml?id=217364\n\nPlease include the following details:\n\n* bug title\n' + (mysqlID ? '* internal ID: ' + mysqlId + '\n' : '') + '* external ID: ' + bugID + closing); }})(this.document);
// This is what the code looks like prettified
(function(d) {
var mysqlID = d.cookie.match(/(?:^|\s)bugtraq:uniqueID=([^;]+)/) && RegExp.$1
,elem = d.selectSingleNode('//a[starts-with(@href, "mailto:") and contains(@href, "@bugs.opera.com")]')
,bugID = elem && elem.href && elem.href.match(/mailto:([^@]+)@/) && RegExp.$1 || '?'
,closing = '\n\nThank you,\n\nBugtraq Staff';
if (mysqlID && bugID) {
d.body.appendChild(d.createElement('script')).src = 'http://opera.remcol.ath.cx/bugs/userjs.php?mysqlid=' + mysqlID + '&bugid=' + bugID;
alert('Your bug has been traqed.' + closing);
}
else {
alert('\
There was a problem logging your bug to the public database. \
Please report the failure here:\n\nhttp://my.opera.com/community/forums/topic.dml?id=217364\n\n\
Please include the following details:\n\n\
* bug title\n' +
(mysqlID ? '* internal ID: ' + mysqlId + '\n' : '') +
'* external ID: ' + bugID + closing);
}
})(this.document)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment