Flower_thz

方便赏桃花

Verze ze dne 10. 07. 2020. Zobrazit nejnovější verzi.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         Flower_thz
// @name:zh-cn   赏桃花
// @name:en      Flower_thz
// @namespace    http://tampermonkey.net/
// @version      0.1.4
// @description:zh-cn  方便赏桃花
// @description:en     Easy to enjoy peach blossom
// @author       xy969
// @match        *://thzd.cc/forum-*.html
// @grant        none
// @require      https://code.jquery.com/jquery-1.12.4.min.js
// @description 方便赏桃花
// ==/UserScript==

(function() {

     //遍历列表元素,添加点击事件
     $.each($("tbody[id^='normalthread']"), function(i){
         $(this).on('click',function(){
         //alert(this.id);
             if($("ul#picA_"+i+"").length!=0){
              $("ul#picA_"+i+"").remove();
             }else{
                 var $yy = $(this);

                 var url = $yy.children().find('a.s.xst').attr('href');

                 //获取详情页信息
                 htmlobj=$.ajax({url:url,async:false});console.log(htmlobj.responseText)
                 var rspTxt = htmlobj.responseText
                 //console.log(htmlobj);
                 //主图展示
                 var tr1 = document.createElement("ul");
                 $(tr1).attr('id','picA_'+i);
                 var td_1 = document.createElement("li");
                 $(td_1).attr('width','300');
                 $(td_1).attr('class','common');
                 td_1.innerHTML ='<div><img src="'+/(?<=zoomfile=")\S*(?=")/.exec(rspTxt).toString()+'"  width=600></img></div>';
                 tr1.append(td_1);
                 this.append(tr1);
                 var url2s = rspTxt.match(/(?<=class="zoom" file=")\S*(?=")/g);
                 //副图展示
                 for(var j=0;j<url2s.length;j++){

                   var tr2 = document.createElement("ul");
                   $(tr2).attr('id','picB_'+i+'_'+j);

                   var td_2 = document.createElement("li");
                   $(td_2).attr('width','300');
                   $(td_2).attr('colspan','2');
                   $(td_2).attr('class','common');
                   td_2.innerHTML ='<div><img src="'+url2s[j]+'" width=600></img></div>';
                   tr1.append(td_2);
                   this.append(tr2);
                 }

             }
         })
     })

})();