Clean-up UploadWizardDetails.js

Authored by Rillke.


Clean-up UploadWizardDetails.js

Add the {{location dec}} template only if valid, non-null,
floating point or integer numbers are entered into the textfields
for longitude and latitude and copy only valid numbers from metadata.
A fix for the UpWiz-config was submitted as

Additionally, this patch does the following:

  • Eliminate the mixed use of $ and $j. There is no point in passing jQuery to an IIFE and then using both of them.
  • When constructing DOM nodes without attributes using jQuery, no closing tag is required. jQuery will use the browser's createElement function.
  • When constructing DOM elements with attributes from a string, the string passed to jQuery should be valid HTML; thus closing tags are a good idea for elements that need them.
  • For some conditions, a “truthy-test” is better than comparing their type to undefined. (Actually you want to know whether they are objects or different from ''.)
  • Rename latInput to $latInput because it is an instance of jQuery. There already was an instance in the code that got it wrong and did $(latInput).
  • If an object member is first tested and then used, it can be assigned to a variable before doing testing. Also, there is no point in declaring variables inside an if-block. They should be declared in the function body.

Bug: 51879
Change-Id: Idd38f573110f7e91baaf1168c2bd7dde9e7ffabc