$("h3").attr("class","expanded").attr("title",MSG_CLICK_TO_EXPAND);
var collapsible = $(".collapsed,.expanded");
- $(collapsible).toggle(
- function () {
+ $(collapsible).on("click",function(){
+ var panel = $(this).next("div");
+ if(panel.is(":visible")){
$(this).addClass("collapsed").removeClass("expanded").attr("title",MSG_CLICK_TO_EXPAND);
- $(this).next("div").hide();
- },
- function () {
+ panel.hide();
+ } else {
$(this).addClass("expanded").removeClass("collapsed").attr("title",MSG_CLICK_TO_COLLAPSE);
- $(this).next("div").show();
+ panel.show();
}
- );
+ });
if ( to_highlight ) {
var words = to_highlight.split( ' ' );
});
var loaded = 0;
- $("#switchview").toggle(
- function () {
- $(this).text(_("view labeled"));
- $("#labeledmarc").hide();
- if(!loaded){
- $("#plainmarc").show().html("<div style=\"margin:1em;padding:1em;border:1px solid #EEE;font-size:150%;\"><img src=\"[% interface %]/[% theme %]/images/loading.gif\" /> "+_("Loading")+"...</div>").load("/cgi-bin/koha/opac-showmarc.pl","id=[% biblionumber %]&viewas=html");
- loaded = 1;
+ var toggle = 0;
+ $("#switchview").on("click",function(e){
+ e.preventDefault();
+ if( toggle == 0){
+ $(this).text(_("view labeled"));
+ $("#labeledmarc").hide();
+ if(!loaded){
+ $("#plainmarc").show().html("<div style=\"margin:1em;padding:1em;border:1px solid #EEE;font-size:150%;\"><img src=\"[% interface %]/[% theme %]/images/loading.gif\" /> "+_("Loading")+"...</div>").load("/cgi-bin/koha/opac-showmarc.pl","id=[% biblionumber %]&viewas=html");
+ loaded = 1;
+ } else {
+ $("#plainmarc").show();
+ }
+ toggle = 1;
} else {
- $("#plainmarc").show();
+ $(this).text(_("view plain"));
+ $("#labeledmarc").show();
+ $("#plainmarc").hide();
+ toggle = 0;
}
- },
- function () {
- $(this).text(_("view plain"));
- $("#labeledmarc").show();
- $("#plainmarc").hide();
- }
- );
+ });
});
[% END %]
//]]>
});
var loaded = 0;
- $("#switchview").toggle(
- function () {
- $(this).text(_("view labeled"));
- $("#labeledmarc").hide();
- if(!loaded){
- $("#plainmarc").show().html("<div style=\"margin:1em;padding:1em;border:1px solid #EEE;font-size:150%;\"><img src=\"[% interface %]/[% theme %]/images/loading.gif\" /> "+_("Loading")+"...</div>").load("/cgi-bin/koha/opac-showmarc.pl","id=[% biblionumber %]&viewas=html");
- loaded = 1;
+ var toggle = 0;
+ $("#switchview").on("click",function(e){
+ e.preventDefault();
+ if( toggle == 0){
+ $(this).text(_("view labeled"));
+ $("#labeledmarc").hide();
+ if(!loaded){
+ $("#plainmarc").show().html("<div style=\"margin:1em;padding:1em;border:1px solid #EEE;font-size:150%;\"><img src=\"[% interface %]/[% theme %]/images/loading.gif\" /> "+_("Loading")+"...</div>").load("/cgi-bin/koha/opac-showmarc.pl","id=[% biblionumber %]&viewas=html");
+ loaded = 1;
+ } else {
+ $("#plainmarc").show();
+ }
+ toggle = 1;
} else {
- $("#plainmarc").show();
+ $(this).text(_("view plain"));
+ $("#labeledmarc").show();
+ $("#plainmarc").hide();
+ toggle = 0;
}
- },
- function () {
- $(this).text(_("view plain"));
- $("#labeledmarc").show();
- $("#plainmarc").hide();
- }
- );
+ });
});
[% END %]
//]]>