From 263aaa0f1d39ed439ad5b3a885d50a56b894dcf8 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 4 Nov 2013 21:59:28 +0000 Subject: [PATCH] luci2: fix various cross browser issues - add respond.js to fix page rendering in IE 8 - fix datatype validation compiler in IE 8 - fix RPC response type checking in IE 8 - show/hide badges and labels since IE 8 does not support :empty CSS selector - fix wrong classes for radio and checkbox items, leading to broken rendering in Chrome - stop using deprecated arguments.callee --- luci2/htdocs/luci2.html | 5 +++- luci2/htdocs/luci2/luci2.js | 41 ++++++++++++++++--------------- luci2/htdocs/luci2/respond.min.js | 6 +++++ 3 files changed, 31 insertions(+), 21 deletions(-) create mode 100644 luci2/htdocs/luci2/respond.min.js diff --git a/luci2/htdocs/luci2.html b/luci2/htdocs/luci2.html index b390ec1..de5e037 100644 --- a/luci2/htdocs/luci2.html +++ b/luci2/htdocs/luci2.html @@ -6,7 +6,10 @@ - + diff --git a/luci2/htdocs/luci2/luci2.js b/luci2/htdocs/luci2/luci2.js index 6481c0b..ab7faa8 100644 --- a/luci2/htdocs/luci2/luci2.js +++ b/luci2/htdocs/luci2/luci2.js @@ -214,7 +214,7 @@ function LuCI2() _class.prototype = prototype; _class.prototype.constructor = _class; - _class.extend = arguments.callee; + _class.extend = Class.extend; return _class; }; @@ -451,7 +451,7 @@ function LuCI2() if (typeof(ret) != 'undefined' && key != '') ret = ret[key]; - if (type.call(ret) != type.call(req.expect[key])) + if (typeof(ret) == 'undefined' || type.call(ret) != type.call(req.expect[key])) ret = req.expect[key]; break; @@ -2920,7 +2920,7 @@ function LuCI2() else if (typeof types[label] == 'function') { stack.push(types[label]); - stack.push(null); + stack.push([ ]); } else { @@ -2939,7 +2939,7 @@ function LuCI2() throw "Syntax error, argument list follows non-function"; stack[stack.length-1] = - arguments.callee(code.substring(pos, i)); + _luci2.cbi.validation.compile(code.substring(pos, i)); pos = i+1; } @@ -3389,6 +3389,7 @@ function LuCI2() } i.error = $('
') + .hide() .addClass('label label-danger'); i.widget = $('
') @@ -3525,7 +3526,7 @@ function LuCI2() d.elem.parents('div.form-group, td').first().addClass('luci2-form-error'); d.elem.parents('div.input-group, div.form-group, td').first().addClass('has-error'); - d.inst.error.text(_luci2.tr('Field must not be empty')); + d.inst.error.text(_luci2.tr('Field must not be empty')).show(); rv = false; } else if (val.length > 0 && !vstack[0].apply(val, vstack[1])) @@ -3533,7 +3534,7 @@ function LuCI2() d.elem.parents('div.form-group, td').first().addClass('luci2-form-error'); d.elem.parents('div.input-group, div.form-group, td').first().addClass('has-error'); - d.inst.error.text(validation.message.format.apply(validation.message, vstack[1])); + d.inst.error.text(validation.message.format.apply(validation.message, vstack[1])).show(); rv = false; } else @@ -3544,7 +3545,7 @@ function LuCI2() if (d.multi && d.inst.widget && d.inst.widget.find('input.error, select.error').length > 0) rv = false; else - d.inst.error.text(''); + d.inst.error.text('').hide(); } } @@ -3749,7 +3750,6 @@ function LuCI2() if (typeof(o.disabled) == 'undefined') o.disabled = '0'; var i = $('') - .addClass('form-control') .attr('id', this.id(sid)) .attr('type', 'checkbox') .prop('checked', this.ucivalue(sid)); @@ -4424,13 +4424,12 @@ function LuCI2() $('
  • ') .append($('
  • ') .append($('