Simple, self-contained Javascript app for displaying CODE39-barcodes commonly used in library cards. Based on JsBarcode. Uses js-cookie for persisting barcode for one year. Reads initial barcode value from URL (https://[your-server/librarycard/#2561231231]) or from user input.
Credits: mpitka
-
Enable displaying additional user identifiers in Primo VE user profile
-
Include following to your Primo VE customizations. Please note that at least you have to modify parameters to startsWith() functions which check whether the idenfitier is barcode or something else.
app.component('prmPersonalInfoAfter', {
controller: 'bcode',
template: '<div ng-if="$ctrl.getId()" style="background-color:#f3f3f3;display:block;margin:0 8px 0 8px;padding:15px 26px 15px 26px;">Sähköinen kirjastokortti | eLibrary card: <a href="https://webpages.tuni.fi/tunilib/librarycard/#{{$ctrl.getId()}}" target="_blank">{{$ctrl.getId()}}</a></div>'
});
app.controller('bcode', [function () {
var bcode = this;
bcode.getId = getId;
function getId() {
var ids = document.getElementsByClassName("margin-left-medium");
if (typeof ids[0] !== 'undefined' && typeof ids[1] !== 'undefined') {
if ((ids[0].innerHTML.toString().startsWith('25'))
|| (ids[0].innerHTML.toString().startsWith('837a'))) {
return ids[0].innerHTML;
} else {
return ids[1].innerHTML;
}
} else {
return ids[0].innerHTML;
}
}
}]);
/* Hide extra user info, as identifier is needed only for creating link to library card */
.user-info-section {
display:none;
}