Jump to content

User:Alexis Jazz/Factotum-ES5.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
/*
Some IE11 hacking for Factotum. Does Factotum work on ES5 browsers like IE11?

Short answer: no.

Longer answer: not really. Nothing works on IE11. This file exists merely for your enterainment. I didn't even bother actually implementing Object.assign.

This crap is irrevocably released as WTFPL Version 2[www.wtfpl.net/about/] by its author, Alexis Jazz.
Put this crap after var FTT = window.FTT; and remove the 'use strict'; line. I managed to open a form, didn't try anything else.
*/
if ( typeof Object.values == 'undefined' ) { //IE sux
	Object.values = function(obj1,suxInt,arr) {
		arr = [];
		for (suxInt=0;suxInt<Object.keys(obj1).length;suxInt++) {
			arr.push(obj1[Object.keys(obj1)[suxInt]]);
		}
		return arr;
	};
}
if ( typeof mw.loader.using == 'undefined' ) { //IE sux
	mw.loader.using = function(a,callback) {
		callback();
	};
}
if ( typeof Array.prototype.includes == 'undefined' ) { //IE sux
	Array.prototype.includes = function(val) {
		if ( this.indexOf(val) == -1 ) {
			return false;
		} else {
			return true;
		}
	};
}
if ( typeof Object.assign == 'undefined' ) { //IE sux
	Object.assign = function(a,b){
		return a; // YOLO
	};
}
if ( typeof Array.from == 'undefined' ) { //IE sux
	Array.from = function(a,b,c) {
		c = [];
		for (b=0;b<Object.keys(a).length;b++) {
			c.push(a[Object.keys(a)[b]]);
			if ( b > 20000 ) {break;}
		}
		return c;
	};
}