Skip to content
Snippets Groups Projects
Commit 564e04e1 authored by Goik Martin's avatar Goik Martin
Browse files

Externalizing Javascript code, rebasing on jquery

parent ac53c4a0
No related branches found
No related tags found
No related merge requests found
......@@ -3,7 +3,8 @@
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:d="http://docbook.org/ns/docbook"
xmlns:m="http://www.w3.org/1998/Math/MathML"
exclude-result-prefixes="d xs"
xmlns="http://www.w3.org/1999/xhtml"
exclude-result-prefixes="d xs m"
version="2.0">
<xsl:variable name="n">
......@@ -13,23 +14,7 @@
<xsl:param name="toggleDisplayScript">
<script xmlns="http://www.w3.org/1999/xhtml" type="text/javascript"> <!-- goiks extension head start -->
"use strict";
function toggleDisplay(inputElement) {
var divElement = inputElement.nextElementSibling;
switch(divElement.style.visibility) {
case 'hidden':
divElement.style.visibility = 'visible';
inputElement.setAttribute('value', '-');
break;
default:
divElement.style.visibility = 'hidden';
inputElement.setAttribute('value', '+');
break;
}
}
</script>
<script src="docbooksupplement.js"></script>
</xsl:param>
<!--Allow for opening and closing of answers -->
......@@ -53,8 +38,8 @@
</xsl:if>
</td>
<td align="{$direction.align.start}" valign="top">
<input onclick="toggleDisplay(this)" type="button" value="+"/> <!--goik: start "header" clickable answer modification -->
<div style="visibility:hidden;"> <!--goik: end "header" clickable answer modification -->
<input class="hideSolution" type="button" /> <!--goik: start "header" clickable answer modification -->
<div> <!--goik: end "header" clickable answer modification -->
<xsl:apply-templates select="*[local-name(.) != 'label' and local-name(.) != 'qandaentry']"/>
<!-- * handle nested answer/qandaentry instances -->
<!-- * (bug 1509043 from Daniel Leidert) -->
......
jQuery.fn.extend({
toggleVisibilityState: function() {
var ATT_TOGGLE_VALUES = [
// attribute, closed state , open state
['value', '+', '-'],
['title', 'open solution (Did you try hard enough yourself?)', 'Close solution']
];
var nextIndex;
switch(this.attr(ATT_TOGGLE_VALUES[0][0])) { // First attribute defines reference
case ATT_TOGGLE_VALUES[0][1]:
nextIndex = 2; break;
default:
nextIndex = 1; break;
}
for (var r in ATT_TOGGLE_VALUES) {
this.attr(ATT_TOGGLE_VALUES[r][0], ATT_TOGGLE_VALUES[r][nextIndex]);
}
}
});
$(document).ready(
function () {
$(".hideSolution").next().toggle(0); // Show or hide first following sibling
$(".hideSolution").toggleVisibilityState(); // Initialization
$(".hideSolution").click(
function () {
$(this).toggleVisibilityState();
$(this).next().slideToggle(); // Show or hide first following sibling
}
);
}
);
......@@ -82,7 +82,7 @@ SAXONCMD=java -cp "${DBOOK_XSL}/tools/lib/saxon9he.jar:/usr/share/java/xercesImp
-xsl:${DBOOK_XSL_PREPROCESS}/Xsl/docbook2print.xsl > ${*}.print.xml
cd $(@D); ${SAXONCMD} -s:$(<F) -xsl:${DBOOK_XSL_PREPROCESS}/Xsl/docbookExtractFig.xsl
tar cv- `find . -name Ref -and -type d|grep -v ^\./target`|tar -x -C $(@D)
cp -f ${DBOOK_XSL_PREPROCESS}/make.image $(@D)
cp -f ${DBOOK_XSL_PREPROCESS}/make.image ${DBOOK_XSL_PREPROCESS}/docbooksupplement.js $(@D)
cd $(@D); $(MAKE) -j ${numCores} -f make.image; rm -rf `find . -name Generate`
# Webhelp and indexing
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment