Posted By

Pjotor on 08/25/15


Tagged

debug console meme fun-at-work easter-egg


Versions (?)

Panda console meme


 / Published in: JavaScript
 

URL: http://usepanda.com

Console meme generator ripped from the source of Panda, can be nice to easter egg your dev-pals.

Usage: console.meme(TOPROW, BOTTOMROW, IMAGE)

  1. function (a) {
  2. "use strict";
  3. function b(a, b) {
  4. return {
  5. string: "+",
  6. style: "font-size: 1px; padding: " + Math.floor(b / 2) +
  7. "px " + Math.floor(a / 2) + "px; line-height: " + b + "px;"
  8. }
  9. }
  10. function c(a, b, c, f, g) {
  11. if (c = c.toUpperCase(), c.length < 24) {
  12. var h = Math.max(0, c.length - 12),
  13. i = 70 + -3 * h;
  14. d(a, i, c, f / 2, g)
  15. } else if (c.length < 29) d(a, 40, c, f / 2, g);
  16. else {
  17. var j = e(c, 27);
  18. j.forEach(function (c, e) {
  19. d(a, 40, c, f / 2, "lower" == b ? g - 40 * (j.length - 1) + 40 * e : g + 40 * e)
  20. })
  21. }
  22. }
  23. function d(a, b, c, d, e) {
  24. a.font = "bold " + b + "px Impact",
  25. a.fillStyle = "#fff",
  26. a.textAlign = "center",
  27. a.textBaseline = "middle",
  28. a.lineWidth = 7,
  29. a.strokeStyle = "#000",
  30. a.strokeText(c, d, e),
  31. a.fillText(c, d, e)
  32. }
  33. function e(a, b) {
  34. for (var c = [],
  35. d = a.split(" "),
  36. e = [],
  37. f = 0,
  38. g = d.length;
  39. g > f;
  40. f++
  41. )(e + d[f]).length < b ?
  42. e.push(d[f]) :
  43. (
  44. c.push(e.join(" ")),
  45. e.length = 0,
  46. e.push(d[f])
  47. );
  48. return c.push(e.join(" ")), c
  49. }
  50. var f = {
  51. "10 Guy": "//i.imgur.com/LaENqOV.jpg",
  52. "3rd World Success Kid": "//i.imgur.com/WA5duA1.jpg",
  53. "90's Problems": "//i.imgur.com/tL47qtp.jpg",
  54. "Aaand It's Gone": "//i.imgur.com/yf12saq.jpg",
  55. "Actual Advice Mallard": "//i.imgur.com/WymFmVy.jpg",
  56. "Advice Dog": "//i.imgur.com/Qk0VO6D.jpg",
  57. "Advice God": "//i.imgur.com/xH2fSFg.jpg",
  58. "Almost Politically Correct Redneck": "//i.imgur.com/YqLgINf.jpg",
  59. "Am I The Only One": "//i.imgur.com/gS9YL5U.jpg",
  60. "Ancient Aliens": "//i.imgur.com/NfCknz0.jpg",
  61. "Annoyed Picard": "//i.imgur.com/s9GmfSS.jpg",
  62. "Annoying Childhood Friend": "//i.imgur.com/27VCyQw.jpg",
  63. "Annoying Facebook Girl": "//i.imgur.com/ccczyGt.jpg",
  64. "Anti-Joke Chicken (Rooster)": "//i.imgur.com/KOsW0jh.jpg",
  65. "Awkward Penguin": "//i.imgur.com/ez1tQrq.jpg",
  66. "Back In My Day Grandpa": "//i.imgur.com/zuJSZp8.jpg",
  67. "Bad Advice Mallard": "//i.imgur.com/QEPvL2B.jpg",
  68. "Bad Luck Brian": "//i.imgur.com/sRW8BiO.jpg",
  69. "Bear Grylls": "//i.imgur.com/6Spqy1D.jpg",
  70. "Brace Yourself": "//i.imgur.com/NhIq0LY.jpg",
  71. "Captain Obvious": "//i.imgur.com/DmUcxBu.jpg",
  72. "Chemistry Cat": "//i.imgur.com/8agP4Xe.jpg",
  73. "College Freshman": "//i.imgur.com/2Ynyv9t.jpg",
  74. "College Liberal": "//i.imgur.com/OWfvSFE.jpg",
  75. "Condescending Wonka": "//i.imgur.com/D0e5fgL.jpg",
  76. "Confession Bear": "//i.imgur.com/kH1SKhp.jpg",
  77. "Confession Kid": "//i.imgur.com/jhOxR12.jpg",
  78. "Confused Gandalf": "//i.imgur.com/iIb5SEo.jpg",
  79. "Conspiracy Keanu": "//i.imgur.com/pFyk3J7.jpg",
  80. "Courage Wolf": "//i.imgur.com/H5qoXFb.jpg",
  81. "Dating Site Murderer": "//i.imgur.com/jffNNql.jpg",
  82. "Depression Dog": "//i.imgur.com/wgad6P8.jpg",
  83. "Drunk Baby": "//i.imgur.com/QvZdbRE.jpg",
  84. "English Motherfucker": "//i.imgur.com/sJThEC0.jpg",
  85. "Evil Plotting Raccoon": "//i.imgur.com/xMslWFf.jpg",
  86. "First Day On The Internet Kid": "//i.imgur.com/TWfdmVu.jpg",
  87. "First World Cat Problems": "//i.imgur.com/0vR5Slq.jpg",
  88. "First World Problem": "//i.imgur.com/ATcIl08.jpg",
  89. "Forever Alone": "//i.imgur.com/pcfXSUU.jpg",
  90. "Forever Resentful Mother": "//i.imgur.com/pIrdwo2.jpg",
  91. "Foul Bachelor Frog": "//i.imgur.com/JUFmusm.jpg",
  92. "Foul Bachelorette Frog": "//i.imgur.com/dYf971U.jpg",
  93. "Friendzone Fiona": "//i.imgur.com/Qu1eedL.jpg",
  94. "Frustrated Farnsworth": "//i.imgur.com/U3SElKP.jpg",
  95. "Fuck Me, Right?": "//i.imgur.com/J9gfxsx.jpg",
  96. "Gangster Baby": "//i.imgur.com/C3XhI56.jpg",
  97. "Good Girl Gina": "//i.imgur.com/qK6lYr2.jpg",
  98. "Good Guy Greg": "//i.imgur.com/UXMPoKN.jpg",
  99. "Grandma Finds The Internet": "//i.imgur.com/xPfGYqu.jpg",
  100. "Grinds My Gears": "//i.imgur.com/t4JqU1j.jpg",
  101. "Grumpy Cat (Tard)": "//i.imgur.com/dU5CDxN.jpg",
  102. "High Expectations Asian Father": "//i.imgur.com/7QeB9LI.jpg",
  103. "Hipster Barista": "//i.imgur.com/AbWxdy2.jpg",
  104. "Horrifying House Guest": "//i.imgur.com/DxmoFp1.jpg",
  105. "I Dare You Samuel Jackson": "//i.imgur.com/UQtpdqj.jpg",
  106. "I Should Buy A Boat": "//i.imgur.com/XqlqPxn.jpg",
  107. "I Too Like To Live Dangerously": "//i.imgur.com/qF70EL9.jpg",
  108. "Idiot Nerd Girl": "//i.imgur.com/8hYPYwd.jpg",
  109. "Insanity Wolf": "//i.imgur.com/GOOdg3k.jpg",
  110. "Joker Mind Loss": "//i.imgur.com/qQIRaOD.jpg",
  111. "Joseph Ducreux": "//i.imgur.com/QL7TyR9.jpg",
  112. "Lame Joke Eel": "//i.imgur.com/oQXw3jF.jpg",
  113. "Lame Pun Raccoon": "//i.imgur.com/nvALRK3.jpg",
  114. "Lazy College Senior": "//i.imgur.com/PpkVfzz.jpg",
  115. "Mad Karma": "//i.imgur.com/G0QMPum.jpg",
  116. "Masturbating Spidey": "//i.imgur.com/dZ7AB4c.jpg",
  117. "Matrix Morpheus": "//i.imgur.com/8Yrw6cZ.jpg",
  118. "Mayonnaise Patrick": "//i.imgur.com/5jE0Y7f.jpg",
  119. "Musically Oblivious 8th Grader": "//i.imgur.com/l5YHN5D.jpg",
  120. "Not Sure Fry": "//i.imgur.com/7rFgBB1.jpg",
  121. "Oblivious Suburban Mom": "//i.imgur.com/Y7o7UJs.jpg",
  122. "One Does Not Simply": "//i.imgur.com/7LrwR1Y.jpg",
  123. "Overly Attached Girlfriend": "//i.imgur.com/5blLJLR.jpg",
  124. "Overly Manly Man": "//i.imgur.com/dOSn9Na.jpg",
  125. "Paranoid Parrot": "//i.imgur.com/KooYHdg.jpg",
  126. Pedobear: "//i.imgur.com/c6JZKRW.jpg",
  127. "Pepperidge Farm Remembers": "//i.imgur.com/uFde4v5.jpg",
  128. Philosoraptor: "//i.imgur.com/eERhI5h.jpg",
  129. "Priority Peter": "//i.imgur.com/BBEFk0e.jpg",
  130. "Rasta Science Teacher": "//i.imgur.com/Js6Ai5T.jpg",
  131. "Redditor's Wife": "//i.imgur.com/d1XfJeD.jpg",
  132. "Revenge Band Kid": "//i.imgur.com/dlvmaRI.jpg",
  133. "Schrute Facts": "//i.imgur.com/UxcvPwT.jpg",
  134. "Scumbag Brain": "//i.imgur.com/OZhhZdS.jpg",
  135. "Scumbag Stacy": "//i.imgur.com/Qqz1axp.jpg",
  136. "Scumbag Steve": "//i.imgur.com/Rfvoc0Y.jpg",
  137. "Sexually Oblivious Rhino": "//i.imgur.com/RoaNuEC.jpg",
  138. "Sheltering Suburban Mom": "//i.imgur.com/vMkSofv.jpg",
  139. "Shut Up And Take My Money": "//i.imgur.com/uWe0rtQ.jpg",
  140. "Skeptical Third World Kid": "//i.imgur.com/uwAusxV.jpg",
  141. "Smug Spongebob": "//i.imgur.com/OTTRjrv.jpg",
  142. "Socially Awesome Penguin": "//i.imgur.com/S6WgQW7.jpg",
  143. "Success Kid": "//i.imgur.com/ZibijBz.jpg",
  144. "Successful Black Man": "//i.imgur.com/ogIm0cy.jpg",
  145. "Sudden Clarity Clarence": "//i.imgur.com/N3Xmfbe.jpg",
  146. "Tech Impaired Duck": "//i.imgur.com/riz28ci.jpg",
  147. "The Most Interesting Man In The World": "//i.imgur.com/MGv15MH.jpg",
  148. "The Rent Is Too High": "//i.imgur.com/r5WLktQ.jpg",
  149. "Tough Spongebob": "//i.imgur.com/2w0F1HX.jpg",
  150. "Unhelpful Highschool Teacher": "//i.imgur.com/ohbGhuD.jpg",
  151. "Vengeance Dad": "//i.imgur.com/0nUStsa.jpg",
  152. "What Year Is It?": "//i.imgur.com/fj79hQS.jpg",
  153. "X, X Everywhere": "//i.imgur.com/GGy94Gt.jpg",
  154. "Yeah That'd Be Great": "//i.imgur.com/nz9M2pl.jpg",
  155. "Yo Dawg Xzibit": "//i.imgur.com/XOyGqF2.jpg",
  156. "You're Bad And You Should Feel Bad": "//i.imgur.com/YsabGnQ.jpg",
  157. "You're Gonna Have A Bad Time": "//i.imgur.com/2tNR7P7.jpg"
  158. };
  159. a.meme = function (b, d, e, g, h) {
  160. if (b || a.error("Yo, you forgot the text for the upper part of the meme. The bit at the top. Yeah, that bit."),
  161. d || a.error("You forgot the text for the bottom of the meme, stupid."),
  162. e || a.error("Dude, you forgot the meme type or url for the background image (CORS enabled, *hint* imgur *hint*). To see a list of supported memes, hit `console.meme()`"),
  163. !b && !d && !e) return a.log("> " + Object.keys(f).join("\n> "));
  164. var i = document.createElement("canvas"),
  165. j = i.getContext("2d"),
  166. g = g || 500,
  167. h = g || 500,
  168. k = 500,
  169. l = 500,
  170. m = new Image;
  171. if (m.setAttribute("crossOrigin", "anonymous"), m.onload = function () {
  172. i.width = g, i.height = h;
  173. b.toUpperCase();
  174. j.scale(g / 500, h / 500),
  175. j.drawImage(this, 0, 0, k, l),
  176. c(j, "upper", b, k, 50),
  177. c(j, "lower", d, k, l - 50),
  178. a.image(i.toDataURL())
  179. },f[e]) var n = f[e];
  180. else var n = e;
  181. m.src = n
  182. },
  183. a.image = function (c, d) {
  184. d = d || 1;
  185. var e = new Image;
  186. e.onload = function () {
  187. var e = b(this.width * d, this.height * d);
  188. a.log("%c" + e.string, e.style + "background: url(" + c + "); background-size: " +
  189. this.width * d + "px " + this.height * d + "px; color: transparent;")
  190. }, e.src = c
  191. }
  192. }(console)

Report this snippet  

You need to login to post a comment.