From 79a99aa7e17c02bc8718407164420180dcf947e1 Mon Sep 17 00:00:00 2001
From: yanamal ');
+ if (url) {
+ result.attr('src', imgUrl(url));
+ }
+ if (options) {
+ result.css(options);
+ }
+ return {
+ result: result
+ };
+}
+
//////////////////////////////////////////////////////////////////////////
// TABLE PRINTER
//////////////////////////////////////////////////////////////////////////
diff --git a/test/globals.html b/test/globals.html
index 244c50b..21039e2 100644
--- a/test/globals.html
+++ b/test/globals.html
@@ -61,6 +61,7 @@
"random",
"hatch",
"button",
+ "img",
"table",
"rgb",
"rgba",
diff --git a/test/img.html b/test/img.html
index da97633..3f3d734 100644
--- a/test/img.html
+++ b/test/img.html
@@ -2,17 +2,25 @@
+
-
+
+
+
+
+
+
+
From 37e7f6f68a287963c2a7a56318dc1432e1c31774 Mon Sep 17 00:00:00 2001
From: yanamal
.
+function getTrailingPre() {
+ var pre = document.body.lastChild;
+ if (!pre || pre.tagName != 'PRE') {
+ pre = document.createElement('pre');
+ document.body.appendChild(pre);
+ }
+ return pre;
+}
+
function plainTextPrint() {
var args = arguments;
autoScrollAfter(function() {
- var pre = document.body.lastChild;
- if (!pre || pre.tagName != 'PRE') {
- pre = document.createElement('pre');
- document.body.appendChild(pre);
- }
+ var pre = getTrailingPre();
for (var j = 0; j < args.length; j++) {
pre.appendChild(document.createTextNode(String(args[j])));
}
});
}
+function plainBoxPrint(clr, text) {
+ var elem = $("");var g=Xd(b);if("Function"==g){var h=b.toString(),i=/\{(?:.|\n)*$/.exec(h);i&&(h=i[0]),d.push("
")}}function ke(){if(!dg&&!Ie.document.getElementById("_logcss")){var a=Ie.document.createElement("style");a.id="_logcss",a.innerHTML=(Mf?"samp._log{"+Mf+"}":"")+cg,Ie.document.head.appendChild(a),dg=!0}}function le(a,b,c){b=b||3;var d=c||[],e=Xd(a);return"Error"==e||"ErrorEvent"==e?(d.push(''),je("",a,b,d),d.push("")):Yd(e)?d.push(ae(a)):de(a,!0,100)||0>=b?d.push(fe(a,100)):je("",a,b,d),c?void 0:d.join("")}function me(b,c){switch(typeof b){case"string":return"body"==b?document.body:document.querySelector?document.querySelector(b):a?a(b)[0]:null;case"undefined":return c;case"boolean":return b?c:null;default:return b}}function ne(){var a=!1,b=me(Of,null);return b&&(a=b.scrollHeight-b.scrollTop-10<=b.clientHeight),a?function(){b.scrollTop=b.scrollHeight-b.clientHeight}:function(){}}function oe(){var a,b=me(Pf,null);if(b&&b.appendChild&&gg.length){ke();var c=Ie.document.createElement("samp");c.innerHTML=gg.join(""),gg.length=0;for(var d=ne();a=c.firstChild;)b.appendChild(a);d()}!fg&&gg.length?("auto"==Qf&&Be(),fg=setTimeout(function(){fg=null,oe()},100)):fg&&!gg.length&&(clearTimeout(fg),fg=null)}function pe(){a("#_testpanel").hide()}function qe(){a("#_testpanel").show()}function re(){return a("#_testpanel").is(":visible")}function se(b){a("#_testinput").val(b)}function te(){hg&&a("#_testlog").find("._log").not("#_testpaneltitle").remove()}function ue(a){return''}function ve(){return Ie.getSelection?Ie.getSelection().toString():document.getSelection?document.getSelection():document.selection?document.selection.createRange().text:void 0}function we(a){return''+a+""}function xe(){if(Wf){var b,c={height:Xf,history:[]};try{b=Ie.JSON.parse(Ie.localStorage[Wf])}catch(d){b=mg||{}}return b&&b.slice&&b.length?(c.history=b,c):(a.extend(c,b),c)}}function ye(a){if(Wf){var b=xe(),c=!1;if("history"in a&&a.history.length&&(!b.history.length||b.history[b.history.length-1]!==a.history[a.history.length-1])&&(b.history.push(a.history[a.history.length-1]),c=!0),"height"in a&&a.height!==b.height&&(b.height=a.height,c=!0),c)try{Ie.localStorage[Wf]=Ie.JSON.stringify(b)}catch(d){mg=b}}}function ze(){return Ie.innerHeight||a(Ie).height()}function Ae(){try{if(Tf&&Ie.console&&!Ie.console._log&&"function"==typeof Ie.console.log){var a=Ie.console._log=Ie.console.log;Ie.console.log=function(){a.apply(this,arguments),Sf.apply(this,arguments)};var b=Ie.console._debug=Ie.console.debug;Ie.console.debug=function(){b.apply(this,arguments),Sf.apply(this,arguments)}}}catch(c){}}function Be(){ig||(ig=!0,Vd(Ce))}function Ce(){if(hg)Uf&&(a("#_testpaneltitle").length?a("#_testpaneltitle").html(Uf):a("#_testlog").prepend(we(Uf))),a("#_testpanel").show();else if(!Ie.document.getElementById("_testlog")&&Ie.document.body){Ae(),ke();var b=xe(),c=Uf?we(Uf):"";b.height>ze()-50&&(b.height=Math.min(ze(),Math.max(10,ze()-50))),a("body").prepend(''+c+''+ue("blue")+''),hg=!0,oe();var d=0,e={};a("#_testinput").on("keydown",function(c){if(13==c.which){var f=a(this).val();if(a(this).val(""),!f.trim().length||b.history.length&&b.history[b.history.length-1]===f||(b.history.push(f),ye({history:[f]})),e={},d=0,Wd(''+ue("lightgray")+he(f)+""),a(this).select(),f.trim().length&&":"==f.trim()[0]){var g=f.trim().substring(1).trim();if(!g||Zf.hasOwnProperty(g)){Yf=g;var h=g?"scope "+g:"default scope";Wd('switched to '+h+"")}else Wd('no scope '+g+"");return}a.turtle.interrupt("reset");var i=!1;try{var j;try{j=Pd(Yf,f)}finally{if(lg&&lg(f,j))i=!0;else{for(var k=kg.length-1;k>=0&&j!==kg[k];--k);0>k&&Wd(le(j))}}}catch(c){i||Sf(c)}}else if(38==c.which||40==c.which){e[d]=a(this).val(),d+=38==c.which?1:-1,d=Math.max(0,Math.min(b.history.length,d));var l=e[d]||b.history[b.history.length-d];"undefined"==typeof l&&(l=""),a(this).val(l),this.selectionStart=this.selectionEnd=l.length,c.preventDefault()}}),a("#_testdrag").on("mousedown",function(c){var d,e=this,f=a("#_testpanel").height()+c.pageY,g=a("#_testdrag").height(),h=c.which;return e.setCapture&&e.setCapture(!0),d=function(c){if("blur"!=c.type&&c.which==h){var e=ze(),i=Math.max(g,Math.min(e,f-c.pageY)),j=ne();a("#_testpanel").height(i),a("#_testscroll").height(i-g),j()}("mouseup"==c.type||"blur"==c.type||"mousemove"==c.type&&c.which!=h)&&(a(Ie).off("mousemove mouseup blur",d),document.releaseCapture&&document.releaseCapture(),a("#_testpanel").height()!=b.height&&(b.height=a("#_testpanel").height(),ye({height:b.height})))},a(Ie).on("mousemove mouseup blur",d),!1}),a("#_testpanel").on("mouseup",function(b){if(!ve()){var c=a("#_testscroll").scrollTop();a("#_testinput").focus(),a("#_testscroll").scrollTop(c)}})}jg&&hg?clearTimeout(jg):hg||jg||(jg=setTimeout(Ce,100))}function De(a,b){var c=document.createElement("canvas");b||(b=0),c.width=a.width,c.height=a.height;var d=c.getContext("2d");return d.drawImage(a,0,0),Ee(c,b)}function Ee(a,b){for(var c,d,e=a.getContext("2d"),f=e.getImageData(0,0,a.width,a.height).data,g=[],h=256*b,i=1/0,j=-1,k=0;k