Skip to content

Instantly share code, notes, and snippets.

@suneo3476
Created June 15, 2016 05:17
Show Gist options
  • Save suneo3476/277237a5a8d163ad75edb4a20fdfe63d to your computer and use it in GitHub Desktop.
Save suneo3476/277237a5a8d163ad75edb4a20fdfe63d to your computer and use it in GitHub Desktop.
//step1
(ScriptRunner=function(v){var i,n,l,p,c={},w=window,t=setTimeout;for(i=0,n=v.length;i<n;++i){l=v[i];if(typeof l=='string'||l instanceof String){l={'':l}}for(p in l){if(p){if(w[p]){continue}c[p]=1}(function(j){var s=document.createElement('script');s.type='text/javascript';s.charset='UTF-8';s.src=j;t(function(){document.documentElement.appendChild(s)},0)})(l[p])}}return function(f){if(f){t(function(){for(p in c){if(!w[p]){return t(arguments.callee,99)}}f()},0)}return arguments.callee}})([{jQuery: 'https://code.jquery.com/jquery-2.2.4.min.js'},{vue: 'https://cdn.jsdelivr.net/vue/1.0.24/vue.min.js'}])
//step2
(function(){$(document).ready(function(){var css = ["#4A3C94","#BF3559","#4DAB38"];$("h1:last").after("<h2>もくじリスト</h2><ul id='header_list'></ul>");$("td").each(function(){var description = "",$td = $(this),$a = $td.children("a");$.ajax({url: $a.attr("href"),type: 'GET',dataType: 'html',}).done(function(data) {$(data).find( "h1,h2,h3,h4,h5,h6" ).each(function(){description += " - " + $(this).text();});var gakka = $td.children("a").text()[5];$("#header_list").append("<li>"+$td.html()+" <span style='color:white;font-weight:bold;background:"+css[gakka]+"'>"+description+"</span></li>")}).fail(function(data) {});});});})();
//1行ずつ順番にコピペ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment