blog/2023-10-04 の変更点

入力ヘルパープラグイン「inputtoolbar」をPW1.5.4で使えるようにした


#author("2023-10-05T21:54:57+09:00;2023-10-04T18:25:38+09:00","default:admin","admin")
#author("2023-11-22T22:57:05+09:00;2023-10-04T18:25:38+09:00","default:admin","admin")
* 入力ヘルパープラグイン「inputtoolbar」をPW1.5.4で使えるようにした [#mb6079d3]
&tag(PukiWiki,PukiWiki Plus!,プラグイン);

#bcontents

#ecache{{{

PukiWiki Plus!で標準搭載されている入力ヘルパーをTakuchan氏がプラグイン化したinputtoolbarプラグインをこのサイトに導入したいため、1.5.4へ対応させ、修正しました。

以下のページからダウンロードできます。
https://github.com/PTOM76/PukiWiki-Plugins/raw/main/inputtoolbar_0.2.1.zip

inputtoolbar 0.2.0aではpukiwiki.skin.phpへJSのタグを追加しないといけませんでしたが、プラグイン呼び出し時、自動的にタグへ追加するようにしましたので、導入方法はzipの中身をすべてPukiWikiのルートディレクトリへ移動させます。

なお、zipに入っているものは以下の通りとなっています。
- plugin/
-- inputtoolbar.inc.php
- image/
-- plus/画像類
-- face/
--- plus/画像類
- skin/
-- pukiwiki_plus/
--- jsファイル類


そしてinputtoolbarを表示させたいプラグインに
 (exist_plugin("inputtoolbar") ? "\n" . plugin_inputtoolbar_convert() : '')
をhtml生成部分に挿入するだけです。

私が開発している[[CtrlCmt>PukiWikiプラグイン/ctrlcmt.inc.php]]プラグインでは自動的にinputtoolbarを導入している場合使えるようにしているのでプラグイン改造がよくわからない方は使ってみてください。

commentプラグインの場合は、comment.inc.php内のplugin_comment_convert()関数の最後の$stringを以下のように変更するといいでしょう。
#gcode(php){{
</form>
EOD;

	// return $string;
	return $string . (exist_plugin("inputtoolbar") ? "\n" . plugin_inputtoolbar_convert() : '');
}
}}

このままでは使えないPlus!限定の絵文字があるのでdefault.ini.phpも編集してPlus!の絵文字も追加します。

#gcode(php){{
	// Face marks, Japanese style
	'\s(\(\^\^\))'	=> ' <img alt="$1" src="' . IMAGE_DIR . 'face/smile.png" />',
	'\s(\(\^-\^)'	=> ' <img alt="$1" src="' . IMAGE_DIR . 'face/bigsmile.png" />',
	'\s(\(\.\.;)'	=> ' <img alt="$1" src="' . IMAGE_DIR . 'face/oh.png" />',
	'\s(\(\^_-\))'	=> ' <img alt="$1" src="' . IMAGE_DIR . 'face/wink.png" />',
	'\s(\(--;)'	=> ' <img alt="$1" src="' . IMAGE_DIR . 'face/sad.png" />',
	'\s(\(\^\^;\))'	=> ' <img alt="$1" src="' . IMAGE_DIR . 'face/worried.png" />',
	'\s(\(\^\^;)'	=> ' <img alt="$1" src="' . IMAGE_DIR . 'face/worried.png" />',
// ここから
	'\s(\(T\-T)'    => ' <img alt="$1" src="' . IMAGE_DIR . 'face/plus/tear.png" />',
	'\s(\(\^Q\^)'   => ' <img alt="$1" src="' . IMAGE_DIR . 'face/plus/huh.png" />',
	'\s(\(\^_\-)'   => ' <img alt="$1" src="' . IMAGE_DIR . 'face/plus/wink.png"/>',
// ここまで追加

	// Push buttons, 0-9 and sharp (Compatibility with cell phones)
}}

全部Plus!仕様の絵文字でいいや!って方は以下を使ってみてください
#gcode(php){{
	// Face marks
	'\s(\:\))'	=> ' <img alt="$1" src="' . IMAGE_DIR . 'face/plus/smile.png" />',
	'\s(\:D)'	=> ' <img alt="$1" src="' . IMAGE_DIR . 'face/plus/bigsmile.png" />',
	'\s(\:p)'	=> ' <img alt="$1" src="' . IMAGE_DIR . 'face/plus/huh.png" />',
	'\s(\:d)'	=> ' <img alt="$1" src="' . IMAGE_DIR . 'face/plus/huh.png" />',
	'\s(XD)'	=> ' <img alt="$1" src="' . IMAGE_DIR . 'face/plus/oh.png" />',
	'\s(X\()'	=> ' <img alt="$1" src="' . IMAGE_DIR . 'face/plus/oh.png" />',
	'\s(;\))'	=> ' <img alt="$1" src="' . IMAGE_DIR . 'face/plus/wink.png" />',
	'\s(;\()'	=> ' <img alt="$1" src="' . IMAGE_DIR . 'face/plus/sad.png" />',
	'\s(\:\()'	=> ' <img alt="$1" src="' . IMAGE_DIR . 'face/plus/sad.png" />',
	'&amp;(smile);'	=> ' <img alt="[$1]" src="' . IMAGE_DIR . 'face/plus/smile.png" />',
	'&amp;(bigsmile);'=>' <img alt="[$1]" src="' . IMAGE_DIR . 'face/plus/bigsmile.png" />',
	'&amp;(huh);'	=> ' <img alt="[$1]" src="' . IMAGE_DIR . 'face/plus/huh.png" />',
	'&amp;(oh);'	=> ' <img alt="[$1]" src="' . IMAGE_DIR . 'face/plus/oh.png" />',
	'&amp;(wink);'	=> ' <img alt="[$1]" src="' . IMAGE_DIR . 'face/plus/wink.png" />',
	'&amp;(sad);'	=> ' <img alt="[$1]" src="' . IMAGE_DIR . 'face/plus/sad.png" />',
	'&amp;(heart);'	=> ' <img alt="[$1]" src="' . IMAGE_DIR . 'face/plus/heart.png" />',
	'&amp;(worried);'=>' <img alt="[$1]" src="' . IMAGE_DIR . 'face/plus/worried.png" />',

	// Face marks, Japanese style
	'\s(\(\^\^\))'	=> ' <img alt="$1" src="' . IMAGE_DIR . 'face/plus/smile.png" />',
	'\s(\(\^-\^)'	=> ' <img alt="$1" src="' . IMAGE_DIR . 'face/plus/bigsmile.png" />',
	'\s(\(\.\.;)'	=> ' <img alt="$1" src="' . IMAGE_DIR . 'face/plus/oh.png" />',
	'\s(\(\^_-\))'	=> ' <img alt="$1" src="' . IMAGE_DIR . 'face/plus/wink.png" />',
	'\s(\(--;)' 	=> ' <img alt="$1" src="' . IMAGE_DIR . 'face/plus/sad.png" />',
	'\s(\(\^\^;\))'	=> ' <img alt="$1" src="' . IMAGE_DIR . 'face/plus/worried.png" />',
	'\s(\(\^\^;)'	=> ' <img alt="$1" src="' . IMAGE_DIR . 'face/plus/worried.png" />',
	'\s(\(T\-T)'    => ' <img alt="$1" src="' . IMAGE_DIR . 'face/plus/tear.png" />',
	'\s(\(\^Q\^)'   => ' <img alt="$1" src="' . IMAGE_DIR . 'face/plus/huh.png" />',
	'\s(\(\^_\-)'   => ' <img alt="$1" src="' . IMAGE_DIR . 'face/plus/wink.png"/>',

}}
その場合以下も変更するといいでしょう。skin/pukiwiki_plus/inputhelper.js
#gcode(javascript){{
var pukiwiki_helper_img = 
'<img src="image/plus/buttons.gif" width="103" height="16" border="0" usemap="#map_button" tabindex="-1" />&nbsp;'+
pukiwiki_adv_tag +
'<img src="image/plus/colors.gif" width="64" height="16" border="0" usemap="#map_color" tabindex="-1" />&nbsp;'+
'<span style="cursor:hand;">'+
'<img src="image/face/plus/smile.png" width="15" height="15" border="0" title="(^^)" alt="(^^)" onClick="javascript:pukiwiki_face(\'(^^)\'); return false;" />'+
'<img src="image/face/plus/bigsmile.png" width="15" height="15" border="0" title="(^-^" alt="(^-^" onClick="javascript:pukiwiki_face(\'(^-^\'); return false;" />'+
'<img src="image/face/plus/huh.png" width="15" height="15" border="0" title="(^Q^" alt="(^Q^" onClick="javascript:pukiwiki_face(\'(^Q^\'); return false;" />'+
'<img src="image/face/plus/oh.png" width="15" height="15" border="0" title="(..;" alt="(..;" onClick="javascript:pukiwiki_face(\'(..;\'); return false;" />'+
'<img src="image/face/plus/wink.png" width="15" height="15" border="0" title="(^_-" alt="(^_-" onClick="javascript:pukiwiki_face(\'(^_-\'); return false;" />'+
'<img src="image/face/plus/sad.png" width="15" height="15" border="0" title="(--;" alt="(--;" onClick="javascript:pukiwiki_face(\'(--;\'); return false;" />'+
'<img src="image/face/plus/worried.png" width="15" height="15" border="0" title="(^^;" alt="(^^;" onclick="javascript:pukiwiki_face(\'(^^\;\'); return false;" />'+
'<img src="image/face/plus/tear.png" width="15" height="15" border="0" title="(T-T" alt="(T-T" onclick="javascript:pukiwiki_face(\'(T-T\'); return false;" />'+
'<img src="image/face/plus/heart.png" width="15" height="15" border="0" title="&amp;heart;" alt="&amp;heart;" onClick="javascript:pukiwiki_face(\'&amp;heart;\'); return false;" />'+
'<'+'/'+'span>';
}}


** 関連 [#q4ee449c]
#blink(https://pukiwiki.osdn.jp/?自作プラグイン/inputtoolbar.inc.php,http://lunatear.net/archives/000700.html)
#blink(https://pukiwiki.sourceforge.io/?自作プラグイン/inputtoolbar.inc.php,http://lunatear.net/archives/000700.html)

}}}

** コメント [#j78467c0]

#pctrlcmt

検索

 

最新のページ

2023-11-22 2023-10-26 2023-10-08

[もっと見る]

タグ

[もっと見る]

人気のページ

カウンター

合計: 221
今日: 2
昨日: 1
オンライン: 3
  編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
This site is protected by Turnstile and the Cloudflare Privacy Policy and Terms of Service apply.