CasperSecurity

Current Path : /usr/share/doc/libjs-codemirror/examples/
Upload File :
Current File : //usr/share/doc/libjs-codemirror/examples/spanaffectswrapping_shim.html

<!doctype html>

<title>CodeMirror: Automatically derive odd wrapping behavior for your browser</title>
<meta charset="utf-8"/>
<link rel=stylesheet href="../html/docs.css">

<div id=nav>
  <a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../html/logo.png"></a>

  <ul>
    <li><a href="../index.html">Home</a>
    <li><a href="../html/manual.html">Manual</a>
    <li><a href="https://github.com/codemirror/codemirror">Code</a>
  </ul>
  <ul>
    <li><a class=active href="#">Automatically derive odd wrapping behavior for your browser</a>
  </ul>
</div>

<article>
<h2>Automatically derive odd wrapping behavior for your browser</h2>


    <p>This is a hack to automatically derive
    a <code>spanAffectsWrapping</code> regexp for a browser. See the
    comments above that variable
    in <a href="/usr/share/javascript/codemirror/lib/codemirror.js"><code>lib/codemirror.js</code></a>
    for some more details.</p>

    <div style="white-space: pre-wrap; width: 50px;" id="area"></div>
    <pre id="output"></pre>

    <script id="script">
      var a = document.getElementById("area"), bad = Object.create(null);
      var chars = "a~`!@#$%^&*()-_=+}{[]\\|'\"/?.>,<:;", l = chars.length;
      for (var x = 0; x < l; ++x) for (var y = 0; y < l; ++y) {
        var s1 = "foooo" + chars.charAt(x), s2 = chars.charAt(y) + "br";
        a.appendChild(document.createTextNode(s1 + s2));
        var h1 = a.offsetHeight;
        a.innerHTML = "";
        a.appendChild(document.createElement("span")).appendChild(document.createTextNode(s1));
        a.appendChild(document.createElement("span")).appendChild(document.createTextNode(s2));
        if (a.offsetHeight != h1)
          bad[chars.charAt(x)] = (bad[chars.charAt(x)] || "") + chars.charAt(y);
        a.innerHTML = "";
      }

      var re = "";
      function toREElt(str) {
        if (str.length > 1) {
          var invert = false;
          if (str.length > chars.length * .6) {
            invert = true;
            var newStr = "";
            for (var i = 0; i < l; ++i) if (str.indexOf(chars.charAt(i)) == -1) newStr += chars.charAt(i);
            str = newStr;
          }
          str = str.replace(/[\-\.\]\"\'\\\/\^a]/g, function(orig) { return orig == "a" ? "\\w" : "\\" + orig; });
          return "[" + (invert ? "^" : "") + str + "]";
        } else if (str == "a") {
          return "\\w";
        } else if (/[?$*()+{}[\]\.|/\'\"]/.test(str)) {
          return "\\" + str;
        } else {
          return str;
        }
      }

      var newRE = "";
      for (;;) {
        var left = null;
        for (var left in bad) break;
        if (left == null) break;
        var right = bad[left];
        delete bad[left];
        for (var other in bad) if (bad[other] == right) {
          left += other;
          delete bad[other];
        }
        newRE += (newRE ? "|" : "") + toREElt(left) + toREElt(right);
      }

      document.getElementById("output").appendChild(document.createTextNode("Your regexp is: " + (newRE || "^$")));
    </script>
  </article>
Hacker Blog, Shell İndir, Sql İnjection, XSS Attacks, LFI Attacks, Social Hacking, Exploit Bot, Proxy Tools, Web Shell, PHP Shell, Alfa Shell İndir, Hacking Training Set, DDoS Script, Denial Of Service, Botnet, RFI Attacks, Encryption
Telegram @BIBIL_0DAY