| このページではAC/DC という JavaScript のガジェットを解説しており、有効にするには利用者の個人設定で切り替えます。スクリプト自体の保管先はMediaWiki:Gadget-ACDC.js です。 |
![AC/DC [変更の保存ボタン]。編集するファイル:[ファイル名6件]。追加する文:Caroline Zhang の動き。ビールマンスピンの体勢またはポーズを示す。[文を追加するボタン]](/image.pl?url=https%3a%2f%2fupload.wikimedia.org%2fwikipedia%2fcommons%2fthumb%2fa%2fa3%2fAdd_to_Commons_Descriptive_Claims_-_Caroline_Zhang.png%2f500px-Add_to_Commons_Descriptive_Claims_-_Caroline_Zhang.png&f=jpg&w=240)
Add to Commons / Descriptive Claims(コモンズ・解説の文書に追加)、略称AC/DCは複数のファイルにそれぞれ構造化データの文を追加するガジェットのこと。
有効にするには自分の個人設定を開きます。概観はこちら。
Add to Commons / Descriptive Claims (ACDC): Add a collection of structured data statements to a set of files.[documentation / talk]
このガジェットはサイドバーのTools部分に「AC/DC」リンクを追加し、これを押すとメインダイヤログが開きます。入力欄に編集対象のファイル名を記入し、その下部の文を編集するにはコモンズの通常の構造化された利用者インターフェイスの要素が使えます。書き終えたら上部にある大きな青いボタンを押し(ボタンの英語表記は“publish changes”、翻訳対象)、一覧にあるファイルにそれぞれの文を追加します。ダイヤログの操作を完了すると自動で閉じますので、手動でブラウザの窓/タブは閉じないでください。(処理中を示す横棒が上部に表示されます 。)
ファイル一覧に複数のファイル名をコピペするには(接頭辞の「ファイル:」あるいは URL 全文を省略可)、1件ごとにパイプ文字 (|)かタブか改行で区切ります。Enter(リターンキー) を押すとそれぞれの入力欄が生成されます。注意点:あまりたくさんのファイルを処理しようとするとエラーが出やすくなります。確定した上限値はないものの、百の単位で入力欄に記入した場合、ブラウザが数秒にわたって固まるため、作者自身はその規模の処理を試みたことがありません。おそらくは処理終了がかなり遅延し、処理が終わるまではブラウザを開いたまま、電源も落とせなくなると予想されます。
特定のカテゴリやPagePile,にすべての画像を加えることもでき、その手順は
アイコンを押してから、「カテゴリを読み込む」もしくは「PagePile を読み込む」ボタンを押すとダイアログが開き、カテゴリ名もしくは PagePile ID を記入欄に入力します。前記の文で扱った思考がここでも適用でき –1000件単位のファイルを扱うのには適していません。(ユーザーインターフェイスそのものも、リストが長大すぎると扱いにくくなりがちですので、まずあらかじめ入力する文をよくよく考えておき、カテゴリもしくは PagePile の指定を急がないことです。)
IfCat-a-lot is enabled, then you can also use it to select some files, and those files will be added when you open AC/DC. (You can still add more files to AC/DC afterwards as described above.)
特定のファイルについて、利用者が追加したい文の値が既に付与されている場合、不足している修飾子のどれかが既存の文に追加され、利用者がその文を重要と指定してマークすることができます。さもなければ、新しい文が追加されます。
既定では AC/DC 「描写」(depict)声明のフィールドから開始し、直接、描写した項目を追加したりその他の属性を追加して声明の添付ができます。カスタマイズするにはご自分の common.jsでwindow.acdcFavoritePropertiesの設定でおこないます。たとえば属性のdepicts(P180)、creator(P170)、copyright license(P275)から取りかかり、次のコードを記入します。
window.acdcFavoriteProperties=['P180','P170','P275',];
もし毎回、自分で属性を選択するには、既定の属性を以下の方法で除去します。
window.acdcFavoriteProperties=[];
また声明の除去にも予備のサポートがあります。window.acdcEnableRemoveFeature = true;をご利用の common.js (例) に追加すると、声明欄に2個目の削除用の欄が追加する声明の下部に表示されます。ファイル一覧から属性が適合する声明と値ごとに削除ができます。(この機能はたまたま既定で有効ですが、UI 改良が望まれます。) 前述のwindow.acdcFavoritePropertiesは声明の2つの欄どちらにも働きます。どちらか一方の欄の属性のみ扱うには、window.acdcFavoritePropertiesToAdd とwindow.acdcFavoritePropertiesToRemove を使います。
AC/DC includes some features intended to make it easier for user scripts to interact with the gadget.The starting points are twohooks that user scripts can add handlers for,gadget.acdc.loaded andgadget.acdc.opened.For more details, see also thegadget’s source code, especially at the end.
gadget.acdc.loaded is fired as soon as AC/DC has finished loading (after adding the link to theTools
menu).It is called with one argument, the “exports” of AC/DC, an object containing theopenAcdc() function.You can call this function to open AC/DC at any time; it returns aPromise for an object containing the AC/DC dialog as thestatementsDialog member.You can mostly interact with the dialog as soon as the promise resolves,but thestatementToAddWidgets andstatementToRemoveWidgets will not be initialized yet;in general, it’s usually a better idea to use thegadget.acdc.opened hook instead,and ignore the return value ofopenAcdc().
gadget.acdc.opened is fired as soon as the AC/DC has been fully opened and the widgets to add and remove statements have been initialized.It is called with one argument, an object containing thestatementsDialog.Useful methods that you can call includestatementsDialog.filesWidget.loadCategory( 'Category:...' ),statementsDialog.filesWidget.loadPagePile( 12345 ),andstatementsDialog.addStatementToAddWidget( 'P180', 'wikibase-item' );see thegadget’s source code for details.
The following example prepares AC/DC to addinstance of(P31)test data(Q7705759) to all files inCategory:Test images:
mw.hook('gadget.acdc.loaded').add(({openAcdc})=>{openAcdc();mw.hook('gadget.acdc.opened').add(async({statementsDialog})=>{constrequire=awaitmw.loader.using(['wikibase.datamodel']);const{Claim,EntityId,PropertyValueSnak,Statement,StatementList,}=require('wikibase.datamodel');conststatementWidget=statementsDialog.addStatementToAddWidget('P31','wikibase-item');awaitstatementWidget.setData(newStatementList([newStatement(newClaim(newPropertyValueSnak('P31',newEntityId('Q7705759'),))),]));statementWidget.setEditing(true);awaitstatementsDialog.filesWidget.loadCategory('Category:Test images');console.log('Done!');});});
ユーザーインターフェイスの翻訳は、MediaWiki:Gadget-ACDC-i18n.jsonで定義します。(ページ編集ができるのは管理者およびインターフェイス管理者に限定されるため、{{編集リクエスト}}を出してから/または開発者にピン通知をしてください。)
Development takes placeon GitHub.
全般的にこのガジェットWikibaseMediaInfo 内部機能とその実行手順に強く連動し、その結果、予想外の障害を起こす可能性があります。なにか異常を発見したら、その場で開発者に報告をあげてください。
2019年9月19日以降、このガジェットを使った編集には「ACDC」タグが付与され、最近の更新から探せるようになりました。(当時より以前はACDC経由の編集かどうか確かめたり検出する方法はありませんでした。)
Since 2022年2月10日, anedit group is automatically created when ten or more files are edited at once. The edit group offers a convenient place to discuss the edits, or revert them all if necessary.