Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

essage:fixed JSLint reported issues

  • Loading branch information...
commit a2d15bfd0324fc523ac823d681b53967ac887daa 1 parent 43d4a4f
@Haacked authored
View
2  index.html
@@ -3,7 +3,7 @@
<head>
<title></title>
<script type="text/javascript" src="lib/jquery-1.3.2.min.js"></script>
- <script type="text/javascript" src="src/jquery.livepreview.min.js"></script>
+ <script type="text/javascript" src="src/jquery.livepreview.js"></script>
<script type="text/javascript">
/*
View
2  lib/demo-style.css
@@ -30,7 +30,7 @@ textarea.source
div.preview {
width: 400px;
- height: 200px;
+ min-height: 200px;
border: solid 1px #000;
background-color: #ffffec;
padding: 5px;
View
2  src/jquery.livepreview.js
@@ -31,7 +31,7 @@
textarea.reloadPreview = function() {
var previewString = this.val();
- if (previewString.length > 0 && previewString.indexOf('<') > -1) {
+ if (previewString.length > 0) {
previewString = this.htmlUnencode(previewString);
previewString = previewString.replace(opts.paraRegExp, "<p>$1</p><p>$2</p>");
previewString = previewString.replace(opts.lineBreakRegExp, "$1<br />$2");
View
4 src/jquery.livepreview.min.js
@@ -5,5 +5,5 @@
* Licensed under the MIT license.
*/
(function(c){c.fn.livePreview=function(f){var d=c.extend({},c.fn.livePreview.defaults,f),g=d.previewElement.length-1,h=new RegExp("&lt;(/?("+d.allowedTags.join("|")+")(\\s+.*?)?)&gt;","g");return this.each(function(i){var b=c(this),e=c(d.previewElement[Math.min(i,g)]);b.handleKeyUp=function(){b.unbind("keyup",b.handleKeyUp);if(!e.updatingPreview){e.updatingPreview=true;window.setTimeout(function(){b.reloadPreview()},d.interval)}return false};b.htmlUnencode=function(a){return a.replace(/&/g,"&amp;").replace(/</g,
-"&lt;").replace(/>/g,"&gt;")};b.reloadPreview=function(){var a=this.val();if(a.length>0&&a.indexOf("<")>-1){a=this.htmlUnencode(a);a=a.replace(d.paraRegExp,"<p>$1</p><p>$2</p>");a=a.replace(d.lineBreakRegExp,"$1<br />$2");a=a.replace(h,"<$1>")}try{e[0].innerHTML=a}catch(j){alert("Sorry, but inserting a block element within is not allowed here.")}e.updatingPreview=false;this.bind("keyup",this.handleKeyUp)};b.reloadPreview()})};c.fn.livePreview.defaults={paraRegExp:new RegExp("(.*)\n\n([^#*\n\n].*)",
-"g"),lineBreakRegExp:new RegExp("(.*)\n([^#*\n].*)","g"),allowedTags:["a","b","strong","blockquote","p","i","em","u","strike","super","sub","code"],interval:80}})(jQuery);
+"&lt;").replace(/>/g,"&gt;")};b.reloadPreview=function(){var a=this.val();if(a.length>0){a=this.htmlUnencode(a);a=a.replace(d.paraRegExp,"<p>$1</p><p>$2</p>");a=a.replace(d.lineBreakRegExp,"$1<br />$2");a=a.replace(h,"<$1>")}try{e[0].innerHTML=a}catch(j){alert("Sorry, but inserting a block element within is not allowed here.")}e.updatingPreview=false;this.bind("keyup",this.handleKeyUp)};b.reloadPreview()})};c.fn.livePreview.defaults={paraRegExp:new RegExp("(.*)\n\n([^#*\n\n].*)","g"),lineBreakRegExp:new RegExp("(.*)\n([^#*\n].*)",
+"g"),allowedTags:["a","b","strong","blockquote","p","i","em","u","strike","super","sub","code"],interval:80}})(jQuery);
Please sign in to comment.
Something went wrong with that request. Please try again.