We need TW players to complete the article of the region-locked game Fingertips Breakout.
You don't need an account to add and correct this Wiki. Learn how to contribute, browse Bounties and join our Discord server.

MediaWiki:Gadget-live2dLoader.js

Welcome to IOP Wiki. This website is maintained by the Girls' Frontline community and is free to edit by anyone.
Jump to navigation Jump to search

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
window.animations = window.animations || {};

if (!window.animations.Live2dLoader) {
	window.animations.Live2dLoader = {};
	window.animations.Live2dLoader.initialized = false;
	window.animations.Live2dLoader.init = function() {
		return new Promise(
		    function (resolve, reject) {
		    	if (window.animations.Live2dLoader.initialized) {
		    		resolve(null);
		    		return;
		    	}
		    	
		    	// Make sure PIXI.JS is available first
		    	window.animations.PIXILoader.init().then(function() {
		    		// Now we can initialize Live2D
		    		$.ajax({
					    cache: true,
					    url: "/index.php?title=MediaWiki:Gadget-live2d.js&action=raw",
					    dataType: "script"
					}).done(function() {
						console.log("Request L2D Framework successfull.");
						window.animations.Live2dLoader.initialized = true;
					    resolve(null);
					}).fail(function() {
				        console.error("Loading L2D framework failed");
				        var reason = new Error('L2D framework failed loading');
				        reject(reason);
				    });
		    	});
		    }
		);
	};
}

console.log("Loaded L2D Framework Loader.");