/* Copyright 2014 Yukkuri Games
Licensed under the terms of the GNU GPL v2 or later
- @license http://www.gnu.org/licenses/gpl-2.0.html
- @source: http://yukkurigames.com/yuu/
+ @license https://www.gnu.org/licenses/gpl-2.0.html
+ @source: https://yukkurigames.com/yuu/
*/
(function (yuu) {
"use strict";
-
yuu.require = function (m) {
try { return require(m); }
catch (exc) { return null; }
};
- if (!Math.sign)
+ if (!Object.assign)
require("./pre");
var yT = this.yT || require("./yT");
/** Initialize Yuu and call all registered hooks
*/
+ document.body.className += (navigator.standalone || gui)
+ ? " standalone" : " browser";
+
if (gui) {
var win = gui.Window.get();
var nativeMenuBar = new gui.Menu({ type: "menubar" });
wkdoc.hidden = false;
wkdoc.dispatchEvent(ev);
});
+ win.on('new-win-policy', function (frame, url, policy) {
+ if (url.startsWith('chrome')) {
+ policy.forceNewPopup();
+ } else {
+ policy.ignore();
+ gui.Shell.openExternal(url);
+ }
+ });
}
return new Promise(function (resolve) {
req[k] = params[k];
req.onload = function () {
var status = this.status;
- // status === 0 is given by node-webkit for success.
+ // status === 0 is given by NW.js for success.
if ((status >= 200 && status < 300) || status === 0)
resolve(this.response);
else