Last active
August 7, 2017 06:15
-
-
Save houtianze/ee2cf2f4d022911566a09e77bcfc9233 to your computer and use it in GitHub Desktop.
GreaseMonkey IBM WSVT Forking Script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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