Created
April 23, 2015 16:53
-
-
Save takuya/90c7548537872ed29e3a to your computer and use it in GitHub Desktop.
This file contains 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 SBI 銀行の乱数表を自動的に入力する。 | |
// @author takuya_1st ( twitter: @tauya_1st ) | |
// @license GPLv3 | |
// @copyright takuya_1st | |
// @update 2015-04-24 | |
// ==/UserScript== | |
*/ | |
data={ | |
"1":{"A":"99", "B":"99", "C":"99", "D":"99", "E":"99", "F":"99"},/*ここ乱数表から拾う*/ | |
"2":{"A":"99", "B":"99", "C":"99", "D":"99", "E":"99", "F":"99"},/*ここ乱数表から拾う*/ | |
"3":{"A":"99", "B":"99", "C":"99", "D":"99", "E":"99", "F":"99"},/*ここ乱数表から拾う*/ | |
"4":{"A":"99", "B":"99", "C":"99", "D":"99", "E":"99", "F":"99"},/*ここ乱数表から拾う*/ | |
} | |
/*XPATH evaluateの簡略化*/ | |
document.xpath = function(expression) { | |
ret = document.evaluate(expression,document,null,XPathResult.ANY_TYPE,null); | |
switch(ret.resultType){ | |
case 1: return ret.numberValue; | |
case 2: return ret.stringValue; | |
case 3: return ret.booleanValue; | |
case 4: | |
case 5: | |
a=[]; | |
while(e=ret.iterateNext()){a.push(e);}; | |
if(a.length==1){return a[0];}else{return a} | |
default: return ret; | |
} | |
} | |
b = document.xpath("//form[.//th[@class='f01th01p'] and .//div[contains(./text(),'第3認証方法')]]//div[@class='floatClear']") | |
b = b.textContent.split("\n").filter(function(e){ return e}) | |
b = b.map(function(e){ | |
e=e.replace(/A/g,"A"); | |
e=e.replace(/B/g,"B"); | |
e=e.replace(/C/g,"C"); | |
e=e.replace(/D/g,"D"); | |
e=e.replace(/E/g,"E"); | |
e=e.replace(/F/g,"F"); | |
return e; | |
}) | |
b = b.map(function(e){ if(ret = e.match(/[A-F]-[1-4]/)){return ret[0]} }) | |
b = b.map(function(e){ return e.split(/-/) }) | |
b = b.map(function(e){ return data[e[1]][e[0]] }) | |
inputs = document.xpath("//form[.//th[@class='f01th01p'] and .//div[contains(./text(),'第3認証方法')]]//div[@class='floatClear']//input") | |
inputs.forEach(function(e,idx){e.value=b[idx];}) | |
inputs[0].form.submit(); | |
/* | |
This program is free software: you can redistribute it and/or modify | |
it under the terms of the GNU General Public License as published by | |
the Free Software Foundation, either version 3 of the License, or | |
(at your option) any later version. | |
This program is distributed in the hope that it will be useful, | |
but WITHOUT ANY WARRANTY; without even the implied warranty of | |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
GNU General Public License for more details. | |
You should have received a copy of the GNU General Public License | |
along with this program. If not, see <http://www.gnu.org/licenses/>. | |
*/ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment