twit原寸(改)

    @@ -12,7 +12,7 @@ var urls = []; [].forEach.call( d.querySelectorAll( '.permalink-tweet-container .AdaptiveMedia-photoContainer img' ), function( img ) { - if ( img.src ) urls.push( img.src.replace( ':[^:]*$', '' ) + ':orig' ); + if ( img.src ) urls.push( img.src.replace( /:\w*$/, '' ) + ':orig' ); } ); if ( urls.length <= 0 ) return;
  • /*
     * @title twit原寸(改)
     * @description twitter画像原寸ボタン(http://hogas.moe/tooi.html)のtwit原寸を、1ページで全画像を表示するよう改修
     * @include https://twitter.com/*
     * @license MIT License
     * @javascript_url
     */
    
    ( function( w, d ) {
    'use strict';
    
    var urls = [];
    
    [].forEach.call( d.querySelectorAll( '.permalink-tweet-container .AdaptiveMedia-photoContainer img' ), function( img ) {
        if ( img.src ) urls.push( img.src.replace( /:\w*$/, '' ) + ':orig' );
    } );
    
    if ( urls.length <= 0 ) return;
    
    d = w.open( 'about:blank' ).document;
    d.open();
    d.write( '<body></body>' );
    d.close();
    
    urls.forEach( function( url ) {
        var img = d.createElement( 'img' ),
            link = d.createElement( 'a' ),
            p = d.createElement( 'p' ),
            img_style = img.style;
        img.src = link.href = url;
        img_style.maxWidth = '100%';
        img_style.height = 'auto';
        link.target = '_blank';
        link.appendChild( img );
        p.appendChild( link );
        d.body.appendChild( p );
    } );
    
    } )( window, document );
    
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2016/01/13 14:57:31 - 2016-01-13
  2. 2016/01/13 12:16:15 - 2016-01-13