您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
aggiunge pulsante copia codice
当前为
- // ==UserScript==
- // @name Copia codice Greasyfork figuccio
- // @namespace https://greasyfork.org/users/237458
- // @version 0.1
- // @description aggiunge pulsante copia codice
- // @author figuccio
- // @match https://greasyfork.org/*
- // @match https://sleazyfork.org/*
- // @require https://lib.baomitu.com/jquery/3.5.0/jquery.min.js
- // @run-at document-end
- // @grant GM_addStyle
- // @grant GM_setClipboard
- // @license MIT
- // ==/UserScript==
- function execCopy() {
- var code='';
- if($(".prettyprint li").length>0)
- {
- $(".prettyprint li").each(function(){
- code += $(this).text()+'\n';
- });
- }
- else
- {
- code = $(".prettyprint").text();
- }
- code = encodeURI(code)
- code = code.replace(/%C2%A0/g,'%20');
- code = decodeURI(code);
- GM_setClipboard(code, 'text');
- alert("copia con successo")
- return true;
- }
- (function() {
- 'use strict';
- //Il collegamento al codice sorgente viene visualizzato dopo il collegamento allo script
- $(".script-list h2 a").each(function(){
- if(!$(this).next().hasClass("code-link"))
- {
- let short_link = $(this).attr("href");
- let $code_link = $('<a href=\"'+short_link+'/code\" class=\"code-link\">codice</a>');
- $(this).after($code_link);
- }
- })
- //////////////////////////////////////////////////////////
- GM_addStyle('.source{'+
- 'transition: box-shadow 0.2s;'+
- 'display: inline-block;'+
- 'background-color:lime;'+
- 'padding: 0.5em 1em;'+
- 'color: white;'+
- 'text-decoration: none;'+
- 'cursor:pointer}'+
- '.source:hover{'+
- 'transition: box-shadow 0.2s;'+
- 'box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);'+
- '}'+
- '.code-link'+
- '{'+
- ' margin-left:10px; '+
- ' padding-left:2px;'+
- ' padding-right:2px; '+
- ' font-size:12px; '+
- ' background:red; '+
- ' color:white!important; '+
- ' text-decoration: none;'+
- '}'+
- '.rating-icon-none {'+
- ' border-color: #bbbbbb;'+
- ' background-color: #8590a612;'+
- ' color: gray;'+
- '}');
- //////////////////
- if(window.location.href.indexOf("/code")!= -1) //code
- {
- var source_btn = $("<a></a>")
- source_btn.addClass("source");
- source_btn.text("copiare il codice sorgente");
- source_btn.click(function(){
- execCopy();
- });
- $("#install-area").after(source_btn);
- }
- // else if(window.location.href.indexOf("/scripts/")!= -1) //scripts
- // {
- // }
- })();