Cleanup Samigo JavaScript and use jQuery where possible

Description

There is a lot of legacy, custom JavaScript in Samigo. We can reduce the amount of code by replacing a lot of these functions with jQuery code.

jQuery also takes care of a lot of cross-browser compatability issues for us. So instead of having to add conditional statements to Samigo, we can depend on jQuery to do it for us.

Here is an example of custom JavaScript in Samigo code:

84 function checkRadio()
85 {
86 for (i=0; i<document.forms[0].elements.length; i++)
87 {
88 if (document.forms[0].elements[i].type == "radio")
89 {
90 if (document.forms[0].elements[i].defaultChecked == true)
91 {
92 document.forms[0].elements[i].click();
93 }
94 }
95 }
96 }

Here is the equivalent code with jQuery:

$('form input[type="radio"]:checked').each().click();

100% Done
Loading...

Activity

Show:

Sam Ottenhoff July 9, 2011 at 8:59 AM

I will turn this into a parent ticket with a bunch of sub-tickets with smaller, contained patches.

Sam Ottenhoff July 9, 2011 at 7:34 AM

Also, we should re-organize the Javascript in these files to put the JS in the helper files like js/delivery.js instead of inside the JSF body.

Details

Priority

Affects versions

Components

Assignee

Reporter

Created July 9, 2011 at 6:53 AM
Updated April 17, 2018 at 8:08 AM