🎉 欢迎访问GreasyFork.Org 镜像站!本镜像站由公众号【爱吃馍】搭建,用于分享脚本。联系邮箱📮

Greasy fork 爱吃馍镜像

66ysGetUrl

try to take over the world!

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

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.

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

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!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

/**
 * Created by zhang on 2017/5/27.
 */


// ==UserScript==
// @name         66ysGetUrl
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  try to take over the world!
// @author       You
// @match        https://chrome.google.com/webstore/category/extensions
// @grant        none
// ==/UserScript==

(function() {


    // Your code here...

    //找到页面中的所有table

    var tabArray = document.getElementsByTagName("table");
    var realTable = [];
    //find all Tbody
    for(var i=0,a=0,len=tabArray.length; i<len; i++){
        if(tabArray[i].getAttribute("bgcolor") === "#0099cc"){
            realTable[a] = tabArray[i];
            a++;
        }
    }

    var linkList = [];
    var j = 0;
    //变量有3 i为体 j为连续的数组下标 o为单个体内a的个数
    for(var i=0,len=realTable.length; i<len; i++){

        var linkContent = realTable[i].getElementsByTagName("a");
        var strs = realTable[i].getElementsByTagName("strong")[0];

        // tBody Head info
        if(strs){
            linkList[j] = "\n" + "\n" +strs.lastChild.nodeValue + "\n" + "\n";
            j++;
        }
        //

        for(var o = 0; o<linkContent.length; j++,o++){
            if(linkContent[o].getAttribute("thunderpid")){
                //黑恶势力做斗争
                linkList[j] = linkContent[o].getAttribute("thunderrestitle")+ "\n";
            }
            else {
                linkList[j] =   linkContent[o].getAttribute("href") + "\n";
            }
        }

    }

    //creat textarea button to body!
    var linkTagTextArea = document.createElement("textarea");
    linkTagTextArea.setAttribute("cols",150);
    linkTagTextArea.setAttribute("rows",50);
    linkTagTextArea.setAttribute("id","UrlArea");

    for(var i=0,len=linkList.length; i<len; i++){
        linkTagTextArea.appendChild(document.createTextNode(linkList[i]));
    }

    document.body.appendChild(linkTagTextArea);

    //TODO 添加按钮 增加事件 拷贝到粘贴板

    var btn = document.createElement("input");
    btn.setAttribute("type","button");
    btn.setAttribute("value","复制到粘贴板");

    btn.addEventListener("click",function (e) {

        var textArea = document.getElementById("UrlArea");
        var clipboardData = window.clipboardData; //for IE
        if (!clipboardData) { // for chrome
            alert("浏览器不支持复制 请手动 CTRL+C");
            return;
        }

        clipboardData.setData('Text', textArea.firstChild.nodeValue);
        alert("复制成功");

    })

    document.body.appendChild(btn);
    document.body.appendChild(linkTagTextArea);
    //end
})();