Minor JavaScript fixes

Move some JavaScript to the external file, and make sure that the
modified warning doesn't pop up when "Cancel" is used.
This commit is contained in:
Jesse Weaver 2009-10-20 12:18:09 -06:00
parent 8dbf0810a1
commit 038c380bd6
2 changed files with 18 additions and 17 deletions

View file

@ -57,4 +57,20 @@ $( document ).ready( function () {
return _( "You have made changes to system preferences." );
}
}
$("h3").attr("class","expanded").attr("title",_("Click to expand this section"));
var collapsible = $(".collapsed,.expanded");
$(collapsible).toggle(
function () {
$(this).addClass("collapsed").removeClass("expanded").attr("title",_("Click to expand this section"));
$(this).next("table").hide();
},
function () {
$(this).addClass("expanded").removeClass("collapsed").attr("title",_("Click to collapse this section"));
$(this).next("table").show();
}
);
$( '.prefs-tab .action .cancel' ).click( function () { KOHA.Preferences.Modified = false } );
} );

View file

@ -8,23 +8,8 @@
<script src="<!-- TMPL_VAR NAME="themelang" -->/js/pages/preferences.js" type="text/javascript"></script>
<script src="<!-- TMPL_VAR NAME="themelang" -->/lib/jquery/plugins/jquery.highlight-3.js" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
$(document).ready(function(){
$("h3").attr("class","expanded").attr("title",_("Click to expand this section"));
var collapsible = $(".collapsed,.expanded");
$(collapsible).toggle(function () {
$(this).addClass("collapsed").removeClass("expanded").attr("title",_("Click to expand this section"));
$(this).next("table").hide();
},
function () {
$(this).addClass("expanded").removeClass("collapsed").attr("title",_("Click to collapse this section"));
$(this).next("table").show();
}
);
});
//<![CDATA[
// This is here because of its dependence on template variables, everything else should go in js/pages/preferences.js - jpw
<!-- TMPL_IF NAME="searchfield" -->
var to_highlight = "<!-- TMPL_VAR NAME="searchfield" ESCAPE="JS"-->";