UNPKG

@mourner/bullshit

Version:

Bullshit.js is a best-of-breed, mission-critical enterprise JavaScript bookmarklet that will empower you to evaluate the high impact of market-driven text on any Web resource, cultivating process-centric innovation and out-of-the-box thinking.

15 lines (13 loc) 17.2 kB
(()=>{var L=Object.create;var T=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var q=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,B=Object.prototype.hasOwnProperty;var P=(d,c)=>()=>(c||d((c={exports:{}}).exports,c),c.exports);var $=(d,c,p,u)=>{if(c&&typeof c=="object"||typeof c=="function")for(let h of q(c))!B.call(d,h)&&h!==p&&T(d,h,{get:()=>c[h],enumerable:!(u=D(c,h))||u.enumerable});return d};var F=(d,c,p)=>(p=d!=null?L(j(d)):{},$(c||!d||!d.__esModule?T(p,"default",{value:d,enumerable:!0}):p,d));var O=P((M,w)=>{(function(d,c){typeof w=="object"&&w.exports?w.exports=c():typeof define=="function"&&define.amd?define(c):d.findAndReplaceDOMText=c()})(M,function(){var c="retain",p="first",u=document,h={}.hasOwnProperty;function z(i){return String(i).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function f(){return C.apply(null,arguments)||I.apply(null,arguments)}function C(i,a,n,t,o){if(a&&!a.nodeType&&arguments.length<=2)return!1;var l=typeof n=="function";l&&(n=function(r){return function(s,g){return r(s.text,g.startIndex)}}(n));var e=I(a,{find:i,wrap:l?null:n,replace:l?n:"$"+(t||"&"),prepMatch:function(r,s){if(!r[0])throw"findAndReplaceDOMText cannot handle zero-length matches";if(t>0){var g=r[t];r.index+=r[0].indexOf(g),r[0]=g}return r.endIndex=r.index+r[0].length,r.startIndex=r.index,r.index=s,r},filterElements:o});return f.revert=function(){return e.revert()},!0}function I(i,a){return new N(i,a)}f.NON_PROSE_ELEMENTS={br:1,hr:1,script:1,style:1,img:1,video:1,audio:1,canvas:1,svg:1,map:1,object:1,input:1,textarea:1,select:1,option:1,optgroup:1,button:1},f.NON_CONTIGUOUS_PROSE_ELEMENTS={address:1,article:1,aside:1,blockquote:1,dd:1,div:1,dl:1,fieldset:1,figcaption:1,figure:1,footer:1,form:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,header:1,hgroup:1,hr:1,main:1,nav:1,noscript:1,ol:1,output:1,p:1,pre:1,section:1,ul:1,br:1,li:1,summary:1,dt:1,details:1,rp:1,rt:1,rtc:1,script:1,style:1,img:1,video:1,audio:1,canvas:1,svg:1,map:1,object:1,input:1,textarea:1,select:1,option:1,optgroup:1,button:1,table:1,tbody:1,thead:1,th:1,tr:1,td:1,caption:1,col:1,tfoot:1,colgroup:1},f.NON_INLINE_PROSE=function(i){return h.call(f.NON_CONTIGUOUS_PROSE_ELEMENTS,i.nodeName.toLowerCase())},f.PRESETS={prose:{forceContext:f.NON_INLINE_PROSE,filterElements:function(i){return!h.call(f.NON_PROSE_ELEMENTS,i.nodeName.toLowerCase())}}},f.Finder=N;function N(i,a){var n=a.preset&&f.PRESETS[a.preset];if(a.portionMode=a.portionMode||c,n)for(var t in n)h.call(n,t)&&!h.call(a,t)&&(a[t]=n[t]);this.node=i,this.options=a,this.prepMatch=a.prepMatch||this.prepMatch,this.reverts=[],this.matches=this.search(),this.matches.length&&this.processMatches()}return N.prototype={search:function(){var i,a=0,n=0,t=this.options.find,o=this.getAggregateText(),l=[],e=this;t=typeof t=="string"?RegExp(z(t),"g"):t,r(o);function r(s){for(var g=0,m=s.length;g<m;++g){var v=s[g];if(typeof v!="string"){r(v);continue}if(t.global)for(;i=t.exec(v);)l.push(e.prepMatch(i,a++,n));else(i=v.match(t))&&l.push(e.prepMatch(i,0,n));n+=v.length}}return l},prepMatch:function(i,a,n){if(!i[0])throw new Error("findAndReplaceDOMText cannot handle zero-length matches");return i.endIndex=n+i.index+i[0].length,i.startIndex=n+i.index,i.index=a,i},getAggregateText:function(){var i=this.options.filterElements,a=this.options.forceContext;return n(this.node);function n(t){if(t.nodeType===Node.TEXT_NODE)return[t.data];if(i&&!i(t))return[];var o=[""],l=0;if(t=t.firstChild)do{if(t.nodeType===Node.TEXT_NODE){o[l]+=t.data;continue}var e=n(t);a&&t.nodeType===Node.ELEMENT_NODE&&(a===!0||a(t))?(o[++l]=e,o[++l]=""):(typeof e[0]=="string"&&(o[l]+=e.shift()),e.length&&(o[++l]=e,o[++l]=""))}while(t=t.nextSibling);return o}},processMatches:function(){var i=this.matches,a=this.node,n=this.options.filterElements,t,o,l=[],e=a,r=i.shift(),s=0,g=0,m=0,v,b=[a];e:for(;;){if(e.nodeType===Node.TEXT_NODE&&(!o&&e.length+s>=r.endIndex?o={node:e,index:m++,text:e.data.substring(r.startIndex-s,r.endIndex-s),indexInMatch:s===0?0:s-r.startIndex,indexInNode:r.startIndex-s,endIndexInNode:r.endIndex-s,isEnd:!0}:t&&l.push({node:e,index:m++,text:e.data,indexInMatch:s-r.startIndex,indexInNode:0}),!t&&e.length+s>r.startIndex&&(t={node:e,index:m++,indexInMatch:0,indexInNode:r.startIndex-s,endIndexInNode:r.endIndex-s,text:e.data.substring(r.startIndex-s,r.endIndex-s)}),s+=e.data.length),v=e.nodeType===Node.ELEMENT_NODE&&n&&!n(e),t&&o){if(e=this.replaceMatch(r,t,l,o),s-=o.node.data.length-o.endIndexInNode,t=null,o=null,l=[],r=i.shift(),m=0,g++,!r)break}else if(!v&&(e.firstChild||e.nextSibling)){e.firstChild?(b.push(e),e=e.firstChild):e=e.nextSibling;continue}for(;;){if(e.nextSibling){e=e.nextSibling;break}if(e=b.pop(),e===a)break e}}},revert:function(){for(var i=this.reverts.length;i--;)this.reverts[i]();this.reverts=[]},prepareReplacementString:function(i,a,n){var t=this.options.portionMode;return t===p&&a.indexInMatch>0?"":(i=i.replace(/\$(\d+|&|`|')/g,function(o,l){var e;switch(l){case"&":e=n[0];break;case"`":e=n.input.substring(0,n.startIndex);break;case"'":e=n.input.substring(n.endIndex);break;default:e=n[+l]||""}return e}),t===p?i:a.isEnd?i.substring(a.indexInMatch):i.substring(a.indexInMatch,a.indexInMatch+a.text.length))},getPortionReplacementNode:function(i,a){var n=this.options.replace||"$&",t=this.options.wrap,o=this.options.wrapClass;if(t&&t.nodeType){var l=u.createElement("div");l.innerHTML=t.outerHTML||new XMLSerializer().serializeToString(t),t=l.firstChild}if(typeof n=="function")return n=n(i,a),n&&n.nodeType?n:u.createTextNode(String(n));var e=typeof t=="string"?u.createElement(t):t;return e&&o&&(e.className=o),n=u.createTextNode(this.prepareReplacementString(n,i,a)),!n.data||!e?n:(e.appendChild(n),e)},replaceMatch:function(i,a,n,t){var o=a.node,l=t.node,e,r;if(o===l){var s=o;a.indexInNode>0&&(e=u.createTextNode(s.data.substring(0,a.indexInNode)),s.parentNode.insertBefore(e,s));var g=this.getPortionReplacementNode(t,i);return s.parentNode.insertBefore(g,s),t.endIndexInNode<s.length&&(r=u.createTextNode(s.data.substring(t.endIndexInNode)),s.parentNode.insertBefore(r,s)),s.parentNode.removeChild(s),this.reverts.push(function(){e===g.previousSibling&&e.parentNode.removeChild(e),r===g.nextSibling&&r.parentNode.removeChild(r),g.parentNode.replaceChild(s,g)}),g}else{e=u.createTextNode(o.data.substring(0,a.indexInNode)),r=u.createTextNode(l.data.substring(t.endIndexInNode));for(var m=this.getPortionReplacementNode(a,i),v=[],b=0,_=n.length;b<_;++b){var y=n[b],k=this.getPortionReplacementNode(y,i);y.node.parentNode.replaceChild(k,y.node),this.reverts.push(function(A,E){return function(){E.parentNode.replaceChild(A.node,E)}}(y,k)),v.push(k)}var x=this.getPortionReplacementNode(t,i);return o.parentNode.insertBefore(e,o),o.parentNode.insertBefore(m,o),o.parentNode.removeChild(o),l.parentNode.insertBefore(x,l),l.parentNode.insertBefore(r,l),l.parentNode.removeChild(l),this.reverts.push(function(){e.parentNode.removeChild(e),m.parentNode.replaceChild(o,m),r.parentNode.removeChild(r),x.parentNode.replaceChild(l,x)}),x}}},f})});var R=F(O());var S=["(business|client|community|culture|customer|data|goal|intelligence|market|process|quality|results|role|sales|subject|service|user).(centric(ity)?|facing|oriented|driven|focused|assessment|service|process|align(ed|ment|ing))","10x","24/7","ai","agile","ambassador","artificial intelligence","at (your|their) fingertips?","autonomous","a[-/]b testing","acquisition","action items?","act in time","advanc(es?|ing)","advantages?","agendas?","agents?","aggregat(e|ion)","accelerate","all.in.one","all.new","amazing","analytics?","application service providers?","as a service","assets?","astonishing","authoritative","automated","augmented","extended reality","award.winning","b2(b|c)","back to the drawing board","ball.?park","band.aid","bandwidth","(benefit|gap|risk|investment) analysis","bespoke","best.in.class","best.of.breed","best.practice","big.data","big picture","big thinkers?","billboard","block.?chain","blazing(ly)? fast","bleeding.edge","boil the ocean","bottom.line","bottom.up","boost(s|ing)?","boundless","brain.?storm(ing)?","brain.?dump","brand(s?|ing|ed)","bright","building.trust","bulletproof","burn.rates?","business( cases| plans)","buzz","call to action","capacity","capabilit(y|ies)","capitali(s|z)e","centers? of excellence","challenges?","change agents?","circle the wagons","client-centered","client-centric","client-focused","cloud","cloud native","cloudif(y|ication)","collaborat(e|ion|ive)s?","combat(ing|s)?","comfort( zone)?","commit(ments?|tee)?","communicat(e|ion)s?","company-employee.fit","compelling","competitive( advantage)?","connected systems?","complex(ity)?","comprehensive","connect the dots","container orchestration","containerizat(e|ion|ing)","content management","contextual(ly)?","contingency plans?","control groups?","control plane","convergence","convergent","conversions?","core business","core competenc(y|ies)","core.to.edge","corprate synergy","corprate values","cosmic","cost-effective","cost/benefit","cost control","counter(s|ing)?","craftsmanship","critical (path|area)s?","crypto.currency","crypto(?!graphy).\\w+","crm","cross.sell","crowd.?(fund(s?|ed|ing)|sourc(ed|e|ing))","customer obsession","customer journey","cutting.edge","cyber","dashboards?","dashboarding","data mining","decentrali(s|z)ed","de-?dupe","deep dive","deep learning","delight","deliver(able)?s?","demographic","demystify","demystifying","deploy(less|s)?","devops?","dialog(ue?)s?","digital transformation","differentiation","discover(y|ed)?","distributed ledgers?","disrupt(ive|tor|ion|er)?","dollar.productive","downsi(s|z)e","drill down","drive( out|s)?","driving force","drop.?in","drop the ball","due dilligence","dynamic(s|ally)?","e-?(business|commerce|tailers)","early.stage","eas(y|ily)","ecosystem(s)?","edge.comput?(ed|ing)","efficien(t|cy)","effortless(ly)?","elastic","elaboration","elephant in the room","elevator pitch(ing)?","enabl(e|ing)","emerging markets?","empower(ing|ment|s)?","enablement","end of the day","end.to.end","engulf","engag(e(d)|ing|ment)","enhanced?","enterprise","erp","estimate","eta","etched in stone","evangelist","evolution","exceed expectations","excellent","exceptional","exclusive(ly)?","exhaustive","expedite","experiences?","experts?","expertise","exposure","extraordinary","facilitat(e|or)","fast track","fault.tolerant","feeling excited","first.rate","first.to.market","flexibility","flux","focus(es|ing)?","foot view","forward-thinking","fosters?","four pillars","freemium","frictionless","front lines","frustration[- ]free","functional","futurist","futures","full benefit","future[- ]facing","future.proof","game changer","game plan","behavioral","global(ly)?","go public","go.to.market","goals?","god-speed","going forward","granular","ground.?breaking","growth","grow","guidance","guru","guarantee(d)?","hackathon","hacker( mindset)?","happiness manage(ment|rs?)","hardball","heavy.lifting","herding cats","hidden.gem","hidden.meaning","high.level","(high|mass).impact","high quality","highly.scalable","hive ?mind","hybrid environments?","hyperautomation","hyper.personalization","hyper.?converged","hyperlocal","hyperscal(e|ed|er|ing)","holistic","ideathon","ideation","impact(ful|s)?","impeccable","in( |-)a( |-)nutshell","incent","(dis)?incentivi(s|z)e","increase the odds","incredibl(e|y)","(inflat|redeem)able value","influencers?","influx","initiat(es?|ing|ives?)","innovat(e|ed|ion|ive|ing|or)s?","inspir(e|ing|ation)","insights?","integrat(e|ed|ion)s?","internet[- ]of[- ]things","intellectual property","intuitive","iot","key( result)?s?","kickstart(er|ed|ing)?s?","killjoy","knowledge.(base|transfer|sharing)","kpis?","land(ing page)?s?","lead the field","leading","leaders?","leadership","learnings","legacy","lessons learned","level (the )? playing field","level set","leverag(e|ing)s?","liais(es?|ings?)","lifecycle","logistics","low.hanging fruit","look.(&|and).feel","m2m","machine learning","made simple","magical","market (chang(er|ing)|leader|window|simplified|fit)","market.ready","marketing automation","marketing collateral","maximi(s|z)e","meaningful( client | )interactions?","measurements?","merger?","metaverse","methodolog(y|ies)","metrics","middleware","milestone","military.grade encryption","mind ?share","mind ?shower","mind-boggling","mindset","(mission|time).critical","mission","miracle","ml","momentum","moneti(s|z)e","mov(e|ing) (fast|forward)","multitask(ing?)","multifaceted","multi-?tenant(ed)?","mvp","negotiated","networking","new.economy","new.breed","(new|next|second).(level|gen|generation)","nexus","nfts?","nft","niches?","ninja","no-brainer","non-traditional management","objectives","occupy the field","off.site","off.the.(radar|shelf)","on board","on.premises?","on the (back end|radar screen|same page|house)","one.stop.shop","one to one","open the kimono","opportunit(y|ies)","outperform","overarch(es?|ing)?","optimal","orthogonal","outcome(s)","outstanding","out(side)?.(of)?.the.(box|loop)","outsourc(e|ed|ing)","(total cost of )?ownership","paradigms?( shift)?","partner(ships?)?","patents?","people.focus(ed|sed)","performance indicators","perfect(ly)?","personaliz(e|ed|ation)","perspective","phases?","phased approach","pipeline","pioneers?","pivot","planning horizon","platforms?","pledg(es?|ing)","plethora","plug.?in","potentials?","powerful","premium","prioriti(s|z)ed?","proactive","problem space","processes","profit(ability)?","progress(es)?","promot(e|ion)?s?","promotional collateral","prominent","promise","proprietary","proof.of.concept","prove(n|d)?","purpose.built","push the envelope","push.back","production.ready","productivity","pushing on open doors","quick wins?","quota","rais(e|ing) the bar","ramp.up","ravishing","(reaping )(tangible )rewards","relationship management","responsive","engage(ments?)?","reach out","reactivation","real.time","real.world","reconfigure","re(de)?fin(e|ed|ing)","red flags?","reengineering","reimagin(e|ed|ing)","reinvent(ing)? the(.square)? wheel","reinvigorate","relevance","repurpose","resilien(ce|cy|t)","resource allocation","restructuring","retention","return on investment","results","reus(e|ability)","revenue","reverse.engineer","review","revisit","revolution","revolutionary","reward(ing)?(.experience)?","rich","ring fencing","road ?map","robust","rock.?star","roi","run the numbers","(s|p)aas","sacrific(e|es|ing)","scal(e|es|ing|ability)","high availability","scenarios?","scope","scrum( master)?","seamless","secret sauce","search engine optimization","segments?","self.?guid(ed|ing|ance)","self-managed team","seo","(serial )?entrepreneurs?","serverless","service mesh","shareholder value","significant(ly)?","single-source responsibility","skill ?sets?","slim(ming)? down","smart(er)?","smoke (&|and) mirrors","social(.media|.gaming|.networks?)","solidality","solutions?","sophisticated","soup to nuts","sow","spatial.computing","stakeholders?","startup","start.up?","statement of work","state.of.the.art","step.changes?","sticky-?ness","strateg(y|ic|ize|ise)","streamlin(ed|e|ing)","strength(en(ing)?|s)?","story points?","storytelling","success(ful)?","super(critical|star|nova)","sustainab(le|ility)","synerg(y|ies|ized|i)","systems?","tackl(es?|ing)","tailwinds?","talented","take offline","talking points","target (audience|group)","targeted","tasked","tco","team.building","team.player","teamwork","technolog(y|ies)","tectonic shift","that being said","thought.leader","throughput","time.to.awesome","time.to.market","timelines?","top.down","top.of.the.game","total quality","touch.base","touchpoints?","traction","transform(ing|ative|ation(al)?|s?)","trends?","true","truths?","turnkey","ultimate","up.to.speed","up-?sell","upside","user.friendly","user funnels?","user.experience","utili(s|z)(e|ation)","uncover","unicorn","unique","unlimited.holidays","values?","valueable","value.add(ed)?","venture","venturing","vertical market","viral","virtual(ization|isation)?","visibility","visio(n|nary)","walk the talk","wearable","web(3|4)?(.0)?","web.enabled","win-win","wisdom of crowds","with due respect","with ease","wizards?","workflows?","workloads?","workplaceless","workspace","world.?class","world a better place","wow.factor","you've never seen (a|an) \\w+","zeitgeist","zenith","quantum"];function U({text:d}){let c=d.charAt(0),p=d.length-1,u=`${c===c.toUpperCase()?"B":"b"}ullshit`;d.substr(p-2)==="ing"?u+="ting":d.charAt(p-1)!=="s"&&d.charAt(p)==="s"?u+="s":d.charAt(p-2)!=="e"&&d.substr(p-1)==="ed"?u+="ted":d.charAt(p-2)!=="o"&&d.substr(p-1)==="or"?u+="ter":d.charAt(p-3)!=="o"&&d.substr(p-2)==="ors"&&(u+="ters");let h=document.createElement("abbr");return h.style.color="red",h.title=d,h.innerHTML=u,h}var X=new RegExp(`\\b(${S.join("|")})\\b`,"gi");(0,R.default)(document.body,{find:X,replace:U,preset:"prose"});})(); /*! Bundled license information: findandreplacedomtext/src/findAndReplaceDOMText.js: (** * findAndReplaceDOMText v 0.4.6 * @author James Padolsey http://james.padolsey.com * @license http://unlicense.org/UNLICENSE * * Matches the text of a DOM node against a regular expression * and replaces each match (or node-separated portions of the match) * in the specified element. *) */