読者です 読者をやめる 読者になる 読者になる

by shigemk2

当面は技術的なことしか書かない

jQueryで各記事に画像を追加する β版

はてなブログ

java

カテゴリーがJavaだったらJavaのサムネを挿入するjQueryを 「デザイン」→「記事」→「記事下」のところに追加する。

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
(function($) {
    $(function() {
        var category = $("div.categories a").text();
        if (category == 'Java') {
            $('<img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxATEBAUExAVFRURFhUXFhYWFRUSEhUYFxYWFhUbFxQYHSohGBwnGxMVITEkJikrLjAuGB8zOjMvNystLisBCgoKBQUFDgUFDisZExkrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrK//AABEIALcBEwMBIgACEQEDEQH/xAAbAAEAAgMBAQAAAAAAAAAAAAAABQYDBAcBAv/EAEwQAAIBAgMDCAUGCQkJAAAAAAABAgMRBAUSBiExBxNBUWFxgZEiMnKhsRRCUmKSwSMzNFODk6KywhUWFyRE0dLh8UNUVWNkc4Li8P/EABQBAQAAAAAAAAAAAAAAAAAAAAD/xAAUEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwDhwAAAAAAAAAAAAAAAAAAAAAAe2Am8sy9VcFjJW9LDSpTT6XGeuM0+z0U/BkGX3J8LzGS4urPc8SrR63G+iHvcn3MoQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA9SA8sWjY3ZaeKmpzTVCD9J8HO3zY/e+jvJHZLYaVXTVxKcafGNPepz9r6Mfe+wmNr9q6eHh8mwtlNLS3G2mkuqP1vh3gQ3KPnUJyhhaVtFD1rerrSsorsir+L7Cj2N/Lssr4iemlTlN9L6FfplJ7l4krjslw+FVsRW11fzFDo9urJNR7kr7wK2DLXnFtuMVFdSu0vGTbZiAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACOlbCbHqMYYjERvJ+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