|
1 | 1 | // Define Angular module and whitelist URL of server with Node.js script |
2 | 2 | var app = angular.module('viewCustom', ['angularLoad']) |
3 | | - .constant('nodeserver', "https://yourserver.edu/primo/browzine") |
| 3 | + .constant('nodeserver', "https://yourserver.edu") |
4 | 4 | .config(['$sceDelegateProvider', 'nodeserver', ($sceDelegateProvider, nodeserver) => { |
5 | 5 | let urlWhitelist = $sceDelegateProvider.resourceUrlWhitelist(); |
6 | 6 | urlWhitelist.push(`${nodeserver}**`); |
7 | 7 | $sceDelegateProvider.resourceUrlWhitelist(urlWhitelist); |
8 | 8 | }]); |
9 | 9 |
|
10 | 10 | // Add Article In Context & Browzine Links |
11 | | - app.controller('prmSearchResultAvailabilityLineAfterController', function($scope, $http) { |
| 11 | + app.controller('prmSearchResultAvailabilityLineAfterController', function($scope, $http, nodeserver) { |
12 | 12 | var vm = this; |
13 | | - if (vm.parentCtrl.result.pnx.addata.doi && vm.parentCtrl.result.pnx.display.type[0] == 'article') { |
14 | | - vm.doi = vm.parentCtrl.result.pnx.addata.doi[0] || ''; |
15 | | - var articleURL = "https://yourserver.edu/primo/browzine/browzineArticleInContext?DOI=" + vm.doi; |
16 | | - $http.jsonp(articleURL, {jsonpCallbackParam: 'callback'}).then(function(response) { |
17 | | - $scope.article = response.data; |
18 | | - }, function(error){ |
| 13 | + if (vm.parentCtrl.result.pnx.addata.doi && vm.parentCtrl.result.pnx.display.type[0] == 'article') { |
| 14 | + vm.doi = vm.parentCtrl.result.pnx.addata.doi[0] || ''; |
| 15 | + var articleURL = nodeserver + "/primo/browzine/browzineArticleInContext?DOI=" + vm.doi; |
| 16 | + $http.jsonp(articleURL, {jsonpCallbackParam: 'callback'}).then(function(response) { |
| 17 | + $scope.article = response.data; |
| 18 | + }, function(error){ |
19 | 19 | console.log(error); |
20 | 20 | }); |
21 | | - } |
22 | | - if (vm.parentCtrl.result.pnx.addata.issn && vm.parentCtrl.result.pnx.display.type[0] == 'journal') { |
23 | | - vm.issn = vm.parentCtrl.result.pnx.addata.issn[0].replace("-", "") || ''; |
24 | | - var journalURL = "https://yourserver.edu/primo/browzine/browzineJournals?ISSN=" + vm.issn; |
25 | | - $http.jsonp(journalURL, {jsonpCallbackParam: 'callback'}).then(function(response) { |
26 | | - $scope.journal = response.data; |
27 | | - }, function(error){ |
| 21 | + } |
| 22 | + if (vm.parentCtrl.result.pnx.addata.issn && vm.parentCtrl.result.pnx.display.type[0] == 'journal') { |
| 23 | + vm.issn = vm.parentCtrl.result.pnx.addata.issn[0].replace("-", "") || ''; |
| 24 | + var journalURL = nodeserver + "/primo/browzine/browzineJournals?ISSN=" + vm.issn; |
| 25 | + $http.jsonp(journalURL, {jsonpCallbackParam: 'callback'}).then(function(response) { |
| 26 | + $scope.journal = response.data; |
| 27 | + }, function(error){ |
28 | 28 | console.log(error); |
29 | 29 | }); |
30 | 30 | } |
31 | 31 |
|
32 | | - }); |
| 32 | + }); |
33 | 33 |
|
34 | 34 | app.component('prmSearchResultAvailabilityLineAfter', { |
35 | | - bindings: { parentCtrl: '<' }, |
36 | | - controller: 'prmSearchResultAvailabilityLineAfterController', |
37 | | - template: ` |
38 | | - <div ng-if="article.data.browzineWebLink"><a href="{{ article.data.browzineWebLink }}" target="_blank"> See article in Table of Contents!</a></div> |
39 | | - <div ng-if="journal.data[0].browzineWebLink"><a href="{{ journal.data[0].browzineWebLink }}" target="_blank"> Browse this journal in Browzine!</a></div> |
40 | | - ` |
41 | | - }); |
| 35 | + bindings: { parentCtrl: '<' }, |
| 36 | + controller: 'prmSearchResultAvailabilityLineAfterController', |
| 37 | + template: ` |
| 38 | + <div ng-if="article.data.browzineWebLink"><a href="{{ article.data.browzineWebLink }}" target="_blank"> See article in Table of Contents!</a></div> |
| 39 | + <div ng-if="journal.data[0].browzineWebLink"><a href="{{ journal.data[0].browzineWebLink }}" target="_blank"> Browse this journal in Browzine!</a></div> |
| 40 | + ` |
| 41 | + }); |
42 | 42 |
|
43 | 43 | // Add Journal Cover Images from Browzine |
44 | | - app.controller('prmSearchResultThumbnailContainerAfterController', function($scope, $http) { |
| 44 | + app.controller('prmSearchResultThumbnailContainerAfterController', function($scope, $http, nodeserver) { |
45 | 45 | var vm = this; |
46 | 46 | var newThumbnail = ''; |
47 | 47 | if (vm.parentCtrl.item.pnx.addata.issn) { |
48 | 48 | vm.issn = vm.parentCtrl.item.pnx.addata.issn[0].replace("-", "") || ''; |
49 | | - var journalURL = "https://yourserver.edu/primo/browzine/browzineJournals?ISSN=" + vm.issn; |
| 49 | + var journalURL = nodeserver + "/primo/browzine/browzineJournals?ISSN=" + vm.issn; |
50 | 50 | $http.jsonp(journalURL, {jsonpCallbackParam: 'callback'}).then(function(response) { |
51 | 51 | newThumbnail = response.data.data["0"].coverImageUrl; |
52 | 52 | }, function(error){ |
|
56 | 56 | vm.$doCheck = function(changes) { |
57 | 57 | if (vm.parentCtrl.selectedThumbnailLink) { |
58 | 58 | if (newThumbnail != '' && (vm.parentCtrl.selectedThumbnailLink.linkURL.indexOf("icon_journal.png") != -1 || vm.parentCtrl.selectedThumbnailLink.linkURL.indexOf("img/icon_article.png") != -1) ) { |
59 | | - vm.parentCtrl.selectedThumbnailLink.linkURL = newThumbnail; |
60 | | - } |
| 59 | + vm.parentCtrl.selectedThumbnailLink.linkURL = newThumbnail; |
| 60 | + } |
61 | 61 | } |
62 | 62 | }; |
63 | 63 | }); |
|
0 commit comments