diff --git a/css/hsg-collections-topbar.css b/css/hsg-collections-topbar.css new file mode 100644 index 0000000..3cdfc89 --- /dev/null +++ b/css/hsg-collections-topbar.css @@ -0,0 +1,6 @@ +/******************************************/ +/****** White collections top bar ******/ +/******************************************/ +prm-explore-main .header .transparent-top-bar::before { + background-color: transparent; +} diff --git a/css/hsg-sublocation-link.css b/css/hsg-sublocation-link.css new file mode 100644 index 0000000..11ce7e5 --- /dev/null +++ b/css/hsg-sublocation-link.css @@ -0,0 +1,3 @@ +.hsg-sublocation-link { + margin-left: 40px; +} diff --git a/css/slsp-i-button.css b/css/slsp-i-button.css new file mode 100644 index 0000000..4ce5b07 --- /dev/null +++ b/css/slsp-i-button.css @@ -0,0 +1,3 @@ +.lib-info { + display: inline-block; +} diff --git a/js/main.js b/js/main.js index bc25626..e5cf346 100644 --- a/js/main.js +++ b/js/main.js @@ -5,6 +5,7 @@ import { hsgAlertMessageModule } from './modules/hsg-alert-message/hsg-alert-mes import { hsgExceptionHandlerModule } from './modules/hsg-exception-handler/hsg-exception-handler.module' import { hsgAlmaOtherMembersAfterModule } from './modules/prm-alma-other-members-after/hsg-alma-other-members-after.module' import { hsgAlmaViewitAfterModule } from './modules/prm-alma-viewit-after/hsg-alma-viewit-after.module' +import { hsgGalleryItemAfterModule } from './modules/prm-gallery-item-after/hsg-gallery-item-after.module' import { hsgJournalsAfterModule } from './modules/prm-journals-after/hsg-journals-after.module' import { hsgLoanAfterModule } from './modules/prm-loan-after/hsg-loan-after.module' import { hsgLocationItemAfterModule } from './modules/prm-location-item-after/hsg-location-item-after.module' @@ -27,6 +28,7 @@ app.requires.push(hsgHowovpAfterModule.name) app.requires.push(hsgHtgiSvcAfterModule.name) app.requires.push(hsgAlmaOtherMembersAfterModule.name) app.requires.push(hsgAlmaViewitAfterModule.name) +app.requires.push(hsgGalleryItemAfterModule.name) app.requires.push(hsgJournalsAfterModule.name) app.requires.push(hsgLoanAfterModule.name) app.requires.push(hsgLocationItemAfterModule.name) @@ -43,7 +45,16 @@ app.requires.push(slspHttpInterceptRequestsModule.name) app.run(function () { console.log('** app running **') }) -//BrowZine not enabled yet // +window.isSandbox = function () { + const sandboxView = "41SLSP_HSG:sandbox_jfu" + const params = new URLSearchParams(window.location.search) + if (params.has('vid')) { + const vid = params.get('vid') + return vid == sandboxView + } + return false +} + // Begin BrowZine - Primo Integration (See: https://thirdiron.atlassian.net/wiki/spaces/BrowZineAPIDocs/pages/79200260/Ex+Libris+Primo+Integration) window.browzine = { api: "https://public-api.thirdiron.com/public/v1/libraries/2827", @@ -73,3 +84,277 @@ document.head.appendChild(browzine.script) // **controller is implemented in hsg-browzine-integration module** // End BrowZine - Primo Integration + +if (window.isSandbox()) { + /////////////////////////////////////////// + /// code for LibraryH3lp chat /// + /// provided by support@libraryh3lp.com /// + /////////////////////////////////////////// + function getClosest(elem, selector) { + // Element.matches() polyfill + if (!Element.prototype.matches) { + Element.prototype.matches = + Element.prototype.matchesSelector || + Element.prototype.mozMatchesSelector || + Element.prototype.msMatchesSelector || + Element.prototype.oMatchesSelector || + Element.prototype.webkitMatchesSelector || + function (s) { + var matches = (this.document || this.ownerDocument).querySelectorAll(s), + i = matches.length + while (--i >= 0 && matches.item(i) !== this) { } + return i > -1 + } + } + + // Get the closest matching element + for (; elem && elem !== document; elem = elem.parentNode) { + if (elem.matches(selector)) return elem + } + return null + } + + var chatFrameWrap = document.createElement('div') + chatFrameWrap.setAttribute('id', 'lh3-chat-frame-wrap') + chatFrameWrap.setAttribute('style', 'display: none; height: 390px; background-color: #fff; border: 1px solid #00802f; width: 400px') + + var closeChatBar = document.createElement('div') + closeChatBar.setAttribute('id', 'lh3-close-chat-bar') + closeChatBar.setAttribute('style', 'background-color: #00802f; color: #fff; font-family: Arial, sans-serif; font-size: 20px; font-weight: bold; padding: 5px 10px; text-align: right;') + var closeChat = document.createElement('span') + closeChat.setAttribute('id', 'lh3-close-chat') + closeChat.setAttribute('style', 'cursor: pointer;') + closeChat.innerHTML = '✕' + closeChatBar.appendChild(closeChat) + chatFrameWrap.appendChild(closeChatBar) + + var needsJs = document.createElement('div') + needsJs.setAttribute('class', 'needs-js') + chatFrameWrap.appendChild(needsJs) + + var chatHeader = document.createElement('header') + chatHeader.setAttribute('aria-labelled-by', 'lh3-chat-button') + chatHeader.setAttribute('id', 'lh3-chat-header') + chatHeader.setAttribute('style', 'display: block; position: absolute; top: -3px; left: -65px;') + + var chatOnlineImage = document.createElement('img') + chatOnlineImage.setAttribute('src', 'https://s3.amazonaws.com/libraryh3lp.com/eu/buttons/1725-st-gallen-chat-online.png') + chatOnlineImage.setAttribute('alt', 'Chat online') + chatOnlineImage.setAttribute('style', 'height: 46px; width: 46px; padding: 2px 0;') + + var chatButton = document.createElement('button') + chatButton.setAttribute('id', 'lh3-chat-button') + chatButton.setAttribute('style', 'background-color: transparent; border: none; display: block; padding: 10px 10px 8px;') + chatButton.appendChild(chatOnlineImage) + + var chatTooltipHeader = document.createElement('div') + chatTooltipHeader.setAttribute('style', 'font-weight: bold;') + chatTooltipHeader.innerHTML = 'Live Chat' + var chatTooltipContentDe = document.createElement('div') + chatTooltipContentDe.innerHTML = 'Haben Sie Fragen?' + var chatTooltipContentEn = document.createElement('div') + chatTooltipContentEn.innerHTML = 'Do you have any questions?' + var chatTooltip = document.createElement('div') + chatTooltip.setAttribute('id', 'chat-tooltip') + chatTooltip.setAttribute('style', 'display: none; position: absolute; top: 70px; right: 10px; width: max-content; text-align: right; padding: 5px; border: 1px solid #00802f; border-radius: 0; background-color: white; color: #3A3A3A; font-family: Source Sans Pro;') + chatTooltip.appendChild(chatTooltipHeader) + chatTooltip.appendChild(chatTooltipContentDe) + chatTooltip.appendChild(chatTooltipContentEn) + + var chatTooltipArrow = document.createElement('div') + chatTooltipArrow.setAttribute('id', 'chat-tooltip-arrow') + chatTooltipArrow.setAttribute('style', 'display: none; position: absolute; bottom: -2px; left: 15px; width: 0; border-top: 5px solid #00802f; border-right: 5px solid transparent; border-left: 5px solid transparent; font-size: 0; line-height: 0; transform: rotate(180deg);') + + var lh3ChatOnline = false + var showLH3Chat = false + window.mouseOverChatTab = function (event) { + if (lh3ChatOnline && !showLH3Chat) { + document.getElementById('chat-tooltip').style.display = 'block' + document.getElementById('chat-tooltip-arrow').style.display = 'block' + } + } + window.mouseOutChatTab = function (event) { + if (lh3ChatOnline && !showLH3Chat) { + document.getElementById('chat-tooltip').style.display = 'none' + document.getElementById('chat-tooltip-arrow').style.display = 'none' + } + } + window.toggleChatTab = function (event) { + if (event) { + event.preventDefault() + event.stopPropagation() + } else if (showLH3Chat) { + // Clicked a toggle somewhere from page, but chat is already open. + return false + } + + // Hide any tooltip. + document.getElementById('chat-tooltip').style.display = 'none' + document.getElementById('chat-tooltip-arrow').style.display = 'none' + + showLH3Chat = !showLH3Chat + chatButton.style.display = showLH3Chat ? 'none' : 'block' + chatFrameWrap.style.display = showLH3Chat ? 'block' : 'none' + chatFrameWrap.style.width = ((window.screen.availWidth < 400) ? (window.screen.availWidth - 2) : 400) + 'px' + chatHeader.style.left = showLH3Chat ? '-69px' : '-67px' + if (!showLH3Chat) { + chatWidget.setAttribute('style', 'position: fixed; top: 38.2%; right: 20px; z-index: 1000;') + } + return false + } + + closeChat.addEventListener('click', window.toggleChatTab) + closeChat.addEventListener('touchend', window.toggleChatTab) + chatButton.addEventListener('click', window.toggleChatTab) + chatButton.addEventListener('mouseover', window.mouseOverChatTab) + chatButton.addEventListener('mouseout', window.mouseOutChatTab) + chatButton.addEventListener('touchend', window.toggleChatTab) + chatHeader.appendChild(chatTooltip) + chatHeader.appendChild(chatTooltipArrow) + chatHeader.appendChild(chatButton) + + var chatWidget = document.createElement('div') + chatWidget.setAttribute('id', 'lh3-chat-widget') + chatWidget.setAttribute('style', 'position: fixed; top: 35%; right: 20px; z-index: 1000;') + chatWidget.appendChild(chatHeader) + chatWidget.appendChild(chatFrameWrap) + document.body.appendChild(chatWidget) + + var chatWidgetMouseDown = false + window.dragChatWidget = function (event) { + event.preventDefault() + const dataOffset = chatWidget.getAttribute('data-offset') + if (chatWidgetMouseDown && dataOffset) { + const offset = JSON.parse(dataOffset) + const left = event.type === 'mousemove' ? event.clientX : event.targetTouches[0].clientX + const top = event.type === 'mousemove' ? event.clientY : event.targetTouches[0].clientY + chatWidget.style.left = (left + offset[0]) + 'px' + chatWidget.style.top = (top + offset[1]) + 'px' + } + } + window.stopDraggingChatWidget = function (event) { + chatWidgetMouseDown = false + document.removeEventListener('mousemove', window.dragChatWidget, true) + document.removeEventListener('touchmove', window.dragChatWidget, true) + document.removeEventListener('mouseup', window.stopDraggingChatWidget, true) + document.removeEventListener('touchend', window.stopDraggingChatWidget, true) + } + window.startDraggingChatWidget = function (event) { + if (chatFrameWrap.style.display === 'none') { + return // Chat box is not visible. + } + + event.preventDefault() + event.stopPropagation() + + chatWidgetMouseDown = true + const left = event.type === 'mousedown' ? event.clientX : event.targetTouches[0].clientX + const top = event.type === 'mousedown' ? event.clientY : event.targetTouches[0].clientY + const chatWidgetOffset = [ + chatWidget.offsetLeft - left, + chatWidget.offsetTop - top + ] + chatWidget.setAttribute('data-offset', JSON.stringify(chatWidgetOffset)) + + document.addEventListener('mousemove', window.dragChatWidget, true) + document.addEventListener('touchmove', window.dragChatWidget, true) + document.addEventListener('mouseup', window.stopDraggingChatWidget, true) + document.addEventListener('touchend', window.stopDraggingChatWidget, true) + } + + chatWidget.addEventListener('mousedown', window.startDraggingChatWidget, true) + chatWidget.addEventListener('touchstart', window.startDraggingChatWidget, true) + + window.lh3PresenceCheck = function () { + s = document.createElement('script') + s.async = true + s.id = 'lh3-presence-check' + s.src = 'https://eu.libraryh3lp.com/presence/jid/hsg-library-queue/chat.eu.libraryh3lp.com/js?cb=window.updateChatTab' + s.type = 'application/javascript' + document.body.appendChild(s) + } + + window.updateChatTab = function () { + for (var i = 0; i < jabber_resources.length; ++i) { + var resource = jabber_resources[i] + if (resource.show !== 'available' && resource.show !== 'chat') { + lh3ChatOnline = false + + var busyText = document.querySelector('.lh3-busy') + var offlineText = document.querySelector('.lh3-offline') + + if (!busyText && !offlineText) { + setTimeout(lh3PresenceCheck, 1000) + } + + var wrap = document.getElementById('lh3-chat-frame-wrap') + wrap.style.borderColor = '#00802f' + + var bar = document.getElementById('lh3-close-chat-bar') + bar.style.backgroundColor = '#00802f' + + var chatOfflineImage = document.createElement('img') + if (resource.show === 'dnd') { // Busy + chatOfflineImage.setAttribute('src', 'https://s3.amazonaws.com/libraryh3lp.com/eu/buttons/1725-st-gallen-chat-online.png') + chatOfflineImage.setAttribute('alt', 'Chat ausgelastet / busy') + + var lh3ChatFrameWrap = document.querySelector('#lh3-chat-frame-wrap') + if (lh3ChatFrameWrap) { + lh3ChatFrameWrap.style.borderColor = "#6829ff" + lh3ChatFrameWrap.children[0].style.backgroundColor = "#6829ff" + } + + if (busyText && offlineText) { + busyText.style.display = 'block' + offlineText.style.display = 'none' + } + } else { // Away, Extended Away, Unavailable + chatOfflineImage.setAttribute('src', 'https://s3.amazonaws.com/libraryh3lp.com/eu/buttons/1725-st-gallen-chat-offline.svg') + chatOfflineImage.setAttribute('alt', 'Chat offline') + + if (busyText && offlineText) { + busyText.style.display = 'none' + offlineText.style.display = 'block' + } + } + chatOfflineImage.setAttribute('style', 'height: 46px; width: 46px; padding: 2px 0;') + + var button = document.getElementById('lh3-chat-button') + button.innerHTML = '' + button.appendChild(chatOfflineImage) + } else { + lh3ChatOnline = true + } + } + } + + function clickAway(event) { + var linkToggleRegex = RegExp('toggleChatTab') + var linkElement = getClosest(event.target, 'a') + if (showLH3Chat && !lh3ChatOnline && !getClosest(event.target, '#lh3-chat-widget') && (!linkElement || !linkToggleRegex.test(linkElement.getAttribute('onclick')))) { + window.toggleChatTab(event) + } + } + + document.addEventListener('click', clickAway) + document.addEventListener('touchend', clickAway) + + function handleEscape(event) { + if (event.key === "Escape" && showLH3Chat && !lh3ChatOnline) { + window.toggleChatTab(event) + } + } + document.addEventListener('keyup', handleEscape) + + var s = document.createElement('script') + s.async = true + s.id = 'lh3-chat-snippet' + s.src = 'https://eu.libraryh3lp.com/js/libraryh3lp.js?1564' + s.type = 'application/javascript' + s.onload = lh3PresenceCheck + document.body.appendChild(s) + /////////////////////////////////////////// + /// code for LibraryH3lp chat ends here /// + /// provided by support@libraryh3lp.com /// + /////////////////////////////////////////// +} diff --git a/js/modules/README.md b/js/modules/README.md index 60e1b6e..e242880 100644 --- a/js/modules/README.md +++ b/js/modules/README.md @@ -26,6 +26,10 @@ There is a proof of concept to report exceptions to a remote serivce via http, i * **`slsp-archives-viewit`** *module*\ Adapted from SLSP, see: https://github.com/Swiss-Library-Service-Platform/central-customization-package/tree/main/41SLSP_NETWORK-CENTRAL_PACKAGE/js/slsp-archives-viewit

+* **`prm-gallery-item-after`** *hook* + * **`hsg-collections-show-author`** *module*\ + Show author name in collections. +

* **`prm-journals-after`** *hook* * **`hsg-journals-startpage`** *module*\ Start page for the journals search, similar to the [ETHZ Solution](https://gitlab.com/ethlibrary/slsp/customization-eth-view/-/tree/master/js/modules/prm-journals-after/eth-journals-startpage) diff --git a/js/modules/alma-howovp-after/slsp-ill-signin-order-alert/slsp-ill-signin-order-alert.controller.js b/js/modules/alma-howovp-after/slsp-ill-signin-order-alert/slsp-ill-signin-order-alert.controller.js index a749ec4..8007c79 100644 --- a/js/modules/alma-howovp-after/slsp-ill-signin-order-alert/slsp-ill-signin-order-alert.controller.js +++ b/js/modules/alma-howovp-after/slsp-ill-signin-order-alert/slsp-ill-signin-order-alert.controller.js @@ -1,10 +1,9 @@ export class slspIllSigninOrderAlertController { - constructor() { - this.vm = this.afterCtrl - } + constructor() { } getAlert() { + this.vm = this.afterCtrl var ga = this.vm.parentCtrl.almaHowToGetitService.reqAlert._htmlMsg var myEl2 = angular.element(document.querySelector('primo-explore')) diff --git a/js/modules/alma-htgi-svc-after/slsp-archives-htgi/slsp-archives-htgi.controller.js b/js/modules/alma-htgi-svc-after/slsp-archives-htgi/slsp-archives-htgi.controller.js index 412d1ec..93f9878 100644 --- a/js/modules/alma-htgi-svc-after/slsp-archives-htgi/slsp-archives-htgi.controller.js +++ b/js/modules/alma-htgi-svc-after/slsp-archives-htgi/slsp-archives-htgi.controller.js @@ -1,10 +1,10 @@ export class slspArchivesHtgiController { - constructor() { - this.parentCtrl = this.afterCtrl.parentCtrl - } + constructor() { } $onInit() { + this.parentCtrl = this.afterCtrl.parentCtrl + if (!this.parentCtrl.item.pnx.display.source || this.parentCtrl.item.pnx.display.source.length === 0) { return } diff --git a/js/modules/prm-alma-other-members-after/slsp-collapse-other-inst/slsp-collapse-other-inst.controller.js b/js/modules/prm-alma-other-members-after/slsp-collapse-other-inst/slsp-collapse-other-inst.controller.js index 1119af3..5b79fa6 100644 --- a/js/modules/prm-alma-other-members-after/slsp-collapse-other-inst/slsp-collapse-other-inst.controller.js +++ b/js/modules/prm-alma-other-members-after/slsp-collapse-other-inst/slsp-collapse-other-inst.controller.js @@ -1,5 +1,7 @@ export class slspCollapseOtherInstController { - constructor() { + constructor() { } + + $onInit() { this.parentCtrl = this.afterCtrl.parentCtrl this.parentCtrl.isCollapsed = true } diff --git a/js/modules/prm-alma-viewit-after/hsg-report-broken-link/hsg-report-broken-link.controller.js b/js/modules/prm-alma-viewit-after/hsg-report-broken-link/hsg-report-broken-link.controller.js index f09a6ba..424a2e7 100644 --- a/js/modules/prm-alma-viewit-after/hsg-report-broken-link/hsg-report-broken-link.controller.js +++ b/js/modules/prm-alma-viewit-after/hsg-report-broken-link/hsg-report-broken-link.controller.js @@ -11,10 +11,10 @@ export class hsgReportBrokenLinkController { this.status = '' this.errorMessage this.info = new LinkInfo() - this.parentCtrl = this.afterCtrl.parentCtrl } $onInit() { + this.parentCtrl = this.afterCtrl.parentCtrl // not for open access if (this.parentCtrl.item.pnx.addata.openaccess && this.parentCtrl.item.pnx.addata.openaccess[0] === 'true') { return diff --git a/js/modules/prm-alma-viewit-after/slsp-archives-viewit/slsp-archives-viewit.controller.js b/js/modules/prm-alma-viewit-after/slsp-archives-viewit/slsp-archives-viewit.controller.js index dbb9548..ab54be3 100644 --- a/js/modules/prm-alma-viewit-after/slsp-archives-viewit/slsp-archives-viewit.controller.js +++ b/js/modules/prm-alma-viewit-after/slsp-archives-viewit/slsp-archives-viewit.controller.js @@ -2,10 +2,10 @@ export class slspArchivesViewitController { constructor($translate) { this.$translate = $translate - this.parentCtrl = this.afterCtrl.parentCtrl } $onInit() { + this.parentCtrl = this.afterCtrl.parentCtrl if (!this.parentCtrl.item.pnx.display.source || this.parentCtrl.item.pnx.display.source.length === 0) { return } diff --git a/js/modules/prm-gallery-item-after/hsg-collections-show-author/hsg-collections-show-author.controller.js b/js/modules/prm-gallery-item-after/hsg-collections-show-author/hsg-collections-show-author.controller.js new file mode 100644 index 0000000..586110e --- /dev/null +++ b/js/modules/prm-gallery-item-after/hsg-collections-show-author/hsg-collections-show-author.controller.js @@ -0,0 +1,46 @@ +export class hsgCollectionsShowAuthorController { + + constructor($element, $scope) { + this.$element = $element + this.$scope = $scope + this.waiting = true + } + + $onInit() { + this.parentCtrl = this.afterCtrl.parentCtrl + const name = this.getAuthorOrContributor() + if (!name) { + return + } + const that = this + const deregister = this.$scope.$watch( + function () { + return that.$element.parent().parent().query('.item-title')[0] + }, + function (newValue, oldValue) { + if (that.waiting && typeof newValue === "object") { + that.waiting = false + that.placeAuthor(newValue, name) + deregister() + } + } + ) + } + + placeAuthor(itemTitleElement, author) { + itemTitleElement.insertAdjacentHTML('beforeEnd', '

' + author + '') + } + + getAuthorOrContributor() { + let data = this.parentCtrl.item.pnx.addata + if (data.au) { + return data.au.slice(0, 3).join('; ') + } + if (data.addau) { + return data.addau.slice(0, 3).join('; ') + } + return + } +} + +hsgCollectionsShowAuthorController.$inject = ['$element', '$scope'] diff --git a/js/modules/prm-gallery-item-after/hsg-collections-show-author/hsg-collections-show-author.module.js b/js/modules/prm-gallery-item-after/hsg-collections-show-author/hsg-collections-show-author.module.js new file mode 100644 index 0000000..f4c1b45 --- /dev/null +++ b/js/modules/prm-gallery-item-after/hsg-collections-show-author/hsg-collections-show-author.module.js @@ -0,0 +1,9 @@ +import { hsgCollectionsShowAuthorController } from './hsg-collections-show-author.controller' + +export const hsgCollectionsShowAuthorModule = angular + .module('hsgCollectionsShowAuthorModule', []) + .controller('hsgCollectionsShowAuthorController', hsgCollectionsShowAuthorController) + .component('hsgCollectionsShowAuthorComponent', { + bindings: { afterCtrl: '<' }, + controller: 'hsgCollectionsShowAuthorController' + }) diff --git a/js/modules/prm-gallery-item-after/hsg-gallery-item-after.module.js b/js/modules/prm-gallery-item-after/hsg-gallery-item-after.module.js new file mode 100644 index 0000000..d73348d --- /dev/null +++ b/js/modules/prm-gallery-item-after/hsg-gallery-item-after.module.js @@ -0,0 +1,12 @@ +import { hsgCollectionsShowAuthorModule } from './hsg-collections-show-author/hsg-collections-show-author.module' + +export const hsgGalleryItemAfterModule = angular + .module('hsgGalleryItemAfterModule', []) + .component('prmGalleryItemAfter', { + bindings: { parentCtrl: '<' }, + template: ` + + ` + }) + +hsgGalleryItemAfterModule.requires.push(hsgCollectionsShowAuthorModule.name) diff --git a/js/modules/prm-location-items-after/hsg-location-items-after.module.js b/js/modules/prm-location-items-after/hsg-location-items-after.module.js index 9033667..44a4cca 100644 --- a/js/modules/prm-location-items-after/hsg-location-items-after.module.js +++ b/js/modules/prm-location-items-after/hsg-location-items-after.module.js @@ -1,4 +1,5 @@ import { ethLocationItemsFilterModule } from './eth-location-items-filter/eth-location-items-filter.module' +import { hsgSublocationLinkModule } from './hsg-sublocation-link/hsg-sublocation-link.module' import { slspIButtonModule } from './slsp-i-button/slsp-i-button.module' export const hsgLocationItemsAfterModule = angular @@ -8,8 +9,10 @@ export const hsgLocationItemsAfterModule = angular template: ` + ` }) hsgLocationItemsAfterModule.requires.push(slspIButtonModule.name) hsgLocationItemsAfterModule.requires.push(ethLocationItemsFilterModule.name) +hsgLocationItemsAfterModule.requires.push(hsgSublocationLinkModule.name) diff --git a/js/modules/prm-location-items-after/hsg-sublocation-link/hsg-sublocation-link.config.js b/js/modules/prm-location-items-after/hsg-sublocation-link/hsg-sublocation-link.config.js new file mode 100644 index 0000000..a09235d --- /dev/null +++ b/js/modules/prm-location-items-after/hsg-sublocation-link/hsg-sublocation-link.config.js @@ -0,0 +1,11 @@ +export const hsgSublocationLinkConfig = { + SZ: { + mapLink: 'https://goo.gl/maps/1DpLN6WGWbJMTvCC6' + }, + labels: { + mapLinkTextSZ: { + de: 'Standort \'Zentrum für Sprachen und transkulturelle Kommunikation\'', + en: 'Location \'Center for Languages and Transcultural Communication\'' + } + } +} diff --git a/js/modules/prm-location-items-after/hsg-sublocation-link/hsg-sublocation-link.controller.js b/js/modules/prm-location-items-after/hsg-sublocation-link/hsg-sublocation-link.controller.js new file mode 100644 index 0000000..876e0c7 --- /dev/null +++ b/js/modules/prm-location-items-after/hsg-sublocation-link/hsg-sublocation-link.controller.js @@ -0,0 +1,50 @@ +export class hsgSublocationLinkController { + + constructor($element, hsgSublocationLinkConfig, hsgTranslatorService) { + this.$element = $element + this.config = hsgSublocationLinkConfig + this.translator = hsgTranslatorService + this.showLink = false + this.mapLink = '' + this.mapLinkText = '' + } + + $onInit() { + this.parentCtrl = this.afterCtrl.parentCtrl + if (!this.parentCtrl.currLoc) { + return + } + const loc = this.parentCtrl.currLoc.location + if (loc) { + const subLocationCode = loc.subLocationCode + this.mapLinkText = this.translate('mapLinkText' + subLocationCode) + if (subLocationCode === 'SZ') { + this.showLink = true + this.mapLink = this.config[subLocationCode].mapLink + } + } + } + + getShowLink() { + return this.showLink + } + + getMapLink() { + return this.mapLink + } + + getMapLinkText() { + return this.mapLinkText + } + + translate(key) { + if (!this.config) { + console.log("config missing") + return + } + let msg = this.translator.getLabel(key, this.config) + return msg + } +} + +hsgSublocationLinkController.$inject = ['$element', 'hsgSublocationLinkConfig', 'hsgTranslatorService'] diff --git a/js/modules/prm-location-items-after/hsg-sublocation-link/hsg-sublocation-link.html b/js/modules/prm-location-items-after/hsg-sublocation-link/hsg-sublocation-link.html new file mode 100644 index 0000000..021af03 --- /dev/null +++ b/js/modules/prm-location-items-after/hsg-sublocation-link/hsg-sublocation-link.html @@ -0,0 +1,9 @@ + + + + + + + + {{ $ctrl.getMapLinkText() }} + diff --git a/js/modules/prm-location-items-after/hsg-sublocation-link/hsg-sublocation-link.module.js b/js/modules/prm-location-items-after/hsg-sublocation-link/hsg-sublocation-link.module.js new file mode 100644 index 0000000..69ab4ec --- /dev/null +++ b/js/modules/prm-location-items-after/hsg-sublocation-link/hsg-sublocation-link.module.js @@ -0,0 +1,15 @@ +import { hsgTranslatorService } from '../../../services/hsg-translator.service' +import { hsgSublocationLinkController } from './hsg-sublocation-link.controller' +import { hsgSublocationLinkConfig } from './hsg-sublocation-link.config' +import { hsgSublocationLinkHtml } from './hsg-sublocation-link.html' + +export const hsgSublocationLinkModule = angular + .module('hsgSzLinkModule', []) + .constant('hsgSublocationLinkConfig', hsgSublocationLinkConfig) + .factory('hsgTranslatorService', hsgTranslatorService) + .controller('hsgSublocationLinkController', hsgSublocationLinkController) + .component('hsgSzLinkComponent', { + bindings: { afterCtrl: '<' }, + controller: 'hsgSublocationLinkController', + template: hsgSublocationLinkHtml + }) diff --git a/js/modules/prm-location-items-after/slsp-i-button/slsp-i-button.controller.js b/js/modules/prm-location-items-after/slsp-i-button/slsp-i-button.controller.js index 9c9798a..0817d97 100644 --- a/js/modules/prm-location-items-after/slsp-i-button/slsp-i-button.controller.js +++ b/js/modules/prm-location-items-after/slsp-i-button/slsp-i-button.controller.js @@ -25,8 +25,10 @@ export class slspIButtonController { let currLoc = this.parentCtrl.currLoc if (currLoc) { return currLoc.location.libraryCode - } else { + } else if (this.parentCtrl.loc) { return this.parentCtrl.loc.location.libraryCode + } else { + return '' } } diff --git a/js/modules/prm-location-items-after/slsp-i-button/slsp-i-button.html b/js/modules/prm-location-items-after/slsp-i-button/slsp-i-button.html index cba320b..1efc979 100644 --- a/js/modules/prm-location-items-after/slsp-i-button/slsp-i-button.html +++ b/js/modules/prm-location-items-after/slsp-i-button/slsp-i-button.html @@ -1,8 +1,8 @@ -
+
+ ng-src="/discovery/custom/41SLSP_NETWORK-CENTRAL_PACKAGE/img/information.png" /> {{ $ctrl.getLibrary() }}
diff --git a/js/modules/prm-personal-info-after/slsp-edit-personal-details/slsp-edit-personal-details.controller.js b/js/modules/prm-personal-info-after/slsp-edit-personal-details/slsp-edit-personal-details.controller.js index d1318ad..f26c8c5 100644 --- a/js/modules/prm-personal-info-after/slsp-edit-personal-details/slsp-edit-personal-details.controller.js +++ b/js/modules/prm-personal-info-after/slsp-edit-personal-details/slsp-edit-personal-details.controller.js @@ -2,7 +2,6 @@ export class slspEditPersonalDetailsController { constructor(hsgTranslatorService) { let lang = hsgTranslatorService.getLang() - this.parentCtrl = this.afterCtrl.parentCtrl this.detailsBaseEdu = "https:\/\/eduid.ch\/web\/change-account-data\/2\/?lang=" + lang this.detailsBaseReg = "https:\/\/registration.slsp.ch\/library-card\/?lang=" + lang this.exclude = ['STAFF', '11', '12', '13', '14', '15', '16', '91', '92', '99'] @@ -10,6 +9,10 @@ export class slspEditPersonalDetailsController { this.grpB = ['12', '13', '14', '15', '16'] } + $onInit() { + this.parentCtrl = this.afterCtrl.parentCtrl + } + getPatronGrp() { if (this.parentCtrl.personalInfoService.personalInfo !== undefined) { let patron = this.parentCtrl.personalInfoService.personalInfo.patronstatus[0].registration[0].institution[0].patronstatuscode @@ -55,4 +58,5 @@ export class slspEditPersonalDetailsController { parentElement.append(element) } } + slspEditPersonalDetailsController.$inject = ['hsgTranslatorService'] diff --git a/js/modules/prm-request-after/slsp-courier-info/slsp-courier-info.controller.js b/js/modules/prm-request-after/slsp-courier-info/slsp-courier-info.controller.js index 05e4472..470cde9 100644 --- a/js/modules/prm-request-after/slsp-courier-info/slsp-courier-info.controller.js +++ b/js/modules/prm-request-after/slsp-courier-info/slsp-courier-info.controller.js @@ -1,11 +1,14 @@ export class slspCourierInfoController { constructor($element) { - this.parentCtrl = this.afterCtrl.parentCtrl this.$element = $element this.prmRequestElement = $element[0].parentElement.parentElement } + $onInit() { + this.parentCtrl = this.afterCtrl.parentCtrl + } + //function for inserting block $doCheck() { let form = false @@ -25,7 +28,7 @@ export class slspCourierInfoController { info.innerHTML = `

${this.parentCtrl.$translate.instant('customize.fullview.feesTitle')}

${this.parentCtrl.$translate.instant('customize.fullview.feesInfo')}

-

${this.parentCtrl.$translate.instant('customize.fullview.feesLinkText')}

` diff --git a/js/modules/prm-search-result-availability-line-after/slsp-archives-availability-line/slsp-archives-availability-line.controller.js b/js/modules/prm-search-result-availability-line-after/slsp-archives-availability-line/slsp-archives-availability-line.controller.js index 29bc272..e4e27b9 100644 --- a/js/modules/prm-search-result-availability-line-after/slsp-archives-availability-line/slsp-archives-availability-line.controller.js +++ b/js/modules/prm-search-result-availability-line-after/slsp-archives-availability-line/slsp-archives-availability-line.controller.js @@ -2,10 +2,11 @@ export class slspArchivesAvailabilityLineController { constructor($translate) { this.$translate = $translate - this.parentCtrl = this.afterCtrl.parentCtrl } $onInit() { + this.parentCtrl = this.afterCtrl.parentCtrl + this.changeButton = false if (!this.parentCtrl.result.pnx.display.source || this.parentCtrl.result.pnx.display.source.length === 0) { return @@ -45,3 +46,5 @@ export class slspArchivesAvailabilityLineController { } } } + +slspArchivesAvailabilityLineController.$inject = ['$translate'] diff --git a/js/modules/prm-service-details-after/hsg-service-details-foldable-items/hsg-service-details-foldable-items.controller.js b/js/modules/prm-service-details-after/hsg-service-details-foldable-items/hsg-service-details-foldable-items.controller.js index a64b4bb..5f6215d 100644 --- a/js/modules/prm-service-details-after/hsg-service-details-foldable-items/hsg-service-details-foldable-items.controller.js +++ b/js/modules/prm-service-details-after/hsg-service-details-foldable-items/hsg-service-details-foldable-items.controller.js @@ -6,13 +6,14 @@ export class hsgServiceDetailsFoldableItemsController { this.$sce = $sce this.config = hsgServiceDetailsFoldableItemsConfig this.translator = hsgTranslatorService - this.parentCtrl = this.afterCtrl.parentCtrl this.waiting = true this.iconExpand = this.config.icons.expand this.iconCollapse = this.config.icons.collapse } $onInit() { + this.parentCtrl = this.afterCtrl.parentCtrl + this.rootEl = this.$element.parent().parent().query('div').children() let that = this // add a watcher to the root element diff --git a/js/modules/prm-stack-map-after/hsg-stack-map-link/hsg-stack-map-link.controller.js b/js/modules/prm-stack-map-after/hsg-stack-map-link/hsg-stack-map-link.controller.js index f8d6667..2a32adb 100644 --- a/js/modules/prm-stack-map-after/hsg-stack-map-link/hsg-stack-map-link.controller.js +++ b/js/modules/prm-stack-map-after/hsg-stack-map-link/hsg-stack-map-link.controller.js @@ -30,7 +30,6 @@ export class hsgStackMapLinkController { getTemplate(ctx) { let href = ctx.$element.parent().parent().children().attr('href') href = this.secureLink(href) - debugger return ` @@ -41,7 +40,7 @@ export class hsgStackMapLinkController { - + ` } diff --git a/js/modules/prm-user-area-expandable-after/bcu-lang-switch/bcu-lang-switch.controller.js b/js/modules/prm-user-area-expandable-after/bcu-lang-switch/bcu-lang-switch.controller.js index ec882fc..0bc4e7e 100644 --- a/js/modules/prm-user-area-expandable-after/bcu-lang-switch/bcu-lang-switch.controller.js +++ b/js/modules/prm-user-area-expandable-after/bcu-lang-switch/bcu-lang-switch.controller.js @@ -2,11 +2,12 @@ export class bcuLangSwitchController { constructor($element, $window) { this.$parent = $element.parent().parent()[0] - this.parentCtrl = this.afterCtrl.parentCtrl this.$window = $window } $onInit() { + this.parentCtrl = this.afterCtrl.parentCtrl + this.languages = ["de", "en"] if (!this.languages.includes(this.parentCtrl.lang)) { this.changeLanguage("en")