User:Inwind/common.js

// ENABLE IT FROM YOUR PREFERENCES: www.wikidata.org/wiki/Special:Preferences#mw-prefsection-gadgets /*! * merge.js - Script to merge Wikidata items * @author User:Ebraminio  * @contributors User:Ebraminio, User:Ricordisamoa * @license CC-Zero */ /*jslint browser: true, regexp: true, indent: 2, unparam: true*/ /*global jQuery, mediaWiki, wikibase*/ // See also: MediaWiki:Gadget-EmptyDetect.js and MediaWiki:Gadget-RfDHelper.js // (function ($, mw) { 'use strict';  var messages, itemId = mw.config.get('wbEntityId'), api = new mw.Api;  messages = (function  { var translations = { 'en': { confilictMessage: 'A conflict detected on ', confilictWithMessage: 'with', deleteOption: 'Try to automatically delete extra item after merge (only admins)', deleting: 'Deleting...', loadingMergeDestination: 'Loading merge destination...', lowestQid: 'Always merge into the item with lowest Qid', merge: 'Merge', mergePendingNotification: 'Merge.js has been started. Now you can focus your browser on the other item.', mergeProcess: 'Process the merge now', mergeThisItem: 'Merge this item', mergeWithInput: 'Merge with:', mergeWithProgress: 'Merge with...', mergeWizard: 'Merge Wizard', pleaseWait: 'Please wait...', postpone: 'Postpone', postponeTitle: 'Store this item\'s id and postpone the merge', processPostponed: 'process the postponed merge', requestDeletion: 'Request deletion for extra item on RfD', requestingDeletion: 'Requesting deletion...', requestingStreamDeletion: 'Requesting Stream Deletion...', sendingToRfd: 'Sending to RfD...', streamDelete: 'Request $1StreamDeletion$2 for this item (experimental)', unwatchOption: 'Remove merged item from your watchlist (if watched)', unwatching: 'Removing from watch list...' },     'cs': { confilictMessage: 'Detekován konflikt v ', confilictWithMessage: 's', deleteOption: 'Po sloučení automaticky smazat extra položku (pouze správci)', deleting: 'Mažu...', loadingMergeDestination: 'Načítám výsledek sloučení...', lowestQid: 'Vždy sloučit do položky s nižším číslem', merge: 'Sloučit', mergePendingNotification: 'Skript Merge.js byl aktivován. Nyní můžete ve vašem prohlížeči přejít na jinou položku.', mergeProcess: 'Provést nyní sloučení', mergeThisItem: 'Sloučit položku', mergeWithInput: 'Sloučit s:', mergeWithProgress: 'Sloučit s...', mergeWizard: 'Nástroj pro slučování', pleaseWait: 'Prosím čekejte...', postpone: 'Odložit', postponeTitle: 'Uložit id položky a odložit sloučení', processPostponed: 'provést odložené sloučení', requestDeletion: 'Požádat o smazání extra položek na RfD', requestingDeletion: 'Žádám o smazání...', requestingStreamDeletion: 'Žádám o smazání (StreamDelete)...', sendingToRfd: 'Posílám na RfD...', streamDelete: 'Požádat o $1StreamDelete$2 (experimentální)', unwatchOption: 'Odstranit slučované položky ze sledovaných stránek (jsou-li sledovány)', unwatching: 'Odstraňuji ze sledovaných stránek...' },     'de': { confilictMessage: 'Ein Konflikt wurde erkannt bei ', confilictWithMessage: 'mit', deleteOption: 'Lösche übrige Datenelemente nach dem Zusammenlegen (nur für Admins)', deleting: 'Lösche…', loadingMergeDestination: 'Lade zusammengelegtes Datenelement…', lowestQid: 'Immer in das Datenelement mit der niedrigeren Q-Nummer zusammenlegen', merge: 'Zusammenlegen', mergePendingNotification: 'Merge.js wurde gestartet. Jetzt kannst du das andere Datenelement öffnen.', mergeProcess: 'Starte das Zusammenlegen jetzt', mergeThisItem: 'Lege das Datenelement zusammen', mergeWithInput: 'Zusammenlegen mit:', mergeWithProgress: 'Zusammenlegen mit…', mergeWizard: 'Assistent zum Zusammenlegen', pleaseWait: 'Bitte warte…', postpone: 'Verschieben', postponeTitle: 'Speichere die Nummer des Datenelementes und mach es zum Ziel einer Zusammenlegung', processPostponed: 'Starte das Zusammenlegen in das andere Datenelement', requestDeletion: 'Stelle Löschantrag für übrig gebliebene Datenelemente auf RfD', requestingDeletion: 'Stelle Löschantrag…', requestingStreamDeletion: 'Beantrage die Löschung bei StreamDelete…', sendingToRfd: 'Stelle Löschantrag auf RfD…', streamDelete: 'Beantrage die Löschung bei $1StreamDelete$2 (experimentell)', unwatchOption: 'Entferne zusammengelegte Datenelemente von der Beobachtungsliste (wenn beobachtet)', unwatching: 'Entferne von Beobachtungsliste…' },     'es': { confilictMessage: 'Un conflicto detectado en ', confilictWithMessage: 'con', deleteOption: 'Probar a borrar automáticamente los elementos vacíos después de la fusión (solo administradores)', deleting: 'Borrando...', loadingMergeDestination: 'Cargando el destino de la fusión...', lowestQid: 'Fusionar siempre el elemento con el menor número de Qid (identificador de Q)', merge: 'Fusionar', mergePendingNotification: 'Merge.js empezó. Ahora puedes enfocar tu navegador en el otro elemento', mergeProcess: 'Proceder a la fusión ahora', mergeThisItem: 'Fusionar este elemento', mergeWithInput: 'Fusionarlo con:', mergeWithProgress: 'Fusionarlo con...', mergeWizard: 'Herramienta de fusión', pleaseWait: 'Por favor, espera...', postpone: 'Posponer', postponeTitle: 'Guardar el id de este elemento y posponer la fusión', processPostponed: 'procesar la fusión aplazada', requestDeletion: 'Solicitar el borrado de los elementos vacíos en RfD (Solicitud de borrador)', requestingDeletion: 'Solicitando eliminación...', requestingStreamDeletion: 'Solicitando la eliminación Stream...', sendingToRfd: 'Enviando a RfD...', streamDelete: 'Solicitar $1StreamDeletion$2 para este elemento (experimental)', unwatchOption: 'Eliminar los elementos fusionados de tu lista de seguimiento (si están)', unwatching: 'Eliminando de la lista de seguimiento...' },     'fa': { confilictMessage: 'تداخل در ', confilictWithMessage: 'با', deleteOption: 'آیتم\u200cهای خالی را بعد از ادغام حذف کن (فقط برای مدیران)', deleting: 'در حال حذف\u200cکردن...', loadingMergeDestination: 'بارگیری مقصد ادغام...', lowestQid: 'همیشه ادغام در شماره شناسهٔ کمتر انجام گیرد', merge: 'ادغام', mergePendingNotification: 'ابزار ادغام فعال شد هم\u200cاکنون می\u200cتوانید به صفحهٔ آیتم دیگر برای ادغام بروید.', mergeProcess: 'انجام دادن ادغام', mergeThisItem: 'ادغام این آیتم', mergeWithInput: 'ادغام\u200cکردن با:', mergeWithProgress: 'ادغام\u200cکردن با...', mergeWizard: 'ابزار ادغام', pleaseWait: 'صبر کنید...', postpone: 'به تأخیر انداختن', postponeTitle: 'ذخیرهٔ شناسهٔ آیتم و به تاخیر انداختن ادغام', processPostponed: 'عمل به تأخیر انداختن ادغام انجام شد', requestDeletion: 'درخواست حذف برای آیتم\u200cهای خالی شده', requestText: 'درخواست $1', requestingDeletion: 'درحال درخواست حذف...', requestingStreamDeletion: 'درحال ارسال درخواست حذف نمایشی...', sendingToRfd: 'ارسال برای درخواست حذف...', streamDelete: 'درخواست $1StreamDeletion$2 برای این آیتم (آزمایشی)', unwatchOption: 'حذف آیتم\u200cهای ادغام شده از فهرست پی\u200cگیری\u200cها', unwatching: 'حذف از پیگیری\u200cها...' },     'fr': { confilictMessage: 'Un conflit a été détecté sur ', confilictWithMessage: 'avec', deleteOption: 'Essayer de supprimer automatiquement les éléments en trop après la fusion (administrateurs seulement)', deleting: 'Suppression...', loadingMergeDestination: 'Chargement de la destination de fusion...', lowestQid: 'Toujours fusionner dans l\'élément avec le plus petit Qid', merge: 'Fusionner', mergePendingNotification: 'Merge.js a commencé. Vous pouvez maintenant consulter un autre élément.', mergeProcess: 'Procéder à la fusion maintenant', mergeThisItem: 'Fusionner cet élément', mergeWithInput: 'Fusionner avec :', mergeWithProgress: 'Fusionner avec...', mergeWizard: 'Outil de fusion', pleaseWait: 'Attendez...', postpone: 'Repousser à plus tard', postponeTitle: 'Stocker cet identifiant et repousser à plus tard la fusion', processPostponed: 'procéder à la fusion repoussée', requestDeletion: 'Demander la suppression des éléments en trop dans les demandes de suppression', requestingDeletion: 'Demande de la suppression...', requestingStreamDeletion: 'Demande de la suppression de flux...', sendingToRfd: 'Envoi à RfD...', streamDelete: 'Demander une $1StreamDeletion$2 pour cet élément (expérimental)', unwatchOption: 'Retirer les éléments supprimés de votre liste de suivi (s\'ils étaient suivis)', unwatching: 'Retrait de la liste de suivi...' },     'gl': { confilictMessage: 'Un conflito detectado en ', confilictWithMessage: 'con', deleteOption: 'Probar a borrar automaticamente os elementos baleiros despois da fusión (só administradores)', deleting: 'Borrando...', loadingMergeDestination: 'Cargando o destino da fusión...', lowestQid: 'Fusionar sempre o elemento co menor número de Qid (identificador de Q)', merge: 'Fusionar', mergePendingNotification: 'Merge.js comezou. Agora podes enfocar o teu navegador no outro elemento', mergeProcess: 'Proceder á fusión agora', mergeThisItem: 'Fusionar este elemento', mergeWithInput: 'Fusionalo con:', mergeWithProgress: 'Fusionalo con...', mergeWizard: 'Ferramenta de fusión', pleaseWait: 'Por favor, espera...', postpone: 'Pospoñer', postponeTitle: 'Gardar o id deste elemento e pospor a fusión', processPostponed: 'procesar a fusión aprazada', requestDeletion: 'Solicitar o borrado dos elementos baleiros en RfD (Solicitude de borrador)', requestingDeletion: 'Solicitando eliminación...', requestingStreamDeletion: 'Solicitando a eliminación Stream...', sendingToRfd: 'Enviando a RfD...', streamDelete: 'Solicitar $1StreamDeletion$2 para este elemento (experimental)', unwatchOption: 'Eliminar os elementos fusionados da túa lista de vixilancia (se están)', unwatching: 'Eliminando da lista de vixilancia...' },     'gu': { confilictMessage: 'પર એક અથડામણ મળેલ છે', confilictWithMessage: 'સાથે', deleteOption: 'વિલીન કર્યા બાદ વધારાના લેખો સ્વચલિત રીતે દૂર કરવા પ્રયાસ કરો (ફક્ત પ્રબંધકો)', deleting: 'રદ થઈ રહ્યું છે...', loadingMergeDestination: 'વિલિન કરેલ લક્ષ્યાંક લાવાય રહ્યું છે...', lowestQid: 'હંમેશા સૌથી નીચા Q આંકડા સાથે લેખો વિલીન કરો', merge: 'વિલીનMerge', mergePendingNotification: 'Merge.js શરૂ થઈ ગયેલ છે. હવે તમે તમારું બ્રાઉઝર અન્ય લેખ પર કેન્દ્રિત કરી શકો છો.', mergeProcess: 'હમણા જ વિલિનીકરણની પ્રક્રિયા કરો કરો', mergeThisItem: 'આ લેખ વિલિન કરો', mergeWithInput: 'તેને સાથે વિલિન કરો:', mergeWithProgress: 'તેને સાથે વિલિન કરો...', mergeWizard: 'વિલિન વિઝાર્ડ', pleaseWait: 'મહેરબાની કરીને રાહ જુઓ...', postpone: 'મુલતવી રાખોPostpone', postponeTitle: 'આ લેખની ઓળખ સાચવો અને વિલિનીકરણ મુલતવી રાખો', processPostponed: 'મુલતવી રાખેલ વિલિનિકરણ શરૂ કરો', requestDeletion: 'રદ કરવા માટેની વિનંતી ખાતે વધારાના લેખો દૂર કરવા વિનંતી કરો', requestingDeletion: 'રદ કરવા માટે વિનંતી કરાઈ રહી છે...', requestingStreamDeletion: 'સ્ટ્રિમ રદ કરવા વિનંતી કરાઈ રહી છે...', sendingToRfd: 'રદ કરવા માટે વિનંતી ખાતે મોકલાઈ રહ્યું છે...', streamDelete: 'આ લેખ માટે $1StreamDeletion$2 વિનંતી કરો (પ્રાયોગિક)', unwatchOption: 'વિલિન કરેલ લેખો તમારી ધ્યાનસૂચિમાંથી હટાવો (જો ધ્યાનસૂચિમાં હોય તો)', unwatching: 'ધ્યાનસૂચિમાંથી હટાવાય રહ્યું છે...' },     'id': { confilictMessage: 'Ada konflik terdeteksi pada ', confilictWithMessage: 'dengan', deleteOption: 'Secara otomatis menghapus item tambahan setelah penggabungan (hanya admin)', deleting: 'Menghapus...', loadingMergeDestination: 'Loading tujuan penggabungan...', lowestQid: 'Selalu gabungkan dengan Qid item terendah', merge: 'Gabung', mergePendingNotification: 'Merge.js dimulai. Sekarang Anda dapat fokus pada item lain.', mergeProcess: 'Lakukan penggabungan', mergeThisItem: 'Gabungkan item ini', mergeWithInput: 'Gabung dengan:', mergeWithProgress: 'Gabungkan', mergeWizard: 'Peralatan penggabungan', pleaseWait: 'Mohon tunggu sebentar...', postpone: 'Tunda', postponeTitle: 'Simpan item dan tunda penggabungan', processPostponed: 'proses penggabungan yang ditunda', requestDeletion: 'Minta penghapusan pada item tambahan pada RfD', requestingDeletion: 'Permintaan penghapusan...', requestingStreamDeletion: 'Permintaan Penghapusan Stream...', sendingToRfd: 'Kirim ke RfD...', streamDelete: 'Permintaan $1Penghapusan Stream$2 pada item ini (eksperimental)', unwatchOption: 'Hapus item yang digabung dari pantauan (jika ada)', unwatching: 'Hapus dari daftar pantauan...' },     'it': { confilictMessage: 'Rilevato un conflitto in ', confilictWithMessage: 'con', deleteOption: 'Cancella automaticamente gli elementi svuotati dopo l\'unione (solo amministratori)', deleting: 'Cancellazione...', loadingMergeDestination: 'Caricamento della destinazione...', lowestQid: 'Unisci sempre con l\'elemento col numero Q più piccolo', merge: 'Unione', mergePendingNotification: 'Merge.js è avviato. Adesso vai sulla pagina dell\'altro elemento.', mergeProcess: 'Effettua l\'unione adesso', mergeThisItem: 'Unisci questo elemento', mergeWithInput: 'Unisci con:', mergeWithProgress: 'Unione con l\'elemento...', mergeWizard: 'Unione guidata', pleaseWait: 'Aspetta...', postpone: 'Rimanda a dopo', postponeTitle: 'Memorizza l\'id di questo elemento e rimanda a dopo l\'unione', processPostponed: 'Elabora l\'unione rimandata', requestDeletion: 'Richiedi la cancellazione degli elementi svuotati', requestingDeletion: 'Richiesta di cancellazione...', requestingStreamDeletion: 'Richiesta di cancellazione con Stream...', sendingToRfd: 'Inserimento fra le richieste di cancellazione...', streamDelete: 'Richiedi la $1Cancellazione in Stream$2 per questo elemento (sperimentale)', unwatchOption: 'Rimuovi gli elementi uniti dagli osservati speciali (se presente)', unwatching: 'Rimozione dagli osservati speciali...' },     'ja': { confilictMessage: '衝突が検出されました: ', confilictWithMessage: 'と', deleteOption: '統合後に余分な項目の自動的な削除を試みる（管理者のみ）', deleting: '削除中...', loadingMergeDestination: '統合先の読込中...', lowestQid: 'Qから始まるIDが小さい方の項目を必ず統合先に選ぶ', merge: '統合', mergePendingNotification: 'Merge.js が動き出しました. もうブラウザで他の項目に切り替えても大丈夫です. ',       mergeProcess: '統合をいま実行します', mergeThisItem: 'この項目を統合する', mergeWithInput: '統合相手:', mergeWithProgress: '2つの項目を統合', mergeWizard: '統合ウィザード', pleaseWait: 'お待ちください...', postpone: '延期', postponeTitle: 'この項目のIDを保存し、統合を延期します', processPostponed: '延期された統合を処理する', requestDeletion: '残った余分な項目を削除依頼に出す', requestingDeletion: '削除依頼中...', requestingStreamDeletion: 'Stream Deletion 依頼中...', sendingToRfd: '削除依頼への送信中...', streamDelete: 'この項目の $1StreamDeletion$2 を依頼する（実験的）', unwatchOption: '統合された項目をウォッチリストから除去する（ウォッチリストにある場合）', unwatching: 'ウォッチリストからの除去中...' },     'ko': { confilictMessage: '항목 충돌 감지됨: ', confilictWithMessage: '와', deleteOption: '항목 병합을 완료한뒤 다른 항목을 삭제합니다(관리자만 가능)', deleting: '삭제중...', loadingMergeDestination: '병합한 내용을 불러오는 중입니다...', lowestQid: '항상 낮은 Qid를 가진 항목으로 병합합니다.', merge: '병합', mergePendingNotification: 'Merge.js 가 시작되었습니다. 이제 다른 작업을 하셔도 됩니다.', mergeProcess: '병합을 시작합니다.', mergeThisItem: '이 항목을 병합', mergeWithInput: '이 항목과 병합할 다른 항목:', mergeWithProgress: '항목 병합 마법사', mergeWizard: '항목 병합 마법사', pleaseWait: '잠시만 기다리세요...', postpone: '연기', postponeTitle: '항목 번호 \'를 기억하고 병합을 일시 정지', processPostponed: '미뤄 둔 병합을 진행중', requestDeletion: '병합 후 자동으로 RFD에 삭제를 요청합니다.', requestingDeletion: '삭제 요청중...', requestingStreamDeletion: 'Stream Deletion 요청중...', sendingToRfd: 'RfD에 요청 중...', streamDelete: '이 항목을 $1StreamDeletion$2 요청합니다. (실험)', unwatchOption: '주시문서 목록에서 제거합니다 (주시중인 문서일 경우)', unwatching: '주시문서 목록에서 제거중...' },     'lb': { confilictMessage: 'Et gouf e Konflikt fonnt op ', confilictWithMessage: 'mat', deleteOption: 'Versiche fir zousätzlech Elementer no der Fusioun automatesch ze läschen (nëmmen Adminen)', deleting: 'Läschen...', loadingMergeDestination: 'D\'Zilsäit vun der Fusioun gëtt gelueden...', lowestQid: 'Ëmmer op dat Element fusionéieren dat déi niddregest Q-Nummer huet', merge: 'Fusionéieren', mergePendingNotification: 'Merge.js gouf gestart. Elo kënnt dir Iech an Ärem Browser op dat anert Element konzentréieren.', mergeProcess: 'Maacht d\'Fusioun elo', mergeThisItem: 'Fusionéiert dêst Element', mergeWithInput: 'Fusionéiert et mat:', mergeWithProgress: 'Fusionéiert et mat...', mergeWizard: 'Fusiouns-Wizard', pleaseWait: 'Waard w.e.g....', postpone: 'Spéider maachen', postponeTitle: 'Dësem Element seng Nummer verhalen an d\'Fusioun op méi spéit verleeën', processPostponed: 'déi verluechte Fusioun elo maachen', requestDeletion: 'Läsche vun zousätzlechen Elementer per RfD ufroen', requestingDeletion: 'Läschen ufroen...', requestingStreamDeletion: '\'Stream-Läschen\' ufroen...', sendingToRfd: 'Un RfD schécken...', streamDelete: '$1StreamDeletion$2 firr dëst Element ufroen (experimentell)', unwatchOption: 'Fusionéiert lementer vun Ärer Iwwerwaachungslëscht erofhuelen (wa se iwwerwaacht sinn)', unwatching: 'Vun der Iwwerwaachungslëscht erofhuelen...' },     'min': { confilictMessage: 'Ado konflik tadeteksi pado ', confilictWithMessage: 'jo', deleteOption: 'Sacaro otomatih mangapuih item tambahan sasudah panggabuangan (hanyo admin)', deleting: 'Mangapuih...', loadingMergeDestination: 'Loading tujuan panggabuangan...', lowestQid: 'Salalu gabungan jo Qid item tarandah', merge: 'Gabuang', mergePendingNotification: 'Merge.js dimulai. Kini Sanak dapek fokus pado item lain.', mergeProcess: 'Lakukan panggabuangan', mergeThisItem: 'Gabuangkan item ko', mergeWithInput: 'Gabuang jo:', mergeWithProgress: 'Gabuangkan', mergeWizard: 'Pakakeh panggabuangan', pleaseWait: 'Mohon tunggu sabanta...', postpone: 'Tunda', postponeTitle: 'Simpan item dan tunda panggabuangan', processPostponed: 'proses panggabuangan nan ditunda', requestDeletion: 'Minta pangapuihan pado item tambahan di RfD', requestingDeletion: 'Pamintaan pangapuihan...', requestingStreamDeletion: 'Pamintaan Pangapuihan Stream...', sendingToRfd: 'Kirim ka RfD...', streamDelete: 'Pamintaan $1Pangapuihan Stream$2 pado item ko (eksperimental)', unwatchOption: 'Hapuih item nan digabuang dari pantauan (kok ado)', unwatching: 'Hapuih dari daftar pantauan...' },     'nl': { confilictMessage: 'Een conflict werd gedetecteerd op ', confilictWithMessage: 'met', deleteOption: 'Proberen automatisch de extra items te verwijderen na samenvoegen (alleen moderatoren)', deleting: 'Verwijderen...', loadingMergeDestination: 'Bestemmingspagina samenvoeging laden...', lowestQid: 'Altijd samenvoegen in het item met het laagste Qid', merge: 'Samenvoegen', mergePendingNotification: 'Merge.js is gestart. Nu kan je jezelf focussen op het andere item.', mergeProcess: 'Samenvoeging nu uitvoeren', mergeThisItem: 'Dit item samenvoegen', mergeWithInput: 'Samenvoegen met:', mergeWithProgress: 'Samenvoegen met...', mergeWizard: 'Samenvoegingsassistent', pleaseWait: 'Even wachten...', postpone: 'Uitstellen', postponeTitle: 'Sla het id van het item op en stel de samenvoeging uit', processPostponed: 'Voer de uitgestelde samenvoeging uit', requestDeletion: 'Verzoek verwijdering voor extra items op RfD', requestingDeletion: 'Verwijdering verzoeken...', requestingStreamDeletion: 'Streamverwijdering verzoeken...', sendingToRfd: 'Versturen naar RfD...', streamDelete: 'Verzoek $1StreamDeletion$2 voor dit item (experimenteel)', unwatchOption: 'Verwijder samengevoegde items van volglijst (als deze erop staan)', unwatching: 'Verwijderen van volglijst...' },     'pl': { confilictMessage: 'A conflict detected on ', confilictWithMessage: 'z', deleteOption: 'Spróbuj automatycznie usunąć puste elementy po zakończeniu łączenia (tylko dla administratorów)', deleting: 'Usuwanie...', loadingMergeDestination: 'Ładowanie łączonego elementu...', lowestQid: 'Zawsze łącz z elementem o niższym ID', merge: 'Połącz', mergePendingNotification: 'Merge.js has been started. Now you can focus your browser on the other item.', mergeProcess: 'Rozpocznij proces łączenia', mergeThisItem: 'Połącz ten element', mergeWithInput: 'Połącz z elementem:', mergeWithProgress: 'Połącz z...', mergeWizard: 'Merge Wizard', pleaseWait: 'Czekaj...', postpone: 'Odłóż', postponeTitle: 'Store this item\'s id and postpone the merge', processPostponed: 'process the postponed merge', requestDeletion: 'Zgłoś puste elementy do usunięcia', requestingDeletion: 'Zgłaszanie do usunięcia...', requestingStreamDeletion: 'Requesting Stream Deletion...', sendingToRfd: 'Wysyłanie zgłoszenia do usunięcia...', streamDelete: 'Request $1StreamDeletion$2 for this item (experimental)', unwatchOption: 'Usuń łączone elementy ze swojej listy obserwowanych (jeśli na niej były)', unwatching: 'Usuwanie z listy obserwowanych...' },     'sk': { confilictMessage: 'Detekovaný konflikt v ', confilictWithMessage: 's', deleteOption: 'Po spojení automaticky zmazať extra položku (len správcovia)', deleting: 'Mažem...', loadingMergeDestination : 'Načítam výsledok spojenia...', lowestQid: 'Vždy spojiť do položky s nižším číslom', merge: 'Spojiť', mergePendingNotification: 'Skript Merge.js bol aktivovaný. Teraz môžete vo vašom prehliadači prejsť na inú položku.', mergeProcess: 'Vykonať teraz spojenie', mergeThisItem: 'Spojiť položku', mergeWithInput: 'Spojiť s:', mergeWithProgress: 'Spojiť s...', mergeWizard: 'Nástroj na spájanie', pleaseWait: 'Prosím čakajte...', postpone: 'Odložiť', postponeTitle: 'Uložiť id položky a odložiť spojenie', processPostponed: 'vykonať odložené spojenie', requestDeletion: 'Požiadať o zmazanie extra položiek na RfD', requestingDeletion: 'Žiadam o zmazanie...', requestingStreamDeletion: 'Žiadam o zmazanie (StreamDelete)...', sendingToRfd: 'Posielam na RfD...', streamDelete: 'Požiadať o $1StreamDelete$2 (experimentálne)', unwatchOption: 'Odstrániť spájané položky zo sledovaných stránok (ak sú sledované)', unwatching: 'Odstraňujem zo sledovaných stránok...' },     'zh-hans': { confilictMessage: '存在跨语言冲突：', confilictWithMessage: '和', deleteOption: '尝试直接删除数据项', deleting: '删除中……', loadingMergeDestination: '加载目标项……', lowestQid: '并入编号较小的项', merge: '合并', mergePendingNotification: 'Merge.js已经运行，请前往其他需要合并的项. ',       mergeProcess: '开始合并', mergeThisItem: '合并此项', mergeWithInput: '要和此项合并的数据项：', mergeWithProgress: '合并', mergeWizard: '合并数据项', pleaseWait: '请稍候……', postpone: '和其他项合并', postponeTitle: '储存此项编号以和其他项合并', processPostponed: '和已储存项合并', requestDeletion: '提请删除重复项', requestingDeletion: '提请删除中……', requestingStreamDeletion: '提请StreamDeletion中……', sendingToRfd: '提请删除中……', streamDelete: '（试验中）提请$1StreamDeletion$2', unwatchOption: '若可能，从监视列表移除重复项', unwatching: '正在从监视列表移除重复项……' }   }, languageNameParts = mw.config.get('wgUserLanguage').split('-'), lang; translations.no = translations.nb; if (languageNameParts[1] === 'hans' ||       languageNameParts[1] === 'cn' ||        languageNameParts[1] === 'sg' ||        languageNameParts[1] === 'my') { lang = 'zh-hans'; } else if (languageNameParts[1] === 'hant' ||              languageNameParts[1] === 'hk' ||               languageNameParts[1] === 'tw' ||               languageNameParts[1] === 'mo') { lang = 'zh-hant'; } else if (translations[languageNameParts[0]]) { lang = languageNameParts[0]; } else { lang = 'en'; }   // return to fill messages, it is an object which is filled with local and en messages as fallback return $.extend(true, translations.en, translations[lang]); }); /**   * Display progress on form dialog   */  function displayProgress(message) {    if ($('#merge-progress-message').length !== 0) {      $('#merge-progress-message').text(message);      return;    }    $('#merge-form > *').hide;    $('#merge-form ~ .ui-dialog-buttonpane').hide; // hide buttons    $(' ').css({ 'text-align': 'center', 'margin': '3em 0', 'font-size': '120%' }).append( $.createSpinner({       size: 'large',        type: 'block'      }), ' ',     $(' ', {        id: 'merge-progress-message',        text: message      }) ).appendTo('#merge-form'); }  /**   * Display error on form dialog   */  function displayError(error, hideReportLink) {    mw.msg('Error: ' + error);    $('#merge-form > *').hide;    $('#merge-form ~ .ui-dialog-buttonpane').hide; // hide buttons    var reportLink = ' Please report above error here with source and destination of merge. ';    if (hideReportLink === true) { reportLink = ''; }    $('#merge-form').append($(' ', {      'style': 'color: #990000; margin-top: 0.4em;',      'html': ' Error while "' + $('#merge-progress-message').text + '": ' + error + ' ' + reportLink    }));  }  /**   * Check if the user is an admin, and thus can delete items   */  function canDelete {    return $.inArray('sysop', mw.config.get('wgUserGroups')) !== -1;  }  /**   * Retrieve items by id   */ function getItems(ids) { return api.get({     action: 'wbgetentities',      ids: ids.join('|')    }).then(function (data) {      return $.map(data.entities, function (x) { return x; });    }); } /**   * Set a Storage to postpone merge and deletion */ function mergePending(id) { $.jStorage.set('merge-pending-id', id); mw.notify($.parseHTML(messages.mergePendingNotification)); } /**   * ...and reset this Storage */ function removePending { $.jStorage.deleteKey('merge-pending-id'); } /**   * Check if items can be merged */ function detectConflicts(items) { var all = {}, conflicts = {}; $.each(items, function (i) {     if (items[i].sitelinks !== undefined) {        $.each(items[i].sitelinks, function (dbName) { if (all[dbName] !== undefined && all[dbName].sitelinks[dbName].title !== items[i].sitelinks[dbName].title) { if (conflicts[dbName] === undefined) { conflicts[dbName] = [all[dbName]]; }           conflicts[dbName].push(items[i]); }         all[dbName] = items[i]; });     }    });    return conflicts; } /**   * Sort items by their Q## id. Useful for detecting eligible item to merged into. */ function sortItemsId(items) { return $.map($.map(items, function (item) { return { item: item, id: parseInt(item.id.replace(/^Q/i, ''), 10) };   }).sort(function (x, y) { return x.id - y.id; }), function (item) {      return item.item;    }); } /**   * Delete an item */ function deleteItem(id, reason) { return api.postWithEditToken({     action: 'delete',      title: id,      reason: reason    }).fail(function (data) {      displayError(data);    }); } /**   * Moving logic */ function mergeApi(from, to, mergeSummary) { return api.postWithEditToken({     action: 'wbmergeitems',      fromid: from.id,      toid: to.id,      ignoreconflicts: 'description|label', // ignore descriptions and labels conflicts as old version of merge do      summary: 'merge.js' + mergeSummary    }).fail(function (data) {      displayError(data);    }); } function requestDeletion(entity, success, reason, triesCount) { var MAXRETRY = 10; displayProgress(messages.requestingDeletion); api.postWithEditToken({     action: 'edit',      title: 'Wikidata:Requests for deletions',      watchlist: 'nochange',      section: 'new',      sectiontitle:  + entity + ,      summary: '/* ' + entity + ' */ requested deletion (merge.js)',      text: ' ' + '\n'    }).always(function (data) {      if (data === 'editconflict' || (data.error && data.error.info)) { // may an edit conflict happened? retry ten times with 3 second interval        if (triesCount === MAXRETRY) {          displayError(data, true);          return;        }        if (triesCount === undefined) {          triesCount = 0;        }        triesCount = triesCount + 1;        displayProgress(messages.requestingDeletion + ' (' + mw.language.convertNumber(triesCount) + '/' + mw.language.convertNumber(MAXRETRY) + ')');        setTimeout( function { requestDeletion(entity, success, reason, triesCount); }, 3000 + Math.floor(Math.random * 1000) - 500 // make it random, 3000±500ms );     } else {        success;      }    }); } function requestStreamDeletion(entity, mergedTo) { return api.postWithEditToken({     action: 'edit',      appendtext: '\n',      title: 'User:Ricordisamoa/StreamDelete',      watchlist: 'nochange',      summary: '' + entity + ': requested StreamDeletion (merge.js)'    }).then(function (data) {      if (data.error && data.error.info) {        displayError(data.error.info);      }    }, function (data) {      displayError(data);    }); } /**   * Merge process */ function merger(from, to, mergeSummary) { displayProgress(messages.mergeWithInput + ' ' + to.id.toUpperCase); var deferred = mergeApi(from, to, mergeSummary); if ($('#merge-unwatch').is(':checked')) { deferred = deferred.then(function {        displayProgress(messages.unwatching);        return api.unwatch(from.id);      }); }   if (canDelete && $('#merge-delete').is(':checked')) { deferred = deferred.then(function {        displayProgress(messages.deleting);        return deleteItem( from.id, 'Merged with ' + to.id.toUpperCase + ' (merge.js)' + mergeSummary );     });    } else if ($('#merge-send-to-rfd').is(':checked')) { deferred = deferred.then(function {        displayProgress(messages.sendingToRfd);        var defer = $.Deferred;        requestDeletion(from.id.toUpperCase, defer.resolve, 'Merged with ' + to.id.toUpperCase + '' + mergeSummary);        return defer;      }); } else if ($('#merge-streamdelete').is(':checked')) { deferred = deferred.then(function {        displayProgress(messages.requestingStreamDeletion);        return requestStreamDeletion(from.id, to.id);      }); }   deferred.then(function  {      displayProgress(messages.loadingMergeDestination);      window.location = mw.util.getUrl(to.id) + '?action=purge';    }); } /**   * Merge button action, pre-merge checks */ function merge { var itemsNames = [$('#merge-items').val, itemId.toUpperCase], isValid = true, mergeSummary = $('#merge-summary').val; if (/^\w/.test(mergeSummary)) { mergeSummary = ' ' + mergeSummary; }   $.each(itemsNames, function (i) {      if (!/^Q\d*$/i.test(itemsNames[i])) {        isValid = false;      }    }); if (isValid === false) { $('#merge-input-validation-message').text(' Currently only "Qid" is a valid input'); return; }   displayProgress(messages.pleaseWait); getItems(itemsNames).then(function (items) {     // duplicate item if just an item is returned      // if item was being merged to itself this could conflict error that also useful for debugging conflict detector      if (items.length === 1) {        items = items.concat(items);      }      var conflicts = detectConflicts(items),        message;      if ($.map(conflicts, function (x) { return x; }).length === 0) {        if ($('#merge-always-lowest-id').is(':checked')) {          items = sortItemsId(items); // sort by Qid _only_if_specified_        }        merger(items[1], items[0], mergeSummary);      } else {        message = $.map(conflicts, function (x, i) { return ' ' + messages.confilictMessage + i + ':' + $.map(x, function (y, j) {           return ' ' + x[j].id.toUpperCase + ' ' + messages.confilictWithMessage +              ' ' + i + ':' + y.sitelinks[i].title + '';          }).join(','); }).join('').replace(/\[\[([^\]\:]*?)\:([^\]]*?)\]\]/g, function (x, y, z) { return '' + y + ':' + z + ''; });       displayError(message, true);      }    }); } /**   * Create checkbox html */ function createCheckbox(id, text) { return $(' ') .attr('for', id) .css('display', 'block') .append(       $(' ')          .attr({ 'id': id, 'name': id, 'type': 'checkbox' })         .prop('checked', $.jStorage.get(id) === true),        text      ); } /**   * Save options in storage */ function saveOptions { $('#merge-form input:checkbox').each(function (i, x) {     $.jStorage.set(x.id, x.checked);    }); } /**   * Dialog creator and launcher */ function launchDialog(id) { if (typeof id !== 'string') { id = ''; }   var dialog = { width: 450, title: messages.mergeWizard, modal: true, close: function { $(this).remove; },     buttons: [id === '' ? {       text: messages.postpone, title: messages.postponeTitle, click: function { saveOptions; mergePending(itemId.toUpperCase); $(this).dialog('close'); }     } : {        style: 'display: none' }, {       text: messages.merge, title: messages.mergeProcess, specialButton: 'proceed', click: function { saveOptions; removePending; merge; }     }]    };    $(' ', {      'id': 'merge-form',      'style': 'position: relative;'    }).append(      $(' ')        .attr('for', 'merge-items')        .css('display', 'block')        .text(messages.mergeWithInput + ' ')        .append( $(' ', {           'id': 'merge-items',            'style': 'padding: 1px; vertical-align: baseline;'          }).val(id) ),     $(' ')        .attr('for', 'merge-summary')        .css('display', 'block')        .text('merge summary: will be prepended by an auto-generated summary ')        .append( $(' ', {           'id': 'merge-summary',            'style': 'padding: 1px; vertical-align: baseline;'          }) ),     $(' ', {          'id': 'merge-input-validation-message' }).css('color', 'red'),     createCheckbox('merge-always-lowest-id', messages.lowestQid),      createCheckbox('merge-send-to-rfd', messages.requestDeletion),      createCheckbox('merge-streamdelete', messages.streamDelete .replace(/\$1([\S\s]*)\$2/, ' $1 ')),     canDelete ? createCheckbox('merge-delete', messages.deleteOption) : '',      createCheckbox('merge-unwatch', messages.unwatchOption)    ).dialog(dialog).parent('.ui-dialog').attr('lang', $(document.documentElement).attr('lang')); } // Initialization if (itemId !== null &&     mw.config.get('wgNamespaceNumber') === 0 &&      mw.config.get('wgAction') === 'view') { $(window).on('focus storage', function {      $('#merge-queue-process').remove;      if ($.jStorage.get('merge-pending-id') !== null && $.jStorage.get('merge-pending-id') !== '' && $.jStorage.get('merge-pending-id').toLowerCase !== itemId.toLowerCase) {       $(' ')          .attr({ 'src': '//upload.wikimedia.org/wikipedia/commons/thumb/1/10/Pictogram_voting_merge.svg/26px-Pictogram_voting_merge.svg.png', 'alt': 'merge icon' })         .wrap('').parent          .attr({ 'href': '#', 'title': 'process the postponed merge' })         .click(function (event) { event.preventDefault; launchDialog($.jStorage.get('merge-pending-id')); })         .wrap('').parent          .attr('id', 'merge-queue-process')          .prependTo('#p-views ul');      }    }); $(function {      $('#merge-queue-process, #merge-form, #ca-merge').remove;      $(mw.util.addPortletLink('p-cactions', '#', messages.mergeWithProgress, 'ca-merge', messages.mergeThisItem))        .click(function (event) { event.preventDefault; launchDialog; });   });  }  // Export section // currently just for MediaWiki:Gadget-EmptyDetect.js, just launchDialog is exposed window.mergeTool = { launchDialog: launchDialog }; }(jQuery, mediaWiki));