非公開 Movable Type アイテム埋め込みコード作成

  • /*
     * @title Movable Type アイテム埋め込みコード作成
     * @description Movable Type アイテムの編集ページ内でサムネイルつきリンクのコードを生成する
     * @include http://*
     * @license MIT License
     * @private
     * @require 
     */
    
    (function($){
      var itemview = $("div.asset-preview");
      if(!itemview) return;
      var imgthumb, imgthumb_src, imgthumb_w, imgthumb_h, imgthumb_htm, item_embed;
      var item_uri = $("#asset-url").val();
      if($(itemview).hasClass("asset-type-image")){
        imgthumb = $("div .thumbnail img");
        imgthumb_src = imgthumb.attr("src");
        imgthumb_w = imgthumb.attr("width");
        imgthumb_h = imgthumb.attr("height");
        imgthumb_htm = '<img src="' + imgthumb_src + '" width="' + imgthumb_w +'" height="' + imgthumb_h +'" alt="" />';
        item_embed = '<a href="' + item_uri + '">' + imgthumb_htm + '</a>';
        return prompt("           アイテムの埋め込み          ", item_embed);
      } else {
        return;
      }
    })(jQuery);
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2014/01/12 19:55:58 - 2014-01-12
  2. 2014/01/12 19:09:13 - 2014-01-12
  3. 2014/01/12 18:05:26 - 2014-01-12