“miniLab”的版本间的差异

来自个人维基
跳转至: 导航搜索
(if(_r!==undefined))
 
(未显示1个用户的6个中间版本)
第5行: 第5行:
 
<html>
 
<html>
 
   <head>
 
   <head>
 +
    <meta name=viewport content="width=device-width,initial-scale=1">
 
     <title>miniLab</title>
 
     <title>miniLab</title>
 
   </head>
 
   </head>
第14行: 第15行:
 
       onblur="
 
       onblur="
 
         try {
 
         try {
           alert(eval(this.value))
+
           var _r = eval(this.value)
 +
          if (_r !== undefined) alert(_r)
 
         } catch (e) {
 
         } catch (e) {
 
           alert(e)
 
           alert(e)
第25行: 第27行:
  
 
Data URL:
 
Data URL:
<pre style="white-space: pre-wrap; overflow-wrap: break-word;">
+
<pre style="white-space: pre-wrap; word-break: break-all;">
data:text/html;,<!DOCTYPE%20html><html><head><title>miniLab</title></head><body><textarea%20id=codebox%20autocapitalize=off%20spellcheck=false%20onblur=%22try%7Balert(eval(this.value))%7Dcatch(e)%7Balert(e)%7D%22%20style=%22width:100%25;height:25rem%22%3E%3C/textarea%3E</body></html>
+
data:text/html;,<!DOCTYPE%20html><html><head><meta%20name=viewport%20content=%22width=device-width,initial-scale=1%22><title>miniLab</title></head><body><textarea%20id=codebox%20autocapitalize=off%20spellcheck=false%20onblur=%22try%7Bvar%20_r=eval(this.value);if%20(_r!==undefined)alert(_r)%7Dcatch(e)%7Balert(e)%7D%22%20style=%22width:100%25;height:25rem%22%3E%3C/textarea%3E</body></html>
 
</pre>
 
</pre>
  
第38行: 第40行:
 
window.myDiv = document.body.appendChild(document.createElement("div"))
 
window.myDiv = document.body.appendChild(document.createElement("div"))
 
text.onblur = function () { myDiv.innerHTML = text.value }
 
text.onblur = function () { myDiv.innerHTML = text.value }
;[][[]]
+
;''
 
</source>
 
</source>
  
[[分类:草稿]]
+
=== audio player ===
 +
 
 +
<source lang=javascript>
 +
var fu = null
 +
var fi = document.body.appendChild(document.createElement('input'))
 +
fi.type = "file"
 +
fi.onchange = function () {
 +
  if (fu) window.URL.revokeObjectURL(fu)
 +
  a.src = fu = window.URL.createObjectURL(fi.files[0])
 +
}
 +
/* var */ a = document.body.appendChild(document.createElement('audio'))
 +
a.controls = true
 +
;''
 +
</source>
 +
 
 +
[[分类:存档]]

2021年11月20日 (六) 07:40的最后版本

<!DOCTYPE html>
<html>
  <head>
    <meta name=viewport content="width=device-width,initial-scale=1">
    <title>miniLab</title>
  </head>
  <body>
    <textarea
      id=codebox
      autocapitalize=off
      spellcheck=false
      onblur="
        try {
          var _r = eval(this.value)
          if (_r !== undefined) alert(_r)
        } catch (e) {
          alert(e)
        }"
      style="width: 100%; height: 25rem"
    ></textarea>
  </body>
</html>

Data URL:

data:text/html;,<!DOCTYPE%20html><html><head><meta%20name=viewport%20content=%22width=device-width,initial-scale=1%22><title>miniLab</title></head><body><textarea%20id=codebox%20autocapitalize=off%20spellcheck=false%20onblur=%22try%7Bvar%20_r=eval(this.value);if%20(_r!==undefined)alert(_r)%7Dcatch(e)%7Balert(e)%7D%22%20style=%22width:100%25;height:25rem%22%3E%3C/textarea%3E</body></html>

Snippets

myDiv

this.value = ""
window.text = document.body.appendChild(this.cloneNode())
window.myDiv = document.body.appendChild(document.createElement("div"))
text.onblur = function () { myDiv.innerHTML = text.value }
;''

audio player

var fu = null
var fi = document.body.appendChild(document.createElement('input'))
fi.type = "file"
fi.onchange = function () {
  if (fu) window.URL.revokeObjectURL(fu)
  a.src = fu = window.URL.createObjectURL(fi.files[0])
}
/* var */ a = document.body.appendChild(document.createElement('audio'))
a.controls = true
;''