ページソース

&spanclass(image){https://twimg0-a.akamaihd.net/profile_images/3032515523/41ea2b7cb8683f1d0f8b18d4f3385b5e_bigger.png,width=200,height=200}
&spanclass(image){flame_gob.png}

Javascript

#js(){{
$(function(){
  $(".image").each(function(){
    var option = $(this).text().split(",");
    var imgSrc = new Array();
    var imgAttr = new Object;
    var imgAttrLength = 0;
    for(var i = 0;i < option.length;i++){
      if(option[i].indexOf("=") >= 0){
        var optionItem = option[i].split("=");
        imgAttr[optionItem[0]] = optionItem[1];
        imgAttrLength++;
      } else {
        imgSrc.push(option[i]);
      }
    }
    if(imgSrc.length == 0){
      $(this).text("imageプラグインError:画像ファイル名を指定してください。");
    } else {
      if(imgSrc[0].indexOf("http") < 0){
        var sitePath = String(location).split("/");
        sitePath = "http://" + sitePath[2]+"/"+sitePath[3]+"/";
        var pageName = $("head title").text().split(" - ");
        pageName = pageName[1];
        imgSrc[0] = sitePath + "?cmd=upload&act=open&page=" +pageName +"&file="+ imgSrc[0];
      }
      imgAttr["src"] = imgSrc[0];
      var imgtag = $("").attr(imgAttr);
      if(imgSrc.length > 1){
        imgtag = imgtag.wrap("");
      }
      $(this).replaceWith(imgtag);
    }
  });
});

}}

ソースの整形表示

最終更新:2013年02月18日 06:28
添付ファイル