Skip to content

Instantly share code, notes, and snippets.

@uda
Created November 2, 2014 12:09
Show Gist options
  • Save uda/0071eca1edad59c62eee to your computer and use it in GitHub Desktop.
Save uda/0071eca1edad59c62eee to your computer and use it in GitHub Desktop.
Page through the knesset law proposals and accepted amendments with modern browsers
// ==UserScript==
// @name OpenLaw - Knesset version
// @namespace http://www.knesset.gov.il/
// @version 0.2
// @description Make the forms on knesset.gov.il work w/o M$ products
// @match http://www.knesset.gov.il/laws/heb/template.asp*
// @match http://knesset.gov.il/laws/heb/template.asp*
// @author uda
// @license MIT; http://opensource.org/licenses/MIT
// @copyright 2014, Yehuda Deutsch (http://0x59.net/)
// @run-at document-body
// ==/UserScript==
// ==UserScript==
// @name OpenLaw - Knesset version
// @namespace http://www.knesset.gov.il/
// @version 0.2
// @description Make the forms on knesset.gov.il work w/o M$ products
// @match http://www.knesset.gov.il/laws/heb/template.asp*
// @match http://knesset.gov.il/laws/heb/template.asp*
// @author uda
// @license MIT; http://opensource.org/licenses/MIT
// @copyright 2014, Yehuda Deutsch (http://0x59.net/)
// @run-at document-body
// ==/UserScript==
var usw = (typeof this.unsafeWindow !== 'undefined') ? this.unsafeWindow : window;
var getElementByName = function(name) {
return document.getElementsByName(name).length ? document.getElementsByName(name)[0] : {value:''};
};
var FromNumber = getElementByName('FmNum');
var ToNumber = getElementByName('ToNum');
var FindWord = getElementByName('FndWord');
var oldSndSelf = usw.SndSelf;
usw.SndSelf = function(first, start) {
var url = 'http://www.knesset.gov.il/laws/heb/template.asp?';
url += 'Type=' + document.frmSelf.Type.value;
if (first !== undefined) {
url += '&First=' + first;
}
if (start !== undefined) {
url += '&Start=' + start;
}
if (FromNumber.value) {
url += '&FmNum=' + FromNumber.value;
}
if (ToNumber.value) {
url += '&ToNum=' + ToNumber.value;
}
if (FindWord.value) {
url += '&FndWord=' + FindWord.value;
}
window.location.href = url;
};
var SubmitSelf = function(event) {
if (event.keyCode == 13) SndSelf();
};
FromNumber.onkeypress = SubmitSelf;
ToNumber.onkeypress = SubmitSelf;
FindWord.onkeypress = SubmitSelf;
var oldSndFileD = usw.SndFileD;
usw.SndFileD = function(nID, nSubID) {
document.frmFileD.action = 'OneResDoc.asp';
oldSndFileD(nID, nSubID);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment