| Line 5: |
Line 5: |
| | * https://phabricator.wikimedia.org/T107693 | | * https://phabricator.wikimedia.org/T107693 |
| | * | | * |
| − | * @author [[User:Efly]] | + | * @author [https://meta.wikimedia.org/wiki/User:Efly] |
| | */ | | */ |
| − |
| |
| − | mw.notify( $('<span>Gadget <a href="https://wiki.personaldata.io/wiki/User:Podehaye/Gadget-CreateNewItem.js">CreateNewItem</a> loaded this time! Yay!</span>') );
| |
| | | | |
| | ( function ( $, mw ) { | | ( function ( $, mw ) { |
| | 'use strict'; | | 'use strict'; |
| − |
| |
| | // To translators: | | // To translators: |
| | // $1 is the original error message (e.g. "No match was found.") | | // $1 is the original error message (e.g. "No match was found.") |
| Line 18: |
Line 15: |
| | switch ( mw.config.get( 'wgUserLanguage' ) ) { | | switch ( mw.config.get( 'wgUserLanguage' ) ) { |
| | default: | | default: |
| | + | mw.messages.set( { |
| | + | 'not-found-message': '$1. Create new item...' |
| | + | } ); |
| | + | break; |
| | case 'en': | | case 'en': |
| | mw.messages.set( { | | mw.messages.set( { |
| Line 48: |
Line 49: |
| | | | |
| | function openNewItemPopup( currentField ) { | | function openNewItemPopup( currentField ) { |
| − | mw.notify( $('<span>openNewItemPopup</span>') );
| |
| | // .submit( requestDeletion ) | | // .submit( requestDeletion ) |
| | var currentLabel = currentField.val(); | | var currentLabel = currentField.val(); |
| Line 86: |
Line 86: |
| | | | |
| | function init() { | | function init() { |
| − | mw.notify( $('<span>init</span>') );
| + | // mw.notify( $('<span>init Gadget-CreateNewItem</span>') ); |
| | var currentField = $( 'input' ); | | var currentField = $( 'input' ); |
| | var willEntitySelectorListUpdate = false; | | var willEntitySelectorListUpdate = false; |
| Line 107: |
Line 107: |
| | return false; | | return false; |
| | } ); | | } ); |
| − | $innerA.text( mw.message( 'not-found-message', $innerA.text(), $( '#n-special-newitem' ).text() ) ); | + | $innerA.text( mw.message( 'not-found-message', $innerA.text(), |
| | + | // $( '#n-special-newitem' ).text() |
| | + | "Create New Item" |
| | + | ) ); |
| | } | | } |
| | } | | } |
| Line 114: |
Line 117: |
| | | | |
| | $( function () { | | $( function () { |
| − | mw.notify( $('<span>hooking'+mw.config.get( 'wgUserLanguage' )+'</span>') );
| |
| | mw.hook( 'wikibase.entityPage.entityLoaded' ).add( init ); | | mw.hook( 'wikibase.entityPage.entityLoaded' ).add( init ); |
| | } ); | | } ); |
| | | | |
| | }( jQuery, mediaWiki ) ); | | }( jQuery, mediaWiki ) ); |