Skip to content

Instantly share code, notes, and snippets.

@jrgifford
Forked from rlemon/seabandoned.user.js
Created January 25, 2012 18:22
Show Gist options
  • Save jrgifford/1677724 to your computer and use it in GitHub Desktop.
Save jrgifford/1677724 to your computer and use it in GitHub Desktop.
abandoned user script
// ==UserScript==
// @name LookAtMeImADuplicate
// @author rlemon, jamesgifford
// @version 0.1
// @namespace rlemon.com
// @description Flag SE Questions as Duplicates
// @include http://*stackoverflow.com/*
// @include http://*superuser.com/*
// @include http://*serverfault.com/*
// @include http://*askubuntu.com/*
// @include http://*stackapps.com/*
// @include http://*.stackexchange.com/*
// @include http://answers.onstartups.com/*
// ==/UserScript==
function EmbedCodeOnPage(kode) {
var elm = document.createElement('script');
elm.textContent = kode;
document.head.appendChild(elm);
}
function EmbedFunctionOnPageAndExecute(fn) {
EmbedCodeOnPage("(" + fn.toString() + ")()");
}
EmbedFunctionOnPageAndExecute(function() {
$(document).on('ajaxComplete', function() {
var new_option_link = $('<a>', {
'text': 'I\'m a Duplicate!',
'click': function() {
$('.action-subform.mod-attention-subform textarea').val('Duplicate!');
$('.action-subform.mod-attention-subform input[name=prefilled]').trigger('click');
}
}),
new_option = $('<li>');
new_option.append(new_option_link);
$('.action-subform.mod-attention-subform ul').append(new_option);
});
});
EmbedFunctionOnPageAndExecute(function() {
$(document).on('ajaxComplete', function() {
var new_option_link = $('<a>', {
'text': 'I\'m a Abandoned!',
'click': function() {
$('.action-subform.mod-attention-subform textarea').val('Abandoned!');
$('.action-subform.mod-attention-subform input[name=prefilled]').trigger('click');
}
}),
new_option = $('<li>');
new_option.append(new_option_link);
$('.action-subform.mod-attention-subform ul').append(new_option);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment