Recent changes Random page
GAMING
more wikis
 
Gaming
Entertainment
Science Fiction
Biggest wikis
Hobbies
Music
その他

Help:専用のボタンを作る

出典: Wikia

button_bold.png
button_italic.png
button_link.png
button_extlink.png
button_headline.png
button_image.png
button_media.png
button_math.png
button_nowiki.png
button_sig.png
button_hr.png
button_upload.gif

MediaWiki 1.9にアップグレードしたため、個人の編集ボタンのカスタマイズが簡単になっています(アカウント名/monobook.js'か、ウィキアの全ユーザー向けなら、in MediaWiki:Common.js)。

これらのボタンは、グラフィカルではありますが、文字挿入に近い機能を提供します。これらは、javascriptが有効になっているときしか出現しませんし、ユーザーがカスタマイズもできます。

[編集] 利用法

まずは、23x22の画像を作成し(テンプレートとして Image:Button_blank.pngを使うことができます)、アップロードします。注意 : 画像は、ウィキアを横断して使うつもりなら(つまり、他のウィキでも便利に使えるように)、アップロードをして、直接、セントラル・ウィキアから使ってください([[Category:Custom edit buttons]]にリストアップするといいです)。images.wikia.comから全ての画像を提供しているので、そこにおけば、誰でも使えるというのがその理由です。とりあえずは、複製する必要はありません。

その後、あなたのuser js(またはside-side.js)を編集します。単にmwCustomEditButtonsの配列を加えれば、ドキュメントが出力されたときに呼び出されます。



 if (mwCustomEditButtons) {
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://images.wikia.com/central/images/c/c8/Button_redirect.png",
     "speedTip": "Redirect",
     "tagOpen": "#REDIRECT [[",
     "tagClose": "]]",
     "sampleText": "Insert text"};
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://images.wikia.com/central/images/c/c9/Button_strike.png",
     "speedTip": "Strike",
     "tagOpen": "<s>",
     "tagClose": "</s>",
     "sampleText": "Strike-through text"};
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://images.wikia.com/central/images/1/13/Button_enter.png",
     "speedTip": "Line break",
     "tagOpen": "<br />",
     "tagClose": "",
     "sampleText": ""};

   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://images.wikia.com/central/images/7/74/Button_comment.png",
     "speedTip": "Comment visible only for editors",
     "tagOpen": "<!-- ",
     "tagClose": " -->",
     "sampleText": "Insert comment here"}
  }

  • imageFile : 画像のフルパスです。画像は、ウィキア上の画像にしてください。もしくは、望むにしても、あなたの個人的なサイトの画像にしてください。— ウィキメディアからの帯域を取ろうとしないでください。
  • speedTip : ツールチップテキストです(マウスをボタンにかざしたときに出力されます)。
  • tagOpen : 開くタグです。
  • tagClose : 閉じるタグです(サンプルのテキストでは、必要ないので、落としています)。
  • sampleText : 挿入時に(他のふたつのタグに囲まれて)自動的にハイライトされるテキストです。これは、ユーザーの入力で置き換えられることになります。

[編集] 参考

画像のアップロードは、以下よりできます。

画像の利用できるリポジトリです(ここでは、コピーとアップロードが必要です)。

詳細な例は、以下にあります。

.