練炭ブログ

萌え壁紙、Irvine、DMonkey、Proxomitron などの情報を扱ってます。

Proxomitron: Visualize document.write output

コメントなし»

使ってないフィルタをブログに書いて default.cfg 減量化なう。

Name = "Visualize document.write output (2005-12-01; rentan)"
Active = TRUE
URL = "$TYPE(htm)"
Limit = 4096
Match = "(^(^<[^%1b>]+>)|"
        "</+(!--(^\[|[^<>]+<)|\?xml|!doctype|html|head|title|meta|link|base|((^</+title)?)+</title>)"
        "|"
        "(</+[^<>"']+>[^<>"']+)+{1,*}"[^<>"']+>"
        ")$STOP()"
Replace = "<script type="text/javascript">"
          "(function () {"
          "  var Prx_document_write = document.write;"
          "  document.write = function (s) {"
          "    Prx_document_write (s);"
          "    for (i = 0; i < s.length; ++i) {"
          "      c = s.charAt (i);"
          "      if (c == '&') Prx_document_write ("&amp;");"
          "      else if (c == '<') Prx_document_write ("&lt;");"
          "      else if (c == '>') Prx_document_write ("&gt;");"
          "      else Prx_document_write (c);"
          "    }"
          "  }"
          "}) ();"
          "</script>\n"

なぜメタ文字を一文字ずつパースしているのかは不明。このころは初心者だったからだと思われます。

あとマッチングパターンは誤爆が多いかも知れません。

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です