LoginSignup
1
0

More than 1 year has passed since last update.

サイトのデータ整形メモ

Last updated at Posted at 2017-12-29

スマホゲー FEH(ファイアーエムブレムヒーロズ) のキャラ一覧データ整形するためのjQuery

https://altema.jp/fe-heroes/charalist
事前にソートした後実行が望ましい

$('table tr').each(function() {
  $(this).children(':last-child').text($(this).children(':last-child').data('value'));
  $(this).children(':first-child').replaceWith("<td>" + $(this).children(':first-child').find('img').attr('alt') + "</td>");
  $(this).children(':nth-child(2)').replaceWith("<td>" + $(this).children(':nth-child(2)').find('img').attr('alt') + "</td>");
  $(this).children(':nth-child(3)').remove();
  $(this).children(':nth-child(5)').remove();
});

↑がいつの間にかフォーマット変わってて動かないー。

こっちで代用 https://game8.jp/fe-heroes/116312 tdの /10 を削除するだけのjQuery

$('td').each(function(){
    var txt = $(this).html();
    $(this).html(
        txt.replace(/\/10/g,'')
    );
});

evernoteで左側のリストのタイトルと日付をコンソールに表示する

$(".focus-NotesView-Note-snippetContent").each(function(index, element){
    console.log($(element).children().eq(1).text() + '\t' + $(element).children().eq(0).text());
})

なろう系小説を縦書き用ブックマークレット

javascript:$('#novel_header').remove();$('.box_announce_bookmark').remove();$('.contents1').remove();$('.toaster').remove();$('div[class^="koukoku"]').remove();$('.novel_bn').remove();$('#pageBottom').remove();$('.wrap_menu_novelview_after').remove();$('#novel_hyouka').remove();$('.center').remove();$('.narou_modal').remove();$('#impression').remove();$('#novel_attention').remove();$('#novel_footer').remove();$('#pageTop').remove();$('#footer').remove();$('#recommend').remove();$('#review').remove();$('#container').css('margin','10px auto 0');$('body').css('writing-mode','vertical-rl');$('p').last().css('padding-left','60px');

画像で特定URL始まりの抽出(CDNの画像抽出とか)


// srcの始まりで検索
domArray = $$('img[src^="https://cdn.hoge"]')
for (let i in domArray) {
    console.log(domArray[i].getAttribute('src'))
}
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0