Line 0
Link Here
|
|
|
1 |
//Invoke for Mendeley Reference Manager |
2 |
|
3 |
function getMendeleyModal(){ |
4 |
document.getElementsByTagName('body')[0].appendChild(document.createElement('script')).setAttribute('src','https://www.mendeley.com/minified/bookmarklet.js'); |
5 |
} |
6 |
|
7 |
$(document).ready(function(){ |
8 |
$( "#mendeley_modal" ).click(function( event ){ |
9 |
event.preventDefault(); |
10 |
getMendeleyModal(); |
11 |
return false; |
12 |
}); |
13 |
}); |
14 |
|
15 |
//EasyBib for opac results and patron lists |
16 |
|
17 |
$(document).ready(function(){ |
18 |
|
19 |
$("#CheckAllEasy").click(function(){ |
20 |
$( ".easycheck" ).prop( "checked", true ); |
21 |
}); |
22 |
|
23 |
$("#CheckNoneEasy").click(function(){ |
24 |
$( ".easycheck" ).prop( "checked", false ); |
25 |
}); |
26 |
|
27 |
$("#closeEasyBibModal, #cancelEasyBibModal").click(function(){ |
28 |
$( ".easycheck" ).remove(); |
29 |
$( ".label_reference_manager" ).remove(); |
30 |
$( ".crRecord" ).remove(); |
31 |
$( ".recordSeparator" ).remove(); |
32 |
}); |
33 |
|
34 |
$("#easybib_modal").click(function(){ |
35 |
$( ".cb" ).each(function( index ) { |
36 |
var value = $( this ).val(); |
37 |
var id = "biblionumber" + value; |
38 |
var checkbox = "<input type='checkbox' name='bib' value='" + value + "' id='" + id + "' class='easycheck'>"; |
39 |
$( checkbox ).appendTo( "#content" ); |
40 |
$( ".title" ).each(function( i ) { |
41 |
var title = $( this ).text(); |
42 |
var href = $( this ).attr("href"); |
43 |
var url = "/cgi-bin/koha/opac-detail.pl?biblionumber=" + value + "&query_desc="; |
44 |
var urlShelves = "/cgi-bin/koha/opac-detail.pl?biblionumber=" + value; |
45 |
if ( href == url || href == urlShelves ){ |
46 |
var label = "<label for='" + id + "' class='label_reference_manager'>" + title + "</label>"; |
47 |
$( label ).appendTo( "#content" ); |
48 |
$( "<br class='crRecord'>" ).appendTo( "#content" ); |
49 |
$( "<hr class='recordSeparator'>" ).appendTo( "#content" ); |
50 |
} |
51 |
}); |
52 |
}); |
53 |
}); |
54 |
|
55 |
//EasyBib for basket |
56 |
|
57 |
$("#easybib_modal_basket").click(function(){ |
58 |
$( ".title" ).each(function( index ) { |
59 |
var data_bibnum = $( this ).data( "bibnumber" ); |
60 |
var id = "biblionumber" + data_bibnum; |
61 |
var checkbox = "<input type='checkbox' name='bib' value='" + data_bibnum + "' id='" + id + "' class='easycheck'>"; |
62 |
$( checkbox ).appendTo( "#content" ); |
63 |
var title = $( this ).text(); |
64 |
var label = "<label for='" + id + "' class='label_reference_manager'>" + title + "</label>"; |
65 |
$( label ).appendTo( "#content" ); |
66 |
$( "<br class='crRecord'>" ).appendTo( "#content" ); |
67 |
$( "<hr class='recordSeparator'>" ).appendTo( "#content" ); |
68 |
}); |
69 |
}); |
70 |
}); |
71 |
|
72 |
$( "#easybib_form" ).submit(function( event ) { |
73 |
event.preventDefault(); |
74 |
var recordSelected = []; |
75 |
var totalSeleceted; |
76 |
$.each($(".easycheck:checked"), function(){ |
77 |
recordSelected.push($(this).val()); |
78 |
}); |
79 |
if ( recordSelected.length > 0 ) { |
80 |
totalSelected = recordSelected.join( "/" ); |
81 |
$.ajax({ |
82 |
url: "/cgi-bin/koha/opac-downloadcart.pl", |
83 |
contentType: "application/x-www-form-urlencoded; charset=UTF-8", |
84 |
type: "post", |
85 |
data: { format: "ris", bib_list: totalSelected }, |
86 |
success: function( data ){ |
87 |
$( "#easybibTextArea" ).html(data); |
88 |
$( "#ris_form" ).submit(); |
89 |
$( "#closeEasyBibModal" ).click(); |
90 |
} |
91 |
}); |
92 |
} else { |
93 |
alert ( MSG_NO_EASYBIB_TITLE_SELECTED ); |
94 |
} |
95 |
}); |
96 |
|
97 |
//EasyBib for opac detail record and populate data |
98 |
$(document).ready(function(){ |
99 |
$( "#easybib_menu" ).click(function( event ){ |
100 |
event.preventDefault(); |
101 |
var bibNumber = $( this ).data( "bibnum" ); |
102 |
$.ajax({ |
103 |
url: "/cgi-bin/koha/opac-export.pl", |
104 |
contentType: "application/x-www-form-urlencoded; charset=UTF-8", |
105 |
type: "get", |
106 |
data: { op: "export", bib: bibNumber, format: "ris" }, |
107 |
success: function( data ){ |
108 |
$( "#easybibTextArea" ).html(data); |
109 |
$( "#ris_form" ).submit(); |
110 |
} |
111 |
}); |
112 |
return false; |
113 |
}); |
114 |
}); |