teratail 修正依頼を定型文で送る

    @@ -13,7 +13,7 @@ const $qs = ( s, c = document ) => { const r = Array.from( c.querySelectorAll(s) ); return r.length ? r : [document.createDocumentFragment()]; - } + }; const helpHTML = ( new DOMParser() ).parseFromString( await(await fetch("https://teratail.com/help/question-tips")).text(),
  • /*
     * @title teratail 修正依頼を定型文で送る
     * @description https://teratail.com/questions/233570 からインスパイア。
     * @include https://teratail.com/*
     * @license public domain
     * @private
     * @javascript_url
     * @require 
     */
    
    
    void (async()=>{
      const $qs = ( s, c = document ) => {
        const r = Array.from( c.querySelectorAll(s) );
        return r.length ? r : [document.createDocumentFragment()];
      };
    
      const helpHTML = ( new DOMParser() ).parseFromString( 
        await(await fetch("https://teratail.com/help/question-tips")).text(), 
        'text/html'
      );
      const helpDOM = $qs( '.P-navigation', helpHTML )[0];
    
      const div = document.createElement('div');
      div.style.position = 'fixed';
      div.style.top = '0';
      div.style.width = '50vw';
      div.style.height = '100vh';
      div.style.background = 'rgba(255,255,255,0.5)';
      div.style.zIndex = '99';
      div.appendChild(helpDOM);
    
      const backDiv = document.createElement('div');
      backDiv.style.position = 'fixed';
      backDiv.style.top = '0';
      backDiv.style.width = '100vw';
      backDiv.style.height = '100vh';
      backDiv.style.zIndex = '98';
    
      document.body.appendChild(backDiv);
      document.body.appendChild(div);
    
      helpDOM.addEventListener('click',e=>{
        $qs('#RequestRewriteInfoForm')[0].value += e.target.textContent + "\nhttps://teratail.com/help/question-tips" + e.target.href + '\n\n';
      });
    
      backDiv.addEventListener('click',e=>{
        backDiv.remove();
        div.remove();
      });
      
    })()
    
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2020/01/10 18:24:55 - 2020-01-10
  2. 2020/01/10 18:16:37 - 2020-01-10
  3. 2020/01/10 17:40:20 - 2020-01-10
  4. 2020/01/10 17:30:48 - 2020-01-10
  5. 2020/01/10 17:29:42 - 2020-01-10