计算器
Posted cxatg
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了计算器相关的知识,希望对你有一定的参考价值。
!function(){"use strict";var p="https://www.omnicalculator.com";function e(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),a.push.apply(a,r)}return a}function t(n){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?e(o,!0).forEach(function(t){var e,a,r;e=n,r=o[a=t],a in e?Object.defineProperty(e,a,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[a]=r}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(o)):e(o).forEach(function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(o,t))})}return n}"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var g=Array.prototype.forEach,a={visibility:"visible",opacity:1},r="8px",n="#eee",b={container:t({},a,{display:"block",margin:0,padding:0,fontFamily:"Arial, sans-serif",fontSize:"16px",lineHeight:1.15,color:"#666",boxSizing:"border-box",background:"#f9f9f9",border:"1px solid "+n,borderRadius:r}),header:t({},a,{display:"block",padding:"20px 0",fontSize:"24px",textAlign:"center",background:n,borderTopLeftRadius:r,borderTopRightRadius:r}),iframe:t({},a,{display:"block",border:"none",width:"100%",margin:0,padding:0}),footer:t({},a,{display:"block",marginTop:"16px",marginLeft:"16px",marginBottom:"20px",marginRight:"12px",textAlign:"right"}),link:t({},a,{display:"inline",color:"#989c9d",textDecoration:"none",border:0,boxShadow:"none"}),omniImageLink:t({},{display:"inline-block",textIndent:"100%",whiteSpace:"nowrap",overflow:"hidden"},{width:"51px",height:"13px",background:"url(https://cdn.omnicalculator.com/images/omni-db2e5a9837.svg)",backgroundRepeat:"no-repeat"}),logo:t({},a,{width:"142px",height:"13px"})},y="omni-calculator-loading",l="omni-calculator-loaded";function h(e,a){Object.keys(a).forEach(function(t){e.style[t]=a[t]})}function v(t){return t.getElementsByClassName("omni-calculator-header")[0]}function w(t){return t.getElementsByClassName("omni-calculator-footer")[0]}!function(t,d){if(!t.OmniC){var e,u=0,f=/^d+$/,a=function(){var t=d.getElementsByClassName("omni-calculator");g.call(t,r)},m=function(t,e){return t.substring(0,e.length)===e};e=function(){t.addEventListener("message",n,!1),a()},"loading"!==d.readyState?e():d.addEventListener("DOMContentLoaded",e),t.OmniC=t.OmniC||{parse:a}}function r(t){if(!t.hasAttribute("data-parsed")){var e=v(t),a=w(t);if(a&&e){var r=t.getAttribute("data-calculator");if(r){var n=a.getElementsByTagName("a");g.call(n,function(t){!function(t){t.target||(t.target="_blank")}(t)});var o=Array.prototype.some.call(n,function(t){return m(t.href,"https://www.omnicalculator.com")});t.style.width="360px";var i=t.getAttribute("data-version")||1,c=++u,l=d.createElement("iframe");l.className="omni-calculator-frame",l.setAttribute("data-calculator-id",""+c),l.src=p+"/embed/"+r+"#id="+c+"&hasLink="+o+"&version="+i,h(l,b.iframe),l.style.height="0",t.insertBefore(l,a);var s=t.getAttribute("data-width");s&&(s.match(f)&&(s+="px"),t.style.width=s),o||a.parentElement.removeChild(a),t.setAttribute("data-parsed","1"),t.classList&&t.classList.add(y)}}}}function n(t){if(t.origin===p){var e=t.data;if(e)switch(e.type){case"CHANGE_HEIGHT":return void function(t){var e=t.calculatorId,a=t.value,r=c(e);r&&(r.style.height=a+"px")}(e);case"LOADED":return void function(t){var e=c(t.calculatorId),a=e.parentNode;if(!a)return;var r,n=a.getAttribute("data-currency"),o=a.getAttribute("data-config");if(o)try{r=JSON.parse(o)}catch(t){}r=r||{};var i=a.getAttribute("data-show-row-controls");!function(t,e){t.contentWindow.postMessage(e,p)}(e,{type:"CONFIG",config:r,currency:n,showRowControls:"false"!==i})}(e);case"READY":return void function(t){!function(t){var e=t.parentNode,a=v(e),r=w(e);if(h(a,b.header),h(e,b.container),r){h(r,b.footer);var n=r.getElementsByTagName("a");g.call(n,function(t){h(t,b.link)});var o=r.getElementsByClassName("omni-calculator-img-link");g.call(o,function(t){h(t,b.omniImageLink)});var i=r.getElementsByClassName("omni-calculator-logo");g.call(i,function(t){h(t,b.logo)})}var c=e.getElementsByClassName("omni-calculator-placeholder");g.call(c,function(t){t.parentNode.removeChild(t)}),e.classList&&(e.classList.remove(y),e.classList.add(l))}(c(t.calculatorId))}(e)}}}function c(t){return d.querySelector(‘.omni-calculator-frame[data-calculator-id="‘+t+‘"]‘)}}(window,document)}();
以上是关于计算器的主要内容,如果未能解决你的问题,请参考以下文章