diff --git a/var/mongoose/cgi-bin/opkg.jim b/var/mongoose/cgi-bin/opkg.jim index 705b6f5..0fe5a7d 100755 --- a/var/mongoose/cgi-bin/opkg.jim +++ b/var/mongoose/cgi-bin/opkg.jim @@ -2,7 +2,7 @@ package require cgi source /mod/var/mongoose/lib/setup -require pkg.class +require pkg.class chunked puts "Content-Type: text/html" puts "Transfer-Encoding: chunked" @@ -11,22 +11,8 @@ puts "" cgi_input #cgi_dump -#set _cgi(cmd) {remove binutils} +set cmd [cgi_get cmd update] -if {![dict exists $_cgi cmd]} { set _cgi(cmd) update } - -set cmd [dict get $_cgi cmd] - -proc chunk {chk} { - puts -nonewline [format "%x\r\n" [string length $chk]] - puts -nonewline "$chk\r\n" - flush stdout -} - -# Kick the browser into life... -chunk [string range [format "%301d" 0] 1 end-1] - -#puts [exec /mod/var/mongoose/lib/opkg {*}$cmd] set bcmd "|/mod/var/mongoose/lib/opkg $cmd" set fd [open $bcmd r] while {[gets $fd line] >= 0} { diff --git a/var/mongoose/html/js/iajax.js b/var/mongoose/html/js/iajax.js new file mode 100644 index 0000000..22a0403 --- /dev/null +++ b/var/mongoose/html/js/iajax.js @@ -0,0 +1,50 @@ + +jQuery.ajaxPrefilter(function(options, _, jqXHR) { + + if (jQuery.isFunction(options.progress)) { + + var xhrFactory = options.xhr, + interval; + + options.xhr = function() { + + var xhr = xhrFactory.apply(this, arguments), + partial = "", + prevcount = 1; + + interval = setInterval(function() { + + var responseText, + jQueryPartial; + + try { + + responseText = xhr.responseText; + + if (responseText && (responseText.length > partial.length)) + { + + partial = responseText; + jQueryPartial = $(partial).filter("*") + + if (jQueryPartial.length > prevcount) { + prevcount = jQueryPartial.length; + options.progress(jQueryPartial.filter("*:not(:last)")); + } + } + } catch(e) { + alert(e); + } + }, options.progressInterval); + + return xhr; + }; + function stop() + { + if (interval) + clearInterval(interval); + } + jqXHR.then(stop, stop); + } +}); + diff --git a/var/mongoose/html/pkg.shtml b/var/mongoose/html/pkg.shtml index 4ec8bee..425d31b 100644 --- a/var/mongoose/html/pkg.shtml +++ b/var/mongoose/html/pkg.shtml @@ -42,12 +42,17 @@ Update package list from Internet
Processing request...
+