Skip to content

Commit

Permalink
Merge pull request #31 from readium/develop
Browse files Browse the repository at this point in the history
Merging in latest stuff from develop
  • Loading branch information
ryanackley committed Feb 8, 2014
2 parents ac9733e + 921f489 commit 5c00fa1
Show file tree
Hide file tree
Showing 9 changed files with 163 additions and 24 deletions.
37 changes: 36 additions & 1 deletion css/viewer.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
display:none;
}

.about-message{
margin: 20px 0px;
}

#about-dialog .version{
margin-top: 10px;
font-weight: bold;
}

#readium-toc-body{
display: none;
Expand Down Expand Up @@ -148,14 +156,41 @@
float: left;
position: relative;
border-right: 1px solid #888;
padding-right: 20px;
display: none;
}
#audioplayer.isPlaying {
background-color: rgba(0,255,0,0.1);
}

#audioplayer button[disabled],
#audioplayer input[disabled] {
opacity: 0.3;
}

#btn-toggle-audio:not(.pause-audio) > #icon-pause {
display: none;
}
#btn-toggle-audio.pause-audio > #icon-play {
display: none;
}

#btn-audio-volume:not(.no-volume) > #icon-volume-off {
display: none;
}
#btn-audio-volume.no-volume > #icon-volume-on {
display: none;
}

#btn-touch-audio:not(.no-touch) > #icon-touch-off {
display: none;
}
#btn-touch-audio.no-touch > #icon-touch-on {
display: none;
}

#icon-touch-hand {
margin-right: -0.4em;
}

#volume-range-slider {
position: relative;
Expand Down
1 change: 0 additions & 1 deletion epub_content/epub_library.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,5 @@
"packagePath" : "EPUB/package.opf",
"rootUrl" : "epub_content/linear-algebra"
}

]

13 changes: 10 additions & 3 deletions i18n/Strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,20 @@ function(de, en_US, fr, id, it, ja, ko, pt_BR, zh_CN, zh_TW){
Strings['zh_TW'] = zh_TW;

var language = navigator.userLanguage || navigator.language;

console.log("Language: [" + language + "]");

var allowEnglishFallback = true;

var i18nStr = Strings[language] || en_US;

var i18nObj = JSON.parse(i18nStr);
var i18nObj_en = i18nStr === en_US ? i18nObj : JSON.parse(en_US);

for(var prop in i18nObj){
i18nObj[prop] = i18nObj[prop].message;
for(var prop in i18nObj_en){
var okay = prop in i18nObj;
if (!okay) console.log("Language [" + language + "], missing string: [" + prop + "]");

i18nObj[prop] = okay ? i18nObj[prop].message : (allowEnglishFallback ? ("* " + i18nObj_en[prop].message + " *") : "");
}
return i18nObj;

Expand Down
37 changes: 35 additions & 2 deletions i18n/_locales/en_US/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
"message" : "Add Book To Readium Library:"
},
"i18n_add_book" : {
"message" : "Add Book"
"message" : "Add to Library"
},
"i18n_cancel" : {
"message" : "Cancel"
Expand Down Expand Up @@ -229,7 +229,40 @@
"message" : "DISPLAY FORMAT"
},
"i18n_html_readium_tm_a_project" : {
"message" : "Readium<sup>TM</sup>, a project of the International Digital Publishing Forum (IDPF) and supporters, is an open source reference system and rendering engine for EPUB&reg; publications. To learn more, visit the <a href=\"http://readium.org/\">project homepage</a>. To date, the project development has been lead by <a href=\"http://evidentpoint.com/\">Evident Point</a> and <a href=\"http://www.bluefirereader.com/\">Bluefire Productions</a>. To contribute visit the <a href=\"https://github.com/readium/readium-js-viewer\">github repository</a>"
"message" : "Readium for Chrome is the Chrome browser extension configuration of ReadiumJS, an open source reading system and JavaScript library for displaying EPUB® publications in web browsers. ReadiumJS is a project of the Readium Foundation (Readium.org). To learn more or to contribute, visit the <a href=\"http://readium.org/projects/readiumjs\">project homepage</a>"
},
"i18n_audio_play" : {
"message" : "Play"
},
"i18n_audio_pause" : {
"message" : "Pause"
},
"i18n_audio_previous" : {
"message" : "Previous audio phrase"
},
"i18n_audio_next" : {
"message" : "Next audio phrase"
},
"i18n_audio_volume" : {
"message" : "Audio volume"
},
"i18n_audio_mute" : {
"message" : "Mute audio"
},
"i18n_audio_unmute" : {
"message" : "Unmute audio"
},
"i18n_audio_touch_enable" : {
"message" : "Enable touch-to-play"
},
"i18n_audio_touch_disable" : {
"message" : "Disable touch-to-play"
},
"i18n_page_previous" : {
"message" : "P̲revious Page"
},
"i18n_page_next" : {
"message" : "N̲ext Page"
},
"chrome_accept_languages": {
"message": "$CHROME$ accepts $languages$ languages",
Expand Down
33 changes: 33 additions & 0 deletions i18n/_locales/fr/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,39 @@
"i18n_html_readium_tm_a_project" : {
"message" : "Readium<sup>TM</sup>, un projet de l'International Digital Publishing Forum (IDPF) et de ses adhérents, est un système à code-source libre de référence et un moteur de rendu pour les publications EPUB&reg;. Pour en savoir plus, visitez <a href=\"http://readium.org/\">la page du projet</a>. À ce jour, le développement du projet a été menée par <a href=\"http://evidentpoint.com/\">Evident Point</a> et par <a href=\"http://www.bluefirereader.com/\">Bluefire Productions</a>. Pour contribuer, visiter le <a href=\"https://github.com/readium/readium\">dépôt github</a>."
},
"i18n_audio_play" : {
"message" : "Jouer"
},
"i18n_audio_pause" : {
"message" : "Pauser"
},
"i18n_audio_previous" : {
"message" : "Phrase audio précédente"
},
"i18n_audio_next" : {
"message" : "Phrase audio suivante"
},
"i18n_audio_volume" : {
"message" : "Contrôle du volume audio"
},
"i18n_audio_mute" : {
"message" : "Silence audio"
},
"i18n_audio_unmute" : {
"message" : "Restaurer le volume audio"
},
"i18n_audio_touch_enable" : {
"message" : "Activer la function 'toucher pour jouer'"
},
"i18n_audio_touch_disable" : {
"message" : "Désactiver la function 'toucher pour jouer'"
},
"i18n_page_previous" : {
"message" : "Page précédente (P̲)"
},
"i18n_page_next" : {
"message" : "Page suivante (N̲)"
},
"chrome_accept_languages": {
"message": "$CHROME$ accepts $languages$ languages",
"placeholders": {
Expand Down
27 changes: 24 additions & 3 deletions lib/EpubReader.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ define(['module','jquery', 'bootstrap', 'URIjs', 'Readium', 'Spinner', 'storage/
$('.modal-backdrop').remove();
var $appContainer = $('#app-container');
$appContainer.empty();
$appContainer.append(ReaderBody({}));
$appContainer.append(ReaderBody({strings: Strings}));
$appContainer.append(AboutDialog({strings: Strings}));
$('nav').empty();
$('nav').append(ReaderNavbar({strings: Strings}));
Expand Down Expand Up @@ -330,21 +330,38 @@ define(['module','jquery', 'bootstrap', 'URIjs', 'Readium', 'Spinner', 'storage/

readium.reader.on(ReadiumSDK.Events.MEDIA_OVERLAY_STATUS_CHANGED, function (value) {

var $audioPlayer = $('#audioplayer');
var $audioPlayerControls = $('#audioplayer button, #audioplayer input');

if (readium.reader.isMediaOverlayAvailable()) {
$('#audioplayer').show();
$audioPlayer.show();
$audioPlayerControls.attr('disabled', false);

var isPlaying = 'isPlaying' in value
? value.isPlaying // for all the other events
: true; // for events raised by positionChanged, as `isPlaying` flag isn't even set
$toggleAudioBtn.toggleClass('pause-audio', isPlaying);
$audioPlayer.toggleClass('isPlaying', isPlaying);
} else {
$audioPlayerControls.attr('disabled', true);
}
});

var $buttonTouch = $('#btn-touch-audio');
$buttonTouch.on("click", function() {
var noTouch = $buttonTouch.hasClass('no-touch');
if (noTouch) {
$buttonTouch.removeClass('no-touch');
} else {
$buttonTouch.addClass('no-touch');
}

readium.reader.updateSettings({
doNotUpdateView: true,
mediaOverlaysEnableClick: noTouch
});
});

var $changeVolumeControl = $('#volume-range-slider'),
$volumeButton = $('#btn-audio-volume');

Expand All @@ -368,8 +385,12 @@ define(['module','jquery', 'bootstrap', 'URIjs', 'Readium', 'Spinner', 'storage/
volumeButtonAppearance($volumeButton, volumeVal);
});

var _lastVolumeBeforeMute = '0';

$volumeButton.on("click", function() {
var volumeVal = '0';
var currentVolume = $changeVolumeControl.val();
var volumeVal = currentVolume === '0' ? _lastVolumeBeforeMute : '0';
_lastVolumeBeforeMute = currentVolume;

//readium.reader.setVolumeMediaOverlay(volumeVal);
readium.reader.updateSettings({
Expand Down
13 changes: 7 additions & 6 deletions templates/about-dialog.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<div>
<div class="splash-logo">
<img src="/images/about_readium_logo.png">
</div>
<p>
<span id="i18n_html_readium_tm_a_project">{{{strings.i18n_html_readium_tm_a_project}}}</span>
</p>
<div class="about-message">
<span>{{{strings.i18n_html_readium_tm_a_project}}}</span>
</div>
<div>
<img src="/images/partner_logos.png">
</div>
<img src="/images/partner_logos.png">
</div>
<div class="version">Version 2.12.3, released February 7, 2014</div>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
Expand Down
6 changes: 3 additions & 3 deletions templates/reader-body.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<div id="readium-toc-body">
</div>
<div id="reading-area">
<!-- Previous page -->
<a accesskey="p" href="#" id="previous-page-btn" class="page-switch-overlay-icon" role="button" title="P̲revious Page" style="z-index:1">
<!-- Previous page -->
<a accesskey="p" href="#" id="previous-page-btn" class="page-switch-overlay-icon" role="button" title="{{strings.i18n_page_previous}}" style="z-index:1">
<img src="images/pagination1.svg">
</a>
<!-- Next page -->
<a accesskey="n" href="#" id="next-page-btn" class="page-switch-overlay-icon" role="button" title="N̲ext Page" style="z-index:1">
<a accesskey="n" href="#" id="next-page-btn" class="page-switch-overlay-icon" role="button" title="{{strings.i18n_page_next}}" style="z-index:1">
<img src="images/pagination1.svg">
</a>
<div id="epub-reader-container">
Expand Down
20 changes: 15 additions & 5 deletions templates/reader-navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,30 @@

<!--Audioplayer Controls START-->
<div id="audioplayer">
<button id="btn-previous-audio" type="button" class="btn icon-previous-audio" disabled>
<button id="btn-previous-audio" type="button" class="btn icon-previous-audio" title="{{strings.i18n_audio_previous}}" disabled>
<span class="glyphicon glyphicon-backward"></span>
</button>
<button id="btn-toggle-audio" type="button" class="btn icon-play-audio" disabled>
<span class="glyphicon glyphicon-play"></span>
<span id="icon-play" class="glyphicon glyphicon-play" title="{{strings.i18n_audio_play}}"></span>
<span id="icon-pause" class="glyphicon glyphicon-pause" title="{{strings.i18n_audio_pause}}"></span>
</button>
<button id="btn-next-audio" type="button" class="btn icon-next-audio" disabled>
<button id="btn-next-audio" type="button" class="btn icon-next-audio" title="{{strings.i18n_audio_next}}" disabled>
<span class="glyphicon glyphicon-forward"></span>
</button>

<button id="btn-audio-volume" type="button" class="btn icon-audio-volume" disabled>
<span class="glyphicon glyphicon-volume-up"></span>
<span id="icon-volume-on" class="glyphicon glyphicon-volume-up" title="{{strings.i18n_audio_mute}}"></span>
<span id="icon-volume-off" class="glyphicon glyphicon-volume-off" title="{{strings.i18n_audio_unmute}}"></span>
</button>
<input id="volume-range-slider" type="range" min="0" max="100" title="{{strings.i18n_audio_volume}}" disabled />


<button id="btn-touch-audio" type="button" class="btn icon-touch-audio" disabled>
<span id="icon-touch-hand" class="glyphicon glyphicon-hand-up"></span>

<span id="icon-touch-on" class="glyphicon glyphicon-ok" title="{{strings.i18n_audio_touch_disable}}"></span>
<span id="icon-touch-off" class="glyphicon glyphicon-remove" title="{{strings.i18n_audio_touch_enable}}"></span>
</button>
<input id="volume-range-slider" type="range" min="0" max="100" disabled />
</div>
<!--Audioplayer Controls END-->
<button type="button" class="btn icon-library" title="{{strings.view_library}}">
Expand Down

0 comments on commit 5c00fa1

Please sign in to comment.