Moving IP-check to mw.util & some enhancements to and applying code conventions to mw.special.block.js
- This commit addresses the @TODOs that were in mediawiki.legacy.block before it was migrated to /resources in r83183 ("@TODO: find some better JS file for [is IP functions]")
- JSHint warning fixed: Using ==== when comparing to '' (safer and faster than ==)
- Instead of checking the initial onload state by faking a onkeyup/onchange event, seperate the two functions and use those
- --> This fixes issue where it falsely triggers other bindings on-load that are globally bound to input elements via $('input').live() or $('[type="text"]').delegate() because of the .keyup()/.change() call )
- Caching selectors (var $wpBlockExpiry = $(..) etc.) instead of re-creating a dozen jQuery objects again and getting the document element by id – on *every* onkeyup/onchange
- --> Notable speed improvement in Safari 3 and IE6 with the caching, these had a little bit of a lag when typing fast, mw.legacy.block.js had the lag as well. Fixed now.
- Adding instantToggle-argument to switch between fade or hiding/showing right away. When setting the initial state they're called with instant=true so that there's no fading, the page loads and stuff hides that shouldn't be visible. Any later interaction will still have the fade.
- Calling a function like foo(true) sucks, adding a local DO_INSTANT = true.
- Making behaviour the same as the legacy.block was (if isEmpty, do bring the element back to view ( show() / fadeIn) instead of doing nothing)