模板:Codepen:修订间差异

来自康健生活
Kangkk​(留言 | 贡献)
无编辑摘要
Kangkk​(留言 | 贡献)
无编辑摘要
 
(未显示同一用户的114个中间版本)
第1行: 第1行:
<noinclude>{{Documentation}}</noinclude>
<templatestyles src="Codepen/styles.css" /><noinclude>{{Documentation}}</noinclude><includeonly><div class="wiki-codepen" style="height:{{{height|}}}px;">{{Double-columns|
<includeonly><div class="wiki-codepen">{{leftrightflex
  <tabs>
|<tabs><!--
    {{#if:{{{html|}}}|
  --><tab name="HTML">{{{output|{{{1|{{META Error}}}}}}}}</tab><!--
      {{#tag:tab|{{#tag:syntaxhighlight|{{{html|}}}|lang=html}}|name='html'}}|}}
   --><tab name="CSS">{{{2}}}</tab><!--
    {{#if:{{{style|}}}|
  --><tab name="JS">{{{3}}}</tab><!--
      {{#tag:tab|{{#tag:syntaxhighlight|{{{style|}}}|lang=css}}|name='style'}}|}}
  --></tabs>
    {{#if:{{{script|}}}|
|<div class="wiki-codepen-iframe">{{{iframe|}}}</div>}}</div></includeonly>
      {{#tag:tab|{{#tag:syntaxhighlight|{{{script|}}}|lang=javascript}}|name='script'}}|}}
  </tabs>
   |{{#tag:html|
    {{#tag:html|{{#tag:script|function {{{id|}}}(_){
      const target = _.contentDocument <nowiki>||</nowiki> _.contentWindow.document;
      target.body.innerHTML = `{{#if:{{{style|}}}|{{#tag:style|{{{style|}}}|type=text/css}}|}}{{#if:{{{html|}}}|{{{html|}}}|}}`;
     
      const ele = document.createElement('script');
      ele.type = 'text/javascript';
      ele.innerHTML = `{{{script|}}}` <nowiki>||</nowiki> '';
      target.body.appendChild(ele);
 
    }|type='text/javascript'}}}}
    <iframe class="wiki-codepen-iframe" onload="{{{id|}}}(this)"></iframe>
    |class=wiki-codepen-preview}}
  }}</div></includeonly>