Mitemin_Image_Code

Mitemin Image to Narou Tag

  1. // ==UserScript==
  2. // @name Mitemin_Image_Code
  3. // @namespace phodra
  4. // @description Mitemin Image to Narou Tag
  5. // @include http://mitemin.net/userimagesearch/search/
  6. // @include http://mitemin.net/imagemanage/top/icode/*
  7. // @include http://*.mitemin.net/userpageimagesearch/search
  8. // @include http://*.mitemin.net/i*
  9. // @version 0.2
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function (){
  14.  
  15. // 小説本文用のタグを生成
  16. var Tagntag = function( userid, imageid)
  17. {
  18. return "<" + imageid + "|" + userid + ">";
  19. }
  20. // 活動報告用のタグを生成
  21. var TagToBlog = function( userid, imageid)
  22. {
  23. return "<img src='http://"+userid+".mitemin.net/userpageimage/viewimage/icode/"+imageid+"/' width='520px' alt='"+imageid+"' />"
  24. }
  25.  
  26. var AppendCode = function()
  27. {
  28. var $div = $("<div style='margin:5px 0px' />");
  29. var $txb = $("<input type='text' onfocus='this.select();' readonly='readonly' name='url'>");
  30. if( location.href.indexOf("http://mitemin.net/imagemanage/top/icode/")>=0 )
  31. { //画像管理TOP
  32. var addres = $("div.manage_box>a:last").attr('href');
  33. var userid = addres.match(/\d+/);
  34. var imgid = addres.match(/i\d+/);
  35.  
  36. var $box = $("div.manage_box");
  37. var $ntag = $div.clone();
  38. var $btag = $div.clone();
  39. var $nt_txb = $txb.clone();
  40. var $bt_txb = $txb.clone();
  41. $ntag.text("小説:");
  42. $btag.text("活報:");
  43. $nt_txb.attr('value', Tagntag(userid,imgid));
  44. $bt_txb.attr('value', TagToBlog(userid,imgid));
  45. $ntag.append($nt_txb);
  46. $btag.append($bt_txb);
  47. $box.append("<br>");
  48. $box.append("・貼付け用タグ");
  49. $box.append($ntag);
  50. $box.append($btag);
  51. }else if( location.href.indexOf("http://mitemin.net/userimagesearch/search")>=0 )
  52. { // 画像情報編集
  53. var $sbox = $(".search_box");
  54. var userid = $("div#mypagelink_button>a.myuser_menu").attr('href').match(/\d+/);
  55. for( var i=0; i<$sbox.size(); i++)
  56. {
  57. var $item = $sbox.eq(i);
  58. if( $item.children("div.codetag").size() ) continue;
  59. var imgid = "i" + $item.children("a").attr('href').match(/\d+/);
  60. var $codetag = $("<div class='codetag'>");
  61. $item.append($codetag);
  62. var $ntag = $div.clone();
  63. $ntag.text("小説:");
  64. var $ntag_txb = $txb.clone();
  65. $ntag_txb.attr( 'value', Tagntag(userid,imgid));
  66. $codetag.append($ntag);
  67. $ntag.append($ntag_txb);
  68. var $toBlog = $div.clone();
  69. $toBlog.text("活報:");
  70. var $toBlog_txb = $txb.clone();
  71. $toBlog_txb.attr( 'value', TagToBlog(userid,imgid));
  72. $codetag.append($toBlog);
  73. $toBlog.append($toBlog_txb);
  74. }
  75. $("div.codetag input").css('width', '100px');
  76. }else if( location.href.search(/http:\/\/\d+\.mitemin\.net\/i\d+/i)>=0 )
  77. { // 個別画像ページ
  78. var $input = $(".image_infomation:last td input");
  79. var $parent = $input.parent();
  80. $input.css('width','230px');
  81.  
  82. var thisurl_val = $input.eq(0).attr('value');
  83. var userid = thisurl_val.match(/\d+/);
  84. var imgid = thisurl_val.match(/i\d+/);
  85.  
  86. var $box = $("<div class='urlbox'>");
  87. var $thisurl = $div.clone();
  88. $thisurl.text("この画像の URL:");
  89. $thisurl.append($input.eq(0));
  90. $box.append($thisurl);
  91. var $tburl = $div.clone();
  92. $tburl.text("Track Back URL:");
  93. $tburl.append($input.eq(1));
  94. $box.append($tburl);
  95.  
  96. var $ntag = $div.clone();
  97. $ntag.text("小説本文用タグ:");
  98. var $nt_txb = $input.eq(0).clone();
  99. $nt_txb.attr('value', Tagntag(userid,imgid));
  100. $ntag.append($nt_txb);
  101. $box.append($ntag);
  102. var $btag = $div.clone();
  103. $btag.text("活動報告用タグ:");
  104. var $bt_txb = $input.eq(0).clone();
  105. $bt_txb.attr('value', TagToBlog(userid,imgid));
  106. $btag.append($bt_txb);
  107. $box.append($btag);
  108.  
  109. $parent.parent().append($box);
  110. $parent.hide();
  111.  
  112. }else if( location.href.search(/http:\/\/\d+\.mitemin\.net\/userpageimagesearch\/search/i)>=0 )
  113. { // 画像一覧
  114. var $sbox = $(".search_box");
  115. var userid = $(".profile_name>p:eq(1)").text().match(/\d+/);
  116. for( var i=0; i<$sbox.size(); i++)
  117. {
  118. var $item = $sbox.eq(i);
  119. if( $item.children("div.codetag").size() ) continue;
  120. var imgid = $item.children("a").attr('href').match(/i\d+/);
  121. var $codetag = $("<div class='codetag'>");
  122. $item.append($codetag);
  123. var $ntag = $div.clone();
  124. $ntag.text("小説:");
  125. var $ntag_txb = $txb.clone();
  126. $ntag_txb.attr( 'value', Tagntag(userid,imgid));
  127. $codetag.append($ntag);
  128. $ntag.append($ntag_txb);
  129. var $toBlog = $div.clone();
  130. $toBlog.text("活報:");
  131. var $toBlog_txb = $txb.clone();
  132. $toBlog_txb.attr( 'value', TagToBlog(userid,imgid));
  133. $codetag.append($toBlog);
  134. $toBlog.append($toBlog_txb);
  135. }
  136. }
  137. }
  138.  
  139. AppendCode();
  140. $(document).on(
  141. {
  142. // 'GM_AutoPagerizeLoaded': function()
  143. // {
  144. // },
  145. 'GM_AutoPagerizeNextPageLoaded': function(e)
  146. {
  147. AppendCode();
  148. }
  149. }
  150. );
  151.  
  152. })();