From 806d9100311c20ba414b05a893198f623c2d6c98 Mon Sep 17 00:00:00 2001 From: sjy Date: Sun, 26 Aug 2012 17:15:12 +0800 Subject: [PATCH] better judge regex --- TODO | 3 +++ austlii.js | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 TODO diff --git a/TODO b/TODO new file mode 100644 index 0000000..51564f6 --- /dev/null +++ b/TODO @@ -0,0 +1,3 @@ +judge exp breaks on +http://www.austlii.edu.au/au/cases/cth/HCA/2012/19.html +http://www.austlii.edu.au/au/cases/cth/HCA/2004/37.html diff --git a/austlii.js b/austlii.js index e2ce166..1908d47 100644 --- a/austlii.js +++ b/austlii.js @@ -66,7 +66,8 @@ austlii.addMarkup = function() { $("center i").first().parent().addClass("citation"); // find and markup judges - var judgeExp = /([A-Zc]+)(\s[A-Zc,\s]+\sC?JJ?\.)/g; + // var judgeExp = /([A-Zc]+\s)([A-Zc,\s]+\sC?JJ?\.)/g; + var judgeExp = /([A-Z]{3})((?:[A-Z\s,]| )+C?J?J\.)/g var replacementText = document.body.innerHTML.replace(judgeExp, '$1$2'); document.body.innerHTML = replacementText; @@ -100,7 +101,7 @@ austlii.paintMenu = function() { }); }); - // update right menu on scroll + // update current judge on scroll $(window).scroll(function() { $("#menu ol li a").each(function(){ // if the relevant link appearsmore than half way down the page -- 2.20.1