M365 Copilot Chat Full Width

Expands M365 Copilot Chat to the available page width while retaining modest page margins.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         M365 Copilot Chat Full Width
// @namespace    http://tampermonkey.net/
// @version      3.1
// @description  Expands M365 Copilot Chat to the available page width while retaining modest page margins.
// @author       hiyun1137 GPT 5.6 Think
// @match        https://m365.cloud.microsoft/*
// @match        https://*.m365.cloud.microsoft/*
// @match        https://microsoft365.com/*
// @match        https://www.microsoft365.com/*
// @grant        GM_addStyle
// @run-at       document-start
// @license      MIT
// ==/UserScript==


(() => {
  const style = document.createElement('style');
  style.textContent = `
    #m365-copilot-app-layout-content {
      width: 100% !important;
      max-width: none !important;
      padding-inline: clamp(12px, 1.5vw, 24px) !important;
      box-sizing: border-box !important;
    }

    /* Widen the real chat branch, located by the stable composer ID. */
    #m365-copilot-app-layout-content :has(#m365-chat-input-shared-container) {
      width: 100% !important;
      max-width: none !important;
      margin-inline: 0 !important;
      box-sizing: border-box !important;
    }

    /* Copilot applies the remaining reading-width cap below that branch. */
    #m365-copilot-app-layout-content div {
      max-width: none !important;
    }

    #m365-chat-input-shared-container,
    [data-test-id="chat-input-wrapper"] {
      width: 100% !important;
      max-width: none !important;
    }

    @media (max-width: 700px) {
      #m365-copilot-app-layout-content { padding-inline: 10px !important; }
    }
  `;
  (document.head || document.documentElement).appendChild(style);
})();