Skip to content

Instantly share code, notes, and snippets.

@gforcada
Created April 26, 2015 19:51
Show Gist options
  • Save gforcada/31555f15d7b04a3ede04 to your computer and use it in GitHub Desktop.
Save gforcada/31555f15d7b04a3ede04 to your computer and use it in GitHub Desktop.
Easily close dev.plone.org tickets as invalid with greasemonkey
// ==UserScript==
// @name dev.plone.org close bug as invalid
// @namespace plone
// @include https://dev.plone.org/ticket/*
// @version 1
// @grant none
// @run-at document-end
// ==/UserScript==
$(document).ready(function () {
var status, status_text, button;
status = document.getElementsByClassName("status")[0];
status_text = status.childNodes[0].nodeValue;
if (status_text.search("invalid") === -1) {
// open the 'modify ticket form'
document.getElementById("no2").click();
// mark as resolved
document.getElementById("action_resolve").checked = true;
document.getElementById("action_resolve").click();
// mark as invalid
document.getElementById("action_resolve_resolve_resolution").selectedIndex = "2";
// ask for confirmation
if (confirm('Close as invalid?')) {
button = document.getElementsByName("submit")[0];
button.click();
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment