Skip to content

Commit

Permalink
HTML5 - New info added to language file for mediaelement controls, gl…
Browse files Browse the repository at this point in the history
…ossary button, error messages, kblang, tick/cross images. Fixed bug so narration bar width now updates if full screen and window size is changed

git-svn-id: https://xerteonlinetoolkits.googlecode.com/svn/trunk@505 912cdd6b-5c7d-d5a7-a2ba-d0f0cdb91641
  • Loading branch information
FayCross committed Nov 16, 2012
1 parent 5681900 commit 5e6f3d9
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 13 deletions.
29 changes: 28 additions & 1 deletion languages/engine_en-GB.xml
Expand Up @@ -12,6 +12,8 @@

<pageHelp name="Page Help" description="Page Help" toClose="Press Space to close help"/>

<glossaryButton label="Glossary" description="Glossary Button. "/>

<continueButton label="Continue" description="Continue Button"/>

<toc label="Table of Contents" description="table of contents. Use the arrow keys to select a page. Press space to go to that page.">
Expand All @@ -20,7 +22,25 @@
<gotoPageButton label="Go to Page" description="Go to Page Button"/>
</toc>

<glossary label="Glossary" description="A list of words and their definitions.">
<closeButton label="" description="Close glossary list button"/>
</glossary>

<kbLanguage label="Special Characters" description="A list of buttons which add special characters to text areas">
<closeButton label="" description="Close special character list button"/>
</kbLanguage>

<textToSpeech label="null" description="Text to Speech"/>

<errorProject label="The project data has not loaded."/>

<errorPage label="No template is currently available for this page type."/>

<errorFlash label="You need to install the Flash Player to view this content." description="Get the Flash Player"/>

<tick label="Tick"/>

<cross label="Cross"/>

<themes label="--Colour Schemes--" description="Colour Scheme Options">
<item>default</item>
Expand Down Expand Up @@ -79,6 +99,14 @@
<loader label="Loading: "/>
</movieController>

<mediaElementControls>
<stopButton label="Stop" description="Stop Media Button"/>
<playPauseButton label="Play/Pause" description="Play/Pause Media Button"/>
<muteButton label="Mute Toggle" description="Toggle Mute Button"/>
<fullscreenButton label="Fullscreen" description="Fullscreen Movie Button"/>
<captionsButton label="Captions/Subtitles" description="Show/Hide Captions Button"/>
</mediaElementControls>

<interactions>
<button name="Button"/>
<radioButton selected="selected. Use the arrow keys to choose from the options"/>
Expand All @@ -89,7 +117,6 @@
<textEntry name="Text Entry Box" selected="Text entry box selected"/>
<targetArea name="Target Area" description="Drop zone for" toSelect="Press space to drop the selected item."/>
<draggableItem name="Draggable Item" selected="Item Selected" toSelect="Press space to select" deSelected="No item selected." />

</interactions>

</language>
41 changes: 30 additions & 11 deletions modules/xerte/parent_templates/Nottingham/common_html5/js/xenith.js
Expand Up @@ -15,6 +15,7 @@ var x_firstLoad = true;
var x_fillWindow = false;
var x_volume = 1;
var x_audioBarH = 30;
var x_mediaText = [];
var x_timer; // use as reference to any timers in page models - they are cancelled on page change

var $x_window, $x_body, $x_head, $x_mainHolder, $x_mobileScroll, $x_headerBlock, $x_pageHolder, $x_pageDiv, $x_footerBlock, $x_footerL, $x_menuBtn, $x_prevBtn, $x_pageNo, $x_nextBtn, $x_background, $x_glossaryHover;
Expand Down Expand Up @@ -583,6 +584,16 @@ function x_setUp() {
"filter" :"alpha(opacity=" + alpha + ")"
});
}

// store language data for mediaelement buttons - use fallbacks in mediaElementText array if no lang data
var mediaElementText = [{name:"stopButton", label:"Stop", description:"Stop Media Button"},{name:"playPauseButton", label:"Play/Pause", description:"Play/Pause Media Button"},{name:"muteButton", label:"Mute Toggle", description:"Toggle Mute Button"},{name:"fullscreenButton", label:"Fullscreen", description:"Fullscreen Movie Button"},{name:"captionsButton", label:"Captions/Subtitles", description:"Show/Hide Captions Button"}];

for (var i=0; i<mediaElementText.length; i++) {
var mediaTextObj = new Object();
mediaTextObj.label = x_getLangInfo(x_languageData.find("mediaElementControls").find(mediaElementText[i].name)[0], "label", mediaElementText[i].label[0]);
mediaTextObj.description = x_getLangInfo(x_languageData.find("mediaElementControls").find(mediaElementText[i].name)[0], "description", mediaElementText[i].description[0]);
x_mediaText.push(mediaTextObj);
}

x_navigateToPage({type:'page', ID:0});
x_navigateToPage(x_startPage);
Expand Down Expand Up @@ -669,16 +680,7 @@ function x_setUpPage() {
if (x_pageInfo[0].type == "menu") {
$x_menuBtn.button("enable");
}
if (x_currentPageXML.getAttribute("narration") != null && x_currentPageXML.getAttribute("narration") != "") {
$("#x_footerBlock div:first").before('<div id="x_pageNarration"></div>');
$("#x_footerBlock #x_pageNarration").mediaPlayer({
type :"audio",
source :x_currentPageXML.getAttribute("narration"),
width :"100%",
autoPlay :x_currentPageXML.getAttribute("playNarration"),
autoNavigate:x_currentPageXML.getAttribute("narrationNavigate")
});
}
x_addNarration();
}

$("#x_headerBlock h2").html(pageTitle);
Expand Down Expand Up @@ -718,6 +720,19 @@ function x_pageLoaded() {
.fadeIn();
}

function x_addNarration() {
if (x_currentPageXML.getAttribute("narration") != null && x_currentPageXML.getAttribute("narration") != "") {
$("#x_footerBlock div:first").before('<div id="x_pageNarration"></div>');
$("#x_footerBlock #x_pageNarration").mediaPlayer({
type :"audio",
source :x_currentPageXML.getAttribute("narration"),
width :"100%",
autoPlay :x_currentPageXML.getAttribute("playNarration"),
autoNavigate:x_currentPageXML.getAttribute("narrationNavigate")
});
}
}

// function returns correct phrase from language file or uses fallback if no matches / no language file
function x_getLangInfo(node, attribute, fallBack) {
var string = fallBack;
Expand All @@ -735,7 +750,11 @@ function x_getLangInfo(node, attribute, fallBack) {
function x_updateCss(updatePage) {
// adjust width of narration controls
if ($("#x_pageNarration").length > 0) {
// ** need to change the narration bar width here **
if ($("#x_pageNarration audio").is(":visible")) { // html5 audio tag being used (not flash)
// can't get narration bar width to resize (audio tag not flash) without reloading it
$("#x_pageNarration").remove();
x_addNarration();
}
}
if ($("audio,video").length > 0) {
$("audio,video").each(function() {
Expand Down
Expand Up @@ -31,6 +31,12 @@
startVolume: x_volume,
alwaysShowControls: true,
pauseOtherPlayers: true,
enableAutosize: true,
playpauseText: x_mediaText[1].label,
muteText: x_mediaText[2].label,
fullscreenText: x_mediaText[3].label,
stopText: x_mediaText[0].label,
tracksText: x_mediaText[4].label,
success: function (mediaElement, domObject) {
if (opts.autoNavigate == "true" && x_currentPage + 1 != x_pages.length) { // go to next page when media played to end
mediaElement.addEventListener("ended", function() {
Expand Down
Expand Up @@ -72,7 +72,6 @@
endTag = "</li>";
}
for (var i=0; i<bulletArray.length; i++) {
console.log(bulletArray[i]);
if (bulletArray[i] != "" && $.trim(bulletArray[i]) != "") {
contentsStr += startTag + bulletArray[i] + endTag;
}
Expand Down

0 comments on commit 5e6f3d9

Please sign in to comment.