PluginProbe
Code Block Pro – Beautiful Syntax Highlighting / 1.25.0
Code Block Pro – Beautiful Syntax Highlighting v1.25.0
1.27.1 1.27.2 1.27.3 1.27.4 1.27.5 1.27.6 1.27.7 1.28.0 1.3.0 1.4.0 1.5.0 1.5.1 1.5.2 1.6.0 1.7.0 1.8.0 1.9.0 1.9.1 1.9.2 1.9.3 trunk 1.1.0 1.10.0 1.11.0 1.11.1 All 63 releases
code-block-pro / build / front / front.js

front.js in Code Block Pro – Beautiful Syntax Highlighting 1.25.0, at build/front/front.js

1 lines 6.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 !function(){var e={640:function(e,t,o){"use strict";var n=o(742),r={"text/plain":"Text","text/html":"Url",default:"Text"};e.exports=function(e,t){var o,a,c,s,l,i,d=!1;t||(t={}),o=t.debug||!1;try{if(c=n(),s=document.createRange(),l=document.getSelection(),(i=document.createElement("span")).textContent=e,i.ariaHidden="true",i.style.all="unset",i.style.position="fixed",i.style.top=0,i.style.clip="rect(0, 0, 0, 0)",i.style.whiteSpace="pre",i.style.webkitUserSelect="text",i.style.MozUserSelect="text",i.style.msUserSelect="text",i.style.userSelect="text",i.addEventListener("copy",(function(n){if(n.stopPropagation(),t.format)if(n.preventDefault(),void 0===n.clipboardData){o&&console.warn("unable to use e.clipboardData"),o&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var a=r[t.format]||r.default;window.clipboardData.setData(a,e)}else n.clipboardData.clearData(),n.clipboardData.setData(t.format,e);t.onCopy&&(n.preventDefault(),t.onCopy(n.clipboardData))})),document.body.appendChild(i),s.selectNodeContents(i),l.addRange(s),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");d=!0}catch(n){o&&console.error("unable to copy using execCommand: ",n),o&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),d=!0}catch(n){o&&console.error("unable to copy using clipboardData: ",n),o&&console.error("falling back to prompt"),a=function(e){var t=(/mac os x/i.test(navigator.userAgent)?"":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}("message"in t?t.message:"Copy to clipboard: #{key}, Enter"),window.prompt(a,e)}}finally{l&&("function"==typeof l.removeRange?l.removeRange(s):l.removeAllRanges()),i&&document.body.removeChild(i),c()}return d}},742:function(e){e.exports=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,o=[],n=0;n<e.rangeCount;n++)o.push(e.getRangeAt(n));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null}return e.removeAllRanges(),function(){"Caret"===e.type&&e.removeAllRanges(),e.rangeCount||o.forEach((function(t){e.addRange(t)})),t&&t.focus()}}}},t={};function o(n){var r=t[n];if(void 0!==r)return r.exports;var a=t[n]={exports:{}};return e[n](a,a.exports,o),a.exports}o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,{a:t}),t},o.d=function(e,t){for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){"use strict";var e=o(640),t=o.n(e);const n=".wp-block-kevinbatdorf-code-block-pro",r=()=>{(()=>{if(!window.codeBlockPro?.pluginUrl)return;const e=Array.from(document.querySelectorAll("[data-code-block-pro-font-family]:not(.cbp-ff-loaded)")||[]);e.forEach((e=>e.classList.add("cbp-ff-loaded"))),[...new Set(e.map((e=>e.dataset.codeBlockProFontFamily)).filter(Boolean))].forEach((async e=>{const[t,o]=e.split("."),n=`url(${window.codeBlockPro.pluginUrl}/build/fonts/${t}.${o||"woff2"})`,r=new FontFace(t,n);await r.load().catch((e=>console.error(e))),document.fonts.add(r)}))})(),Array.from(document.querySelectorAll(`${n}:not(.cbp-see-more-loaded) .cbp-see-more-line`)).forEach((e=>{const t=e.closest(n);t.classList.add("cbp-see-more-loaded");const o=e.closest("pre"),r=o.offsetHeight;let a=0;if(e.classList.contains("cbp-see-more-transition")){const t=o.querySelectorAll("code > *").length,n=Array.from(e.closest("code").children).filter((t=>t.offsetTop<e.offsetTop))?.length;a=.5+.01*(t-n),o.style.transition=`max-height ${a}s ease-out`}const c="SPAN"===t.children[0].tagName?t.children[0].offsetHeight:0,s=parseFloat(window.getComputedStyle(e).lineHeight);o.style.maxHeight=e.offsetTop+s-c+"px";const l=e.closest(n).querySelector(".cbp-see-more-container");if(!l)return;l.style.display="flex";const i=l.querySelector(".cbp-see-more-simple-btn");if(!i)return;t.classList.contains("padding-disabled")&&i.classList.remove("cbp-see-more-simple-btn-hover"),i.style.transition=`all ${Math.max(a,1)/1.5}s linear`;const d=e=>{e.preventDefault(),i.classList.remove("cbp-see-more-simple-btn-hover"),o.style.maxHeight=r+"px",setTimeout((()=>{i.style.opacity=0,i.style.transform="translateY(-100%)",setTimeout((()=>i.remove()),1e3*Math.max(a,1))}),1e3*a)};i.addEventListener("click",d),i.addEventListener("keydown",(e=>{"Enter"===e.key&&d(e)}))})),Array.from(document.querySelectorAll(".code-block-pro-copy-button:not(.cbp-cb-loaded)")).forEach((e=>{e.classList.add("cbp-cb-loaded"),e.style.display="block";const o=o=>{var n;const{type:r,key:a,target:c}=o;if("keydown"===r&&!["Enter"," "].includes(a))return;o.preventDefault();const s=c?.closest("span"),l=s?.dataset?.encoded?decodeURIComponent(decodeURIComponent(s?.dataset?.code)):s?.dataset?.code,i=null!==(n=window.cbpCopyOverride?.(l,e))&&void 0!==n?n:l;t()(null!=i?i:"",{format:"text/plain",onCopy:t=>{window.cbpCopyCallback?.(t,e),s.classList.add("cbp-copying"),setTimeout((()=>{s.classList.remove("cbp-copying")}),2e3)}})};["click","keydown"].forEach((t=>e.addEventListener(t,o)))})),Array.from(document.querySelectorAll(`${n}:not(.cbp-hl-loaded)`)).forEach((e=>{e.classList.add("cbp-hl-loaded");const t=new Set(e.querySelectorAll(".cbp-line-highlight"));e.classList.contains("cbp-highlight-hover")&&e.querySelectorAll("span.line").forEach((e=>t.add(e))),t.size&&(new ResizeObserver((()=>{const t=e.querySelectorAll("span.line");e.style.setProperty("--cbp-block-width","unset");const o=Array.from(t).reduce(((e,t)=>e.offsetWidth>t.offsetWidth?e:t)),n=Array.from(t).reduce(((e,t)=>e.offsetHeight>t.offsetHeight?e:t));e.style.setProperty("--cbp-block-height",n.offsetHeight+"px"),e.style.setProperty("--cbp-block-width",o.offsetWidth+"px")})).observe(e),t.forEach((e=>{e.querySelector(".cbp-line-highlighter")||e.insertAdjacentHTML("beforeend",'<span aria-hidden="true" class="cbp-line-highlighter"></span>')})))}))};r(),window.codeBlockProInit=r,window.addEventListener("DOMContentLoaded",r),window.addEventListener("load",r)}()}();