Ласкаво просимо до україномовної Вікіпедії! Welcome to Ukrainian Wikipedia!

ред.

Ми раді бачити Вас у нашому спільному відкритому проєкті і сподіваємося, що Ви візьмете участь у його подальшій роботі не тільки як читач, але і як дописувач!

Якщо Ви початківець, то радимо переглянути деякі корисні поради:

Якщо після прочитання у Вас залишились запитання або знадобилася допомога спеціальною порадою для перших кроків, то:


 
Кнопка підпису в новому оформленні

У Ваших репліках на сторінках обговорень бажано ставити автоматичний підпис за допомогою чотирьох тильд (~~~~) або за допомогою позначки підпису в вікні редагування. У статтях, написаних або редагованих Вами, підпис ніколи не ставиться.

Бажаємо успіхів та якнайбільше творчого задоволення!

Regardless of your languages skills, you are welcome to create your own User Page, link your UkrWiki user page or other pages of this project to Wikipedia projects in other languages, upload images, correct data, discuss problems, communicate & cooperate with the community. Please, use language templates from Wikipedia:Babel or create your own to describe your language skills.
You can ask for further help at the Embassy.


Pgnviewer

ред.

Hello, קיפודנחש. Interface administrator of ukwiki NickK created file MediaWiki:Script/pgnwrapper.js on ukwiki. Then I used the template {{Pgnviewer}} in the article Матч за звання чемпіона світу із шахів 2016 and discovered that the template repeated 12 times instead of 1. The same problem is seen on the page of the template - that is each using of the template cause its duplicating: it is duplicated as many times as it is used on the page. I couldn't find the reason of the error. Could you help to solve the problem? Раммон (обговорення) 07:33, 14 травня 2019 (UTC)Відповісти

User:Раммон - thanks. i will try to get to it in the next couple of days - prolly not today... :( peace - קיפודנחש (обговорення) 15:18, 14 травня 2019 (UTC)Відповісти
User:Раммон - it seems that the problem was solved by Спеціальна:Diff/25154752. this is something i mentioned on ruwiki a while ago. unfortunately, User:Sergento solved it for MediaWiki:Script/pgnwrapper.js, instead of doing it on MediaWiki:Common.js, which will do it for _any_ "load on demand" (or "load by template") script. (basically, instead of the current code
// CURRENT CODE
//Для Шаблон:Виконати скрипт

if ( mw.config.get('wgCanonicalNamespace') !== 'Special' ) 
	mw.hook( 'wikipage.content' ).add( function( content ) {
		$( '.executeJS', content ).each( function () {
			var sc = this.className.split(' ')[1];
			sc = $.trim( sc.replace(/[^\w ]/g,'') );
			if( sc ) importScript('MediaWiki:Script/'+sc+'.js');
		} );
	} );

// "CORRECT" code:

if ( mw.config.get('wgCanonicalNamespace') !== 'Special' ) 
	mw.hook( 'wikipage.content' ).add( function( content ) {
		var already = {}; // will reset on each "content" event, but 99% of the time, this is good enough.
		$( '.executeJS', content ).each( function () {
			var sc = this.className.split(' ')[1];
			sc = $.trim( sc.replace(/[^\w ]/g,'') );
			if( sc && !already[sc] ) {
				already[sc] = true;
				importScript('MediaWiki:Script/'+sc+'.js');
			}
		} );
	} );
in hewiki, we do not have this problem, since we load it as a "hidden gadget", so resourceloader takes care on not loading more than once. (btw - i did not check to see what ruwiki does to prevent multiple load of same script, but i'm sure they do something, otherwise same problem should appear there too). peace - קיפודנחש (обговорення) 22:08, 14 травня 2019 (UTC)Відповісти