// Play normally
$this.pauseAllPlayers();
button.addClass('playing');
- //fb('currently playing: ' + player.src);
+ //console.log('currently playing: ' + player.src);
player.play();
e.preventDefault();
if (this.datas.phonegap == 'android') {
if (types_android[type] != undefined) {
- fb('open pdf file');
+ console.log('open pdf file');
this.displayLoader();
window.requestFileSystem(LocalFileSystem.TEMPORARY, 0, function (fileSystem) {
- fb('got local file system');
- fb('try to resolve url');
+ console.log('got local file system');
+ console.log('try to resolve url');
window.resolveLocalFileSystemURL(url, function (entry) {
- fb('resolved from file');
+ console.log('resolved from file');
window.resolveLocalFileSystemURL(cordova.file.externalDataDirectory, function (dirEntry) {
- fb('resolved to dir');
+ console.log('resolved to dir');
entry.copyTo(dirEntry, 'document.pdf', function (copyEntry) {
- fb('copied file');
+ console.log('copied file');
window.plugins.webintent.startActivity({
action: window.plugins.webintent.ACTION_VIEW,
type: types_android[type],
// If there is a full screen video playing, we must abort any orientation change
// because it will destroy the player and interrupt the video playback.
if (this.fluidbook.video.isVideoFullscreen()) {
- //fb('### Full screen video detected -- aborting Fluidbook orientation change...');
+ //console.log('### Full screen video detected -- aborting Fluidbook orientation change...');
this.fluidbook.video.resizeControls();
return false;
}
// Remove videos before page transition so we can properly handle page turns
// and orientation changes (switching from dual page to single page layout and vice-versa)
$(fluidbook).on('fluidbook.beforePageTransition', function () {
- //fb('triggered beforePageTransition -- ' + $this.fluidbook.resize.orientation + ' --- REMOVING VIDEOS...');
+ //console.log('triggered beforePageTransition -- ' + $this.fluidbook.resize.orientation + ' --- REMOVING VIDEOS...');
$this.removeAllVideos();
});
});
$(window).on('videoFullscreenEntered', function() {
- //fb('>>> Video player entered full screen mode...');
+ //console.log('>>> Video player entered full screen mode...');
$this.fullscreenActive = true;
});
$(window).on('videoFullscreenExited', function() {
- //fb('<<< Video player exited full screen mode.');
+ //console.log('<<< Video player exited full screen mode.');
// Try resizing after a short delay. Depending on the system and the speed of the
setTimeout(function() {
html,
player;
- //fb('Initialising video ID: ' + id);
+ //console.log('Initialising video ID: ' + id);
// Player might be active but not visible so we need to dispose of it before re-initialising the element
if (videojs.players[id]) {
- //fb(id + ' player already active. Disposing...');
+ //console.log(id + ' player already active. Disposing...');
try {
videojs(id).dispose();
}
// if (setup) {
// html += "data-setup='" + setup + "' ";
- // fb('SETUP...');
- // fb(setup);
+ // console.log('SETUP...');
+ // console.log(setup);
// }
//html += 'src="' + path + '.' + this.preferedFormat + '"';
html += '>';
player = videojs(id, setup);
player.ready(function () {
- //fb(id + ' player is ready');
+ //console.log(id + ' player is ready');
$this.resizeControls(); // Make sure player controls are the right size
if (fluidbook.video.players[id]) {
- //fb('found saved settings for player ID ' + id);
+ //console.log('found saved settings for player ID ' + id);
var settings = fluidbook.video.players[id];
//console.log(settings);
}, 50);
player.one('play', function () {
- //fb('Player has started playing... ID: ' + id);
+ //console.log('Player has started playing... ID: ' + id);
// Handle pause in here if needed.. Better than using the timeout...
if (settings.paused) {
- //fb(id + ' should be paused');
+ //console.log(id + ' should be paused');
setTimeout(function () {
player.pause();
}, 100);
});
player.on('pause', function () {
- // fb(id + ' player paused');
+ // console.log(id + ' player paused');
// Show play button (ref: http://stackoverflow.com/a/25296575)
this.bigPlayButton.show();
});
// player.on('fullscreenchange', function() {
- // fb('Entering or exiting fullscreen... resetting control sizes #' + player.id());
+ // console.log('Entering or exiting fullscreen... resetting control sizes #' + player.id());
// Note: this doesn't work because the fluidbookresize gets called multiple times after this fires and that overrides this change
// $('#' + player.id()).attr('style', ''); // Reset inline styles
// });
};
}
- //fb('Disposing video ID ' + id);
+ //console.log('Disposing video ID ' + id);
player.dispose();
return id;
},
// var fullscreenPlayerFound = false;
//
// this.getActivePlayers().forEach(function(p) {
- // fb('Video ID: ' + p.id(), 'Fullscreen: ' + p.isFullscreen());
+ // console.log('Video ID: ' + p.id(), 'Fullscreen: ' + p.isFullscreen());
//
// if (p.isFullscreen()) {
// fullscreenPlayerFound = true;
return false;
});
$('#formBulle form').submit(function() {
- fb('submit');
+ console.log('submit');
$(this).ajaxSubmit({
url: 'https://workshop.fluidbook.com/services/bulle',
success: function(data) {
message = 'path exists';
break;
}
- fb('Filesystem error:', error.code + ' :: ' + message);
+ console.log('Filesystem error:', error.code + ' :: ' + message);
}
* @return DirectoryEntry to the directory that was just created.
*/
function createDir_(root, folders, callback) {
- fb('createDir_ :: ' + root.toURL() + " ;; " + folders.join('/'));
+ console.log('createDir_ :: ' + root.toURL() + " ;; " + folders.join('/'));
// Throw out './' or '/' and move on to prevent something like '/foo/.//bar'.
if (folders.length && (folders[0] === '.' || folders[0] === '')) {
folders = folders.slice(1);
}, 1000);
root.getDirectory(f, {create: true}, function (dirEntry) {
- fb('dirCreated !! ' + folders.join('/') + ' :: ' + folders.length);
+ console.log('dirCreated !! ' + folders.join('/') + ' :: ' + folders.length);
clearTimeout(timeout);
if (folders.length > 0) {
createDir_(dirEntry, folders, callback);
* @param {string} opt_quota The quota (in bytes) to request (optional).
*/
GALFS.prototype.init = function (fsprefix, callback, opt_quota) {
- fb('gal fs init');
+ console.log('gal fs init');
if (fsprefix == undefined) {
fsprefix = '';
}
var that = this;
// Callback when the filesystem has been initialized
var onInitFs = function (fs) {
- fb('fs inited');
+ console.log('fs inited');
that.fs = fs;
that.regenerate(callback);
};
- fb('request file system');
+ console.log('request file system');
requestFileSystem(LocalFileSystem.PERSISTENT, 0, onInitFs, onError);
var interval = setInterval(function () {
if (that.fs) {
clearInterval(interval);
} else {
- fb('request file system again');
+ console.log('request file system again');
requestFileSystem(LocalFileSystem.PERSISTENT, 0, onInitFs, onError);
}
}, 500);
u = cordova.file.dataDirectory + fileEntry.fullPath;
}
- fb('download to ' + u)
+ console.log('download to ' + u)
fileTransfer.download(url, u, function (entry) {
var e = entry.toURL();
};
GALFS.prototype.regenerate = function (callback) {
- fb('gal fs regenerate');
+ console.log('gal fs regenerate');
var that = this;
// And then recreate it
var fs = this.fs;
createDir_(fs.root, ROOT_DIR.split('/'), function (res) {
- fb('root dir created :: ' + res.toURL());
+ console.log('root dir created :: ' + res.toURL());
// Create a directory for the root of the GAL
that.root = res;
callback();
* manifest.
*/
GAL.prototype.init = function (callback) {
- fb('gal init');
+ console.log('gal init');
var that = this;
- fb(this._manifest);
+ console.log(this._manifest);
finishInit_.call(that, this._manifest, callback)
};
};
GAL.prototype.downloadAndCall = function (bundleName, callback) {
- fb('download and call ' + bundleName);
+ console.log('download and call ' + bundleName);
var $this = this;
var timeout = setTimeout(function () {
$this.downloadAndCall(bundleName, callback)
this.check(bundleName, function (info) {
clearTimeout(timeout);
if (info.success) {
- fb('already downloaded');
+ console.log('already downloaded');
callback();
} else {
- fb('i download');
+ console.log('i download');
$this.download(bundleName, callback);
}
});
};
GAL.prototype.initAdapter_ = function (callback) {
- fb('gal init adapter');
+ console.log('gal init adapter');
var $this = this;
if (this.adapter != null) {
this.adapter = new GAL.adapterClass();
this.adapter.init(this._fsprefix, function () {
- fb('gal adapter inited');
+ console.log('gal adapter inited');
callback($this.adapter);
});
};
* @param {object} manifest The manifest object.
*/
function setManifest_(manifest) {
- fb('gal set manifest');
+ console.log('gal set manifest');
this.manifest = manifest;
// Set this.bundles object and this.bundleOrder array
for (var i = 0, bundle; bundle = manifest.bundles[i]; ++i) {
* @param {function} callback Called when the initialization is finished.
*/
function finishInit_(manifest, callback) {
- fb('gal finish init');
+ console.log('gal finish init');
var context = this;
this.initAdapter_.call(context, function () {
- fb('gal set manifest');
+ console.log('gal set manifest');
setManifest_.call(context, manifest);
// Optionally, start auto-download.
if (manifest.autoDownload) {
\r
var api = getAPIHandle();\r
if (api == null) {\r
- fb("Unable to locate the LMS's API Implementation.\nLMSInitialize was not successful.");\r
+ console.log("Unable to locate the LMS's API Implementation.\nLMSInitialize was not successful.");\r
return "false";\r
}\r
\r
\r
var api = getAPIHandle();\r
if (api == null) {\r
- fb("Unable to locate the LMS's API Implementation.\nLMSFinish was not successful.");\r
+ console.log("Unable to locate the LMS's API Implementation.\nLMSFinish was not successful.");\r
return "false";\r
}\r
else {\r
function doLMSGetValue(name) {\r
var api = getAPIHandle();\r
if (api == null) {\r
- fb("Unable to locate the LMS's API Implementation.\nLMSGetValue was not successful.");\r
+ console.log("Unable to locate the LMS's API Implementation.\nLMSGetValue was not successful.");\r
return "";\r
}\r
else {\r
if (errCode != _NoError) {\r
// an error was encountered so display the error description\r
var errDescription = api.LMSGetErrorString(errCode);\r
- fb("LMSGetValue(" + name + ") failed. \n" + errDescription);\r
+ console.log("LMSGetValue(" + name + ") failed. \n" + errDescription);\r
return "";\r
}\r
else {\r
function doLMSSetValue(name, value) {\r
var api = getAPIHandle();\r
if (api == null) {\r
- fb("Unable to locate the LMS's API Implementation.\nLMSSetValue was not successful.");\r
+ console.log("Unable to locate the LMS's API Implementation.\nLMSSetValue was not successful.");\r
return;\r
}\r
else {\r
function doLMSCommit() {\r
var api = getAPIHandle();\r
if (api == null) {\r
- fb("Unable to locate the LMS's API Implementation.\nLMSCommit was not successful.");\r
+ console.log("Unable to locate the LMS's API Implementation.\nLMSCommit was not successful.");\r
return "false";\r
}\r
else {\r
function doLMSGetLastError() {\r
var api = getAPIHandle();\r
if (api == null) {\r
- fb("Unable to locate the LMS's API Implementation.\nLMSGetLastError was not successful.");\r
+ console.log("Unable to locate the LMS's API Implementation.\nLMSGetLastError was not successful.");\r
//since we can't get the error code from the LMS, return a general error\r
return _GeneralError;\r
}\r
function doLMSGetErrorString(errorCode) {\r
var api = getAPIHandle();\r
if (api == null) {\r
- fb("Unable to locate the LMS's API Implementation.\nLMSGetErrorString was not successful.");\r
+ console.log("Unable to locate the LMS's API Implementation.\nLMSGetErrorString was not successful.");\r
}\r
\r
return api.LMSGetErrorString(errorCode).toString();\r
function doLMSGetDiagnostic(errorCode) {\r
var api = getAPIHandle();\r
if (api == null) {\r
- fb("Unable to locate the LMS's API Implementation.\nLMSGetDiagnostic was not successful.");\r
+ console.log("Unable to locate the LMS's API Implementation.\nLMSGetDiagnostic was not successful.");\r
}\r
\r
return api.LMSGetDiagnostic(errorCode).toString();\r
\r
var api = getAPIHandle();\r
if (api == null) {\r
- fb("Unable to locate the LMS's API Implementation.\nLMSIsInitialized() failed.");\r
+ console.log("Unable to locate the LMS's API Implementation.\nLMSIsInitialized() failed.");\r
return false;\r
}\r
else {\r
function ErrorHandler() {\r
var api = getAPIHandle();\r
if (api == null) {\r
- fb("Unable to locate the LMS's API Implementation.\nCannot determine LMS error code.");\r
+ console.log("Unable to locate the LMS's API Implementation.\nCannot determine LMS error code.");\r
return;\r
}\r
\r
// on the previous error.\r
}\r
\r
- fb(errDescription);\r
+ console.log(errDescription);\r
}\r
\r
return errCode;\r
findAPITries++;\r
// Note: 7 is an arbitrary number, but should be more than sufficient\r
if (findAPITries > 7) {\r
- fb("Error finding API -- too deeply nested.");\r
+ console.log("Error finding API -- too deeply nested.");\r
return null;\r
}\r
\r
theAPI = findAPI(window.opener);\r
}\r
if (theAPI == null) {\r
- fb("Unable to find an API adapter");\r
+ console.log("Unable to find an API adapter");\r
}\r
return theAPI\r
}\r
$_GET = parseGet();
INITED = false;
- if (Modernizr.applicationcache) {
- applicationCache.addEventListener('updateready', cacheUpdated, false);
- applicationCache.addEventListener('downloading', function (e) {
- fb('cache downloading');
- }, false);
- applicationCache.addEventListener('cached', function (e) {
- fb('cache completed');
- fluidbook.video.initCache();
- }, false);
- applicationCache.addEventListener('noupdate', function (e) {
- fb('cache nothing to update');
- fluidbook.video.initCache();
- }, false);
- applicationCache.addEventListener('checking', function (e) {
- fb('cache check');
- }, false);
- applicationCache.addEventListener('error', function (e) {
- fb('cache error');
- }, false);
- }
-
if (DATAS && DATAS.phonegap) {
loadPhonegap();
} else {
cordovaPath
, cordovaLoaded);
if (window.cordova) {
- fb('cordova already loaded');
+ console.log('cordova already loaded');
cordovaLoaded();
}
if (DEVICE_READY_BEFORE_JQUERY) {
DEVICE_READY = true;
- fb('device ready !');
+ console.log('device ready !');
document.addEventListener("offline", onDeviceOffline, false);
var manifest;
var fsprefix = window.localStorage.getItem('galfsprefix');
PLATFORM = DATAS.phonegap;
if (PLATFORM == 'ios') {
- window.ExternalFileUtil = cordova.require('com.techblue.cordova.plugin.externalfileutilios.ExternalFileUtilIos');
+ try {
+ window.ExternalFileUtil = cordova.require('com.techblue.cordova.plugin.externalfileutilios.ExternalFileUtilIos');
+ }catch (err){
+ console.error('Error while loading ExternalFileUtil plugin');
+ }
} else if (PLATFORM == 'android') {
}
try {
collection = json_parse(window.localStorage.getItem('collection'));
} catch (err) {
- fb('error parsing collection');
+ console.log('error parsing collection');
}
if (collection.res != undefined && collection.res) {
}
if (!OFFLINEAPP) {
- fb('set manifest from manifest pub');
+ console.log('set manifest from manifest pub');
manifest = collection.manifestPub[DATAS.id];
}
if (navigator.onLine && !OFFLINEAPP) {
- fb('init online');
+ console.log('init online');
var readyToLoad = false;
var finishedLoading = false;
}, 1000);
gal.onLoaded(function (info) {
- fb('gal loaded');
+ console.log('gal loaded');
clearTimeout(timeout);
$(window).trigger('GALBundleLoaded', [info]);
});
gal.check('extras', function (info) {
if (info.success) {
- fb('set offline flag');
+ console.log('set offline flag');
FINISHLOADING = true;
window.localStorage.setItem('offline.' + DATAS.id, '1');
}
});
$(window).on('GALBundleLoaded', function (e, info) {
- fb('Loaded :: ' + info.bundleName);
+ console.log('Loaded :: ' + info.bundleName);
if (info.bundleName == 'content_4') {
fluidbook.changeAddress();
}
if (info.bundleName == 'extras') {
- fb('set offline flag');
+ console.log('set offline flag');
FINISHLOADING = true;
window.localStorage.setItem('offline.' + DATAS.id, '1');
}
}
}
} catch (err) {
- fb(err);
+ console.log(err);
}
function checkScroll() {