Skip to content

Commit 8c0599a

Browse files
authored
Merge pull request #11 from johnseguin/patch-6
Removed all es6 features to ensure IE11 compatibility...
2 parents eab7747 + c25cf0d commit 8c0599a

1 file changed

Lines changed: 56 additions & 60 deletions

File tree

js/browzine.js

Lines changed: 56 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,69 @@
11
// Define Angular module and whitelist URL of server with Node.js script
2-
var app = angular.module('viewCustom', ['angularLoad'])
3-
.constant('nodeserver', "https://yourserver.edu")
4-
.config(['$sceDelegateProvider', 'nodeserver', ($sceDelegateProvider, nodeserver) => {
5-
let urlWhitelist = $sceDelegateProvider.resourceUrlWhitelist();
6-
urlWhitelist.push(`${nodeserver}**`);
7-
$sceDelegateProvider.resourceUrlWhitelist(urlWhitelist);
8-
}]);
2+
var app = angular.module('viewCustom', ['angularLoad'])
3+
.constant('nodeserver', "https://yourserver.edu")
4+
.config(['$sceDelegateProvider', 'nodeserver', function ($sceDelegateProvider, nodeserver) {
5+
var urlWhitelist = $sceDelegateProvider.resourceUrlWhitelist();
6+
urlWhitelist.push(nodeserver + '**');
7+
$sceDelegateProvider.resourceUrlWhitelist(urlWhitelist);
8+
}]);
99

1010
// Add Article In Context & BrowZine Links
11-
app.controller('prmSearchResultAvailabilityLineAfterController', function($scope, $http, nodeserver) {
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 = nodeserver + "/primo/browzine/articles?DOI=" + vm.doi;
16-
$http.jsonp(articleURL, {jsonpCallbackParam: 'callback'}).then(function(response) {
17-
$scope.article = response.data;
18-
}, function(error){
19-
console.log(error);
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 = nodeserver + "/primo/browzine/journals?ISSN=" + vm.issn;
25-
$http.jsonp(journalURL, {jsonpCallbackParam: 'callback'}).then(function(response) {
26-
$scope.journal = response.data;
27-
}, function(error){
28-
console.log(error);
29-
});
30-
}
31-
32-
});
11+
app.controller('prmSearchResultAvailabilityLineAfterController', function ($scope, $http, nodeserver) {
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 = nodeserver + "/primo/browzine/articles?DOI=" + vm.doi;
16+
$http.jsonp(articleURL, { jsonpCallbackParam: 'callback' }).then(function (response) {
17+
$scope.article = response.data;
18+
}, function (error) {
19+
console.log(error);
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 = nodeserver + "/primo/browzine/journals?ISSN=" + vm.issn;
25+
$http.jsonp(journalURL, { jsonpCallbackParam: 'callback' }).then(function (response) {
26+
$scope.journal = response.data;
27+
}, function (error) {
28+
console.log(error);
29+
});
30+
}
31+
});
3332

3433
// Below is where you can customize the wording that is displayed (as well as the hover over text) for the BrowZine links.
3534
// St Olaf has chosen "View Journal Contents" for the "Journal Availability Link" but other great options include things such as "View Journal" or "View this Journal"
3635
// St Olaf is using "View Issue Contents" for the "Article in Context" link but another great option is "View Complete Issue" or "View Article in Context".
3736
// St Olaf also has added a hover over link that says "Via BrowZine" to emphasize the interaction being used.
3837

39-
app.component('prmSearchResultAvailabilityLineAfter', {
40-
bindings: { parentCtrl: '<' },
41-
controller: 'prmSearchResultAvailabilityLineAfterController',
42-
template: `
43-
<div ng-if="article.data.browzineWebLink"><a href="{{ article.data.browzineWebLink }}" target="_blank" title="Via BrowZine"><img src="custom/01BRC_SOC/img/browzine.png" class="browzine-icon"> View Issue Contents <md-icon md-svg-icon="primo-ui:open-in-new" aria-label="icon-open-in-new" role="img" class="browzine-external-link"><svg id="open-in-new_cache29" width="100%" height="100%" viewBox="0 0 24 24" y="504" xmlns="http://www.w3.org/2000/svg" fit="" preserveAspectRatio="xMidYMid meet" focusable="false"></svg></md-icon></a></div>
44-
<div ng-if="journal.data[0].browzineWebLink"><a href="{{ journal.data[0].browzineWebLink }}" target="_blank" title="Via BrowZine"><img src="custom/01BRC_SOC/img/browzine.png" class="browzine-icon"> View Journal Contents <md-icon md-svg-icon="primo-ui:open-in-new" aria-label="icon-open-in-new" role="img" class="browzine-external-link"><svg id="open-in-new_cache29" width="100%" height="100%" viewBox="0 0 24 24" y="504" xmlns="http://www.w3.org/2000/svg" fit="" preserveAspectRatio="xMidYMid meet" focusable="false"></svg></md-icon></a></div>
45-
`
46-
});
38+
app.component('prmSearchResultAvailabilityLineAfter', {
39+
bindings: { parentCtrl: '<' },
40+
controller: 'prmSearchResultAvailabilityLineAfterController',
41+
template: '<div ng-if="article.data.browzineWebLink"><a href="{{ article.data.browzineWebLink }}" target="_blank" title="Via BrowZine"><img src="https://s3.amazonaws.com/thirdiron-assets/images/integrations/browzine_open_book_icon.png" class="browzine-icon"> View Issue Contents <md-icon md-svg-icon="primo-ui:open-in-new" aria-label="icon-open-in-new" role="img" class="browzine-external-link"><svg id="open-in-new_cache29" width="100%" height="100%" viewBox="0 0 24 24" y="504" xmlns="http://www.w3.org/2000/svg" fit="" preserveAspectRatio="xMidYMid meet" focusable="false"></svg></md-icon></a></div><div ng-if="journal.data[0].browzineWebLink"><a href="{{ journal.data[0].browzineWebLink }}" target="_blank" title="Via BrowZine"><img src="https://s3.amazonaws.com/thirdiron-assets/images/integrations/browzine_open_book_icon.png" class="browzine-icon"> View Journal Contents <md-icon md-svg-icon="primo-ui:open-in-new" aria-label="icon-open-in-new" role="img" class="browzine-external-link"><svg id="open-in-new_cache29" width="100%" height="100%" viewBox="0 0 24 24" y="504" xmlns="http://www.w3.org/2000/svg" fit="" preserveAspectRatio="xMidYMid meet" focusable="false"></svg></md-icon></a></div>'
42+
});
4743

4844
// Add Journal Cover Images from BrowZine
49-
app.controller('prmSearchResultThumbnailContainerAfterController', function($scope, $http, nodeserver) {
50-
var vm = this;
51-
var newThumbnail = '';
52-
if (vm.parentCtrl.item.pnx.addata.issn) {
53-
vm.issn = vm.parentCtrl.item.pnx.addata.issn[0].replace("-", "") || '';
54-
var journalURL = nodeserver + "/primo/browzine/journals?ISSN=" + vm.issn;
55-
$http.jsonp(journalURL, {jsonpCallbackParam: 'callback'}).then(function(response) {
56-
newThumbnail = response.data.data["0"].coverImageUrl;
57-
}, function(error){
58-
console.log(error); //
59-
});
45+
app.controller('prmSearchResultThumbnailContainerAfterController', function ($scope, $http, nodeserver) {
46+
var vm = this;
47+
var newThumbnail = '';
48+
if (vm.parentCtrl.item.pnx.addata.issn) {
49+
vm.issn = vm.parentCtrl.item.pnx.addata.issn[0].replace("-", "") || '';
50+
var journalURL = nodeserver + "/primo/browzine/journals?ISSN=" + vm.issn;
51+
$http.jsonp(journalURL, { jsonpCallbackParam: 'callback' }).then(function (response) {
52+
newThumbnail = response.data.data["0"].coverImageUrl;
53+
}, function (error) {
54+
console.log(error); //
55+
});
56+
}
57+
vm.$doCheck = function (changes) {
58+
if (vm.parentCtrl.selectedThumbnailLink) {
59+
if (newThumbnail != '' && (vm.parentCtrl.selectedThumbnailLink.linkURL.indexOf("icon_journal.png") != -1 || vm.parentCtrl.selectedThumbnailLink.linkURL.indexOf("img/icon_article.png") != -1)) {
60+
vm.parentCtrl.selectedThumbnailLink.linkURL = newThumbnail;
6061
}
61-
vm.$doCheck = function(changes) {
62-
if (vm.parentCtrl.selectedThumbnailLink) {
63-
if (newThumbnail != '' && (vm.parentCtrl.selectedThumbnailLink.linkURL.indexOf("icon_journal.png") != -1 || vm.parentCtrl.selectedThumbnailLink.linkURL.indexOf("img/icon_article.png") != -1) ) {
64-
vm.parentCtrl.selectedThumbnailLink.linkURL = newThumbnail;
65-
}
66-
}
67-
};
68-
});
62+
}
63+
};
64+
});
6965

70-
app.component('prmSearchResultThumbnailContainerAfter', {
71-
bindings: { parentCtrl: '<' },
72-
controller: 'prmSearchResultThumbnailContainerAfterController',
73-
});
66+
app.component('prmSearchResultThumbnailContainerAfter', {
67+
bindings: { parentCtrl: '<' },
68+
controller: 'prmSearchResultThumbnailContainerAfterController'
69+
});

0 commit comments

Comments
 (0)