您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
This code displays an icon on the right side of the link "Προβολή αρχείου" on the search results of DIAVGEIA, where by click on it, it copies the URL of the file in human readable format.
当前为
// ==UserScript== // @name Copy link in DIAVGEIA // @name:en Copy link in DIAVGEIA // @name:el Αντιγραφή συνδέσμου ΔΙΑΥΓΕΙΑΣ // @description:en This code displays an icon on the right side of the link "Προβολή αρχείου" on the search results of DIAVGEIA, where by click on it, it copies the URL of the file in human readable format. // @description:el Αυτός ο κώδικας εμφανίζει ένα εικονίδιο στα δεξιά του συνδέσμου «Προβολή αρχείου» στα αποτελέσματα της ΔΙΑΥΓΕΙΑΣ, όπου πατώντας αντιγράφει τη διεύθυνση του αρχείου σε αναγνώσιμη μορφή. // @author Δρ. Παναγιώτης Ε. Παπάζογλου (Δασαρχείο Μετσόβου) // @namespace diavgeia // @version 1.1 // @match https://diavgeia.gov.gr/* // @grant GM_setClipboard // @require https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js // @license GPL-3.0-or-later // @description This code displays an icon on the right side of the link "Προβολή αρχείου" on the search results of DIAVGEIA, where by click on it, it copies the URL of the file in human readable format. // ==/UserScript== (function() { const observer = new MutationObserver((mutationsList,observer)=> { for(const mutation of mutationsList) { for(const node of mutation.addedNodes) { if(node.nodeType===Node.ELEMENT_NODE) { const links = node.querySelectorAll('a[href$="inline=true"]'); if((node.tagName==='A' && node.href.endsWith('inline=true')) || links.length>0) { $('a[href$="inline=true"]').each(function() { var lnk = $(this); if(lnk.next('.copy-icon,.check-icon,.ada').length===0) { lnk.after('<span class="copy-icon" title="Αντιγραφή συνδέσμου ΔΙΑΥΓΕΙΑΣ" style="cursor:pointer">📋</span><span class="check-icon" title="Η διεύθυνση αντιγράφτηκε" style="display:none">✅</span> <span class="ada" title="Αντιγραφή ΑΔΑ" style="cursor:pointer">ΑΔΑ</span>'); lnk.next('.copy-icon').on('click',function(e) { e.preventDefault(); navigator.clipboard.writeText(decodeURIComponent(lnk.attr('href'))).then(()=> { lnk.nextAll('.copy-icon').first().fadeOut(300,()=>{lnk.nextAll('.check-icon').first().fadeIn(300).delay(1000).fadeOut(300,()=>{lnk.nextAll('.copy-icon').first().fadeIn(300);});}); let msg=document.createElement('div'); msg.textContent='Η διεύθυνση αντιγράφτηκε!'; Object.assign(msg.style,{position:'fixed',top:'50%',left:'50%',transform:'translate(-50%,-50%)',backgroundColor:'rgba(60,125,34,0.8)',color:'white',padding:'10px 20px',borderRadius:'5px',fontSize:'16px',zIndex:99999,fontFamily:'Arial,sans-serif'}); document.body.appendChild(msg);setTimeout(()=>msg.remove(),5000); }); }); lnk.nextAll('.ada').first().on('click',function(e) { e.preventDefault(); navigator.clipboard.writeText(decodeURIComponent(lnk.attr('href')).split('/').pop().split('?')[0]).then(()=> { lnk.nextAll('.ada').first().css({'font-weight':'bold','color':'rgb(60,125,34)'}); setTimeout(()=>{lnk.nextAll('.ada').first().css({'font-weight':'normal','color':'rgb(0,0,0)'});},3000); let msg=document.createElement('div'); msg.textContent='Ο ΑΔΑ αντιγράφτηκε!'; Object.assign(msg.style,{position:'fixed',top:'50%',left:'50%',transform:'translate(-50%,-50%)',backgroundColor:'rgba(60,125,34,0.8)',color:'white',padding:'10px 20px',borderRadius:'5px',fontSize:'16px',zIndex:99999,fontFamily:'Arial,sans-serif'}); document.body.appendChild(msg);setTimeout(()=>msg.remove(),3000); }); }); } else { return; } }); return; } } } } }); observer.observe(document.body,{childList:true,subtree:true}); })();