One. Get URL in Searchparams
Getqueryparamsmap:function(Searchurlwithoutquestionmark) {varresult = {}; varArray = Searchurlwithoutquestionmark.split (' & '); for(varIinchArray) { varKeyValue =Array[i]; if(!keyvalue | | keyvalue.length = = 0) { Continue; } varKeyvaluearray = keyvalue.split (' = ')); if(Keyvaluearray.length! = 2) { Continue; } varKey = decodeURI (keyvaluearray[0]); varValue = decodeURI (keyvaluearray[1]); Result[key]=value; } returnresult;},
Two. Obtaining data from cookies
function (name) { var value = ";" + document.cookie; var parts = Value.split (";" + name + "="); if (Parts.length = = 2) {return parts.pop (). Split (";" ). Shift (); Else { return undefined }},
Three. Store value in cookie
Document.cookie = "hasauthorization=1;path=/;expires=" + expiresdate.togmtstring ();
Four. Set the font color based on positive and negative numbers
function (value, Defaultnullfontcolor) { if (!value | | IsNaN (value) | | value = = = ' 0 ') { Return Defaultnullfontcolor? Defaultnullfontcolor: ' Font-color-grey '; } return value > 0? ' Font-color-orange ': ' Font-color-green ';},
Five. Process the number returned by the server to the displayed value
Setdisplayvalue:function(value, opts) {varDefaultValue = (opts && opts[' defaultvalue ')? opts[' defaultvalue ': '--'; if(!value | | IsNaN (value) | | value = = = ' 0 ') { if(OPTs && opts[' Defaultvalueforzero ') && (value = = = ' 0 ' | | value = = 0)) { returnopts[' Defaultvalueforzero ']; } returnDefaultValue; } if(OPTs && $.type (opts[' specialdict ') = = = ' object ') { varSpecialvalue = opts[' specialdict '][value]; if(specialvalue) {returnSpecialvalue; } } if(OPTs && $.type (opts[' handlevalue ']) = = ' function ') { varDisplayvalue = opts[' Handlevalue '] (value); } Else { varDisplayvalue =value; } if(Displayvalue > 0) { if(OPTs && opts[' nopositive ']) { returnDefaultValue; } varAddfrontsymbolvalue = (opts && opts[' addfrontsymbolforpositive ')? (opts[' addfrontsymbolforpositive ') +displayvalue): Displayvalue; if(OPTs && opts[' addbehindsymbolforpositive ']) { return(Addfrontsymbolvalue + opts[' addbehindsymbolforpositive ')]); } Else if(OPTs && opts[' Addbehindsymbol ']) { return(Addfrontsymbolvalue + opts[' Addbehindsymbol ')]); } returnAddfrontsymbolvalue; } Else { if(OPTs && opts[' nonegative ']) { returnDefaultValue; } varAddfrontsymbolvalue = (opts && opts[' addfrontsymbolfornegative ')? (opts[' addfrontsymbolfornegative ') +displayvalue): Displayvalue; if(OPTs && opts[' addbehindsymbolfornegative ']) { return(Addfrontsymbolvalue + opts[' addbehindsymbolfornegative ')]); } Else if(OPTs && opts[' Addbehindsymbol ']) { return(Addfrontsymbolvalue + opts[' Addbehindsymbol ')]); } returnAddfrontsymbolvalue; }}
Mobile Small function notes (ii)