Clipd

Clipboard history with search capabilites, CSV export, and cross tab save history

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

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

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

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

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

You will need to install a user script manager extension to install this script.

(У мене вже є менеджер скриптів, дайте мені встановити його!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Clipd
// @namespace    https://github.com/vkunamneni1/Clipd
// @version      1.0
// @description  Clipboard history with search capabilites, CSV export, and cross tab save history
// @license      MIT
// @match        *://*/*
// @grant        none
// ==/UserScript==

(function(){'use strict';const clipLogKey='clipLog',clipLimit=20,bc=new BroadcastChannel('clipChannel');let isOpen=false,filter='';function getClips(){try{return JSON.parse(localStorage.getItem(clipLogKey))||[]}catch{return[]}}function saveClips(a){localStorage.setItem(clipLogKey,JSON.stringify(a.slice(0,clipLimit)))}function addClip(t,sync=true){const list=getClips();if(t&&t.trim()&&t!==list[0]){list.unshift(t);saveClips(list);if(sync)bc.postMessage({type:'clipAdd',data:t});drawClips()}}function toggleBox(){isOpen=!isOpen;drawUI()}function wipeClips(){localStorage.removeItem(clipLogKey);drawClips()}function drawUI(){const box=spawnBox();box.innerHTML='';const btn=toggleBtn();box.appendChild(btn);if(!isOpen)return;const search=document.createElement('input');Object.assign(search,{placeholder:'Find clip...',value:filter,type:'text'});Object.assign(search.style,{padding:'8px',border:'1px solid #444',borderRadius:'0',marginBottom:'10px',width:'100%',boxSizing:'border-box',background:'#111',color:'#ccc',fontSize:'13px'});search.oninput=()=>{filter=search.value.toLowerCase();drawClips()};box.appendChild(search);const list=document.createElement('div');list.id='clipList';Object.assign(list.style,{width:'100%',display:'flex',flexDirection:'column',gap:'8px'});box.appendChild(list);drawClips()}function drawClips(){const box=document.getElementById('clipList');if(!box)return;box.innerHTML='';getClips().filter(x=>x.toLowerCase().includes(filter)).forEach(txt=>{const b=document.createElement('button');b.textContent=txt.length>60?txt.slice(0,60)+'…':txt;b.title=txt;styleClipBtn(b);b.onclick=()=>navigator.clipboard.writeText(txt).then(()=>{b.textContent='✓ copied';setTimeout(drawClips,1000)});box.appendChild(b)});const clr=document.createElement('button');clr.textContent='Clear All';styleClearBtn(clr);clr.onclick=wipeClips;box.appendChild(clr)}function spawnBox(){let b=document.getElementById('clipbox');if(!b){b=document.createElement('div');b.id='clipbox';Object.assign(b.style,{position:'fixed',top:'10px',right:'10px',zIndex:'9999',background:'#000',border:'1px solid #333',borderRadius:'0',padding:'14px',fontFamily:'Helvetica, sans-serif',fontSize:'13px',color:'#eee',boxShadow:'0 4px 16px rgba(0,0,0,0.6)',maxWidth:'320px',display:'flex',flexDirection:'column',alignItems:'center',gap:'10px'});document.body.appendChild(b)}return b}function toggleBtn(){const b=document.createElement('button');b.textContent=isOpen?'Hide':'Show Clipboard';Object.assign(b.style,{all:'unset',padding:'10px 14px',border:'1px solid #666',borderRadius:'0',background:'#111',color:'#8ef',cursor:'pointer',fontWeight:'500',letterSpacing:'0.5px',marginBottom:'8px',textTransform:'uppercase',transition:'0.3s'});b.onmouseenter=()=>b.style.background='#181818';b.onmouseleave=()=>b.style.background='#111';b.onclick=toggleBox;return b}function styleClipBtn(b){Object.assign(b.style,{all:'unset',padding:'8px 10px',border:'1px solid #444',borderRadius:'0',background:'#121212',color:'#ccc',cursor:'pointer',whiteSpace:'nowrap',overflow:'hidden',textOverflow:'ellipsis',transition:'0.2s'});b.onmouseenter=()=>b.style.background='#1a1a1a';b.onmouseleave=()=>b.style.background='#121212'}function styleClearBtn(b){Object.assign(b.style,{all:'unset',padding:'8px 10px',border:'1px solid #555',borderRadius:'0',background:'#220000',color:'#faa',cursor:'pointer',fontWeight:'bold',transition:'0.2s'});b.onmouseenter=()=>b.style.background='#330000';b.onmouseleave=()=>b.style.background='#220000'}document.addEventListener('copy',async()=>{try{const t=await navigator.clipboard.readText();addClip(t)}catch(e){}});bc.onmessage=e=>e.data?.type==='clipAdd'&&addClip(e.data.data,false);drawUI();(async()=>{try{const t=await navigator.clipboard.readText();addClip(t)}catch(e){}})();})();

// userscript for managing clipboard history
// Hack Club FixIt