// ==UserScript== // @name WPlace Unlimited Favorites⭐ - 無制限保存 & エクスポート機能 // @description WPlace.liveで無制限のお気に入り保存、バックアップ・復元機能付き、Blue Marble完全対応、UI統合型 // @match *://wplace.live/* // @grant GM_setValue // @grant GM_getValue // @icon https://www.google.com/s2/favicons?sz=64&domain=wplace.live // @version 2025-08-21 // @author Defaulter // @license MIT // @namespace https://greasyfork.org/users/1508363 // @downloadURL none // ==/UserScript== class WPlaceExtendedFavorites { constructor() { this.STORAGE_KEY = 'wplace_extended_favorites'; this.init(); } init() { this.observeAndInit(); } observeAndInit() { // ボタン設定 const buttonConfigs = [ { id: 'favorite-btn', selector: '[title="お気に入り"]', containerSelector: 'button[title="Toggle art opacity"]', create: this.createFavoriteButton.bind(this) }, { id: 'save-btn', selector: '[data-wplace-save="true"]', containerSelector: '.hide-scrollbar.flex.max-w-full.gap-1\\.5.overflow-x-auto', create: this.createSaveButton.bind(this) } ]; // 汎用ボタン監視 this.startButtonObserver(buttonConfigs); // モーダル作成 setTimeout(() => this.createModal(), 2000); } // 汎用ボタン監視システム startButtonObserver(configs) { const ensureButtons = () => { configs.forEach(config => { if (!document.querySelector(config.selector)) { const container = document.querySelector(config.containerSelector); if (container) { config.create(container); } } }); }; // DOM変更監視 const observer = new MutationObserver(() => { setTimeout(ensureButtons, 100); }); observer.observe(document.body, { childList: true, subtree: true }); // 初期配置 & 定期チェック setTimeout(ensureButtons, 1000); setInterval(ensureButtons, 5000); } // お気に入りボタン作成 createFavoriteButton(toggleButton) { const container = toggleButton.parentElement; if (!container) return; const button = document.createElement('button'); button.className = 'btn btn-lg sm:btn-xl btn-square shadow-md text-base-content/80 ml-2 z-30'; button.title = 'お気に入り'; button.innerHTML = ` `; button.addEventListener('click', () => this.openModal()); container.appendChild(button); console.log('⭐ Favorite button added'); } // 保存ボタン作成 createSaveButton(container) { const button = document.createElement('button'); button.className = 'btn btn-primary btn-soft'; button.setAttribute('data-wplace-save', 'true'); button.innerHTML = ` 保存 `; button.addEventListener('click', () => this.addFavorite()); container.appendChild(button); console.log('⭐ Save button added'); } // モーダルを作成 createModal() { const modal = document.createElement('dialog'); modal.id = 'favorite-modal'; modal.className = 'modal'; modal.innerHTML = `
お気に入りがありません
下の「保存」ボタンから追加してください