Skip to content

Instantly share code, notes, and snippets.

@xbalaji
Last active September 14, 2016 23:25
Show Gist options
  • Save xbalaji/ca4c2eaaa4721242e0cbb03923e7a02b to your computer and use it in GitHub Desktop.
Save xbalaji/ca4c2eaaa4721242e0cbb03923e7a02b to your computer and use it in GitHub Desktop.
(function() {
q=window.getSelection().toString().replace(/[^0-9]/g,%20'');
if (!q) {
q=prompt('Enter%20Bugid:')
}
if (q) {
window.open('https://bugs.XYZCompany.com/show_bug.cgi?id='+escape(q))
} else {
window.open('http://bugs.XYZCompany.com')
}
})()
You can create a bookmark with the following URI, this when opened, will prompt if there is no selection in the page
javascript:(function(){q=window.getSelection().toString().replace(/[^0-9]/g,%20'');if(!q){q=prompt('Enter%20Bugid:')}if(q){window.open('https://bugs.XYZCompany.com/show_bug.cgi?id='+escape(q))}else{window.open('http://bugs.XYZCompany.com')}})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment