From e1aa1726d011db3173dad3c07e5d8e7ec058c7cd Mon Sep 17 00:00:00 2001 From: SOKHUONG Date: Sun, 11 Oct 2020 11:07:49 +0700 Subject: [PATCH 1/6] make the box's height as half --- console.image.js | 2 +- console.image.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/console.image.js b/console.image.js index a3c29db..55bb27c 100644 --- a/console.image.js +++ b/console.image.js @@ -163,7 +163,7 @@ var img = new Image(); img.onload = function() { - var dim = getBox(this.width * scale, this.height * scale); + var dim = getBox(this.width * scale, this.height * scale / 2); console.log("%c" + dim.string, dim.style + "background: url(" + url + "); background-size: " + (this.width * scale) + "px " + (this.height * scale) + "px; color: transparent;"); }; diff --git a/console.image.min.js b/console.image.min.js index d955ff6..c1555b2 100644 --- a/console.image.min.js +++ b/console.image.min.js @@ -1,4 +1,4 @@ /** * Dubiously created by Adrian Cooney * http://dunxrion.github.io - */(function(e){"use strict";function n(e,t){return{string:"+",style:"font-size: 1px; padding: "+Math.floor(t/2)+"px "+Math.floor(e/2)+"px; line-height: "+t+"px;"}}function r(e,t,n,r,o){n=n.toUpperCase();if(n.length<24){var u=Math.max(0,n.length-12),a=70+u*-3;i(e,a,n,r/2,o)}else if(n.length<29)i(e,40,n,r/2,o);else{var f=s(n,27);f.forEach(function(n,s){i(e,40,n,r/2,t=="lower"?o-(f.length-1)*40+s*40:o+s*40)})}}function i(e,t,n,r,i){e.font="bold "+t+"px Impact";e.fillStyle="#fff";e.textAlign="center";e.textBaseline="middle";e.lineWidth=7;e.strokeStyle="#000";e.strokeText(n,r,i);e.fillText(n,r,i)}function s(e,t){var n=[],r=e.split(" "),i=[];for(var s=0,o=r.length;s "+Object.keys(t).join("\n> "));var a=document.createElement("canvas"),f=a.getContext("2d"),o=o||500,u=o||500,l=500,c=500,h=new Image;h.setAttribute("crossOrigin","anonymous");h.onload=function(){a.width=o;a.height=u;var t=n.toUpperCase();f.scale(o/500,u/500);f.drawImage(this,0,0,l,c);r(f,"upper",n,l,50);r(f,"lower",i,l,c-50);e.image(a.toDataURL())};if(t[s])var p=t[s];else var p=s;h.src=p};e.image=function(t,r){r=r||1;var i=new Image;i.onload=function(){var i=n(this.width*r,this.height*r);e.log("%c"+i.string,i.style+"background: url("+t+"); color: transparent;")};i.src=t;i.style.background="url("+t+")"}})(console); + */(function(e){"use strict";function n(e,t){return{string:"+",style:"font-size: 1px; padding: "+Math.floor(t/2)+"px "+Math.floor(e/2)+"px; line-height: "+t+"px;"}}function r(e,t,n,r,o){n=n.toUpperCase();if(n.length<24){var u=Math.max(0,n.length-12),a=70+u*-3;i(e,a,n,r/2,o)}else if(n.length<29)i(e,40,n,r/2,o);else{var f=s(n,27);f.forEach(function(n,s){i(e,40,n,r/2,t=="lower"?o-(f.length-1)*40+s*40:o+s*40)})}}function i(e,t,n,r,i){e.font="bold "+t+"px Impact";e.fillStyle="#fff";e.textAlign="center";e.textBaseline="middle";e.lineWidth=7;e.strokeStyle="#000";e.strokeText(n,r,i);e.fillText(n,r,i)}function s(e,t){var n=[],r=e.split(" "),i=[];for(var s=0,o=r.length;s "+Object.keys(t).join("\n> "));var a=document.createElement("canvas"),f=a.getContext("2d"),o=o||500,u=o||500,l=500,c=500,h=new Image;h.setAttribute("crossOrigin","anonymous");h.onload=function(){a.width=o;a.height=u;var t=n.toUpperCase();f.scale(o/500,u/500);f.drawImage(this,0,0,l,c);r(f,"upper",n,l,50);r(f,"lower",i,l,c-50);e.image(a.toDataURL())};if(t[s])var p=t[s];else var p=s;h.src=p};e.image=function(t,r){r=r||1;var i=new Image;i.onload=function(){var i=n(this.width*r,this.height*r/2);e.log("%c"+i.string,i.style+"background: url("+t+"); color: transparent;")};i.src=t;i.style.background="url("+t+")"}})(console); From b3ec6bdaaa79b2304fca79734ae9da128abda645 Mon Sep 17 00:00:00 2001 From: SOKHUONG Date: Sun, 11 Oct 2020 23:34:51 +0700 Subject: [PATCH 2/6] make it publishable --- package.json | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 package.json diff --git a/package.json b/package.json new file mode 100644 index 0000000..71a50f1 --- /dev/null +++ b/package.json @@ -0,0 +1,24 @@ +{ + "name": "console.image", + "version": "1.0.0", + "description": "print images and meme in console", + "main": "console.image.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/SOKHUONG/console.image.git" + }, + "keywords": [ + "console", + "console.image", + "console.meme" + ], + "author": "sokhuong", + "license": "WTFPL", + "bugs": { + "url": "https://github.com/SOKHUONG/console.image/issues" + }, + "homepage": "https://github.com/SOKHUONG/console.image#readme" +} From 91f5a75c3a818a2c740361fcad81f495835bafa1 Mon Sep 17 00:00:00 2001 From: SOKHUONG Date: Sun, 11 Oct 2020 23:40:13 +0700 Subject: [PATCH 3/6] change name --- package.json | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 71a50f1..4797fbb 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "console.image", + "name": "console-art", "version": "1.0.0", "description": "print images and meme in console", "main": "console.image.js", @@ -20,5 +20,8 @@ "bugs": { "url": "https://github.com/SOKHUONG/console.image/issues" }, - "homepage": "https://github.com/SOKHUONG/console.image#readme" + "homepage": "https://github.com/SOKHUONG/console.image#readme", + "ignore": [ + "index.html" + ] } From b37a5a5c7ccd51c28f61e319ef0663cebc1647d6 Mon Sep 17 00:00:00 2001 From: SOKHUONG Date: Mon, 12 Oct 2020 00:08:25 +0700 Subject: [PATCH 4/6] update --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 4797fbb..8b55504 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "type": "git", "url": "git+https://github.com/SOKHUONG/console.image.git" }, + "publishConfig": { "registry": "https://npm.pkg.github.com/" }, "keywords": [ "console", "console.image", From 6e9f0840c6fce5eb32b6596a67906a36fa0ce3a1 Mon Sep 17 00:00:00 2001 From: SOKHUONG Date: Mon, 12 Oct 2020 00:18:27 +0700 Subject: [PATCH 5/6] delete --- package.json | 28 ---------------------------- 1 file changed, 28 deletions(-) delete mode 100644 package.json diff --git a/package.json b/package.json deleted file mode 100644 index 8b55504..0000000 --- a/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "console-art", - "version": "1.0.0", - "description": "print images and meme in console", - "main": "console.image.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/SOKHUONG/console.image.git" - }, - "publishConfig": { "registry": "https://npm.pkg.github.com/" }, - "keywords": [ - "console", - "console.image", - "console.meme" - ], - "author": "sokhuong", - "license": "WTFPL", - "bugs": { - "url": "https://github.com/SOKHUONG/console.image/issues" - }, - "homepage": "https://github.com/SOKHUONG/console.image#readme", - "ignore": [ - "index.html" - ] -} From caa10e856807f682c32fbfcfbb9cf538191a7d42 Mon Sep 17 00:00:00 2001 From: SOKHUONG Date: Mon, 12 Oct 2020 00:18:48 +0700 Subject: [PATCH 6/6] add LICENCE.txt --- LICENCE.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 LICENCE.txt diff --git a/LICENCE.txt b/LICENCE.txt new file mode 100644 index 0000000..cb07e35 --- /dev/null +++ b/LICENCE.txt @@ -0,0 +1,13 @@ +DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + Version 2, December 2004 + + Copyright (C) 2004 Sam Hocevar + + Everyone is permitted to copy and distribute verbatim or modified + copies of this license document, and changing it is allowed as long + as the name is changed. + + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. You just DO WHAT THE FUCK YOU WANT TO. \ No newline at end of file