mirror of
https://github.com/google/blockly.git
synced 2026-01-14 12:27:10 +01:00
Defenestration
This commit is contained in:
@@ -629,7 +629,7 @@ Blockly.BlockSvg.prototype.onMouseDown_ = function(e) {
|
||||
Blockly.BlockSvg.prototype.showHelp_ = function() {
|
||||
var url = (typeof this.helpUrl == 'function') ? this.helpUrl() : this.helpUrl;
|
||||
if (url) {
|
||||
window.open(url);
|
||||
open(url);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -383,7 +383,7 @@ Blockly.getMainWorkspace = function() {
|
||||
* @param {function()=} opt_callback The callback when the alert is dismissed.
|
||||
*/
|
||||
Blockly.alert = function(message, opt_callback) {
|
||||
window.alert(message);
|
||||
alert(message);
|
||||
if (opt_callback) {
|
||||
opt_callback();
|
||||
}
|
||||
@@ -396,7 +396,7 @@ Blockly.alert = function(message, opt_callback) {
|
||||
* @param {!function(boolean)} callback The callback for handling user response.
|
||||
*/
|
||||
Blockly.confirm = function(message, callback) {
|
||||
callback(window.confirm(message));
|
||||
callback(confirm(message));
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -409,7 +409,7 @@ Blockly.confirm = function(message, callback) {
|
||||
* @param {!function(string)} callback The callback for handling user response.
|
||||
*/
|
||||
Blockly.prompt = function(message, defaultValue, callback) {
|
||||
callback(window.prompt(message, defaultValue));
|
||||
callback(prompt(message, defaultValue));
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -498,7 +498,8 @@ Blockly.bindEventWithChecks_ = function(node, name, thisObject, func,
|
||||
};
|
||||
|
||||
var bindData = [];
|
||||
if (Blockly.utils.global.PointerEvent && (name in Blockly.Touch.TOUCH_MAP)) {
|
||||
if (Blockly.utils.global['PointerEvent'] &&
|
||||
(name in Blockly.Touch.TOUCH_MAP)) {
|
||||
for (var i = 0, type; type = Blockly.Touch.TOUCH_MAP[name][i]; i++) {
|
||||
node.addEventListener(type, wrapFunc, false);
|
||||
bindData.push([node, type, wrapFunc]);
|
||||
@@ -550,8 +551,8 @@ Blockly.bindEvent_ = function(node, name, thisObject, func) {
|
||||
};
|
||||
|
||||
var bindData = [];
|
||||
var window = Blockly.utils.global['window'];
|
||||
if (window && window.PointerEvent && (name in Blockly.Touch.TOUCH_MAP)) {
|
||||
if (Blockly.utils.global['PointerEvent'] &&
|
||||
(name in Blockly.Touch.TOUCH_MAP)) {
|
||||
for (var i = 0, type; type = Blockly.Touch.TOUCH_MAP[name][i]; i++) {
|
||||
node.addEventListener(type, wrapFunc, false);
|
||||
bindData.push([node, type, wrapFunc]);
|
||||
|
||||
@@ -456,7 +456,9 @@ Blockly.DropDownDiv.hideWithoutAnimation = function() {
|
||||
if (!Blockly.DropDownDiv.isVisible()) {
|
||||
return;
|
||||
}
|
||||
Blockly.DropDownDiv.animateOutTimer_ && window.clearTimeout(Blockly.DropDownDiv.animateOutTimer_);
|
||||
if (Blockly.DropDownDiv.animateOutTimer_) {
|
||||
clearTimeout(Blockly.DropDownDiv.animateOutTimer_);
|
||||
}
|
||||
Blockly.DropDownDiv.positionInternal_();
|
||||
Blockly.DropDownDiv.clearContent();
|
||||
Blockly.DropDownDiv.owner_ = null;
|
||||
|
||||
@@ -48,7 +48,7 @@ Blockly.Touch.touchIdentifier_ = null;
|
||||
* @type {Object}
|
||||
*/
|
||||
Blockly.Touch.TOUCH_MAP = {};
|
||||
if (Blockly.utils.global.PointerEvent) {
|
||||
if (Blockly.utils.global['PointerEvent']) {
|
||||
Blockly.Touch.TOUCH_MAP = {
|
||||
'mousedown': ['pointerdown'],
|
||||
'mouseenter': ['pointerenter'],
|
||||
|
||||
@@ -82,7 +82,7 @@ Blockly.WorkspaceAudio.prototype.load = function(filenames, name) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
var audioTest = new window['Audio']();
|
||||
var audioTest = new Blockly.utils.global['Audio']();
|
||||
} catch (e) {
|
||||
// No browser support for Audio.
|
||||
// IE can throw an error even if the Audio object exists.
|
||||
@@ -94,7 +94,7 @@ Blockly.WorkspaceAudio.prototype.load = function(filenames, name) {
|
||||
var ext = filename.match(/\.(\w+)$/);
|
||||
if (ext && audioTest.canPlayType('audio/' + ext[1])) {
|
||||
// Found an audio format we can play.
|
||||
sound = new window['Audio'](filename);
|
||||
sound = new Blockly.utils.global['Audio'](filename);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user