Greasy Fork is available in English.

今年一定島 列印模式

汲汲營營大報社

2021/06/01時点のページです。最新版はこちら。

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください。
// ==UserScript==
// @namespace    https://greasyfork.org/zh-TW/scripts/425205
// @name         今年一定島 列印模式
// @description  汲汲營營大報社
// @author       稻米
// @version      2021.06.01.0010.build16299
// @grant        none

// @include      *://*.komica.org/00/*
// @include      *://*.komica.org/00/*
// @exclude      *://*.komica.org/00/src/*
// @exclude      *://*.komica.org/00/thumb/*
// @exclude      *.jpg
// @exclude      *.png
// @exclude      *.webm

// ==/UserScript==

$(document).ready(function() {
    //poi();
    poi();
});
function poi(){

    //console.log( document.styleSheets );
    //console.log(window.location.href);
    var tmp=window.location.href;
    tmp=tmp.match("\\?res=");
    //window.location.href.match("\\?res=")
    //console.log(tmp);
    if(tmp){
        if( $('div.thread').length == 1 ){
            poi2();
        }
    }else{
        //console.log('非回應');
    }
}
function poi2(){
    //console.log(arguments.callee.name); //poi2
    //$("#threads").before('before');
    $(".thread").before('<poi><button type="reset">列印模式</button></poi>');
    $("poi >button:contains('列印模式')").click(function(){
        //console.log('按鈕');
        poi3();
    });
    //

}//poi2(){

function poi3(){
    var selfres = $('.post.threadpost').attr('data-no'); //首篇編號
    console.log( selfres );
    var apiurl='./pixmicat.php?mode=module&load=mod_ajax&action=thread&html=true&op='+selfres; //綜合版原生api
    console.log( apiurl );

    var jqxhr=$.ajax({
        dataType: "json",
        url: apiurl,
    });
    jqxhr.done(function(a,b,c){
        //console.log( a,b,c ); //json,success,readyState
        var json1=a; // $.parseJSON(); //已解析
        console.log( json1.posts ); //json
        var FFF='';
        $.each(json1.posts, function(index,item){
            //console.log( index,item ); //json
            //console.log( item.com ); //json
/*
com 留言
ext 檔案類型
html
id
image 圖片
mail
name
no
now
resto
sub 標題
thumb 縮圖
time
*/

            //var aa='<h3>'+'</h3>';
var aa1=`
<b>
${item.name}
${item.now}
ID:${item.id}
No.${item.no}
</b>
`;
var aa2=`
<blockquote>
${item.com}
</blockquote>
`;
            var aa3;
            var imgurl;
if(item.ext=='.jpg' || item.ext=='.png'){ //顯示原圖
    
    imgurl='http:'+item.image+'';
    imgurl='https://images.weserv.nl/?url=' + imgurl + '&output=jpg&q=85&filename=' + imgurl.match(/[0-9]{10,}/) +'&w=2048&h=2048&fit=inside&we';// http://
    aa3='<img src='+imgurl+' style="width:auto;height:auto;max-width:250px;max-height:250px;"><br/>';
}
if(item.ext=='.gif' || item.ext=='.webm'){ //顯示縮圖
    imgurl='http:'+item.thumb+'';
    aa3='<img src='+imgurl+' style="width:auto;height:auto;max-width:250px;max-height:250px;"><br/>';
}

            FFF=FFF+aa1+''+aa2+aa3+'';
        });
        FFF=FFF+'<small><sub>end</sub></small>'
        //console.log( FFF ); //文字
        $('html').attr('style',  'all: initial;'); //reset style
        $('body').html('');
        $('body').append(FFF);

    });



};

/*


如果是要把討論串存成圖片 可以在chrome按F12 會出現開發人員工具
再按ctrl+shift+p 會出現命令菜單 先輸入cap 會跳到適當的位置
選擇 Capture full size screenshot 就能擷取目前的網頁

如果覺得擷取的檔案太大 可以按ctrl+shift+m 切換成畫面較小的手機模式再擷取
*/