Difference between revisions 8052 and 8053 on ukwikivoyage// для експериментальної сторінки створення маршрутів $( document ).ready(function() { //створення форм після завантаження if(mw.config.get('wgPageName') == 'Користувач:RLuts/testforms') { $("#expjsforms").append('<input id="commonscat" value="Категорія Вікісховища"/> <input id="newform" type=button value="Додати населений пункт" />'); } }); (contracted; show full) if($(this).val() === '') { $(this).val(e.data); $(this).css('color', '#ccc'); } }); } //////////////////////////// /////////////////////////////////////// $( '#commonscat' ) .suggestions( { fetch: function( query ) { var $this = $(this); var request = $.ajax( { url: wgScriptPath + '/api.php', data: { 'action': 'opensearch', 'search': query, 'namespace': 0, 'suggest': '' }, dataType: 'json', success: function( data ) { if ( data && 1 in data ) { $this.suggestions( 'suggestions', data[1] ); } } }); $(this).data( 'request', request ); }, cancel: function () { var request = $(this).data( 'request' ); // If the delay setting has caused the fetch to have not even happend yet, the request object will // have never been set if ( request && typeof request.abort == 'function' ) { request.abort(); $(this).removeData( 'request' ); } }, result: { select: function( $input ) { $input.closest( 'form' ).submit(); } }, delay: 120, positionFromLeft: $( 'body' ).is( '.rtl' ), highlightInput: true } ) .bind( 'paste cut', function( e ) { // make sure paste and cut events from the mouse trigger the keypress handler and cause the suggestions to update $( this ).trigger( 'keypress' ); } ); // Special suggestions functionality for skin-provided search box $( '#commonscat' ).suggestions( { result: { select: function( $input ) { $input.closest( 'form' ).submit(); } }, special: { render: function( query ) { if ( $(this).children().size() == 0 ) { $(this).show() $label = $( '<div />' ) .addClass( 'special-label' ) .text( mediaWiki.msg( 'vector-simplesearch-containing' ) ) .appendTo( $(this) ); $query = $( '<div />' ) .addClass( 'special-query' ) .text( query ) .appendTo( $(this) ); $query.autoEllipsis(); } else { $(this).find( '.special-query' ) .empty() .text( query ) .autoEllipsis(); } }, select: function( $input ) { $input.closest( 'form' ).append( $( '<input />' ).attr( { 'type': 'hidden', 'name': 'fulltext', 'value': 1 } ) ); $input.closest( 'form' ).submit(); } }, $region: $( '#сommonscat' ) }⏎ function fetchIT(d, y) { mw.log( 'fetched' ); this.suggestions( 'suggestions', ['Lorem ipsum dolor sit amet', 'consectetur adipisici elit', 'sed eiusmod tempor incidunt ut labore et dolore magna aliqua']); } $( '#commonscat' ).suggestions( 'fetch', fetchIT ); All content in the above text box is licensed under the Creative Commons Attribution-ShareAlike license Version 4 and was originally sourced from https://uk.wikivoyage.org/w/index.php?diff=prev&oldid=8053.
![]() ![]() This site is not affiliated with or endorsed in any way by the Wikimedia Foundation or any of its affiliates. In fact, we fucking despise them.
|