Update webloader.js

This commit is contained in:
Namhyeon Go 2020-07-04 23:07:24 +09:00 committed by GitHub
parent 393e808651
commit 90e2789725
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,11 +8,39 @@ if (!window.addEventListener) {
Element = function() {}; Element = function() {};
(function(WindowPrototype, DocumentPrototype, ElementPrototype, registry) { (function(WindowPrototype, DocumentPrototype, ElementPrototype, registry) {
DocumentPrototype.head = (function() { if (!DocumentPrototype.head) {
return DocumentPrototype.getElementsByTagName("head")[0]; DocumentPrototype.head = (function() {
})(); return DocumentPrototype.getElementsByTagName("head")[0];
})();
}
var inject = function(obj, registry) { if (!DocumentPrototype.getElementsByClassName) {
DocumentPrototype.getElementsByClassName = function(search) {
var d = document,
elements, pattern, i, results = [];
if (d.querySelectorAll) { // IE8
return d.querySelectorAll("." + search);
}
if (d.evaluate) { // IE6, IE7
pattern = ".//*[contains(concat(' ', @class, ' '), ' " + search + " ')]";
elements = d.evaluate(pattern, d, null, 0, null);
while ((i = elements.iterateNext())) {
results.push(i);
}
} else {
elements = d.getElementsByTagName("*");
pattern = new RegExp("(^|\\s)" + search + "(\\s|$)");
for (i = 0; i < elements.length; i++) {
if (pattern.test(elements[i].className)) {
results.push(elements[i]);
}
}
}
return results;
}
}
var enableEventListener = function(obj, registry) {
obj.addEventListener = function(type, listener) { obj.addEventListener = function(type, listener) {
var target = this; var target = this;
@ -45,9 +73,9 @@ if (!window.addEventListener) {
}; };
}; };
inject(WindowPrototype, registry); enableEventListener(WindowPrototype, registry);
inject(DocumentPrototype, registry); enableEventListener(DocumentPrototype, registry);
inject(ElementPrototype, registry); enableEventListener(ElementPrototype, registry);
var __createElement = DocumentPrototype.createElement; var __createElement = DocumentPrototype.createElement;
DocumentPrototype.createElement = function(tagName) { DocumentPrototype.createElement = function(tagName) {
@ -89,7 +117,7 @@ var IEVersion = (function() {
})(); })();
return { return {
setMovableWindow: function() { enableMovableWindow: function() {
var grip = document.getElementById('app'), var grip = document.getElementById('app'),
oX, oY, oX, oY,
mouseDown = function(e) { mouseDown = function(e) {
@ -225,7 +253,7 @@ return {
// "set movable window"; // "set movable window";
if (self.getIEVersion() > 8) { if (self.getIEVersion() > 8) {
self.setMovableWindow(); self.enableMovableWindow();
} }
// "go to entrypoint"; // "go to entrypoint";