Re 2ch Links

2ch各種連結還原、縮圖預覽

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

Advertisement:

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

Advertisement:

// ==UserScript==
// @name         Re 2ch Links
// @version      1.2b
// @description  2ch各種連結還原、縮圖預覽
// @include      http://*.2ch.*/
// @include      http://*.bbspink.com/*
// @include      http://*.open2ch.net/*
// @grant        GM_log
// @grant        GM_addStyle
// @noframes
// @namespace https://greatest.deepsurf.us/users/6037
// ==/UserScript==
var imgSE = 1; //預設1開啟縮圖預覽 0關閉

var ttp = function ttp(){
    var b=document.body; 
    b.innerHTML = b.innerHTML.replace(/(\<br\>\s)(ttp\:\/\/.*?\/.*?)(\s\<br\>)/g, '$1<a href="h$2" target="_blank">h$2</a>$3');
    //b.innerHTML = b.innerHTML.replace(/(\s)(ttp\:\/\/.*?\/.*?\.jpg)(\s\<br\>)|(\s)(ttp\:\/\/.*?\/.*?\.png)(\s\<br\>)|(\s)(ttp\:\/\/.*?\/.*?\.gif)(\s\<br\>)/ig, '$1<a href="h$2" target="_blank">h$2</a>$3');
};ttp();

var ras = 0;
var ra = function re1(){
    var b=document.body;

    b.innerHTML = b.innerHTML.replace(/(\<a\shref\=\")http\:\/\/.*?\/.*?(\"\starget\=\"\_blank\"\>)(http\:\/\/.*?)(\<\/a\>)/ig, '$1$3$2$3$4');
    if (ras < 1){
        setTimeout(ra, 1000);
    }ras++;
};ra();

var css = '.UCss1{max-width:200px;max-height:200px}';
var Uimg = function Uimg1(){   
    GM_addStyle(css);
    if (imgSE == 1){
        var Ulinks = document.links;
        
        for(var i=1;i<Ulinks.length;i++){
            if (Ulinks[i].innerHTML.match('.png') !== null || Ulinks[i].innerHTML.match('.jpg') !== null || Ulinks[i].innerHTML.match('.gif') !== null || Ulinks[i].innerHTML.match('.JPG') !== null || Ulinks[i].innerHTML.match('.PNG') !== null || Ulinks[i].innerHTML.match('.GIF') !== null ){
                Ulinks[i].innerHTML = Ulinks[i].innerHTML.replace(/(.*)/, "");
                var Uhref = Ulinks[i].href;
                var imgt = document.createElement('img');
                imgt.setAttribute('src', Uhref);
                imgt.setAttribute('class', 'UCss1');
                Ulinks[i].appendChild(imgt);              
                var imgt2 = document.createElement('p');
                imgt2.innerHTML = Uhref;
                Ulinks[i].appendChild(imgt2);
            }
        }
    }};Uimg();