Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

94 lines (78 sloc) 1.8 kB
<!DOCTYPE html>
<html>
<head>
<title>Sanitize</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="janitor.js"></script>
<style type="text/css">
body {
font-family: helvetica neue;
}
.code_wrapper {
background-color: #f5f5f5;
padding: 20px;
margin-bottom: 20px;
border-radius: 10px;
border: 1px solid #ddd;
}
.config_wrapper {
background-color: #f5f5f5;
padding: 20px;
border-radius: 10px;
border: 1px solid #ddd;
}
h3 {
margin: 0;
padding: 0 0 10px 0;
}
textarea {
font-family: courier;
}
</style>
</head>
<body>
<h1>
Janitor-js &mdash; jQuery plugin for sanitizing HTML
</h1>
<div class="code_wrapper">
<h3 style="color: #f00">
Dirty HTML
</h3>
<textarea id="dirty" style="height: 100px; width: 400px"></textarea>
<p>
<button id="doit">Sanitize</button>
</p>
<h3 style="color: #0c0">
Cleaner HTML
</h3>
<textarea id="clean" style="height: 100px; width: 400px"></textarea>
</div>
<div class="config_wrapper">
<h3>
Configuration
</h3>
<textarea id="config" style="height: 100px; width: 400px">
{
tags: {
div: [],
ul: [],
li: [],
a: [ 'href' ]
},
protocols: [ 'http', 'https' ]
}
</textarea>
</div>
<script type="text/javascript">
(function($) {
var execute = function () {
var config;
eval('config = ' + $('#config').val());
$('#clean').val(Janitor.clean($('#dirty').val(), config));
}
execute();
$('#doit').on('click', execute);
})(jQuery);
</script>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.