|
Lines 1-7
Link Here
|
| 1 |
/* global __ total_pages */ |
1 |
/* global __ total_pages */ |
| 2 |
//z3950_search.js for Authorities, Bib records and Acquisitions module |
2 |
//z3950_search.js for Authorities, Bib records and Acquisitions module |
| 3 |
|
3 |
|
| 4 |
var last_action, previewed = 0; |
4 |
var last_action; |
| 5 |
|
5 |
|
| 6 |
function validate_goto_page() { |
6 |
function validate_goto_page() { |
| 7 |
var page = $('#goto_page').val(); |
7 |
var page = $('#goto_page').val(); |
|
Lines 108-135
$( document ).ready( function() {
Link Here
|
| 108 |
} |
108 |
} |
| 109 |
}); |
109 |
}); |
| 110 |
|
110 |
|
|
|
111 |
$( "#dataPreview" ).on( "hidden", function() { |
| 112 |
$( "#dataPreviewLabel" ).html( "" ); |
| 113 |
$( "#dataPreview .modal-body" ).html( "<div id='loading'><img src='" + interface + "/" + theme + "/img/spinner-small.gif' alt='' /> " + __("Loading") + "</div>" ); |
| 114 |
}); |
| 115 |
|
| 111 |
$( "#resultst" ).on("click", ".previewData", function(e) { |
116 |
$( "#resultst" ).on("click", ".previewData", function(e) { |
| 112 |
e.preventDefault(); |
117 |
e.preventDefault(); |
| 113 |
previewed = 1; |
118 |
ChangeLastAction( $(this).data('action'), $(this).attr('title') ); |
| 114 |
ChangeLastAction( $(this).attr('title'), 1 ); |
119 |
var long_title = $( this ).text(); |
| 115 |
var ltitle = $( this ).text(); |
|
|
| 116 |
var page = $( this ).attr( "href" ); |
120 |
var page = $( this ).attr( "href" ); |
| 117 |
$( "#dataPreviewLabel" ).text( ltitle ); |
121 |
$( "#dataPreviewLabel" ).text( long_title ); |
| 118 |
$( "#dataPreview .modal-body" ).load( page + " div" ); |
122 |
$( "#dataPreview .modal-body" ).load( page + " div" ); |
| 119 |
$( '#dataPreview' ).modal( {show:true} ); |
123 |
$( '#dataPreview' ).modal( {show:true} ); |
| 120 |
}); |
124 |
}); |
| 121 |
|
125 |
|
| 122 |
$( "#dataPreview" ).on( "hidden", function() { |
|
|
| 123 |
$( "#dataPreviewLabel" ).html( "" ); |
| 124 |
$( "#dataPreview .modal-body" ).html( "<div id='loading'><img src='" + interface + "/" + theme + "/img/spinner-small.gif' alt='' /> " + __("Loading") + "</div>" ); |
| 125 |
}); |
| 126 |
|
| 127 |
$( "#resultst" ).on("click", ".chosen", function(e) { |
126 |
$( "#resultst" ).on("click", ".chosen", function(e) { |
| 128 |
e.preventDefault(); |
127 |
e.preventDefault(); |
| 129 |
var action = $(this).data('action'); |
128 |
var action = $(this).data('action'); |
| 130 |
ChangeLastAction( action, 0 ); |
129 |
ChangeLastAction( action ); |
| 131 |
if( action == 'order' ) window.location = $(this).attr('href'); |
130 |
if( action == 'order' ) window.location = $(this).attr('href'); |
| 132 |
else { |
131 |
else { // import |
| 133 |
opener.document.location = $(this).attr('href'); |
132 |
opener.document.location = $(this).attr('href'); |
| 134 |
window.close(); |
133 |
window.close(); |
| 135 |
} |
134 |
} |
|
Lines 140-157
function InitLastAction() {
Link Here
|
| 140 |
if( $("#resultst").length == 0 ) return; |
139 |
if( $("#resultst").length == 0 ) return; |
| 141 |
try { last_action = localStorage.getItem('z3950search_last_action'); } catch (err) {} |
140 |
try { last_action = localStorage.getItem('z3950search_last_action'); } catch (err) {} |
| 142 |
if( last_action ) { |
141 |
if( last_action ) { |
| 143 |
var z3950_action_li = $(".z3950actions:eq(0)").siblings(".dropdown-menu").find("a[data-action='"+last_action+"']"); |
142 |
// get short title from attr |
| 144 |
if( z3950_action_li.length == 0 ) return; |
143 |
var short_title = $(".z3950actions:eq(0)").siblings(".dropdown-menu").find("a[data-action='"+last_action+"']").attr('title'); |
| 145 |
if( last_action != 'show_marc' ) { |
144 |
if( short_title && last_action != 'show_marc' ) { |
| 146 |
$( ".z3950actions" ).text($(z3950_action_li).text()).data('action', last_action); |
145 |
$( ".z3950actions" ).text( short_title ); |
| 147 |
} |
146 |
} |
| 148 |
} |
147 |
} |
| 149 |
} |
148 |
} |
| 150 |
|
149 |
|
| 151 |
function ChangeLastAction(action, change_text) { |
150 |
function ChangeLastAction( action, short_title ) { |
| 152 |
if( last_action && last_action == action ) return; |
151 |
if( last_action && last_action == action ) return; |
| 153 |
last_action = action; |
152 |
last_action = action; |
| 154 |
if( change_text ) $( ".z3950actions" ).text( last_action ); |
153 |
if( short_title ) { // Save choice for preview (MARC or Card) |
| 155 |
if( previewed == 0 || change_text == 1 ) |
154 |
$( ".z3950actions" ).text( short_title ); |
| 156 |
try { localStorage.setItem('z3950search_last_action', last_action); } catch(err) {} |
155 |
try { localStorage.setItem('z3950search_last_action', last_action ); } catch(err) {} |
|
|
156 |
} |
| 157 |
} |
157 |
} |
| 158 |
- |
|
|