|
Lines 172-213
Link Here
|
| 172 |
[% BLOCK jsinclude %] |
172 |
[% BLOCK jsinclude %] |
| 173 |
<script> |
173 |
<script> |
| 174 |
[% IF ( OPACXSLTDetailsDisplay ) %] |
174 |
[% IF ( OPACXSLTDetailsDisplay ) %] |
| 175 |
$(document).ready(function(){ |
175 |
$(document).ready(function(){ |
| 176 |
$.ajaxSetup({ |
176 |
var loaded = 0; |
| 177 |
error:function(x,e){ |
177 |
var toggle = 0; |
| 178 |
switch (x.status) { |
178 |
$("#switchview").on("click",function(e){ |
| 179 |
case 200: break; |
179 |
e.preventDefault(); |
| 180 |
default: |
180 |
if( toggle == 0){ |
| 181 |
$('#switchview').parent().html("<div class=\"dialog alert\">"+_("Sorry, plain view is temporarily unavailable")+".</div>"); |
181 |
$(this).text(_("view labeled")); |
| 182 |
$("#plainmarc").hide(); |
182 |
$("#labeledmarc").hide(); |
| 183 |
$("#labeledmarc").show(); |
183 |
if(!loaded){ |
| 184 |
break; |
184 |
$("#plainmarc").show().html("<div style=\"margin:1em;padding:1em;border:1px solid #EEE;font-size:150%;\"><img src=\"[% interface | html %]/[% theme | html %]/images/loading.gif\" /> "+_("Loading")+"...</div>"); |
| 185 |
} |
185 |
var plain_marc = $.get( "/cgi-bin/koha/opac-showmarc.pl", { id: "[% biblio.biblionumber | html %]", viewas: "html" }) |
| 186 |
} |
186 |
.done(function( data ) { |
| 187 |
}); |
187 |
$("#plainmarc").html( data ); |
| 188 |
|
188 |
loaded = 1; |
| 189 |
var loaded = 0; |
189 |
}) |
| 190 |
var toggle = 0; |
190 |
.fail(function() { |
| 191 |
$("#switchview").on("click",function(e){ |
191 |
$('#switchview').parent().html("<div class=\"dialog alert\">"+_("Sorry, plain view is temporarily unavailable")+".</div>"); |
| 192 |
e.preventDefault(); |
192 |
$("#plainmarc").hide(); |
| 193 |
if( toggle == 0){ |
193 |
$("#labeledmarc").show(); |
| 194 |
$(this).text(_("view labeled")); |
194 |
}); |
| 195 |
$("#labeledmarc").hide(); |
195 |
} else { |
| 196 |
if(!loaded){ |
196 |
$("#plainmarc").show(); |
| 197 |
$("#plainmarc").show().html("<div style=\"margin:1em;padding:1em;border:1px solid #EEE;font-size:150%;\"><img src=\"[% interface | html %]/[% theme | html %]/images/loading.gif\" /> "+_("Loading")+"...</div>").load("/cgi-bin/koha/opac-showmarc.pl","id=[% biblio.biblionumber | html %]&viewas=html"); |
197 |
} |
| 198 |
loaded = 1; |
198 |
toggle = 1; |
| 199 |
} else { |
199 |
} else { |
| 200 |
$("#plainmarc").show(); |
200 |
$(this).text(_("view plain")); |
|
|
201 |
$("#labeledmarc").show(); |
| 202 |
$("#plainmarc").hide(); |
| 203 |
toggle = 0; |
| 201 |
} |
204 |
} |
| 202 |
toggle = 1; |
205 |
}); |
| 203 |
} else { |
|
|
| 204 |
$(this).text(_("view plain")); |
| 205 |
$("#labeledmarc").show(); |
| 206 |
$("#plainmarc").hide(); |
| 207 |
toggle = 0; |
| 208 |
} |
| 209 |
}); |
206 |
}); |
| 210 |
}); |
|
|
| 211 |
[% END %] |
207 |
[% END %] |
| 212 |
</script> |
208 |
</script> |
| 213 |
[% END %] |
209 |
[% END %] |
| 214 |
- |
|
|