リンクトルトルくん

    
      
  • /*
     * @title リンクトルトルくん
     * @description 表示中のページのタイトルを使ってaタグを表示します。マークダウンでリンクを貼るときに使えます。
     * @include http://*
     * @license MIT License
     * @require 
     */
    
    	console.log("始まり");
    	//タイトルの取得
    	var title = document.querySelector('h1');
    	var titletext = title.textContent;
    	console.log(titletext);
    
    	//urlを取得
    	var url = window.location.href;
    	console.log(url);
    
    	//表示部分の作成
    	var all = document.createElement('div');
    	all.innerHTML = '<textarea color="red">' + '<a href="' + url + '">' + titletext + '</a>' + '</textarea>';
    	all.style.fontSize = '8px';
    	all.style.color = '#000';
    	all.style.zIndex = '1000';
    	all.style.width = '100%';
    	all.style.height = '100%';
    	all.style.backgroundColor = 'rgba(0,0,0,0.9)';
    	all.style.position = 'fixed';
    	var insert = [];
    	insert = document.getElementsByTagName('div');
    	document.body.insertBefore(all, insert[0]);
    
    
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2017/02/28 01:10:39 - 2017-02-28
  2. 2017/02/28 01:10:06 - 2017-02-28