I'm working with Richard Dawkins on jQuery UI based version of his old Blind Watchmaker Programs. I'm trying to get my JavaScript module to load in MediaWiki. Are jquery-ui.js and jquery-ui.css part of MediaWiki? Or can I add them easily?
Talk:JQuery
For anyone reading in the future, jQuery UI can be loaded via ResourceLoader, for example in JavaScript using mw.loader.load( 'jquery.ui' ), but even though it currently works and will work for some time, support for jQuery UI is scheduled to be deprecated and should generally be avoided.
Is "the reason why we patched our jQuery" still relevant? Mentioning it might made sense a decade ago , but now it seems only confusing. If that is applicable only to very old (and unsupported) versions of MediaWiki, I think it should be clearly marked as such.
Thanks. This is obsolete indeed. I've removed it.
In meta:User:Incnis_Mrsi/PDF-PNG.js I used the former for one of the hooks†, whereas pl:MediaWiki:Gadget-edithysteria.js sets a hook with jQuery(document)
. Which differences exist between one and another?
† The script nowadays fails presumably due to error at $( document ).load( PdfToPNG )
, but it’s unclear whether do I attempt something inherently foolish, or anything broke in JS libraries of MediaWiki, or any other kind of error occurred.
I need to load a script from CDN which depends on jQuery. If I use $outputPage->addScriptFile('http://example.com/xxx.js')
, the script loads before jQuery and fails.
Heya everyone. I've upgraded my instance of MW from 1.26 to 1.30 realized that there are JS-warnings like "This page is using the deprecated ResourceLoader module "jquery.ui.widget"." in Chrome console. The reason is I'm using <code>"dependencies": ["jquery.ui.dialog"],</code> im my skin.json.
There is jQuery JavaScript Library v1.11.3 and jQuery UI Dialog 1.9.2 in new wiki resources folder. According http://jqueryui.com jQuery UI Dialog version must be 1.12.1. Am I right? If yes, what is the right way to upgrade jQuery UI? Or just download latest version of UI to skin folder?
Is there a particular reason why jQuery 1.4.2 wasn't used for mediawiki 1.16? Was there a problem with jQuery 1.4.2 that caused you to use the one year older 1.3.2?
This post was posted by Peachey88, but signed as 98.248.0.129.
Because 1.3.2 was the most recent version when 1.16 development was started.
MediaWiki 1.17 shipped with jQuery 1.4.2.
MediaWiki 1.18 will ship with 1.6.2.
For more info, see jQuery.
I'd like to use Firefox add-on FireQuery for jQuery development but haven't come very far yet. I suppose the problem is the minified jQuery which isn't very useful for development purposes. Is there a way to use the uncompressed version of jQuery for development? TIA
I don't know FireQuery, but as of 1.17 the ResourceLoader is serving all resources (minified by default). Append "?debug=true" or "&debug=true" to the end of a link to disable it. Then all raw modules will be loaded. In your development please use mw.log
where you would otherwise do a check for your own debug mode and use console.log
. mw.log
is a built-in function that will either do nothing in production mode or (in debug mode) send messages to your console (if available) or in a logger-element on the page. See also RL/DM#mediaWiki.log.
I have MW 1.25.1 with Vector skins.
I have added the following in the bottom of localsettings.php. then i ran one of the jquery.makeCollapsible to test it out, but it doesn't seems to run anything in preview. Is this normal?
Also, how do i add jquery functions in visualeditor? is that possible?
// Include jQuery
function wfIncludeJQuery() {
global $wgOut;
$wgOut->includeJQuery();
}
$wgExtensionFunctions[] = 'wfIncludeJQuery';
Example
Uncaught Error: Unknown dependency: jquery.json
in JavaScript console on chrome. And all modules, using jquery does not works. Anybody know how to fix this issue?
The 'jquery.json' module was added to MediaWiki in version 1.18. Looks like you're using something that wasn't designed for MediaWiki 1.17. Perhaps you downloaded an extension from /trunk/ ? If so: either:
- download an old version of the extension from /branches/REL1_17/extensions/;
- or, wait until MediaWiki 1.18 or 1.19 is released (1.18 is scheduled for beta-release around September/November)
- or, use MediaWiki from /trunk/ as well. note that trunk is not reviewed or stable. Not recommended for production/live wikis.
Short identifiers in JavaScript are scarce, and "$" is the "golden one". Maybe some future day, jQuery will be obsolete, and there will be willing to free the "$" identifier for a different resource.
That would be a needed but huge breaking change. Do some discussions or thoughts concerning this (I hope hypothetical for long) scenario exist?
Regardless of the future for jQuery in MediaWiki or its default shortcut, I would strongly advise against use of $
as variable name in any JavaScript program. While it's unfortunate jQuery used this shortcut originally, we can't change that (and technically this character is as valid as any other for use in a variable name). But I certainly would not recommend using it for your own code. Not now, not in the future, regardless of whether we use jQuery. There are plenty of other characters available, and you needn't be worried about the length of variable names – given compression and minification we apply.
Nothing that I'm aware of. But I don't think you should worry about something that it's not going to break in the foreseeable future.