Greasy Fork

Greasy Fork is available in English.

c4ai-command-r-plus.hf.space

Customizing the appearance of the cohereforai-c4ai-command-r-plus.hf.space page

当前为 2024-04-07 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         c4ai-command-r-plus.hf.space
// @namespace    Apache-2.0
// @version      1.2.0
// @description  Customizing the appearance of the cohereforai-c4ai-command-r-plus.hf.space page
// @author       Tony 0tis
// @license      Apache-2.0
// @match        *://cohereforai-c4ai-command-r-plus.hf.space/*
// @icon         https://cohereforai-c4ai-command-r-plus.hf.space/favicon.ico
// @grant        none
// ==/UserScript==

(function() {
    console.log('start customize')
    const observer = new MutationObserver((mutationsList, observer)=>{
        for (const mutation of mutationsList) {
            for(const node of mutation.addedNodes){
                if(node.id === 'logo-img'){
                    node.parentNode.parentNode.style.display = 'none';
                }
                if(node.classList && node.classList.contains('label') && node.innerText === 'Examples'){
                	node.parentNode.parentNode.style.display = 'none';
                }
                if(node.classList && node.classList.contains('message-wrap')){
                	let parent = node;
                	while(true || parent){
                		if(parent.id.includes('component')){
                			parent.style.height = '100%';
                			if(parent.id === 'component-0'){
                				parent.style.height = 'calc(100vh - 40px)';
                				document.title = 'C4AI Command R Plus - a Hugging Face Space by CohereForAI';
                				break;
                			}
                		}
                		parent = parent.parentNode;
                	}
                }
                if(node.nodeName === 'FOOTER'){
                    node.style.display = 'none';
                }
            }
        }
    });
    observer.observe(document, {attributes: false, childList: true, characterData: false, subtree:true});
    document.addEventListener('beforeunload', ()=>{
        observer.disconnect();
    });
    
    const stringManifest = JSON.stringify({
        id: '/c4ai-command-r-plus',
        name: 'AI Chat with c4ai-command-r-plus',
        short_name: 'c4ai-command-r-plus',
        description: 'Chat c4ai-command-r-plus',
        categories: ['utilities'],
        orientation: 'portrait',
        display_override: ['fullscreen', 'minimal-ui', 'window-controls-overlay'],
        display: 'standalone',
        start_url: 'https://cohereforai-c4ai-command-r-plus.hf.space/',
        scope: 'https://cohereforai-c4ai-command-r-plus.hf.space/'
    });
    const blob = new Blob([stringManifest], {type: 'application/json'});
    const manifestURL = URL.createObjectURL(blob);
    const manifest = document.createElement('link');
    manifest.rel = 'manifest'
    manifest.href = manifestURL;
    document.head.appendChild(manifest);
})();