Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions dist/woof.js
Original file line number Diff line number Diff line change
Expand Up @@ -1778,11 +1778,10 @@ Woof.prototype.Sound = function () {
low: 0.5,
normal: 1
}
};

// Convert given value to corresponding audio object value
// Throw error if given value not found in allowed values
var soundVolumeToAudioVolume = function soundVolumeToAudioVolume(val) {
// Convert given value to corresponding audio object value
// Throw error if given value not found in allowed values
};var soundVolumeToAudioVolume = function soundVolumeToAudioVolume(val) {
if (typeof val == "number") {
if (val >= 0 && val <= 1) {
return val;
Expand Down Expand Up @@ -2328,8 +2327,12 @@ var getData = function getData(url, callback) {
var currentScript = document.currentScript || Array.prototype.slice.call(document.getElementsByTagName('script')).find(function (s) {
return s.src.includes('woof.js');
});
// the script tag containing Woof has an attribute global="false"
var falseGlobalAttribute = currentScript.getAttribute('global') === 'false';
// WOOF_GLOBAL_MODE = false was set before this script was loaded
var falseConstant = typeof window.WOOF_GLOBAL_MODE !== 'undefined' && window.WOOF_GLOBAL_MODE === false;
var globalMode = !falseGlobalAttribute && !falseConstant;

if (JSON.parse(currentScript.getAttribute('global')) !== false) {
// unless the script tag containing Woof has an attribute global="false", start Woof in global mode
if (globalMode) {
Woof.prototype.extend(window, new Woof({ global: true, fullScreen: true }));
}
8 changes: 6 additions & 2 deletions src/woof.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -1778,8 +1778,12 @@ const getData = (url, callback) => {

// find the woof.js script tag in the page
var currentScript = document.currentScript || Array.prototype.slice.call(document.getElementsByTagName('script')).find(s => s.src.includes('woof.js'))
// the script tag containing Woof has an attribute global="false"
var falseGlobalAttribute = currentScript.getAttribute('global') === 'false'
// WOOF_GLOBAL_MODE = false was set before this script was loaded
var falseConstant = typeof window.WOOF_GLOBAL_MODE !== 'undefined' && window.WOOF_GLOBAL_MODE === false
var globalMode = !falseGlobalAttribute && !falseConstant

if (JSON.parse(currentScript.getAttribute('global')) !== false) {
// unless the script tag containing Woof has an attribute global="false", start Woof in global mode
if (globalMode) {
Woof.prototype.extend(window, new Woof({global: true, fullScreen: true}));
}