2025-10-31 10:01:59 +05:00
|
|
|
(()=>{var e={804:function(e){var t=/-ad-|ai2html|banner|breadcrumbs|combx|comment|community|cover-wrap|disqus|extra|footer|gdpr|header|legends|menu|related|remark|replies|rss|shoutbox|sidebar|skyscraper|social|sponsor|supplemental|ad-break|agegate|pagination|pager|popup|yom-remote/i,i=/and|article|body|column|content|main|shadow/i;function n(e){return(!e.style||"none"!=e.style.display)&&!e.hasAttribute("hidden")&&(!e.hasAttribute("aria-hidden")||"true"!=e.getAttribute("aria-hidden")||e.className&&e.className.indexOf&&-1!==e.className.indexOf("fallback-image"))}e.exports=function(e,r={}){"function"==typeof r&&(r={visibilityChecker:r}),r=Object.assign({minScore:20,minContentLength:140,visibilityChecker:n},r);var o=e.querySelectorAll("p, pre, article"),a=e.querySelectorAll("div > br");if(a.length){var s=new Set(o);[].forEach.call(a,function(e){s.add(e.parentNode)}),o=Array.from(s)}var l=0;return[].some.call(o,function(e){if(!r.visibilityChecker(e))return!1;var n=e.className+" "+e.id;if(t.test(n)&&!i.test(n)||e.matches("li p"))return!1;var o=e.textContent.trim().length;return!(o<r.minContentLength)&&(l+=Math.sqrt(o-r.minContentLength))>r.minScore})}},238:function(e){function t(e,t){if(t&&t.documentElement)e=t,t=arguments[2];else if(!e||!e.documentElement)throw Error("First argument to Readability constructor should be a document object.");if(t=t||{},this._doc=e,this._docJSDOMParser=this._doc.firstChild.__JSDOMParser__,this._articleTitle=null,this._articleByline=null,this._articleDir=null,this._articleSiteName=null,this._attempts=[],this._debug=!!t.debug,this._maxElemsToParse=t.maxElemsToParse||this.DEFAULT_MAX_ELEMS_TO_PARSE,this._nbTopCandidates=t.nbTopCandidates||this.DEFAULT_N_TOP_CANDIDATES,this._charThreshold=t.charThreshold||this.DEFAULT_CHAR_THRESHOLD,this._classesToPreserve=this.CLASSES_TO_PRESERVE.concat(t.classesToPreserve||[]),this._keepClasses=!!t.keepClasses,this._serializer=t.serializer||function(e){return e.innerHTML},this._disableJSONLD=!!t.disableJSONLD,this._flags=this.FLAG_STRIP_UNLIKELYS|this.FLAG_WEIGHT_CLASSES|this.FLAG_CLEAN_CONDITIONALLY,this._debug){let e=function(e){if(e.nodeType==e.TEXT_NODE)return`${e.nodeName} ("${e.textContent}")`;let t=Array.from(e.attributes||[],function(e){return`${e.name}="${e.value}"`}).join(" ");return`<${e.localName} ${t}>`};this.log=function(){if("undefined"!=typeof dump){var t=Array.prototype.map.call(arguments,function(t){return t&&t.nodeName?e(t):t}).join(" ");dump("Reader: (Readability) "+t+"\n")}else if("undefined"!=typeof console){let t=Array.from(arguments,t=>t&&t.nodeType==this.ELEMENT_NODE?e(t):t);t.unshift("Reader: (Readability)"),console.log.apply(console,t)}}}else this.log=function(){}}t.prototype={FLAG_STRIP_UNLIKELYS:1,FLAG_WEIGHT_CLASSES:2,FLAG_CLEAN_CONDITIONALLY:4,ELEMENT_NODE:1,TEXT_NODE:3,DEFAULT_MAX_ELEMS_TO_PARSE:0,DEFAULT_N_TOP_CANDIDATES:5,DEFAULT_TAGS_TO_SCORE:"SECTION,H2,H3,H4,H5,H6,P,TD,PRE".split(","),DEFAULT_CHAR_THRESHOLD:500,REGEXPS:{unlikelyCandidates:/-ad-|ai2html|banner|breadcrumbs|combx|comment|community|cover-wrap|disqus|extra|footer|gdpr|header|legends|menu|related|remark|replies|rss|shoutbox|sidebar|skyscraper|social|sponsor|supplemental|ad-break|agegate|pagination|pager|popup|yom-remote/i,okMaybeItsACandidate:/and|article|body|column|content|main|shadow/i,positive:/article|body|content|entry|hentry|h-entry|main|page|pagination|post|text|blog|story/i,negative:/-ad-|hidden|^hid$| hid$| hid |^hid |banner|combx|comment|com-|contact|foot|footer|footnote|gdpr|masthead|media|meta|outbrain|promo|related|scroll|share|shoutbox|sidebar|skyscraper|sponsor|shopping|tags|tool|widget/i,extraneous:/print|archive|comment|discuss|e[\-]?mail|share|reply|all|login|sign|single|utility/i,byline:/byline|author|dateline|writtenby|p-author/i,replaceFonts:/<(\/?)font[^>]*>/gi,normalize:/\s{2,}/g,videos:/\/\/(www\.)?((dailymotion|youtube|youtube-nocookie|player\.vimeo|v\.qq)\.com|(archive|upload\.wikimedia)\.org|player\.twitch\.tv)/i,shareElements:/(\b|_)(share|sharedaddy)(\b|_)/i,nextLink:/(next|weiter|continue|>([^\|]|$)|»([^\|]|$))/i,prevLink:/(prev|earl|
|
|
|
|
|
${o}`})},t.clipArticle=function(e,t){return n(this,void 0,void 0,function*(){let{body:i,head:n}=yield E(e,t);if(!i||!n)return null;let o=v(n,i),a=new r.Readability(o);a.PRESENTATIONAL_ATTRIBUTES=["align","background","bgcolor","border","cellpadding","cellspacing","frame","hspace","rules","valign","vspace"];let s=a.parse();return`<!DOCTYPE html><html>${(null==n?void 0:n.outerHTML)||""}<body>${(null==s?void 0:s.content)||""}</body></html>`})},t.cleanup=y,t.clipScreenshot=function(e){return n(this,arguments,void 0,function*(e,t="jpeg",i){let n=b(i),{body:r,head:o}=yield E(document,i,!1);if(!r||!o)return null;let a="jpeg"===t?s.toJpeg:"png"===t?s.toPng:"svg"===t?s.toSvg:s.toBlob,l=yield a(r,o,{quality:1,backgroundColor:"white",width:document.body.scrollWidth,height:document.body.scrollHeight,fetchOptions:n,inlineOptions:{inlineImages:!0,fonts:!0,images:!0,stylesheets:!0}});return"jpeg"===t||"png"===t?`<img width="${document.body.scrollWidth}px" height="${document.body.scrollHeight}px" src="${l}" />`:l})},t.enterNodeSelectionMode=function(e,t){let i;return setTimeout(()=>{e.body.addEventListener("click",_),e.body.addEventListener("mouseout",p),e.body.addEventListener("mouseover",m)},0),i=`.${c} {
|
2025-10-31 10:01:59 +05:00
|
|
|
}`,(0,o.injectCss)(i,"nn-clipper-styles"),new Promise((e,i)=>{var r,o;let l;r=()=>n(this,void 0,void 0,function*(){y();let i=document.querySelectorAll(`.${h}`),{head:n}=yield E(document,t,!1),r=document.createElement("html");r.append(n);let o=document.createElement("body");for(let e of(r.append(o),i)){e.classList.remove(h);let i=yield(0,s.getInlinedNode)(e,{raster:!1,fetchOptions:b(t),inlineOptions:Object.assign(Object.assign({},f),{images:null==t?void 0:t.images,inlineImages:null==t?void 0:t.inlineImages})});i&&o.appendChild(i)}e(null==r?void 0:r.outerHTML)}),o=()=>i("Cancelled."),(l=document.createElement("div")).classList.add(d),setTimeout(()=>{document.body.appendChild(l)},0),(0,a.app)({init:{isClipping:!1},view:({isClipping:e})=>(0,a.h)("div",{style:{padding:"10px",backgroundColor:"white",borderRadius:"5px",boxShadow:"0px 0px 10px 0px #00000038"}},[(0,a.h)("p",{style:{marginBottom:"0px",fontSize:"18px"}},[(0,a.text)("Notesnook Web Clipper")]),(0,a.h)("p",{style:{margin:"0px",marginBottom:"5px",fontStyle:"italic"}},[e?(0,a.text)("Clipping selected elements. Please wait..."):(0,a.text)("Click on any element to select it.")]),(0,a.h)("div",{style:{display:"flex",alignItems:"center"}},[(0,a.h)("button",{onclick:e=>[Object.assign(Object.assign({},e),{isClipping:!0}),e=>{null==r||r(),e({isClipping:!1})}],style:{marginRight:"5px"},disabled:e},[e?(0,a.text)("Clipping..."):(0,a.text)("Clip")]),(0,a.h)("button",{onclick:e=>(y(),null==o||o(),e),disabled:e},[(0,a.text)("Cancel")])])]),node:l})})};let r=i(396),o=i(132),a=i(673),s=i(399),l=i(707),c="nn-node-selection--hover",h="nn-node-selection--selected",d="nn-node-selection-container",u=[h,d],f={fonts:!1,images:!1,stylesheets:!0};function g(e){for(let t of u)if(e.classList.contains(t)||e.closest(`.${t}`))return!1;return!0}let m=e=>{let t=e.target;!t.classList.contains(c)&&g(t)&&t.classList.add(c)},p=e=>{let t=e.target;t.classList.contains(c)&&t.classList.remove(c)},_=e=>{e.preventDefault();let t=e.target;t.classList.contains(h)?t.classList.remove(h):g(t)&&t.classList.add(h)};function v(e,t){let i=document.implementation.createHTMLDocument();return i.documentElement.replaceChildren(e,t),i}function y(){setTimeout(()=>{var e;document.querySelectorAll(`.${h}`).forEach(e=>{e instanceof HTMLElement&&e.classList.remove(h)}),document.querySelectorAll(`.${d}`).forEach(e=>e.remove()),(e=document).body.removeEventListener("mouseout",p),e.body.removeEventListener("mouseover",m),document.body.removeEventListener("click",_)},0)}function E(e,t){return n(this,arguments,void 0,function*(e,t,i=!1){let n=b(t),r=yield(0,s.getInlinedNode)(e.body,{raster:!0,fetchOptions:n,inlineOptions:{fonts:!1,inlineImages:null==t?void 0:t.inlineImages,images:null==t?void 0:t.images,stylesheets:null==t?void 0:t.styles},filter:e=>{var t;let n,r,o,a,s,l,c,h,d,u,f,g,m,p,_,v;return!i||(((t=e).nodeType===Node.TEXT_NODE||!t.getBoundingClientRect)&&t.parentElement&&(t=t.parentElement),(n={isInViewport:!1,isPartiallyInViewport:!1,isInsideViewport:!1,isAroundViewport:!1,isOnEdge:!1,isOnTopEdge:!1,isOnRightEdge:!1,isOnBottomEdge:!1,isOnLeftEdge:!1},r=t.getBoundingClientRect(),o=window.innerHeight||document.documentElement.clientHeight,a=window.innerWidth||document.documentElement.clientWidth,s=r.left>=0&&r.left+r.width<=a,l=r.top>=0&&r.top+r.height<=o,n.isInsideViewport=s&&l,c=r.left<0&&r.left+r.width>a,h=r.top<0&&r.top+r.height>o,n.isAroundViewport=c&&h,d=r.top<0&&r.top+r.height>0,u=r.left<a&&r.left+r.width>a,f=r.left<0&&r.left+r.width>0,g=r.top<o&&r.top+r.height>o,m=l||h||d||g,p=s||c||f||u,n.isOnTopEdge=d&&p,n.isOnRightEdge=u&&m,n.isOnBottomEdge=g&&p,n.isOnLeftEdge=f&&m,n.isOnEdge=n.isOnLeftEdge||n.isOnRightEdge||n.isOnTopEdge||n.isOnBottomEdge,_=s||c||n.isOnLeftEdge||n.isOnRightEdge,v=l||h||n.isOnTopEdge||n.isOnBottomEdge,n.isInViewport=_&&v,n.isPartiallyInViewport=n.isInViewport&&n.isOnEdge,n).isInViewport)}});if(!r)return{};let o=e.createElement("head"),a=e.createElement("title");for(let[i,s]of(a.innerText=e.title,o.appendChild(a),(null==t?void 0:t.styles)&&(yield(0,l.addStylesToHead)(o,n)),Object.entries(function(
|