c4console.min

15.06.2020, 06:31:18

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey, Greasemonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Userscripts.

Voor het installeren van scripts heb je een extensie nodig, zoals {tampermonkey_link:Tampermonkey}.

Voor het installeren van scripts heb je een gebruikersscriptbeheerder nodig.

(Ik heb al een user script manager, laat me het downloaden!)

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

(Ik heb al een beheerder - laat me doorgaan met de installatie!)

// ==UserScript==
// @name        c4console.min
// @namespace   Violentmonkey Scripts
// @match       *://*/*
// @run-at      document-start
// @grant       none
// @version     3.1.3
// @author      Tut 'UniBreakfast' Ninin
// @description 15.06.2020, 06:31:18
// ==/UserScript==
if(!window.c4console){let e;const t=window,o=console,{log:n,dir:s}=o,i=setTimeout,a=localStorage,{defineProperty:l,assign:c}=Object,r=Object.prototype,d=Promise.prototype,h=(e,t,o)=>l(e,t,{value:o,enumerable:!1,writable:!0,configurable:!0}),u="font-size:.6rem;font-weight:bold;color:#ee6d;background:#56ab;border-radius:4px;",b=()=>(new Date).toLocaleTimeString("en",{hour12:!1}),f=(e,t=.4,s=" ")=>{if(e.match(/^data:image\/.*;base64,/))return c(new Image,{src:e,onload(){i(n.bind(o,"%c"+s,u+`background: no-repeaturl(${e}); padding:0 ${this.width*t}px ${this.height*t}px4px;border-radius:0;background-size:contain`))}});fetch(e).then(e=>e.blob()).then(e=>c(new FileReader,{onload(){f(this.result,t)}}).readAsDataURL(e))},m=t.c4console={cGlobalFn:(...e)=>i((1==e.length&&(e[0]instanceof Element||e[0]instanceof Attr||e[0]==document)?s:n).bind(o,...e))&&e.length>1?e:e[0],cGenericMethod(t){const a=b(),l=this.valueOf(),c=l instanceof Element||l instanceof Attr||l==document,r=[...a==e?[]:[e=a],..."string"==typeof t?[t+":"]:"number"==typeof t?[t+"."]:[]];return i(n.bind(o,...r.length?[`%c ${r.join` `} `,u]:[],...c?[]:[l])),c&&s(l),l},cPromiseMethod(t){let s=e=>e,a=e=>e;const l=b(),r=new Date,d="response body",h=(s,a)=>{const h=[...l==e?[]:[e=l],..."string"==typeof t?[t+":"]:"number"==typeof t?[t+"."]:[],`${a} in ${new Date-r}ms`],b=s instanceof Response;i(n.bind(o,`%c ${h.join` `} `,u,b?[s]:s)),b&&((s.headers.get("content-type")||"").startsWith("image/")?s.clone().blob().then(e=>c(new FileReader,{onload(){f(this.result,.4,d)}}).readAsDataURL(e)):s.clone().text().then(e=>{try{JSON.parse(e).c(d)}catch{e.c(d)}}))},m=this.then(e=>h(e,"resolved")||s(e),e=>h(e,"rejected")||a(e));return this.then=(e,t)=>(e&&(s=e),t&&(a=t),m),this.catch=m.catch=e=>(a=e)&&m,this},on(){o.img=this.img,t.c=this.cGlobalFn,h(r,"c",this.cGenericMethod),h(d,"c",this.cPromiseMethod),this.status().includes("OFF")&&(this.off(),n("sorry, unable to turn ON"))},off(){o.img==this.img&&delete o.img,t.c==this.cGlobalFn&&delete t.c,r.c==this.cGenericMethod&&delete r.c,d.c==this.cPromiseMethod&&delete d.c},status(){return(t.c==this.cGlobalFn&&r.c==this.cGenericMethod&&d.c==this.cPromiseMethod?"ON":"OFF")+" / "+("enabled"==a.c4?"enabled":"disabled")},enable(){a.c4="enabled",m.on()},disable(){a.c4="disabled",m.off()},img:f,getTime:b,get lastTime(){return e},greet(){n(`Hi. c4console is now %c ${this.status()} `,u,"and c4console.help() is there for you")},help(){n(`c4console is now %c ${this.status()} `,u,"\n\nc4console provides following methods:\n\n  .help() - shows the text you are reading;\n  .on() - turns ON c4console functionality (see below) for this page just until reload;\n  .off() - turns OFF ... the same as previous;\n  .enable() - enables c4console functionality for this page until disabled;\n  .disable() - disables ... the same until enabled\n\nit isn't enabled by default because many big sites won't load if they see that standard prototypes were modified before they themselves did that same thing (like Facebook, YouTube or Google). So you can turn c4console ON on those too BUT don't enable it for them by default or do not forget how to disable it.\n\nc4console functionality includes:\n\n  c(...args) - global function like console.log but it also returns the stuff it outputs;\n  any_variable_or_value.c(?label) - method available on (almost) any value that allows you to output that value to the console and that call is \"transparent\" for the chaining methdods - it returns the thing if was called from, so you can insert it in the middle of any expression without breaking anything;\n  any_promise.c(?label) - method available on any promise that also outputs to the console the final status of the promise, time it took and its value, and, if it was a fetch response, it outputs the response body below - as text, json-parsed object/array or image;\n  console.img(src, ?size, ?label) - function to show images in console, prefers Base64 strings as a source but can also fetch images implicitly if url provided instead")}};"enabled"==a.c4&&m.on(),m.greet()}