Greasy Fork is available in English.
Customizing the appearance of the cohereforai-c4ai-command-r-plus.hf.space page
当前为
// ==UserScript==
// @name c4ai-command-r-plus.hf.space
// @namespace Apache-2.0
// @version 1.2.1
// @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%';
parent.style.overflow = 'auto';
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';
}
if(node.nodeName === 'TEXTAREA'){
node.style.minHeight = '46px';
node.parentNode.parentNode.style.padding = '0px';
}
if(node.nodeName === 'BUTTON' && node.innerText === 'Clear chat'){
node.innerText = '🗑️';
node.style.flex = '0';
node.style.minWidth = '50px';
}
}
}
});
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);
})();