Skip to content

Instantly share code, notes, and snippets.

@pose
Created July 10, 2011 20:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pose/1074918 to your computer and use it in GitHub Desktop.
Save pose/1074918 to your computer and use it in GitHub Desktop.
Monedero Userscript
// ==UserScript==
// @name Monedero Fix
// @namespace monederoFix
// @include *
// @match http://*.monedero.com.ar/*
// @author pose
// @description This userscript is meant to fix monedero.com.ar to work with on Google Chrome.
// ==/UserScript==
/**
* Monedero Fix
* ------------
*
* A translation into Javascript of the VBScript code in monedero.com.ar in
* order to check credit and transactions using Firefox or Google Chrome.
*/
// Load jquery
function addJQuery(callback) {
var script = document.createElement("script");
script.setAttribute("src", "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js");
script.addEventListener('load', function() {
var script = document.createElement("script");
script.textContent = "(" + callback.toString() + ")();";
document.body.appendChild(script);
}, false);
document.body.appendChild(script);
}
// the guts of this userscript
function main() {
// the Encrypt function that is missing in Javascript
Encrypt = function (theNumber) {
var n, szEnc, t, HiN, LoN, i;
n = (Number(theNumber) + 1570) * 4;
szEnc = n < 0 ? 'R' : 'J';
n = String(Math.abs(n));
for ( i = 0; i < n.length; i+= 2) {
t = n.substr(i,2);
if ( t.length === 1 ) {
szEnc = szEnc + String(t);
break;
}
HiN = (Number(t) & 240) / 16;
LoN = (Number(t) & 15);
szEnc = szEnc + String.fromCharCode("M".charCodeAt(0) + HiN) +
String.fromCharCode("C".charCodeAt(0) + LoN);
}
return szEnc;
}
// Fixes issues with "ctl00_ContentPlaceHolder1_strDetalleDeSaldo"
// selector
VerDetalle = function(IdCuenta, NroSerie, Cardcode, ListaNegra, CatCta, NroMonedero) {
var viewstate = theForm.__VIEWSTATE.value;
theForm.__VIEWSTATE.value = "";
var action = theForm.action;
theForm.strIdCuenta.value = IdCuenta;
theForm.strNroSerie.value = Encrypt(NroSerie);
theForm.strCardCode.value = Cardcode;
theForm.strLNegra.value = ListaNegra;
theForm.strCatCta.value = CatCta;
theForm.strPrintN.value = NroMonedero;
theForm.strPagina.value = "MiCuenta";
theForm.action = document.getElementById("ctl00_ContentPlaceHolder1_strDetalleDeSaldo").value ;
//theForm.target = "_blank";
theForm.submit();
theForm.__VIEWSTATE.value = viewstate;
theForm.action = action;
}
$('.Boton01').each(function(i,e) {
var oldEvent = e.onclick;
e.onclick = function() {
oldEvent();
}
});
}
// load jQuery and execute the main function
addJQuery(main);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment