// ==UserScript==
// @name VRChat Web Pages Extender
// @name:ja VRChat Webページ拡張
// @description Add features into VRChat Web Pages and improve user experience.
// @description:ja VRChatのWebページに機能を追加し、また使い勝手を改善します。
// @namespace https://greasyfork.org/users/137
// @version 2.16.0
// @match https://vrchat.com/home
// @match https://vrchat.com/home?*
// @match https://vrchat.com/home#*
// @match https://vrchat.com/home/*
// @require https://greasyfork.org/scripts/19616/code/utilities.js?version=895049
// @license MPL-2.0
// @contributionURL https://pokemori.booth.pm/items/969835
// @compatible Edge
// @compatible Firefox Firefoxを推奨 / Firefox is recommended
// @compatible Opera
// @compatible Chrome
// @grant dummy
// @run-at document-start
// @icon https://images.squarespace-cdn.com/content/v1/5f0770791aaf57311515b23d/1599678606410-4QMTB25DHF87E8EFFKXY/ke17ZwdGBToddI8pDm48kGfiFqkITS6axXxhYYUCnlRZw-zPPgdn4jUwVcJE1ZvWQUxwkmyExglNqGp0IvTJZUJFbgE-7XRK3dMEBRBhUpxQ1ibo-zdhORxWnJtmNCajDe36aQmu-4Z4SFOss0oowgxUaachD66r8Ra2gwuBSqM/favicon.ico
// @author 100の人
// @homepageURL https://greasyfork.org/scripts/371331
// @downloadURL none
// ==/UserScript==
/*global Gettext, _, h, GreasemonkeyUtils */
'use strict';
// L10N
Gettext.setLocalizedTexts({
/*eslint-disable quote-props, max-len */
'en': {
'エラーが発生しました': 'Error occurred',
},
/*eslint-enable quote-props, max-len */
});
Gettext.setLocale(navigator.language);
if (typeof content !== 'undefined') {
// For Greasemonkey 4
fetch = content.fetch.bind(content); //eslint-disable-line no-global-assign, no-native-reassign, no-undef
}
/**
* ページ上部にエラー内容を表示します。
* @param {Error} exception
* @returns {void}
*/
function showError(exception)
{
console.error(exception);
try {
const errorMessage = _('エラーが発生しました') + ': ' + exception
+ ('stack' in exception ? '\n\n' + exception.stack : '');
const homeContent = document.getElementsByClassName('home-content')[0];
if (homeContent) {
homeContent.firstElementChild.firstElementChild.insertAdjacentHTML('afterbegin', h`
`);
} else {
alert(errorMessage); //eslint-disable-line no-alert
}
} catch (e) {
alert(_('エラーが発生しました') + ': ' + e); //eslint-disable-line no-alert
}
}
const ID = 'vrchat-web-pages-extender-137';
/**
* 一度に取得できる最大の要素数。
* @constant {number}
*/
const MAX_ITEMS_COUNT = 100;
/**
* Statusの種類。
* @constant {number}
*/
const STATUSES = {
'join me': {
label: 'Join Me: Auto-accept join requests.',
color: '--status-joinme',
},
active: {
label: 'Online: See join requests.',
color: '--status-online',
},
'ask me': {
label: 'Ask Me: Hide location, see join requests.',
color: '--status-askme',
},
busy: {
label: 'Do Not Disturb: Hide location, hide join requests.',
color: '--status-busy',
},
};
/**
* 一つのブックマークグループの最大登録数。
* @constant {Object.}
*/
const MAX_FRIEND_FAVORITE_COUNT_PER_GROUP = 150;
/**
* @type {Function}
* @access private
*/
let resolveUserDetails;
/**
* @type {Promise.