976}
977
978function nuGetProperty (f) {
979 const v = nuFORM.getProperty(f)980 return v
981}
971 // set the hash cookie to persist / global scope
972 nuSetProperty('hcname', f)
973 nuSetProperty('hcvalue', v)
974 nuRunPHPHidden('NUSETHASHCOOKIE', 0)975 }
976}
977
966}
967
968function nuSetProperty (f, v, p) {
969 nuFORM.setProperty(f, v)970 if (p === true) {
971 // set the hash cookie to persist / global scope
972 nuSetProperty('hcname', f)
962}
963
964function nuCurrentProperties () {
965 return nuFORM.getCurrent()966}
967
968function nuSetProperty (f, v, p) {
950
951function nuGetNumberFormat (f) {
952 const a = ['', '', '', '']
953 const n = nuSERVERRESPONSE.number_formats954
955 for (let i = 0; i < n.length; i++) {
956 if (n[i][0] == f) {
910 const a = nuPad2(o.getDate()) + ' '
911 const h = nuPad2(o.getHours()) + ':'
912 const n = nuPad2(o.getMinutes()) + ':'
913 const s = nuPad2(o.getSeconds())914
915 if (hasTime) {
916 return String(y + m + a + h + n + s)
909 const m = nuPad2(o.getMonth() + 1) + '-'
910 const a = nuPad2(o.getDate()) + ' '
911 const h = nuPad2(o.getHours()) + ':'
912 const n = nuPad2(o.getMinutes()) + ':'913 const s = nuPad2(o.getSeconds())
914
915 if (hasTime) {
908 const y = String(o.getFullYear()) + '-'
909 const m = nuPad2(o.getMonth() + 1) + '-'
910 const a = nuPad2(o.getDate()) + ' '
911 const h = nuPad2(o.getHours()) + ':'912 const n = nuPad2(o.getMinutes()) + ':'
913 const s = nuPad2(o.getSeconds())
914
907 var o = new Date(d.y, Number(d.m) - 1, d.d, Number(d.h), Number(d.n), Number(d.s), 0)
908 const y = String(o.getFullYear()) + '-'
909 const m = nuPad2(o.getMonth() + 1) + '-'
910 const a = nuPad2(o.getDate()) + ' '911 const h = nuPad2(o.getHours()) + ':'
912 const n = nuPad2(o.getMinutes()) + ':'
913 const s = nuPad2(o.getSeconds())
906
907 var o = new Date(d.y, Number(d.m) - 1, d.d, Number(d.h), Number(d.n), Number(d.s), 0)
908 const y = String(o.getFullYear()) + '-'
909 const m = nuPad2(o.getMonth() + 1) + '-'910 const a = nuPad2(o.getDate()) + ' '
911 const h = nuPad2(o.getHours()) + ':'
912 const n = nuPad2(o.getMinutes()) + ':'
888 const l = fmt[0]
889
890 if (l == 'm' && FMT[nuTranslateToEnglish(v[i])] !== undefined) {
891 d.m = FMT[nuTranslateToEnglish(v[i])].mm // -- javascript month892 }
893
894 if (fmt == 'dd') {
887 const fmt = String(f[i])
888 const l = fmt[0]
889
890 if (l == 'm' && FMT[nuTranslateToEnglish(v[i])] !== undefined) {891 d.m = FMT[nuTranslateToEnglish(v[i])].mm // -- javascript month
892 }
893
882 var o = Date().toString().split(' ', 6) // -- Tue Sep 07 2004 11:11:12 GMT+0930 (Cen. Australia Standard Time)
883 const time = String(o[4]).split(':')
884
885 const d = { y: o[3], m: FMT[nuTranslateToEnglish(o[1])].jsmonth, d: o[2], h: time[0], n: time[1], s: time[2] } // -- today's date time[2]}; //-- today's date886 for (let i = 0; i < f.length; i++) {
887 const fmt = String(f[i])
888 const l = fmt[0]
819 s = s.replaceAll('yyyy', yea)
820 s = s.replaceAll('yy', String(yea).substr(2))
821 s = s.replaceAll('mmmm', nuTranslate(FMT[mth].mmmm))
822 s = s.replaceAll('mmm', nuTranslate(FMT[mth].mmm))823 s = s.replaceAll('mm', FMT[mth].mm)
824 s = s.replaceAll('dddd', FMT[wee].dddd)
825 s = s.replaceAll('ddd', FMT[wee].ddd)
818
819 s = s.replaceAll('yyyy', yea)
820 s = s.replaceAll('yy', String(yea).substr(2))
821 s = s.replaceAll('mmmm', nuTranslate(FMT[mth].mmmm))822 s = s.replaceAll('mmm', nuTranslate(FMT[mth].mmm))
823 s = s.replaceAll('mm', FMT[mth].mm)
824 s = s.replaceAll('dddd', FMT[wee].dddd)
794
795 const o = new Date(d[0], d[1] - 1, d[2], t[0], t[1], t[2], 0) // -- (year, month, day, hours, minutes, seconds, milliseconds)
796
797 if (!nuDateIsValid(o)) { return '' }798
799 const splitDate = o.toString().split(' ')
800 const wee = splitDate[0] // -- Tue Jul 07 2022 11:11:12 GMT+0930 (Cen. Australia Standard Time)
771 if (isNaN(Number(v))) { return '' }
772 const splitNumber = v.split('.')
773 const decimals = splitNumber.length == 1 ? '' : splitNumber[1]
774 return String(CF[0] + ' ' + nuAddThousandSpaces(splitNumber[0], CF[1]) + CF[2] + decimals).trim()775 }
776
777 if (f[0] == 'D') { // -- date
environment
array of .deepsource.toml
. Read more in our documentation https://deepsource.io/docs/analyzer/javascript640 for (let f = 0; f < o.fields.length - 1; f++) {
641 const c = []
642
643 titles.push($('#title_' + sf + o.fields[f]).html())644
645 for (let r = 0; r < o.rows.length; r++) {
646 if (o.rows[r][o.fields.length - 1] == 0) {
environment
array of .deepsource.toml
. Read more in our documentation https://deepsource.io/docs/analyzer/javascript606 let V = [dnpk]
607 let E = [0]
608 let C = 1
609 let chk = $('#' + this.id).prop('checked')610
611 THIS.children('[data-nu-data]').each(function () {
612 const children = cThis.subformCollectRecordChildren(this, sf, chk, deleteAll, V, E, F, C)
environment
array of .deepsource.toml
. Read more in our documentation https://deepsource.io/docs/analyzer/javascript602
603 $(sel).each(function (index) {
604 const THIS = $(this)
605 const dnpk = $(this).attr('data-nu-primary-key')606 let V = [dnpk]
607 let E = [0]
608 let C = 1
environment
array of .deepsource.toml
. Read more in our documentation https://deepsource.io/docs/analyzer/javascript601 o.deleted = []
602
603 $(sel).each(function (index) {
604 const THIS = $(this)605 const dnpk = $(this).attr('data-nu-primary-key')
606 let V = [dnpk]
607 let E = [0]
environment
array of .deepsource.toml
. Read more in our documentation https://deepsource.io/docs/analyzer/javascript600 o.edited = []
601 o.deleted = []
602
603 $(sel).each(function (index) {604 const THIS = $(this)
605 const dnpk = $(this).attr('data-nu-primary-key')
606 let V = [dnpk]
environment
array of .deepsource.toml
. Read more in our documentation https://deepsource.io/docs/analyzer/javascript583 sel = "[id*='" + sf + "'][id*='nuRECORD']"
584 table = $(sel).attr('data-nu-table')
585
586 const $sf = $('#' + sf)587 oi = $sf.attr('data-nu-object-id')
588 fk = $sf.attr('data-nu-foreign-key-name')
589 pk = $sf.attr('data-nu-primary-key-name')
environment
array of .deepsource.toml
. Read more in our documentation https://deepsource.io/docs/analyzer/javascript581 }
582 } else {
583 sel = "[id*='" + sf + "'][id*='nuRECORD']"
584 table = $(sel).attr('data-nu-table')585
586 const $sf = $('#' + sf)
587 oi = $sf.attr('data-nu-object-id')
577 if (table === undefined) {
578 oi = parent.nuFORM === undefined ? undefined : parent.nuFORM.getCurrent().form_id
579 } else {
580 oi = nuFORM.getCurrent().form_id581 }
582 } else {
583 sel = "[id*='" + sf + "'][id*='nuRECORD']"
Variables that aren't defined, but accessed may throw reference errors at runtime.
NOTE: In browser applications, DeepSource recommends the use of ESModules over regular
text/javascript
scripts. Using variables that are injected by scripts included in an HTML file is currently not supported.
Potential ReferenceError
s may result from misspellings of variable and parameter names, or accidental implicit globals (for example, forgetting the var
keyword in a for
loop initializer).
Any reference to an undeclared variable causes a warning, unless the variable is explicitly mentioned in a /*global ...*/
comment, or specified in the globals key in the configuration file.
A common use case for these is if you intentionally use globals that are defined elsewhere (e.g. in a script sourced from HTML).
Bad Practice
const foo = someFunction(); // `someFunction` is not defined
const bar = baz + 1; // 'baz' is undeclared
Recommended
import { someFunction } from 'some-file';
const baz = Math.random();
const foo = someFunction();
const bar = baz + 1;