Optimiser et utiliser au mieux son SSD

Auteur 10 décembre 2015 0
Optimiser et utiliser au mieux son SSD

Autrefois réservés aux technophiles les plus fortunés, les SSD ont entamé depuis quelques temps une réelle phase de démocratisation. Prix en baisse, capacités en hausse : le refrain est connu. Mais pour l’utilisateur comme pour le système d’exploitation, le passage d’un disque dur classique à un SSD peut tout de même demander quelques adaptations. Suivez le guide !

Alors que les caractéristiques techniques des processeurs, cartes graphiques et autres barrettes mémoire ne cessent de progresser, le disque dur reste bien souvent le maillon faible de la chaîne informatique. Il faut dire que, fondamentalement, la technologie des plateaux magnétiques date des années 50. Et elle commence à atteindre ses limites. Depuis de trop nombreuses années, la vitesse de rotation standard stagne à 7200 tours/minute. Les modèles à 10 000 ou 15 000 TPM restent rares, et sont souvent chers, bruyants et générateurs de chaleur. D’ailleurs, certains constructeurs jouent même la carte du « low-tech » en remettant au goût du jour des disques à 5400 TPM, dont ils vantent les qualités environnementales. Une preuve supplémentaire, s’il en fallait une, que l’avenir se joue ailleurs.

Lentement mais sûrement, les Solid-State Drive (SSD pour les intimes) sont donc amenés à prendre la relève des disques durs classiques. Ils ne le font pas encore de manière absolue, loin de là même, car le prix au Go reste très nettement en faveur des modèles mécaniques. Fin 2011, un SSD de 120 Go se négociait dans le meilleur des cas aux alentours de 150 euros… une somme qui permettait par ailleurs de se procurer un disque classique de 3 To. Autrement dit : le Go vous revenait à 1.25 euros d’un côté, et à 5 centimes de l’autre. Trois ans plus tard, les choses se sont un peu arrangées puisqu’on peut désormais trouver des disques SSD de 250 Go à 100 euros (contre 4 To pour 150 euros en ce qui concerne les disques durs habituels). Le prix au Go d’un SSD est donc tombé à 40 centimes, tandis que celui d’un HDD magnétique revient dorénavant à un peu moins de 4 centimes.

Il y a donc du mieux, mais même dans ces conditions, il n’est pas encore question de passer à la mémoire flash pour nos unités dédiées au stockage, le coût restant bien trop élevé. En revanche, les SSD font des merveilles en tant que disques systèmes. Les OS modernes (Windows 7 et 8 en tête) les exploitent pleinement, peuvent se satisfaire d’une capacité relativement modeste, et sont les premiers bénéficiaires des très bonnes performances associées à cette technologie.

Pour que tout se passe pour le mieux, nous allons voir qu’il faut tout de même remiser aux placards quelques vieilles habitudes, acquérir un ou deux nouveaux réflexes, et réaliser plusieurs optimisations bien précises.

Cet article a été mis à jour le 10 décembre 2015

0 Commentaires
Récent
Ancien Plus voté
Inline Feedbacks
View all comments
`),this.#I()})).catch((t=>{if(t&&this.#r.error(t),t&&this.#o&&!this.#S)return this.#r.debug("fetch call failed. Switch to adblck domain and path"),this.#S=!0,this.#s.enableAdbMode(),void this.show();this.#n(xt)}))}#I(){this.#r.debug("render"),this.#k.render(this.#y)}#C(t){let e=`${window.location.protocol}//${this.#v}/script/interstitial.php`;if(this.#o&&this.#s.isAdbMode()){const{adserverDomain:t}=this.#o,r=`/${it("abcdefgh0123456789")}`;e=`${window.location.protocol}//${t}${r}`}return e+=`?r=${this.#l}`,this.#m&&(e+="&rbd=1"),this.#b&&(e+=this.#b),e=e+"&atag=1"+`&czid=${this.#d}`+`&aggr=${this.#h}`+`&seqid=${t}`+`&ufp=${encodeURIComponent(this.#T)}`+`&srs=${this.#s.getSesionRandomString()}`+`&cbpage=${encodeURIComponent(P())}`+`&atv=${this.#x}`+`&cbref=${encodeURIComponent(B())}`,this.#o&&(e+="&abtg=1"),this.#g&&(e+="&ppv=1"),this.#p&&(e+=`&ab_test=${this.#p}`),!1===this.#f&&(e+="&cap=0"),this.#o&&this.#o.adbVersion&&(e+=`&adbv=${this.#o.adbVersion}`),this.#o&&this.#s.isAdbMode()?(e+="&sadbl=2",e+="&fmt=intrn",this.#r.debug(`bid url: ${e}`),nt(e)):(this.#r.debug(`bid url: ${e}`),e)}};const jt=6e5,Mt='[doskip*="1"]',_t="znid";var Vt=class{targetElementsCssSelector=null;shouldTriggerPopOnTargetClick=!1;constructor(t,e,r){this.targetElementsCssSelector=t,this.shouldTriggerPopOnTargetClick=e,this.zoneId=r}isPresent(){return!!this.targetElementsCssSelector}isActionAllowedOnElement(t){if(!this.isPresent())return!0;if(t.hasAttribute(_t))return t.getAttribute(_t)===this.zoneId;if(t.hasAttribute("doskip"))return!1;const e=m()(document.querySelectorAll(Mt));for(const r of e)if(r.contains(t))return!1;return this.#O(t)?this.shouldTriggerPopOnTargetClick:!this.shouldTriggerPopOnTargetClick}#O(t){const e=document.querySelectorAll(this.targetElementsCssSelector);do{for(let r=0;r{var t,e,r;const i=(t,e)=>{try{const r=e.getBoundingClientRect();t.style.top=`${r.top+window.scrollY}px`,t.style.left=`${r.left+window.scrollX}px`,t.style.width=`${r.width}px`,t.style.height=`${r.height}px`}catch(t){}};n()(t=this.iframesToOverlays).call(t,(t=>{let{overlay:e,iframe:r}=t;return i(e,r)})),n()(e=this.videosToOverlays).call(e,(t=>{let{overlay:e,video:r}=t;return i(e,r)})),n()(r=this.anchorsToOverlays).call(r,(t=>{let{overlay:e,anchor:r}=t;return i(e,r)}))}),500)}clearOverlaysResizeIntervalChecker(){try{clearInterval(this.overlaysResizeIntervalChecker)}catch(t){}}#R(t){const e=document.createElement("div");if(e.addEventListener("mousedown",(t=>{this.#r.debug("mousedown on overlay"),t.stopPropagation(),t.preventDefault(),this.desktopClickListener(t)}),this.#E),t===document.body)e.id="dontfoid",e.style.top="0px",e.style.left="0px",e.style.width=`${window.innerWidth||document.body.clientWidth}px`,e.style.height=`${window.innerHeight||document.body.clientHeight}px`,e.style.position="fixed";else{const r=t.getBoundingClientRect();e.style.top=`${r.top+window.scrollY}px`,e.style.left=`${r.left+window.scrollX}px`,e.style.width=`${r.width}px`,e.style.height=`${r.height}px`,e.style.position="absolute",e.setAttribute("donto","")}return e.setAttribute(_t,this.#l),e.style.zIndex=2147483647,e.style.backgroundColor="transparent",t===document.body?document.body.appendChild(e):t.parentNode.appendChild(e),e}attachVideoOverlays(){const t=document.querySelectorAll("video");for(let e=0;e false"),this.#E=!1),this.overlays=new Wt(this.elementTargeting,v()(e=this.#z).call(e,this),this.#r,this.#e.zoneId,this.#E),t.tagVersionSuffix&&(this.#x+=t.tagVersionSuffix),this.#r.debug("tag version:",this.#x)}show(){this.#y=null,this.#$=null,this.#P=!1,fetch(this.#C()).then((t=>200===t.status||202===t.status?t.json():(204===t.status&&(this.hasNoInventory=!0,this.#r.debug(`no inventory! reset after ${this.#w} sec`),f()((()=>{this.hasNoInventory=!1}),1e3*this.#w),this.#w<7200&&(this.#w*=5)),yt().reject()))).then((t=>{if(this.#r.debug("response:",t),t.capped_ttl)return this.isCapped=!0,this.#r.debug(`capped! reset after ${t.capped_ttl} sec`),f()((()=>{this.isCapped=!1}),1e3*t.capped_ttl),void this.#e.actionCallback(kt);if(this.#w>12&&(this.#w=12),!this.#m){this.#m=!0;const e=t.delay??0;return this.#r.debug("delay is",e),void f()((()=>{this.#F(t)}),1e3*e)}this.#F(t)})).catch((t=>{if(t&&this.#r.error(t),t&&this.#e.adblockSettings&&!this.#S)return this.#r.debug("fetch call failed. Switch to adblck domain and path"),this.#s.enableAdbMode(),this.#S=!0,void this.show();this.#e.actionCallback(kt)}))}#C(){let t=`${window.location.protocol}//${this.#e.adserverDomain}/script/suurl5.php`;if(this.#e.adblockSettings&&this.#s.isAdbMode()){const{adserverDomain:e}=this.#e.adblockSettings,r=`/${it("abcdefgh0123456789")}`;t=`${window.location.protocol}//${e}${r}`}if(t+=`?r=${this.#e.zoneId}`,this.#m&&(t+="&rbd=1"),this.#e.targetCountries){const e=this.#e.targetCountries.join(",");this.#e.triggerOnTargetCountries?t+="&allowed_countries="+encodeURIComponent(e):t+="&excluded_countries="+encodeURIComponent(e)}return t=t+this.#e.clientHintsQueryStr+"&atag=1&cbur="+Math.random()+"&cbiframe="+$()+"&cbWidth="+F()+"&cbHeight="+N()+"&cbtitle="+encodeURIComponent(U())+"&cbpage="+encodeURIComponent(P())+"&cbref="+encodeURIComponent(B())+"&cbdescription="+encodeURIComponent(H("description"))+"&cbkeywords="+encodeURIComponent(H("keywords"))+"&cbcdn="+encodeURIComponent(this.#s.getCdnDomain())+"&ts="+bt()()+"&atv="+this.#x+"&ufp="+encodeURIComponent(this.#e.uniqueFingerprint)+"&srs="+this.#s.getSesionRandomString(),this.#e.adblockSettings&&(t+="&abtg=1"),this.#e.aggressivity&&(t+=`&aggr=${this.#e.aggressivity}`),this.#e.collectiveZoneId&&(t+=`&czid=${this.#e.collectiveZoneId}`),this.#e.recordPageView&&(t+="&ppv=1"),this.#e.abTest&&(t+=`&ab_test=${this.#e.abTest}`),!1===this.#e.adsCapping&&(t+="&cap=0"),this.#e.adblockSettings&&this.#e.adblockSettings.adbVersion&&(t+=`&adbv=${this.#e.adblockSettings.adbVersion}`),this.#e.adblockSettings&&this.#s.isAdbMode()?(t+="&sadbl=2",t+="&fmt=suv5",this.#r.debug(`bid url: ${t}`),nt(t)):(this.#r.debug(`bid url: ${t}`),t)}#N(t){try{let e=this.#L?this.#L(""):window.open("");return e.document.open(),e.document.writeln(' `),void(!this.#m&&this.#e.delay>0?(this.#r.debug(`delay present. render after: ${this.#e.delay} sec`),f()(v()(s=this.#I).call(s,this),1e3*this.#e.delay)):this.#I())))}#Ot(t){this.#r.debug("fallback script str:",t);const e=(new DOMParser).parseFromString(t,"text/html").querySelector("script");if(!e)return void this.#r.error("invalid fallback script. move on");this.#r.debug("fallback script:",e);const r=document.createElement("script");for(const t of e.attributes)r.setAttribute(t.name,t.value);r.src||(r.textContent=e.textContent),document.body.appendChild(r)}#It(t){const e=JSON.parse(atob(t));this.#r.debug("hp data:",e);const r={zoneId:e.pop_zone_id.toString(),linkedZoneId:e.source_zone_id.toString()};var i;e.attributes&&(e.attributes["element-list"]&&(r.targetElementsCssSelector=e.attributes["element-list"],r.triggerOnTargetElementsClick="allow"===e.attributes["element-action"]),e.attributes["country-list"]&&(r.targetCountries=re()(i=e.attributes["country-list"]).call(i).split(","),r.triggerOnTargetCountries="allow"===e.attributes["country-action"])),this.#s.runPop(r)}#n(){if(this.#e.showOnInnerLinkClick&&this.#Ct)return this.#r.debug("redirect to inner link"),void(window.location.href=this.#Ct);this.#Tt=!1,this.#e.refreshRate>0?(this.#r.debug(`rebid after ${this.#e.refreshRate} sec`),f()((()=>{this.#m=!0,this.#ft()}),1e3*this.#e.refreshRate)):this.#r.debug("no rebidding. finish")}#Et(){const t=document.querySelectorAll("a"),e=new(c())(P()).hostname;for(let r=0;r{e.stopPropagation?e.stopPropagation():e.cancelBubble=!0,e.preventDefault?e.preventDefault():e.returnValue=!1,this.#Tt||(this.#r.debug("click on inner link detected. render ad"),this.#Tt=!0,this.#Ct=t[r].href,this.#k.render(this.#y))}),{capture:!0})}#I(){this.#r.debug("render"),this.#e.showOnInnerLinkClick?(this.#r.debug("google friendly interstitial. ad will be rendered on inner link click"),this.#Et()):this.#k.render(this.#y)}#C(){let t=`${window.location.protocol}//${this.#v}/script/interstitial.php`;if(this.#o&&this.#s.isAdbMode()){const{adserverDomain:e}=this.#o,r=`/${it("abcdefgh0123456789")}`;t=`${window.location.protocol}//${e}${r}`}return t+=`?r=${this.#l}`,this.#m&&(t+="&rbd=1"),this.#b&&(t+=this.#b),t=t+`&srs=${this.#s.getSesionRandomString()}`+`&ufp=${encodeURIComponent(this.#T)}`+`&cbpage=${encodeURIComponent(P())}`+`&atv=${this.#x}`+`&cbref=${encodeURIComponent(B())}`,this.#kt&&(t+=`&sub1=${encodeURIComponent(this.#kt)}`),this.#St&&(t+="&atag=1"),this.#d&&(t+=`&czid=${this.#d}`),this.#At&&(t+=`&pblcz=${this.#At}`),this.#h&&(t+=`&aggr=${this.#h}`),this.#o&&(t+="&abtg=1"),this.#g&&(t+="&ppv=1"),this.#p&&(t+=`&ab_test=${this.#p}`),this.#o&&this.#o.adbVersion&&(t+=`&adbv=${this.#o.adbVersion}`),this.#o&&this.#s.isAdbMode()?(t+="&sadbl=2",t+="&fmt=intrn",this.#r.debug(`bid url: ${t}`),nt(t)):(this.#r.debug(`bid url: ${t}`),t)}};const se="#399afe";const oe="inpageclick",ae="inpageclose",ce="utsid-send";class le extends HTMLElement{#Rt;constructor(){super(),this._shadowRoot=this.attachShadow({mode:"open"}),this.click=t=>{t.stopPropagation();const e=new CustomEvent(oe,{bubbles:!0});this.dispatchEvent(e)},this.close=t=>{t.stopPropagation();const e=new CustomEvent(ae,{bubbles:!0});this.dispatchEvent(e)},this.missclick=()=>{document.dispatchEvent(new CustomEvent("in-page-missclick"))}}connectedCallback(){const t=document.querySelectorAll("in-page-message");let e=0,r="top";for(let r=0;r{const e=document.createElement("div");e.id=`note-${t.id}`,e.style[t.position]=`${t.offset}px`,e.style.fontFamily='-apple-system,system-ui,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif',e.style.fontWeight="400",e.style.fontSize="16px",e.style.lineHeight="1.3",e.style.position="fixed",e.style.right="0",e.style.letterSpacing="-0.31em",e.style.textRendering="optimizespeed",e.style.display="flex",e.style.webkitBoxOrient="horizontal",e.style.webkitBoxDirection="normal",e.style.msFlexFlow="row wrap",e.style.alignContent="flex-start",e.style.alignItems="center",e.style.cursor="pointer",e.style.transition="padding-right 0.1s, top 0.3s",e.style.overflow="hidden",e.style.zIndex="2147483645",e.style.wordWrap="break-word",e.style.width="380px",e.style.paddingTop="20px";const r=()=>{window.innerWidth<380?e.style.width="100%":e.style.width="380px"};r();const i=document.createElement("div");i.style.margin="5px",i.style.borderRadius="55px",i.style.position="relative",i.style.background=se,i.style.color="#ffffff",i.style.width="70%",i.style.textAlign="center",i.style.height="100px",i.style.justifyContent="center",i.style.display="flex",i.style.alignItems="center";const n=document.createElement("p");n.style.width="90%",n.style.padding="2%",n.style.fontSize="0.9em",n.style.display="inline-block",n.style.letterSpacing="normal",n.style.wordSpacing="normal",n.style.verticalAlign="middle",n.style.textRendering="auto",n.style.textAlign="center";const s=document.createElement("b");s.textContent=t.dataTitle;const o=document.createElement("br"),a=document.createTextNode(t.dataDescription),c=document.createElement("img");c.classList.add("graph"),c.src=t.dataIcon,c.alt="graph",c.style.width="76px",c.style.height="76px",c.style.boxSizing="border-box",c.style.borderRadius="50%",c.style.position="relative",c.style.marginLeft="2%",c.style.border=`4px solid ${se}`,c.style.display="inline-block",c.style.letterSpacing="normal",c.style.wordSpacing="normal",c.style.verticalAlign="middle",c.style.textRendering="auto",c.style.textAlign="center";const l=document.createElement("div");l.id=`missclick-${t.id}`,l.style.right="0",l.style.top="0",l.style.height="100%",l.style.width=`${t.widthOfMissclickArea}px`,l.style.zIndex="2",l.style.position="absolute",l.style.alignItems="start",l.style.justifyContent="center",l.style.display="flex";const u=document.createElement("div");return u.id=`close-${t.id}`,u.innerHTML="✕",u.style.fontSize="20px",u.style.marginTop="10px",u.style.zIndex="23",u.style.display="inline-block",u.style.width="24px",u.style.height="24px",u.style.background="transparent",u.style.textAlign="center",u.style.color="#a6a0a7",u.style.letterSpacing="normal",u.style.wordSpacing="normal",u.style.verticalAlign="middle",u.style.textRendering="auto",u.onmouseover=()=>{u.style.background="#a0a0ff"},u.onmouseout=()=>{u.style.background="transparent"},n.appendChild(s),n.appendChild(o),n.appendChild(a),i.appendChild(n),l.appendChild(u),e.appendChild(i),e.appendChild(c),e.appendChild(l),{content:e,resizeFunc:r}})({id:this.getAttribute("id"),position:r,offset:e,dataTitle:this.getAttribute("data-title"),dataDescription:this.getAttribute("data-description"),dataIcon:this.getAttribute("data-icon"),notePaddingRightStyleRaw:"",widthOfMissclickArea:50});this.shadowRoot.appendChild(o.content),this.#Rt=o.resizeFunc;const a=this.shadowRoot.getElementById(`note-${this.getAttribute("id")}`),c=this.shadowRoot.getElementById(`close-${this.getAttribute("id")}`),l=this.shadowRoot.getElementById(`missclick-${this.getAttribute("id")}`);if(this.hasAttribute("data-imp-link")){let t=this.getAttribute("data-imp-link");window[ce]&&(t+=`&utsid=${window[ce]}`),t+=`&cbpage=${encodeURIComponent(P())}`,t+=`&cbref=${encodeURIComponent(B())}`;const e=document.createElement("img");e.src=t.toString(),e.style.display="none",e.width=0,e.height=0,a.appendChild(e)}O(a,"click",this.click),O(c,"click",this.close),O(l,"click",this.missclick)}resize(){this.#Rt&&this.#Rt()}}var ue=le,de=class{#e={};#r;#s;#b="";#Pt;#m=!1;#$t=!1;#x="57.2";#Lt=[];#zt=null;#ht=10;#S=!1;constructor(t){this.#r=new y(`ipp_new_${t.zoneId}`),this.#r.debug("init ipp with config:",t),this.#e=t,this.#s=window[t.adcashGlobalName],customElements.get("in-page-message")||customElements.define("in-page-message",ue),t.tagVersionSuffix&&(this.#x+=t.tagVersionSuffix),O(window,"resize",(()=>{var t;n()(t=this.#Lt).call(t,(t=>{let{htmlElement:e}=t;e&&e.resize()}))})),this.#s.getClientHints(!1).then((t=>{this.#b=t})).finally((()=>{f()((()=>{this.#ft()}),1e3*this.#e.delay)}))}#C(){let t=`${window.location.protocol}//${this.#e.adserverDomain}/script/push.php`;if(this.#e.adblockSettings&&this.#s.isAdbMode()){const{adserverDomain:e}=this.#e.adblockSettings,r=`/${it("abcdefgh0123456789")}`;t=`${window.location.protocol}//${e}${r}`}return t+=`?r=${this.#e.zoneId}&ipp=1`,this.#Pt=et?this.#e.renderPosMobile:this.#e.renderPosDesktop,t+=`&mads=${this.#e.maxAds}&position=${this.#Pt}`,this.#e.isAutoTag&&(t+=`&czid=${this.#e.collectiveZoneId}&atag=1`),this.#e.aggressivity&&(t+=`&aggr=${this.#e.aggressivity}`),this.#e.adblockSettings&&(t+="&abtg=1"),this.#m&&(t+="&rbd=1"),this.#e.recordPageView&&(t+="&ppv=1"),this.#e.linkedZoneId&&(t+=`&pblcz=${this.#e.linkedZoneId}`),this.#e.abTest&&(t+=`&ab_test=${this.#e.abTest}`),this.#e.sub1&&(t+=`&sub1=${encodeURIComponent(this.#e.sub1)}`),this.#e.adblockSettings&&this.#e.adblockSettings.adbVersion&&(t+=`&adbv=${this.#e.adblockSettings.adbVersion}`),t=t+`&srs=${this.#s.getSesionRandomString()}`+`&ufp=${encodeURIComponent(this.#e.uniqueFingerprint)}`+`&cbpage=${encodeURIComponent(P())}`+`&atv=${this.#x}`+`&cbref=${encodeURIComponent(B())}`,this.#b&&(t+=this.#b),this.#zt&&(t+="&ipptr=1"),this.#e.adblockSettings&&this.#s.isAdbMode()?(t+="&sadbl=2",t+="&fmt=ippg",this.#r.debug(`bid url: ${t}`),nt(t)):(this.#r.debug(`bid url: ${t}`),t)}#Ft(t){var e;this.#r.debug(`rebid after ${t} sec`),f()(v()(e=this.#ft).call(e,this),1e3*t)}#bt(){this.#ht<1200&&(this.#ht*=2)}#mt(){this.#ht=10}#Nt(){this.#Ft(this.#ht),this.#bt()}async#ft(){if(this.#Ut()>=this.#e.maxAds||document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement)return this.#r.debug("max ads reached or fullscreen."),void(this.#e.refreshRate>0&&this.#Ft(this.#e.refreshRate));let t,e;try{if(t=await fetch(this.#C()),!t.ok)throw new Error(`HTTP error! Status: ${t.status}`)}catch(t){return this.#r.error(t),this.#e.adblockSettings&&!this.#S?(this.#r.debug("fetch failed. adb present - switch to adb mode"),this.#S=!0,this.#s.enableAdbMode(),void this.#ft()):this.#s.isAdbMode()?void this.#r.debug("fetch failed with adb mode on. exit"):void this.#Nt()}return 204===t.status?(this.#r.debug("unsold inventory!"),this.#m=!0,void this.#Nt()):200!==t.status&&202!==t.status?(this.#r.error(`response status ${t.status} not recognised!`),void this.#Nt()):(this.#m=!0,e=await t.json(),this.#r.debug("response data:",e),202===t.status?e.capped_ttl?(this.#r.debug("capped!"),void this.#Ft(e.capped_ttl)):(e.hp&&this.#Bt(e.hp),void this.#Nt()):(e.hp&&this.#Bt(e.hp),e.fallback?this.#Ot(e.fallback)?void this.#r.debug("fallback rendered. exit!"):void this.#Nt():(this.#mt(),this.#b&&(e.impression_url&&(e.impression_url+=this.#b),e.click_url&&(e.click_url+=this.#b)),2===e.type?this.#zt?this.#r.debug("custom ipp html already present"):this.#Ht({script:e.script||"",link:e.click_url,impressionLink:e.impression_url||null}):(this.#Lt.push({title:e.title||"",description:e.description||"",icon:e.icon||e.image,link:e.click_url,impressionLink:e.impression_url||null}),this.#Dt()),void(this.#e.refreshRate>0&&this.#Ft(this.#e.refreshRate)))))}#Ut(){return this.#zt?this.#Lt.length+1:this.#Lt.length}#Ot(t){this.#r.debug("fallback script str decoded:",t);const e=(new DOMParser).parseFromString(t,"text/html").querySelector("script");if(!e)return this.#r.error("invalid fallback script. move on"),!1;this.#r.debug("fallback script:",e);const r=document.createElement("script");for(const t of e.attributes)r.setAttribute(t.name,t.value);return r.src||(r.textContent=e.textContent),document.body.appendChild(r),!0}#Bt(t){if(this.#$t)return void this.#r.debug("hp already attached");if(this.#e.isAutoTag)return void this.#r.debug("hp not allowed when autotag");this.#$t=!0;const e=JSON.parse(atob(t));this.#r.debug("attach hp. hp data:",e);const r={zoneId:e.pop_zone_id.toString(),linkedZoneId:e.source_zone_id.toString(),isHPop:!0};var i;e.attributes&&(e.attributes["element-list"]&&(r.targetElementsCssSelector=e.attributes["element-list"],r.triggerOnTargetElementsClick="allow"===e.attributes["element-action"]),e.attributes["country-list"]&&(r.targetCountries=re()(i=e.attributes["country-list"]).call(i).split(","),r.triggerOnTargetCountries="allow"===e.attributes["country-action"])),this.#s.runPop(r)}#Ht(t){this.#zt=t;const e=(new DOMParser).parseFromString(this.#zt.script,"text/html").querySelector("script"),r=document.createElement("script");if(e)for(const t of e.attributes)r.setAttribute(t.name,t.value);r.src||(r.innerText=e.innerText);const i=()=>{this.#r.debug("CT-CLICK"),fetch(this.#zt.link,{mode:"no-cors"}),document.removeEventListener("ct-click",i)},n=()=>{this.#r.debug("CT-CLOSE"),document.removeEventListener("ct-click",i),document.removeEventListener("ct-close",n),this.#zt=null,document.body.removeChild(r)};O(document,"ct-click",i),O(document,"ct-close",n);let s=this.#zt.impressionLink;window[ce]&&(s+=`&utsid=${window[ce]}`),s+=`&cbpage=${encodeURIComponent(P())}`,s+=`&cbref=${encodeURIComponent(B())}`,(async()=>{try{await fetch(s.toString())}catch(t){return this.#r.debug(t),void(this.#e.adblockSettings&&!this.#s.isAdbMode()&&(this.#r.debug("imp failed: try alt domain and path"),this.#s.enableAdbMode()))}document.dispatchEvent(new CustomEvent("impression-event"))})(),r.onerror=()=>{this.#r.debug("custom html script failed to load"),this.#zt=null},document.body.appendChild(r)}#Dt(){var t,e;this.#r.debug("drawing.."),n()(t=this.#Lt).call(t,(t=>{let{htmlElement:e}=t;e&&e.remove()})),n()(e=this.#Lt).call(e,((t,e)=>{const r=document.createElement("in-page-message");r.setAttribute("doskip","1"),r.setAttribute("id",e.toString()),r.setAttribute("data-icon",t.icon),r.setAttribute("data-title",t.title),r.setAttribute("data-description",t.description),r.setAttribute("data-offset-top",this.#e.offsetTop),r.setAttribute("data-render-pos-desktop",this.#e.renderPosDesktop),r.setAttribute("data-render-pos-mobile",this.#e.renderPosMobile),t.impressionLink&&(r.setAttribute("data-imp-link",t.impressionLink),t.impressionLink=null,document.dispatchEvent(new CustomEvent("impression-event"))),r.addEventListener(oe,(()=>{var i;if(et||this.#e.adblockSettings&&this.#s.isAdbMode()){const e=document.createElement("a");e.href=t.link,e.rel="noopener, noreferrer",e.target="_blank",e.click()}else try{window.open(t.link,"_blank","noopener,noreferrer")}catch{}r.remove(),h()(i=this.#Lt).call(i,e,1),this.#Dt()})),r.addEventListener(ae,(()=>{var t;r.remove(),h()(t=this.#Lt).call(t,e,1),this.#Dt()})),t.htmlElement=r,document.body.appendChild(r)}))}},he=r(111),ge=r.n(he),fe=r(8607),pe=r.n(fe),ve=class{#s;#e={};#r;#jt="";#Mt;#l=null;#_t=null;#Vt=null;#Wt=null;#qt;#Zt;#v="youradexchange.com";#Gt="velocecdn.com";#Qt;#o;#S=!1;#x="57.2";constructor(t){this.#r=new y(`banner_${t.zoneId}`),this.#s=window[t.adcashGlobalName],this.#r.debug("init banner with config:",t),this.#e=t,this.#l=this.#e.zoneId,this.#_t=this.#e.width,this.#Vt=this.#e.height,this.#Wt=this.#e.renderIn,this.#o=this.#e.adblockSettings,this.#e.currentScript&&(this.#Qt=this.#e.currentScript),this.#qt=this.#Zt=document.body.clientWidth||window.innerWidth,t.tagVersionSuffix&&(this.#x+=t.tagVersionSuffix),this.#r.debug("tag version:",this.#x),this.#Jt()}#Kt(){const t=this.#Mt.impression_url;(new Image).src=t}async#Jt(){this.#r.debug("get initial ad and config"),this.#jt=await R(this.#r);const t=await this.#Yt();let e;this.#r.debug("URL to fetch",t);try{e=await fetch(t)}catch(t){return this.#r.error(t),this.#o&&!this.#S?(this.#r.debug("fetch failed: try alt domain and path"),this.#S=!0,this.#s.enableAdbMode(),void this.#Jt()):this.#s.isAdbMode()?void this.#r.debug("fetch failed: alt domain and path blocked. exit"):void this.#r.debug("fetch failed. exit")}200===e.status||202===e.status?(this.#r.debug("initial fetch received 200 or 202"),this.#Mt=await e.json(),this.#Xt()):204===e.status&&this.#r.debug("initial fetch received 204. No inventory")}async#Yt(){let t=`${window.location.protocol}//${this.#v}/script/banner.php`;if(this.#o&&this.#s.isAdbMode()){const{adserverDomain:e}=this.#o,r=`/${it("abcdefgh0123456789")}`;t=`${window.location.protocol}//${e}${r}`}return t+=`?r=${this.#l}`,t+=`&cbpage=${encodeURIComponent(P())}`,t+=`&cbref=${encodeURIComponent(B())}`,t+=`&cbdescription=${encodeURIComponent(H("description"))}`,t+=`&cbkeywords=${encodeURIComponent(H("keywords"))}`,t+=`&cbtitle=${encodeURIComponent(U())}`,t+=`&srs=${z()}`,t+=`&ufp=${encodeURIComponent(this.#e.uniqueFingerprint)}`,t+=`&atv=${this.#x}`,this.#e.sub1&&(t+=`&sub1=${encodeURIComponent(this.#e.sub1)}`),this.#o&&this.#s.isAdbMode()?(t+="&sadbl=2",t+="&fmt=bnr",nt(t)):t}#Xt(){if(!this.#Mt||"undefined"===this.#Mt)return;if(this.#Mt.hp&&(this.#te(this.#Mt.hp),1===ge()(this.#Mt).length))return;let t;t=this.#Wt?document.querySelector(this.#Wt):this.#e.currentElement?this.#e.currentElement:this.#Qt.parentElement,this.#ee(t);const e=this.#re();t.appendChild(e)}#re(){let t;return this.#Mt.fallback?(this.#r.debug("Banner type - fallback"),t=this.#ie()):1===this.#Mt.render_image?(this.#r.debug("Banner type - image"),t=this.#ne()):(this.#r.debug("Banner type - html"),t=this.#se()),this.#Mt.fallback||this.#Kt(),this.#s||this.#oe(),t}#ne(){const t=document.createElement("a");t.href=this.#Mt.click_url,t.target="_blank",t.rel="noopener, noreferrer",t.style.display="block",t.style.width=`${this.#_t?this.#_t:this.#Mt.width}px`,t.style.height=`${this.#Vt?this.#Vt:this.#Mt.height}px`,t.style.position="relative",t.style.top=0,t.style.left=0,t.style.right=0,t.style.bottom=0,t.setAttribute("doskip","1"),t.setAttribute(Bt,"1");const e=document.createElement("img");if(e.src=this.#Mt.image_url,e.target="_blank",e.width=this.#_t?this.#_t:this.#Mt.width,e.height=this.#Vt?this.#Vt:this.#Mt.height,this.#Mt.width>this.#qt&&this.#Mt.force_resize){const r=(this.#_t?this.#_t:this.#Mt.width)/this.#Zt;t.style.width=`${this.#Zt}px`,t.style.height=`${Math.round((this.#Vt?this.#Vt:this.#Mt.height)/r)}px`,e.style="max-width: 100%;",e.width=this.#Zt,e.height=Math.round((this.#Vt?this.#Vt:this.#Mt.height)/r)}return t.appendChild(e),t}#se(){const t=`banner_${this.#l}`,e=document.createElement("div");e.id=t,e.style.display="block",e.style.width=`${this.#_t?this.#_t:this.#Mt.width}px`,e.style.height=`${this.#Vt?this.#Vt:this.#Mt.height}px`,e.style.position="relative",e.style.top="0",e.style.left="0",e.style.right="0",e.style.bottom="0",e.width=this.#_t?this.#_t:this.#Mt.width,e.height=this.#Vt?this.#Vt:this.#Mt.height,e.setAttribute("doskip","1"),e.setAttribute(Bt,"1"),this.#ae(e,this.#Mt.html);const r=()=>{this.#r.debug("click recorded:",this.#Mt.click_url),(new Image).src=this.#Mt.click_url,n()},i=()=>{this.#r.debug("click on divNode"),r()},n=()=>{e.removeEventListener("click",i),clearInterval(s)};e.addEventListener("click",i);const s=u()((()=>{document.activeElement&&"IFRAME"===document.activeElement.tagName&&((t,e)=>{let r=t.parentElement;for(;r;){if(r.id===e)return r;r=r.parentElement}return null})(document.activeElement,t)&&(this.#r.debug("click on iframe"),r())}),200);return e}#ae(t,e){var r;t.innerHTML=e,n()(r=m()(t.querySelectorAll("script"))).call(r,(t=>{var e;const r=document.createElement("script");n()(e=m()(t.attributes)).call(e,(t=>{r.setAttribute(t.name,t.value)}));const i=document.createTextNode(t.innerHTML);r.appendChild(i),t.parentNode.replaceChild(r,t)}))}#ie(){const t=`banner_${this.#l}`,e=document.createElement("iframe");return e.id=t,e.style.border="medium none",e.style.padding="0",e.style.margin="0",e.style.width=`${this.#_t?this.#_t:this.#Mt.width}px`,e.style.height=`${this.#Vt?this.#Vt:this.#Mt.height}px`,e.width=this.#_t?this.#_t:this.#Mt.width,e.height=this.#Vt?this.#Vt:this.#Mt.height,e.scrolling="no",e.vspace="0",e.hspace="0",e.allowtransparency="true",e.allowfullscreen="true",e.srcdoc=this.#Mt.fallback,e}#te=t=>{const e=JSON.parse(atob(t));if(this.#s){const t={zoneId:e.pop_zone_id.toString(),linkedZoneId:e.source_zone_id.toString()};var r;return e.attributes&&(e.attributes["element-list"]&&(t.targetElementsCssSelector=e.attributes["element-list"],t.triggerOnTargetElementsClick="allow"===e.attributes["element-action"]),e.attributes["country-list"]&&(t.targetCountries=re()(r=e.attributes["country-list"]).call(r).split(","),t.triggerOnTargetCountries="allow"===e.attributes["country-action"])),void this.#s.runPop(t)}const i=document.createElement("script");if(i.type="text/javascript",i.src=`//${this.#Gt}/script/suv4.js`,i.setAttribute("zid",e.pop_zone_id),i.setAttribute("lpzi",e.source_zone_id),i.setAttribute("data-adel","lwsu"),i.setAttribute("adlm","ipvipplm"),e.attributes)for(const t in e.attributes)i.setAttribute(t,e.attributes[t]);document.body.appendChild(i)};#ee(t){if(this.#r.debug("Initial viewport:",this.#qt),this.#Mt.width>this.#qt&&this.#Mt.force_resize){var e=window.getComputedStyle(t),r=pe()(e.paddingLeft),i=pe()(e.marginLeft);this.#Zt=t.clientWidth-r-i,this.#r.debug("Parent element width:",this.#Zt)}}#oe(){const t=document.createElement("a");t.style.display="none",t.style.visibility="hidden",t.style.position="relative",t.style.left="-1000px",t.style.top="-1000px",t.href=this.#Mt.bot_link,document.body.appendChild(t)}};const be="x4G9Tq2Kw6R7v1Dy3P0B5N8Lc9M2zF",me="adblock-settings",ye=(()=>{let t=document.currentScript;return t||(t=document.getElementById("aclib")),t||(t=document.getElementById("adcash-lib")),t})();let we=null;var xe=class{#Gt;#ce={pop:!1,autoTag:!1,inPagePush:!1,interstitial:!1};#le;#b;#ue=new(e());#r;#de;#he={mousedown:[],click:[],touchstart:[]};#ge={mousedown:[],scroll:[],click:[],touchstart:[]};#v="youradexchange.com";#o=null;#fe;#pe;#ve=!1;isShowingPop=!1;#T;constructor(){if(we)return we;we=this,this.#r=new y("aclib_adbl"),window.addEventListener("mousedown",(t=>{var e;this.#r.debug("win mousedown with capture: in"),n()(e=this.#he.mousedown).call(e,(e=>{this.#r.debug("win mousedown with capture: calling observer"),e.callback(t)}))}),!0),window.addEventListener("mousedown",(t=>{var e;this.#r.debug("win mousedown: in"),n()(e=this.#ge.mousedown).call(e,(e=>{this.#r.debug("win mousedown: calling observer"),e.callback(t)}))}),!1),window.addEventListener("click",(t=>{var e;this.#r.debug("win click with capture: in"),n()(e=this.#he.click).call(e,(e=>{this.#r.debug("win click with capture: calling observer"),e.callback(t)}))}),!0),window.addEventListener("click",(t=>{var e;this.#r.debug("win click: in"),n()(e=this.#ge.click).call(e,(e=>{this.#r.debug("win click: calling observer"),e.callback(t)}))}),!1),document.addEventListener("mousedown",(t=>{var e;this.#r.debug("doc mousedown: in"),n()(e=this.#ge.mousedown).call(e,(e=>{this.#r.debug("doc mousedown: calling observer"),e.callback(t)}))})),document.addEventListener("mousedown",(t=>{var e;this.#r.debug("doc mousedown with capture: in"),n()(e=this.#he.mousedown).call(e,(e=>{this.#r.debug("doc mousedown with capture: calling observer"),e.callback(t)}))}),!0),window.addEventListener("scroll",(t=>{var e;n()(e=this.#ge.scroll).call(e,(e=>{e.callback(t)}))})),document.addEventListener("click",(t=>{var e;this.#r.debug("doc click: in"),n()(e=this.#ge.click).call(e,(e=>{this.#r.debug("doc click: calling observer"),e.callback(t)}))})),document.addEventListener("click",(t=>{var e;this.#r.debug("doc click with capture: in"),n()(e=this.#he.click).call(e,(e=>{this.#r.debug("doc click with capture: calling observer"),e.callback(t)}))}),!0),this.getClientHints(),this.#pe=z(),this.#fe=(()=>{const t=Math.floor(11*Math.random())+5;let e="";for(let r=0;r{window[e]&&window[e]===t||(window[e]=t)}),500)}#xe(){this.#de&&(clearInterval(this.#de),this.#de=null)}subscribe(t,e,r){if(!this.#he[t]||!this.#ge[t])throw new Error(`${t} is not observable!`);r?this.#he[t].push(e):this.#ge[t].push(e)}unsubscribe(t,e,r){if(!this.#he[t]||!this.#ge[t])throw new Error(`${t} is not observable!`);if(r)for(let r=0;r{const e=document.createElement("link");e.rel="dns-prefetch",e.href=`//${t}`,document.head.appendChild(e)}))}f()(v()(t=this.#be).call(t,this),100)}getZoneIds(){return m()(this.#ue)}runPop(t){this.#we();const{zoneId:e,refreshRate:r,delay:i,targetElementsCssSelector:n,triggerOnTargetElementsClick:s,targetCountries:o,triggerOnTargetCountries:a,sub1:c,sub2:l,publisherUrl:u,storeUrl:d,c1:h,c2:g,c3:f,pubHash:p,pubClickId:v,pubValue:b,fallbackOn:m,isAutoTag:y,collectiveZoneId:w,aggressivity:x,recordPageView:k,linkedZoneId:S,abTest:A,tagVersionSuffix:T}=t;if(!e)throw new Error("mandatory zoneId is not provided!");if(!ft(e))throw new Error("zoneId is not a string!");if(void 0!==r&&(!gt(r)||r<0))throw new Error("refreshRate is not an integer or is less than zero");if(void 0!==i&&(!gt(i)||i<0))throw new Error("delay is not an integer or is less than zero");if(void 0!==n){if(!ft(n))throw new Error("targetElementsCssSelector is not a string");if(!(t=>{try{document.createDocumentFragment().querySelector(t)}catch{return!1}return!0})(n))throw new Error("targetElementsCssSelector is not a valid css selector");if(!ht(s))throw new Error("triggerOnTargetElementsClick is not a boolean")}if(void 0!==o){if(!(t=>{if(!lt()(t))return!1;if(0===t.length)return!1;for(let e=0;e0&&p<10&&(p<5?p*=60:p=30),new de({zoneId:e,refreshRate:p??60,delay:r??0,maxAds:i??1,renderPosDesktop:n??"top",renderPosMobile:s??"top",offsetTop:o??0,sub1:a,isAutoTag:c,linkedZoneId:l,collectiveZoneId:u,aggressivity:d,recordPageView:h,abTest:g,tagVersionSuffix:f,adserverDomain:this.#v,adblockSettings:this.#o,adcashGlobalName:this.#fe,isLoadedAsPartOfLibrary:!0,uniqueFingerprint:this.#T})}runBanner(t){this.#we();const{zoneId:e,width:r,height:i,renderIn:n,sub1:s,currentScript:o}=t;if(!e)throw new Error("mandatory zoneId is not provided!");if(!ft(e))throw new Error("zoneId is not a string!");if(void 0!==r&&!gt(r))throw new Error("Banner width is not an integer");if(void 0!==i&&!gt(i))throw new Error("Banner height is not an integer");if(this.#ue.has(e))return void this.#r.error(`zone ${e} already loaded`);let a;this.#ue.add(e),this.#r.debug("loading banner on page",e),n||(document.currentScript&&document.currentScript.parentElement&&(a=document.currentScript.parentElement),o&&(a=o.parentElement)),new ve({zoneId:e,width:r,height:i,renderIn:n,currentElement:a,sub1:s,adcashGlobalName:this.#fe,uniqueFingerprint:this.#T,adblockSettings:this.#o})}runInterstitial(t){if(this.#ce.interstitial)return void this.#r.error("interstitial zone already loaded on page");this.#ce.interstitial=!0,this.#we();const{zoneId:e,sub1:r,isAutoTag:i,linkedZoneId:n,collectiveZoneId:s,aggressivity:o,recordPageView:a,abTest:c,tagVersionSuffix:l}=t;if(!e)throw new Error("mandatory zoneId is not provided!");if(!ft(e))throw new Error("zoneId is not a string!");this.#r.debug("loading interstitial on page");const u={zoneId:e,sub1:r,isAutoTag:i,linkedZoneId:n,collectiveZoneId:s,aggressivity:o,recordPageView:a,abTest:c,tagVersionSuffix:l,adcashGlobalName:this.#fe,adserverDomain:this.#v,adblockSettings:this.#o,isLoadedAsPartOfLibrary:!0,uniqueFingerprint:this.#T};this.#ue.add(e),new ne(u)}async#ke(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.#r.debug("fetch collective zone config");let r=`${window.location.protocol}//${this.#v}/ad/czcf.php`;if(this.isAdbMode()){const t=`/${it("abcdefgh0123456789")}`;r=`${window.location.protocol}//${this.#o.adserverDomain}${t}`}r+=`?cz=${t}`;const i=await this.getClientHints();let n;i&&(r+=i),this.isAdbMode()&&(r+="&sadbl=2",r+="&fmt=atg",r=nt(r)),this.#r.debug("collective zone config url: ",r);try{n=await fetch(r)}catch(r){return this.#r.error(r),this.#o&&e?(this.#r.debug("collective zone config fetch failed: try alt domain and path"),this.enableAdbMode(),this.#ke(t,!1)):null}return 200!==n.status?null:n.json()}async runAutoTag(t){if(this.#ce.autoTag)return void this.#r.error("autotag zone already loaded on page");this.#ce.autoTag=!0,this.#we();const e=t.zoneId;if(!e)throw new Error("mandatory zoneId is not provided!");if(!ft(e))throw new Error("zoneId is not a string!");const r=await this.#ke(e);if(r)if(this.#r.debug("collective zone config:",r),r.rotationList)this.#r.debug("running in ROTATION MODE"),this.#ue.add(e),new Gt({adcashGlobalName:this.#fe,collectiveZoneConfig:r,adserverDomain:this.#v,adblockSettings:this.#o,clientHintsQueryStr:this.#b,tagVersionSuffix:t.tagVersionSuffix,isLoadedAsPartOfLibrary:!0,uniqueFingerprint:this.#T});else{this.#r.debug("running in NORMAL MODE");const i=r.indexedFormats;let n=!0;for(const s in i){switch(s){case"suv4":case"pop":this.runPop({zoneId:i[s].zoneId.toString(),targetElementsCssSelector:i[s]["element-list"],triggerOnTargetElementsClick:"allow"===i[s]["element-action"],targetCountries:i[s]["country-list"],triggerOnTargetCountries:"allow"===i[s]["country-action"],isAutoTag:!0,collectiveZoneId:e,aggressivity:r.aggressivity,abTest:r.ab_test,recordPageView:n,tagVersionSuffix:t.tagVersionSuffix});break;case"interstitial":this.runInterstitial({zoneId:i[s].zoneId.toString(),isAutoTag:!0,collectiveZoneId:e,aggressivity:r.aggressivity,abTest:r.ab_test,recordPageView:n,tagVersionSuffix:t.tagVersionSuffix});break;case"ippg":this.runInPagePush({zoneId:i[s].zoneId.toString(),refreshRate:i[s].rr,delay:i[s].d,maxAds:i[s].mads,renderPosDesktop:i[s]["render-pos-desktop"],renderPosMobile:i[s]["render-pos-mobile"],offsetTop:i[s]["offset-top"],isAutoTag:!0,collectiveZoneId:e,aggressivity:r.aggressivity,abTest:r.ab_test,recordPageView:n,tagVersionSuffix:t.tagVersionSuffix});break;default:this.#r.error(`ad format type not recognised from collective zone config. adformat.type: ${s}; czid: ${e}`)}n=!1}}else this.#r.error(`failed to fetch collective zone config! czid: ${e}`)}};const ke=new y("aclib_adblock_index");window.Adcash?ke.debug("lib already on page. exit"):(ke.debug("load lib on page"),window.Adcash=xe,window.AtcshAltNm=xe,window.aclib=new xe)}()}();