您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Amazonや静画(漫画)やGoogle検索ならURLの無駄を削る ニコ動・静画・Web漫画アンテナのマイリスト画面ならリストの列挙をコピー(押すたびにソート条件変更) Shift+Cで除去文字列設定 Calil検索・yahooテレビ検索・駿河屋検索ならタイトルに検索ワードを挿入
当前为
// ==UserScript== // @name 何も選択していない状態でCtrl+Cでページのタイトル+改行+URL+改行をクリップボードにコピー // @description Amazonや静画(漫画)やGoogle検索ならURLの無駄を削る ニコ動・静画・Web漫画アンテナのマイリスト画面ならリストの列挙をコピー(押すたびにソート条件変更) Shift+Cで除去文字列設定 Calil検索・yahooテレビ検索・駿河屋検索ならタイトルに検索ワードを挿入 // @match *://*/* // @version 0.4.5 // @grant none // @namespace https://gf.qytechs.cn/users/181558 // ==/UserScript== (function() { var sakujoRE = localStorage.getItem("ctrlcsakujoRE") || ""; var cckaisuu = 0; document.addEventListener("keydown", function(e) { //キー入力 if (/input|textarea/i.test(e.target.tagName)) return; if (!e.shiftKey && !e.altKey && !e.ctrlKey && e.which == 65 && /www\.nicovideo\.jp\/my\/mylist/.test(location.href)) { // ニコ動マイリストでAで全てチェック for (let a of elegeta('//div[@class="checkBoxOuter"]/input[@name="checkbox"]')) a.click(); return; } if (e.shiftKey && !e.altKey && !e.ctrlKey && e.which == 67) { // shift+C 除去文字列設定 var str = prompt("shift+C:\r\n\"" + document.domain + "\" で Ctrl+C 押下時タイトルやURLや選択文字列から除去したい文字列を正規表現で入力してください\r\n\r\n現在値:" + sakujoRE + "\r\n", sakujoRE); sakujoRE = str === null ? sakujoRE : str; if (sakujoRE != "") { localStorage.setItem("ctrlcsakujoRE", sakujoRE); } else { localStorage.removeItem("ctrlcsakujoRE"); } return; } if (!e.shiftKey && !e.altKey && e.ctrlKey && e.which == 67) { // ctrl+c if (window.getSelection() != "") { //選択文字列がある var selection=window.getSelection().toString(); if(sakujoRE){ selection=selection.replace(RegExp(sakujoRE, "gm"), ""); // Shift+C 除去文字列を除去 if(window.getSelection().toString()!==selection) copy2cb(selection); } popup("<B>" + selection.length + "文字:</B><BR><pre><code>" + selection + "</code></pre>"); return; } var doc = location.href; var txt1 = doc; var txt2 = txt1; if (/www\.amazon\.co\.jp\/|www\.amazon\.com\//.test(txt1) && (txt1.indexOf("/dp/") != -1)) // Amazonの余計なパラメータ除去 txt2 = "https://"+document.domain+"/dp/" + txt1.substr(txt1.indexOf("/dp/") + 4, 10); if ((txt1.indexOf("www.amazon.co.jp/") != -1) && (txt1.indexOf("/ASIN/") != -1)) txt2 = "https://www.amazon.co.jp/dp/" + txt1.substr(txt1.indexOf("/ASIN/") + 6, 10); if (/\/\/www\.google\.co\.jp\/search\?|\/\/www\.google\.com\/search\?/.test(txt1)) { // google検索結果のパラメータ除去 var para = txt1.split(/[&?]/); txt2 = para[0] + "?"; var j = 0; for (var i = 1; i < para.length; i++) { console.log(para[i]); var a = para[i].replace(/^ei=.*/, "").replace(/^oq=.*/, "").replace(/^gs_l=.*/, "").replace(/^hl=ja/, "").replace(/^source=.*/, "").replace(/^sa=.*/, "").replace(/^ved=.*/, "").replace(/^biw=.*/, "").replace(/^bih=.*/, "").replace(/^dpr=.*/, "").replace(/^ie=.*/, "").replace(/^oe=.*/, "").replace(/^client=.*/, "").replace(/^aqs=.*/, "").replace(/^sourceid=.*/, ""); if (a !== "") { txt2 += (j > 0 ? "&" : "") + a; j++; } } } if (/seiga\.nicovideo\.jp\/comic/.test(txt1)) txt2 = txt1.replace(/\?track=.*/, ""); // 静画(マンガ)短縮 if (/seiga\.nicovideo\.jp\/watch\/mg/.test(txt1)) txt2 = txt1.replace(/\?track=.*/, ""); if (/www\.youtube\.com\/embed\//.test(txt1)) txt2 = txt1.replace(/\?.*/, "").replace(/embed\//, "watch?v="); // youtube埋め込み //document.referrer;// var titleOption = addtitle(/calil.jp\/local\/search/, txt1, '//form[@class="search"]/div/input|//input[@id="query"]'); //,'//div[@class="message"]',/$^/," | "); // calil検索 titleOption += addtitle(/tv\.yahoo\.co\.jp\/search\/\?q=/, txt1, '//input[@class="generic_inputText floatl"]'); // yahooテレビ検索 if(document.title.indexOf("|")===-1) titleOption += addtitle(/www\.suruga-ya\.jp\/search\?/, txt1, '//input[@id="searchText"]','//div[@id="topicPath"]',/駿河屋TOP.≫.|駿河屋TOP/gi); // 駿河屋検索 var ret = (navigator.platform.indexOf("Win") != -1) ? "\r\n" : "\n"; var title = titleOption + document.title.replace(/ https?:.*/, ""); title = title.replace(RegExp(sakujoRE, "g"), ""); // Shift+C 除去文字列を除去 txt2 = txt2.replace(RegExp(sakujoRE, "g"), ""); if (cckaisuu % 1 == 0) { var txt = title + ret + txt2 + ret; var bal = "<B>" + title + "</B><BR>" + txt2; } var sort = ""; // 列挙するタイプのサイトなら if (/seiga\.nicovideo\.jp\/my\/manga\/favorite|webcomics\.jp\/mylist|webcomics\.jp\/bookmark|www\.nicovideo\.jp\/my\/mylist|seiga\.nicovideo\.jp\/my\/clip/.test(txt1)) { var rekkyo = ['//div[@class="title"]/a', '//div[@class="entry-title"]/a', '//div[@class="mylistVideo"]/h5/a', '//div[@class="illust_box_li cfix"]/div/div[@class="text_ttl"]/a']; txt = ""; //title+ret; txt2 = ""; var num = 0; for (let target of rekkyo) { var ele = elegeta(target); if (cckaisuu % 4 == 1) { sort = " 名前↓"; ele.sort(function(a, b) { return (a.innerText > b.innerText) ? 1 : -1; }); } if (cckaisuu % 4 == 2) { sort = " URL↓"; ele.sort(function(a, b) { return (a.href.split(/\/\//g)[1]) > (b.href.split(/\/\//g)[1]) ? 1 : -1; }); } if (cckaisuu % 4 == 3) { sort = " URL↑"; ele.sort(function(a, b) { return (a.href.split(/\/\//g)[1]) < (b.href.split(/\/\//g)[1]) ? 1 : -1; }); } for (let a of ele) { txt += a.innerText + ret + a.href.replace(/\?track=.*/, "") + ret; txt2 += a.innerText + "<BR>" + a.href.replace(/\?track=.*/, "") + "<BR>"; num++; } } title += " " + num + "件" + sort; txt = title + ret + txt; var bal = "<B>" + title + "</B><BR>" + txt2; } // クリップボードにコピー var a = document.createElement("textarea"); a.value = txt; document.body.appendChild(a); a.select(); document.execCommand("copy"); a.parentElement.removeChild(a); // バルーン表示 popup(bal); //"<B>" + title + " " + sort + "</B><BR>" + txt2); e.preventDefault(); cckaisuu++; return; } }, false); return; function elegeta(xpath) { var ele = document.evaluate(xpath, document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); var array = []; for (var i = 0; i < ele.snapshotLength; i++) array[i] = ele.snapshotItem(i); return array; } function eleget0(xpath) { var ele = document.evaluate(xpath, document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); return ele.snapshotLength > 0 ? ele.snapshotItem(0) : ""; } // バルーン表示 function popup(txt) { var ele = eleget0("//span[@id='ctrlc']"); var opa = ele ? 0.9 : 0.8; var panel = document.createElement("span"); panel.setAttribute("style", "max-width:95%; right:0; top:0; z-index:2147483647; opacity:" + opa + "; text-align:left; line-height:1.1; position:fixed; font-size:15px; margin:15px; text-decoration:none; padding:15px 15px; border-radius:7px; background-color:#000000; color:#ffffff; box-shadow:5px 5px 8px #0004; border:2px solid #fff; font-family: 'MS UI Gothic','Meiryo UI','Yu Gothic UI','Arial',sans-serif;"); panel.innerHTML = txt; panel.id = "ctrlc"; document.body.appendChild(panel); setTimeout(function() { panel.parentElement.removeChild(panel); }, 4000); return; } // タイトルに足す function addtitle(url, txt1, xpath,optionxpath="",optionReplaceRE=/$^/,separator=" ") { if (url.test(txt1)) { var ele = eleget0(xpath).value.trim(); var ret = ele > "" ? ele + " - " : ""; if(optionxpath && eleget0(optionxpath)){ ret+=""+(eleget0(optionxpath).innerText.trim().replace(optionReplaceRE,""))+separator; } return ret; } return ""; } // クリップボードにコピー function copy2cb(txt){ var a = document.createElement("textarea"); a.value = txt; document.body.appendChild(a); a.select(); document.execCommand("copy"); a.parentElement.removeChild(a); } })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址