שיחת מדיה ויקי:Common.js

תוכן הדף אינו נתמך בשפות אחרות.
מתוך ויקיטקסט, מאגר הטקסטים החופשי

Double jQuery[עריכה]

Hi, As of October 2010 jQuery has been loaded by default on all pages within the Wikimedia domain. Back then the $ alias was not set so you had to use jQuery. I noticed that this wiki is loading an additional instance of jQuery:


document.write('<script type="text/javascript" src="' 
             + 'http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>');

This is a problem because it overrides the jQuery loaded by MediaWiki:

/* MediaWiki */
jQuery = .......
jQuery.plugin = .....

/* he.wikisource.org */
http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js

jQuery.plugin is now gone.

If you wish to use the $-variable as a shortcut to jQuery, use the following:

window.$ = jQuery;

// Now you can use $
$('#something').hide();

As of today, since 1.17 is deployed, the $-variable is automatically a shortcut to jQuery so you dont have to do that either. For that reason please remove the following two lines:


document.write('<script type="text/javascript" src="' 
             + 'http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>');
  • No longer overrides the one loaded by MediaWiki (which is a different version (1.4.2))
  • $ is already set as alias to jQuery
  • Loads the page faster (loading once instead of twice saves time)!

Thanks in advance, Krinkle 20:42, 11 בפברואר 2011 (IST)[תגובה]

PS: If you have any questions, feel free to ask me or someone else in #wikimedia-dev on irc.freenode.org or leave a message on my Talk page on Meta-Wiki. Krinkle 20:42, 11 בפברואר 2011 (IST)[תגובה]

Give search results even when page doesn't exist[עריכה]

Screenshot of the Earth test search, with this script adding links to Wikidata, Reasonator, Commons, and Wikipedia.

Hello, I propose to enable the tool created by Magnus Manske (creator of MediaWiki) to provide results from other languages and Commons (via Wikidata) when a page doesn't exist here: links are added to Special:Search and noarticletext. This helps to encourage translation and to make readers use your wiki more, because they can be sure to find something even if it's not local (rather than searching directly on the biggest wiki). The Italian and Polish Wikipedias, among others already enabled it by default.
Examples: [1] [2] [3]. More information: Magnus blog.
How to: just add the following line at the end of Common.js.

// Results from Wikidata
// [[File:Wdsearch_script_screenshot.png]]
if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Search' ||  ( mw.config.get( 'wgArticleId' ) === 0 && mw.config.get( 'wgCanonicalSpecialPageName' ) === false ) ) {
	importScriptURI("//en.wikipedia.org/w/index.php?title=MediaWiki:Wdsearch.js&action=raw&ctype=text/javascript");
}

--Nemo 22:37, 19 במאי 2017 (IDT) (comments, translations and last instructions)[תגובה]

הצעת עדכון[עריכה]

אני מציע לתקן את הסקריפט כפי שכתוב להלן, כך שקוד ישן שאין בו עוד צורך ימחק ומשתנים גלובלים יקראו באמצעות mw.config.get. (ייתכן שיש עוד קוד ישן - אלו לפחות החלקים ששמתי לב אליהם) ערן (שיחה) 22:37, 19 במאי 2017 (IDT)[תגובה]


עדכונים להווה[עריכה]

הדף הזה לא מתוחזק כבר שנים ולדעתי כדאי שמי מעורכי הממשק שמבין בזה יעבור עליו ויראה מה רלוונטי ומה כבר לא. דוגמאות קונקרטיות:

  • בשורה 621 יש 'סקריפט זמני' שנמצא שם עוד מלפני 2008 (לא בדקתי מעבר), ומיותר.
  • בשורה 672 יש סקריפט מיותר מהסיבה הפשוטה שאין לנו בוויקיטקסט דף שנקרא "ויקיפדיה:מזנון" וגם לא נראה לי שהוא נצרך לאחר כל השדרוגים שעברו דפי השיחה בשנים האחרונות.
  • מיד אחריו מופיע סקריפט של קישורי בינוויקי שהונח שם בתאריך 10/9/2008 (אני חושב שזה לפני המצאת ויקינתונים) וגם נראה מיותר לאחר השדרוגים.

כל זה רק בתוך 100 שורות... שלום אורישיחה • ד' באייר ה'תשפ"ג • 18:50, 24 באפריל 2023 (IDT)[תגובה]

אולי כדאי לתייג את המשתמשים בעלי הרשאת עורך ממשק אצלנו.--נחוםשיחה 20:28, 24 באפריל 2023 (IDT)[תגובה]