Skip to content

Commit

Permalink
Fix errors in jQuery 1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
m1ch4ls committed Aug 20, 2015
1 parent 86f0ce2 commit a3a1e5e
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/citation/citation.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,12 @@ function CitationBox(container, options) {
citationBox[name] = opt;
});

var formats = exportFormats.map(function (format) {
return $('<a></a>')
var tpl = citationBox.body = $(CitationBox.template);
var formatsContainer = tpl.find('[citation-box-formats]');
var sharesContainer = tpl.find('[citation-box-shares]');

exportFormats.forEach(function (format) {
var el = $('<a></a>')
.attr('href', citationBox.oai + '/cite?metadataPrefix=' + format.name + '&handle=' + citationBox.handle)
.on('click', function (e) {
e.preventDefault();
Expand All @@ -120,26 +124,24 @@ function CitationBox(container, options) {
});
})
.text(format.name);
formatsContainer.append(el);
});

var shares = shareButtons.map(function (social) {
var popup = social.popup,
url = makeUrl(popup.url, citationBox);

return $('<a></a>')
var el = $('<a></a>')
.attr('class', 'lindat-icon lindat-icon-' + social.name + ' lindat-share-' + social.name)
.attr('href', url)
.on('click', function (e) {
e.preventDefault();
window.open(url, citationBox.title,
'height:' + popup.height + ',width:' + popup.width);
});
sharesContainer.append(el);
});

var tpl = citationBox.body = $(CitationBox.template);
tpl.find('[citation-box-formats]').append(formats);
tpl.find('[citation-box-shares]').append(shares);

citationBox.text = tpl.find('[citation-box-text]');
citationBox.copyButton = tpl.find('[citation-box-copy-button]');

Expand Down

0 comments on commit a3a1e5e

Please sign in to comment.