Files
justice/www/html/app-base.js
T
2026-05-06 20:18:40 +00:00

20 lines
602 B
JavaScript

/**
* Shared by Main-Lobby, Main-Menu, Login, Create Room, Loading, …
* Resolves absolute paths from site root (e.g. /Game/..., /Main-Menu/...).
*/
(function (global) {
'use strict';
if (typeof global.appPath === 'function') return;
/**
* @param {string} path - must start with / (e.g. '/Game/play.html')
* @returns {string}
*/
global.appPath = function appPath(path) {
if (path == null || path === '') return '';
var p = String(path);
if (p.charAt(0) !== '/') return '/' + p.replace(/^\/+/, '');
return p;
};
})(typeof window !== 'undefined' ? window : this);