Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Jus Mundi.js #3187

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

thebluepotato
Copy link

Adds support for Jus Mundi

@thebluepotato thebluepotato marked this pull request as ready for review September 30, 2024 17:36
Jus Mundi.js Outdated Show resolved Hide resolved
Jus Mundi.js Outdated


function detectWeb(doc, url) {
// TODO: adjust the logic here
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

Jus Mundi.js Outdated
function getSearchResults(doc, checkOnly) {
var items = {};
var found = false;
// TODO: adjust the CSS selector
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove all TODOs

Jus Mundi.js Outdated
var items = {};
var found = false;
// TODO: adjust the CSS selector
var rows = doc.querySelectorAll('h2 > a.title[href*="/article/"]');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this right?

Jus Mundi.js Outdated
Comment on lines 89 to 93
Z.debug(title);
Z.debug(parties);
Z.debug(caseRef);
Z.debug(date);
Z.debug(docTitle);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove debugs (and below)

Jus Mundi.js Outdated
Z.debug(jusMundiPDF);

let docItems = doc.querySelectorAll('#listDocuments > li');
let relatedDocs = ZU.getItemArray(doc, docItems);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't even remember what this utility function does - best to use modern DOM functions.

Jus Mundi.js Outdated
Comment on lines 113 to 128
item.attachments.push({
title: "Original PDF",
mimeType: "application/pdf",
url: originalPDF
});

item.attachments.push({
title: "Jus Mundi PDF",
mimeType: "application/pdf",
url: jusMundiPDF
});

item.attachments.push({
title: "Snapshot",
document: doc
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Don't add snapshot if we have full text
  • What's the difference between the PDFs?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jus Mundi indexes both the original PDF of a decision (with varying degrees of bad quality, depending on the court) as well as their own version, which is much cleaner, but IIRC does not use the same pagination. In short: boths PDFs are relevant.

Jus Mundi.js Outdated
Comment on lines 137 to 227
/*
function generateCopyRefFor(event) {
var _window;

if (!userConnected() && !isUserPremium() && !isIccPremium()) {
event.preventDefault();
jquery__WEBPACK_IMPORTED_MODULE_0___default()('#callToActionPremium').modal('show');
return;
}

var title = "";
var subtitle = "";
var caseRef = "";
var date = "";
var currentElement = null;
var contentToCopy = "";

if (jquery__WEBPACK_IMPORTED_MODULE_0___default()('#iconbar').hasClass('iconbar--pin')) {
currentElement = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.trim(jquery__WEBPACK_IMPORTED_MODULE_0___default()('#elmntforcopyref').text());
}

if ((_window = window) !== null && _window !== void 0 && _window.documentPublicationReference) {
var _window2;

var $buttonClicked = jquery__WEBPACK_IMPORTED_MODULE_0___default()(event.currentTarget);
var contentJson = (_window2 = window) === null || _window2 === void 0 ? void 0 : _window2.documentPublicationReference;
contentToCopy = contentJson.main;
var number = contentJson.number;
var numberPrefix = contentJson.numberPrefix;
var docNumber = jquery__WEBPACK_IMPORTED_MODULE_0___default()('#documentContainer .pa-title-document-managed-by-page').first().text().trim();

if (docNumber) {
number = docNumber;
}

if ($buttonClicked.hasClass('gtm_document_element_copy_ref')) {
var $title = null;
var $active = jquery__WEBPACK_IMPORTED_MODULE_0___default()('#documentContainer').find('.elemcnt.is-current-active').parents('.entity');

if ($active.find('.pa-title-document-managed-by-page').length > 0) {
$title = $active.find('.pa-title-document-managed-by-page');
} else if ($active.find('.pa-title').text().trim().length > 0) {
$title = $active.find('.pa-title');
} else {
jquery__WEBPACK_IMPORTED_MODULE_0___default.a.each($active.prevAll(), function (value) {
if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(value).find('.pa-title-document-managed-by-page').length > 0) {
$title = jquery__WEBPACK_IMPORTED_MODULE_0___default()(value).find('.pa-title-document-managed-by-page');
return false; // breaks
}
});
}

if ($title) {
number = $title.text().trim();
}
} else {
var docNumber = jquery__WEBPACK_IMPORTED_MODULE_0___default()('#documentContainer .pa-title-document-managed-by-page').first().text().trim();

if (docNumber) {
number = docNumber;
}
}

if (number) {
contentToCopy = contentToCopy + ', ' + numberPrefix + ' ' + number;
}

contentToCopy = contentToCopy + '.';
contentToCopy = contentToCopy.replace('..', '.');
} else if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(".metadata").hasClass('metadata--treaty') || jquery__WEBPACK_IMPORTED_MODULE_0___default()(".metadata").hasClass('metadata--rule')) {
date = jquery__WEBPACK_IMPORTED_MODULE_0___default()('#copyrefdate').data('copyrefdate');
subtitle = jquery__WEBPACK_IMPORTED_MODULE_0___default()('.metadata-title .metadata-title__subtitle');
subtitle = subtitle !== undefined ? subtitle.text().trim() : "";
title = jquery__WEBPACK_IMPORTED_MODULE_0___default()('#generalTitle').text();
contentToCopy = (subtitle !== "" ? subtitle : title) + (date !== undefined ? ", " + date : "") + (currentElement != null ? ", " + currentElement : "");
} else {
var titleOfDocActivate = jquery__WEBPACK_IMPORTED_MODULE_0___default()('div[data-title-in-locale]').data('title-in-locale');
var generalTitle = jquery__WEBPACK_IMPORTED_MODULE_0___default()('#generalTitle');
caseRef = generalTitle.data('copyrefnum');
title = generalTitle.data('copyreftitre');
date = jquery__WEBPACK_IMPORTED_MODULE_0___default()('#listDocuments .listofdoc-level.active').data('copyrefdate');
contentToCopy = "<i>" + title + "</i>, " + (caseRef === "" ? "" : caseRef + ", ") + titleOfDocActivate + (date !== undefined ? ", " + date : "") + (currentElement != null && currentElement !== 'para .' ? ", " + currentElement : "");
}

putFormattedRefToClipboard(contentToCopy);
jquery__WEBPACK_IMPORTED_MODULE_0___default()('.notifyrefcopied').fadeIn('fast');
setTimeout(function () {
jquery__WEBPACK_IMPORTED_MODULE_0___default()('.notifyrefcopied').fadeOut('slow');
}, 2000);
}
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

"creators": [],
"dateDecided": "2022-04-01",
"court": "Judgment of the High Court of Justice of England and Wales [2022] EWHC 768",
"extra": "tex.parties: Shell Western Supply and Trading, Africa Finance Corporation, Ecobank Nigeria Limited, Fidelity Bank Plc, First Bank of Nigeria Limited, Guaranty Trust Bank Plc, Sterling Bank Plc, Union Bank of Nigeria Plc, and Zenith Bank Plc v. Aiteo Eastern E&P Company Limited",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add these as actual creators?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK Zotero only allows Author, Contributor and Counsel for Case items. I'd been using this translator internally alongside BetterBibTeX and my own BibLaTeX style, which recognized a parties field. However, all of this is non-standard so we can either:

  • Ignore them completely
  • Add them in Extra as Parties: or something
  • Get Zotero to recognize more Creator types

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants