]>
Commit | Line | Data |
---|---|---|
af61cb80 | 1 | import $ from 'jquery'; |
c146f694 TC |
2 | |
3 | function toggleSaveLinkForm(url, event) { | |
4 | $('#add-link-result').empty(); | |
5 | ||
6 | const $bagit = $('#bagit'); | |
7 | const $bagitForm = $('#bagit-form'); | |
8 | ||
9 | $bagit.toggleClass('active-current'); | |
10 | ||
11 | // only if bag-it link is not presented on page | |
12 | if ($bagit.length === 0) { | |
13 | if (event !== 'undefined' && event) { | |
14 | $bagitForm.css({ position: 'absolute', top: event.pageY, left: event.pageX - 200 }); | |
15 | } else { | |
16 | $bagitForm.css({ position: 'relative', top: 'auto', left: 'auto' }); | |
17 | } | |
18 | } | |
19 | ||
20 | const searchForm = $('#search-form'); | |
21 | const plainUrl = $('#plainurl'); | |
22 | if (searchForm.length !== 0) { | |
23 | $('#search').removeClass('current'); | |
24 | $('#search-arrow').removeClass('arrow-down'); | |
25 | searchForm.hide(); | |
26 | } | |
27 | $bagitForm.toggle(); | |
28 | $('#content').toggleClass('opacity03'); | |
29 | if (url !== 'undefined' && url) { | |
30 | plainUrl.val(url); | |
31 | } | |
32 | plainUrl.focus(); | |
33 | } | |
34 | ||
af61cb80 | 35 | export default toggleSaveLinkForm; |