Skip to content

Instantly share code, notes, and snippets.

@rbtnn
Created October 11, 2025 07:53
Show Gist options
  • Select an option

  • Save rbtnn/d8aff5e0bbe7d62f2739324c4ceedbd8 to your computer and use it in GitHub Desktop.

Select an option

Save rbtnn/d8aff5e0bbe7d62f2739324c4ceedbd8 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Copilot Smart Mode Auto Selector
// @version 1
// @description Automatically selects Smart (GPT-5) mode on Copilot web
// @match https://copilot.microsoft.com/*
// @grant none
// @run-at document-start
// ==/UserScript==
(function() {
'use strict';
const waitForElement = (selector, timeout = 5000) => {
return new Promise((resolve, reject) => {
const interval = 100;
let elapsed = 0;
const check = () => {
const el = document.querySelector(selector);
if (el) return resolve(el);
elapsed += interval;
if (elapsed >= timeout) return reject();
setTimeout(check, interval);
};
check();
});
};
const clickSmartMode = async () => {
try {
const modeButton = await waitForElement('[aria-label="クイック応答"]');
modeButton.click();
await new Promise(r => setTimeout(r, 500));
const smartOption = [...document.querySelectorAll('[role="menuitem"]')]
.find(el => el.textContent.includes('Smart') || el.textContent.includes('GPT-5'));
if (smartOption) smartOption.click();
} catch (e) {
console.warn('Smartモードの自動選択に失敗しました');
}
};
window.addEventListener('load', clickSmartMode);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment