Skip to content

Instantly share code, notes, and snippets.

@houtianze
Last active August 7, 2017 06:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save houtianze/ee2cf2f4d022911566a09e77bcfc9233 to your computer and use it in GitHub Desktop.
Save houtianze/ee2cf2f4d022911566a09e77bcfc9233 to your computer and use it in GitHub Desktop.
GreaseMonkey IBM WSVT Forking Script
// ==UserScript==
// @name Fork 18m WSVT
// @namespace 18m
// @description Just fork it
// @updateURL https://gist.github.com/houtianze/ee2cf2f4d022911566a09e77bcfc9233/raw
// @version 0.1.1
// @grant none
// @include http*://*.ibm.com/WSVTASEAN/*IsamDetails.action
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js
// ==/UserScript==
'use strict';
var ajexWaitMs = 2000;
function setAllLicCatAndComment() {
$('select[id^=pendingIisamDetailList][id$=natureSK]').each(function(index, element) {
$(this).val('27').change();
});
$('input[id=comment]').each(function(index, element) {
$(this).val('Development tools or utilities');
});
alert('You can begin forking.');
}
function fillLicCatCbx(index) {
//var js = "javascript:getPurposeDropdown(" + index + "); void 0";
//location.href = js;
getPurposeDropdown(index);
}
function fillCurrentPage() {
var banner = `
<div id="status" style="color: red; font-weight: bold; font-size: 200%">Forking, please wait ...</div>
`;
$('#ibm-masthead').after(banner);
var totalCbx = 0;
$('select[id^=pendingIisamDetailList][id$=licenceSK]').each(function(index, element) {
//element.val('4');
$(this).val('4').change();
// http://stackoverflow.com/a/13333988/404271
//getPurposeDropdown(index);
setTimeout(function() {fillLicCatCbx(index)}, index * ajexWaitMs);
totalCbx = index + 1;
});
if (totalCbx) {
setTimeout(setAllLicCatAndComment, totalCbx * ajexWaitMs);
} else {
$("#status").text("Nothing to fork.");
}
}
$(document).ready(fillCurrentPage);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment