-
Notifications
You must be signed in to change notification settings - Fork 3
/
preview.html
6 lines (4 loc) · 1.14 KB
/
preview.html
1
2
3
4
5
6
<p class="ciu_embed" data-feature="%property%" data-periods="future_1,current,past_2"> <a href="http://caniuse.com/#feat=%property%">Can I Use %property%?</a> Data on support for the %property% feature across the major browsers from caniuse.com. </p>
<script>
(function(){for(var e=document.getElementsByClassName("ciu_embed"),t=0;t<e.length;t++){var s=e[t],a=s.getAttribute("data-feature"),n=s.getAttribute("data-periods");if(a){var r="http://caniuse.bitsofco.de/embed/index.html",o='<iframe src="'+r+"?feat="+a+"&periods="+n+'" frameborder="0" width="100%" height="400px"></iframe>';s.innerHTML=o}else s.innerHTML="A feature was not included. Go to <a href='http://caniuse.bitsofco.de/#how-to-use'>http://caniuse.bitsofco.de/#how-to-use</a> to generate an embed."}var i=window.addEventListener?"addEventListener":"attachEvent",d=window[i],l="attachEvent"==i?"onmessage":"message";d(l,function(t){var s=t.data;if("string"==typeof s&&s.indexOf("ciu_embed")>-1)for(var a=s.split(":")[1],n=s.split(":")[2],r=0;r<e.length;r++){var o=e[r];if(o.getAttribute("data-feature")===a){var i=parseInt(n)+20;o.childNodes[0].height=i+"px";break}}},!1)}).call(this);
</script>