Thread:User talk:CodeCat/User:CodeCat/lookup language

Hello, you have come here looking for the meaning of the word Thread:User talk:CodeCat/User:CodeCat/lookup language. In DICTIOUS you will not only get to know all the dictionary meanings for the word Thread:User talk:CodeCat/User:CodeCat/lookup language, but we will also tell you about its etymology, its characteristics and you will know how to say Thread:User talk:CodeCat/User:CodeCat/lookup language in singular and plural. Everything you need to know about the word Thread:User talk:CodeCat/User:CodeCat/lookup language you have here. The definition of the word Thread:User talk:CodeCat/User:CodeCat/lookup language will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofThread:User talk:CodeCat/User:CodeCat/lookup language, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.

Since you asked for feedback, some nitpicks in no particular order:

  • You will be better off enabling JSHint options that I recommended. Especially undef.
  • You declared a dependency on LegacyScripts, but you are not using it anywhere. LegacyScripts should not be depended upon anyway. Having (new) scripts depend upon it defeats its only purpose: to make it possible to be disabled.
  • The callback function could be integrated straight into the .done() handler; well, unless you plan to call it from somewhere else.
  • I tend to keep one long-lived mw.Api object instead of creating a new one every time I need to call the API. Repeatedly constructing and destroying objects costs some time.
  • { 'a': 'b', } may not work in some IEs IIRC, some of which we might want to support. I do not really remember which.
  • If you had the form as a raw DOM node instead of a jQuery wrapper, you could access fields like: langcode = form.inputName.value (where inputName is the name property of the field). Though see below for an alternative, I think a less fragile one.
  • Some error handling would be nice. And more features, like looking up scripts, and reverse lookup (i.e. by name). And why force people to navigate to a specific page to use this? Though I realise this is just a prototype. Right?
  • xte has a similar feature already, implemented a bit differently.
  • I think Module:languages/JSON repacking one abstraction into another abstraction shows how the whole object-orientation business imposed upon Lua is silly.
  • Placement of {. Nearly every serious JS library (and some non-serious libraries) follows (Crockford's variant of) K&R here.
  • I really dislike jQuery. This may be just my taste, but I find that library too bloated, and I avoid using it unless 1) MediaWiki forces me to, or 2) I think I would end up writing a half-hearted reimplementation of something jQuery does already anyway if I avoided using it. I never use jQuery for constructing DOM — I tend to use the el function I copy everywhere (I really need to put it in a library), which is similar to newNode we have in LegacyScripts. You give it arguments describing a DOM element, and it returns a fully-formed node. The main advantage comes when you combine that with assignment-expressions:
var target = document.getElementById('mw-content-text'); // or sth
var input, button;

target.appendChild(el('form', [
	el('fieldset', [
		input = el('input', null, { type: 'text', value: 'boo' }),
		button = el('input', null, { type: 'submit', value: 'doit' }, {
			click: function (ev) {
				ev.preventDefault();
				alert(input.value.toUpperCase());				
			}
		}),
	])
], { 'action': 'javascript:void document.validity;' }));

// now input points to the input node, and button points to the button node, so callbacks work correctly
The code can be written quickly, executes quickly (almost at the speed of calling DOM methods directly; no string parsing voodoo like jQuery does), and when you get a bit used to it, is quite readable.
  • Also, if you use jQuery anyway, please be consistent — either use jQuery or $.