Monday, 3 October 2016
WHITE SPACE REMOVER CODE
---------------------------------------------------------------------------------------------------------------------
COPY AND PASTE BELOW CODE IN POST HTML SECTION
COPY CODE FROM NOTEPAD++ >> MICROSOFTWORD
---------------------------------------------------------------------------------------------------------------------
<html>
<head>
<style>
/************************************BODY************************************/
body {
background-color: #eee;
font-family: Arial, Helvetica Neue, Helvetica,
sans-serif;
font-size: 12px;
font-weight: normal;
text-align: left;
color: #444;
line-height: 18px;
background: #eee url() left top repeat-x;
}
/*ENTRY*/
div.entry {
margin-bottom: 20px;
}
div.entry-top {
height: 20px;
background: #fff url() left top no-repeat;
}
div.entry-content {
padding: 0 20px;
background: #fff url() left top repeat-y;
overflow:hidden;
width:600px;
}
div.entry-bottom {
height: 1px;
overflow: hidden;
clear:left;
background: #fff url() left top no-repeat;
}
.ui-helper-hidden { display: none; }
.ui-helper-hidden-accessible { position: absolute
!important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
.ui-helper-reset { margin: 0; padding: 0; border:
0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%;
list-style: none; }
.ui-helper-clearfix:after { content: ".";
display: block; height: 0; clear: both; visibility: hidden; }
.ui-helper-clearfix { display: inline-block; }
* html .ui-helper-clearfix { height:1%; }
.ui-helper-clearfix { display:block; }
.ui-helper-zfix { width: 100%; height: 100%; top:
0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
.ui-state-disabled { cursor: default !important; }
.ui-icon { display: block; text-indent: -99999px;
overflow: hidden; background-repeat: no-repeat; }
.ui-widget-overlay { position: absolute; top: 0;
left: 0; width: 100%; height: 100%; }
.ui-widget { font-family: Trebuchet MS, Tahoma,
Verdana, Arial, sans-serif; font-size: 1.1em; }
.ui-widget .ui-widget { font-size: 1em; }
.ui-widget input, .ui-widget select, .ui-widget
textarea, .ui-widget button { font-family: Trebuchet MS, Tahoma, Verdana,
Arial, sans-serif; font-size: 1em; }
.ui-widget-content { border: 1px solid #dddddd;
background: #eeeeee url(images/ui-bg_highlight-soft_100_eeeeee_1x100.png) 50% top
repeat-x; color: #333333; }
.ui-widget-content a { color: #333333; }
.ui-widget-header { border: 1px solid #e78f08;
background: #f6a828 url(images/ui-bg_gloss-wave_35_f6a828_500x100.png) 50% 50%
repeat-x; color: #ffffff; font-weight: bold; }
.ui-widget-header a { color: #ffffff; }
.ui-state-default, .ui-widget-content
.ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid
#cccccc; background: #f6f6f6 url(images/ui-bg_glass_100_f6f6f6_1x400.png) 50%
50% repeat-x; font-weight: bold; color: #1c94c4; }
.ui-state-default a, .ui-state-default a:link,
.ui-state-default a:visited { color: #1c94c4; text-decoration: none; }
.ui-state-hover, .ui-widget-content
.ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus,
.ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border:
1px solid #fbcb09; background: #fdf5ce
url(images/ui-bg_glass_100_fdf5ce_1x400.png) 50% 50% repeat-x; font-weight:
bold; color: #c77405; }
.ui-state-hover a, .ui-state-hover a:hover { color:
#c77405; text-decoration: none; }
.ui-state-active, .ui-widget-content
.ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid
#fbd850; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50%
50% repeat-x; font-weight: bold; color: #eb8f00; }
.ui-state-active a, .ui-state-active a:link,
.ui-state-active a:visited { color: #eb8f00; text-decoration: none; }
.ui-widget :active { outline: none; }
.ui-state-highlight, .ui-widget-content
.ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid
#fed22f; background: #ffe45c
url(images/ui-bg_highlight-soft_75_ffe45c_1x100.png) 50% top repeat-x; color:
#363636; }
.ui-state-highlight a, .ui-widget-content
.ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636;
}
.ui-state-error, .ui-widget-content
.ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a;
background: #b81900 url(images/ui-bg_diagonals-thick_18_b81900_40x40.png) 50%
50% repeat; color: #ffffff; }
.ui-state-error a, .ui-widget-content
.ui-state-error a, .ui-widget-header .ui-state-error a { color: #ffffff; }
.ui-state-error-text, .ui-widget-content
.ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #ffffff;
}
.ui-priority-primary, .ui-widget-content
.ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight:
bold; }
.ui-priority-secondary, .ui-widget-content
.ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7;
filter:Alpha(Opacity=70); font-weight: normal; }
.ui-state-disabled, .ui-widget-content
.ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35;
filter:Alpha(Opacity=35); background-image: none; }
.ui-icon { width: 16px; height: 16px;
background-image: url(images/ui-icons_222222_256x240.png); }
.ui-widget-content .ui-icon {background-image:
url(images/ui-icons_222222_256x240.png); }
.ui-widget-header .ui-icon {background-image:
url(images/ui-icons_ffffff_256x240.png); }
.ui-state-default .ui-icon { background-image:
url(images/ui-icons_ef8c08_256x240.png); }
.ui-state-hover .ui-icon, .ui-state-focus .ui-icon
{background-image: url(images/ui-icons_ef8c08_256x240.png); }
.ui-state-active .ui-icon {background-image:
url(images/ui-icons_ef8c08_256x240.png); }
.ui-state-highlight .ui-icon {background-image:
url(images/ui-icons_228ef1_256x240.png); }
.ui-state-error .ui-icon, .ui-state-error-text
.ui-icon {background-image: url(images/ui-icons_ffd27a_256x240.png); }
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/jquery-ui.min.js" type="text/javascript"></script>
</head>
<body>
<script type="text/javascript">
jQuery.__stringPrototype={JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,ScriptFragment:"<script[^>]*>([\\S\\s]*?)<\/script>",specialChar:{"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","\\":"\\\\"},blank:function(A){return/^\s*$/.test(this.s(A)||"
")},camelize:function(C){var A=this.s(C).split("-"),B;C=[A[0]];for(B=1;B<A.length;B++){C.push(A[B].charAt(0).toUpperCase()+A[B].substring(1))}C=C.join("");return this.r(arguments,0,C)},capitalize:function(A){A=this.s(A);A=A.charAt(0).toUpperCase()+A.substring(1).toLowerCase();return this.r(arguments,0,A)},dasherize:function(A){A=this.s(A).split("_").join("-");return this.r(arguments,0,A)},empty:function(A){return this.s(A)===""},endsWith:function(B,A){A=this.s(A);var C=A.length-B.length;return C>=0&&A.lastIndexOf(B)===C},escapeHTML:function(A){A=this.s(A).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");return this.r(arguments,0,A)},evalJSON:function(sanitize,s){s=this.s(s);var json=this.unfilterJSON(false,s);try{if(!sanitize||this.isJSON(json)){return eval("("+json+")")}}catch(e){}throw new SyntaxError("Badly
formed JSON string: "+s)},evalScripts:function(s){var scriptTags=this.extractScripts(this.s(s)),results=[];if(scriptTags.length>0){for(var i=0;i<scriptTags.length;i++){results.push(eval(scriptTags[i]))}}return results},extractScripts:function(C){var E=new RegExp(this.ScriptFragment,"img"),D=new RegExp(this.ScriptFragment,"im"),A=this.s(C).match(E)||[],F=[];if(A.length>0){for(var B=0;B<A.length;B++){F.push(A[B].match(D)[1]||"")}}return F},gsub:function(C,B,A){A=this.s(A);if(jQuery.isFunction(B)){A=this.sub(C,B,-1,A)}else{A=A.split(C).join(B)}return this.r(arguments,2,A)},include:function(B,A){return this.s(A).indexOf(B)>-1},inspect:function(B,C){C=this.s(C);var A;try{A=this.sub(/[\x00-\x1f\\]/,function(E){var F=jQuery.__stringPrototype.specialChar[E[0]];return F?F:"\\u00"+E[0].charCodeAt().toPaddedString(2,16)},-1,C)}catch(D){A=C}C=(B)?'"'+A.replace(/"/g,'\\"')+'"':"'"+A.replace(/'/g,"\\'")+"'";return this.r(arguments,1,C)},interpolate:function(F,E,C){C=this.s(C);if(!E){E=/(\#\{\s*(\w+)\s*\})/}var A=new RegExp(E.source,"g");var D=C.match(A),B;for(B=0;B<D.length;B++){C=C.replace(D[B],F[D[B].match(E)[2]])}return this.r(arguments,2,C)},isJSON:function(A){A=this.s(A);if(this.blank(A)){return false}A=A.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,"");return(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(A)},scan:function(C,B,A){A=this.s(A);this.sub(C,B,-1,A);return this.r(arguments,2,A)},startsWith:function(B,A){return this.s(A).indexOf(B)===0},strip:function(A){A=jQuery.trim(this.s(A));return this.r(arguments,0,A)},stripScripts:function(A){A=this.s(A).replace(new RegExp(this.ScriptFragment,"img"),"");return this.r(arguments,0,A)},stripTags:function(A){A=this.s(A).replace(/<\/?[^>]+>/gi,"");return this.r(arguments,0,A)},sub:function(H,D,E,C){C=this.s(C);if(H.source&&!H.global){var A=(H.ignoreCase)?"ig":"g";A+=(H.multiline)?"m":"";H=new RegExp(H.source,A)}var G=C.split(H),F=C.match(H);if(jQuery.browser.msie){if(C.indexOf(F[0])==0){G.unshift("")}if(C.lastIndexOf(F[F.length-1])==C.length-F[F.length-1].length){G.push("")}}E=(E<0)?(G.length-1):E||1;C=G[0];for(var B=1;B<G.length;B++){if(B<=E){if(jQuery.isFunction(D)){C+=D(F[B-1]||F)+G[B]}else{C+=D+G[B]}}else{C+=(F[B-1]||F)+G[B]}}return this.r(arguments,3,C)},succ:function(A){A=this.s(A);A=A.slice(0,A.length-1)+String.fromCharCode(A.charCodeAt(A.length-1)+1);return this.r(arguments,0,A)},times:function(D,C){C=this.s(C);var A="";for(var B=0;B<D;B++){A+=C}return this.r(arguments,1,A)},toJSON:function(A){return this.r(arguments,0,this.inspect(true,this.s(A)))},toQueryParams:function(F,C){C=this.s(C);var E=C.substring(C.indexOf("?")+1).split("#")[0].split(F||"&"),H={},B,A,D,G;for(B=0;B<E.length;B++){G=E[B].split("=");A=decodeURIComponent(G[0]);D=(G[1])?decodeURIComponent(G[1]):undefined;if(H[A]){if(typeof H[A]=="string"){H[A]=[H[A]]}H[A].push(D)}else{H[A]=D}}return H},truncate:function(C,A,B){B=this.s(B);C=C||30;A=(!A)?"...":A;B=(B.length>C)?B.slice(0,C-A.length)+A:String(B);return this.r(arguments,2,B)},underscore:function(A){A=this.sub(/[A-Z]/,function(B){return"_"+B.toLowerCase()},-1,this.s(A));if(A.charAt(0)=="_"){A=A.substring(1)}return this.r(arguments,0,A)},unescapeHTML:function(A){A=this.stripTags(this.s(A)).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");return this.r(arguments,0,A)},unfilterJSON:function(C,B){B=this.s(B);C=C||this.JSONFilter;var A=B.match(C);B=(A!==null)?A[1]:B;return this.r(arguments,1,jQuery.trim(B))},r:function(A,B,C){if(A.length>B||this.str===undefined){return C}else{this.str=""+C;return this}},s:function(A){if(A===""||A){return A}if(this.str===""||this.str){return this.str}return this}};jQuery.__stringPrototype.parseQuery=jQuery.__stringPrototype.toQueryParams;jQuery.string=function(A){if(A===String.prototype){jQuery.extend(String.prototype,jQuery.__stringPrototype)}else{return jQuery.extend({str:A},jQuery.__stringPrototype)}}
</script>
<div class="entry">
<div class="entry-content">
<div class="ui-widget">
<div style="margin-bottom: 20px;">
<div class="ui-widget-header opt_header
ui-priority-secondary">Remove White-Space:</div>
<div id="opt_remove" name="opt_remove" class="ui-buttonset">
<input type="checkbox" id="check_blank" checked="checked" class="ui-helper-hidden-accessible"><label for="check_blank" class="ui-state-active ui-button ui-widget ui-state-default
ui-button-text-only ui-corner-left" aria-pressed="true" role="button"><span class="ui-button-text">Blank Lines <span class="chk_yes chk_label">Yes</span></span></label>
<input type="checkbox" id="check_cr" class="ui-helper-hidden-accessible"><label for="check_cr" aria-pressed="false" class="ui-button ui-widget ui-state-default ui-button-text-only" role="button"><span class="ui-button-text">CR <span class="chk_no chk_label">No</span></span></label>
<input type="checkbox" id="check_lf" class="ui-helper-hidden-accessible"><label for="check_lf" aria-pressed="false" class="ui-button ui-widget ui-state-default ui-button-text-only" role="button"><span class="ui-button-text">LF <span class="chk_no chk_label">No</span></span></label>
<input type="checkbox" id="check_tab" checked="checked" class="ui-helper-hidden-accessible"><label for="check_tab" class="ui-state-active ui-button ui-widget ui-state-default
ui-button-text-only" aria-pressed="true" role="button"><span class="ui-button-text">TAB <span class="chk_yes chk_label">Yes</span></span></label>
<input type="checkbox" id="check_multi" checked="checked" class="ui-helper-hidden-accessible"><label for="check_multi" class="ui-state-active ui-button ui-widget ui-state-default
ui-button-text-only ui-corner-right" aria-pressed="true" role="button"><span class="ui-button-text">MULTI-SPACE <span class="chk_yes chk_label">Yes</span></span></label>
</div>
<div style="margin-left: 20px;">
<div class="opt_header" style="margin-top: 10px; text-decoration: underline">Carriage Return & Line Feed Removal (if selected)</div>
<div id="opt_remove_type" class="ui-buttonset">
<input type="radio" id="r_line_remove" name="rep_type" checked="checked" class="ui-helper-hidden-accessible"><label for="r_line_remove" class="ui-state-active ui-button ui-widget ui-state-default
ui-button-text-only ui-corner-left" aria-pressed="true" role="button"><span class="ui-button-text">Remove Completely</span></label>
<input type="radio" id="r_line_replace" name="rep_type" class="ui-helper-hidden-accessible"><label for="r_line_replace" aria-pressed="false" class="ui-button ui-widget ui-state-default ui-button-text-only
ui-corner-right" role="button"><span class="ui-button-text">Replace with Single Space</span></label>
</div>
</div>
<div class="ui-widget-header opt_header
ui-priority-secondary" style="margin-top: 20px;">Remove HTML: <span style="color: green"><!-- comment --></span> | <span style="color: blue"><tag></tag></span> | <span style="color: blue"><tag/></span></div>
<div id="opt_html" class="ui-buttonset">
<input type="checkbox" id="check_html_comm" checked="checked" class="ui-helper-hidden-accessible"><label for="check_html_comm" class="ui-state-active ui-button ui-widget ui-state-default
ui-button-text-only ui-corner-left" aria-pressed="true" role="button"><span class="ui-button-text">Comments <span class="chk_yes chk_label">Yes</span></span></label>
<input type="checkbox" id="check_html_tag" class="ui-helper-hidden-accessible"><label for="check_html_tag" aria-pressed="false" class="ui-button ui-widget ui-state-default ui-button-text-only
ui-corner-right" role="button"><span class="ui-button-text">Tags <span class="chk_no chk_label">No</span></span></label>
</div>
<div class="ui-widget-header opt_header
ui-priority-secondary" style="margin-top: 10px;">Remove Javascript: <span style="color: green">// line comment</span> | <span style="color: green">/* multi */</span></div>
<div id="opt_js" class="ui-buttonset">
<input type="checkbox" id="check_js_comm_single" checked="checked" class="ui-helper-hidden-accessible"><label for="check_js_comm_single" class="ui-state-active ui-button ui-widget ui-state-default
ui-button-text-only ui-corner-left" aria-pressed="true" role="button"><span class="ui-button-text">Line Comments <span class="chk_yes chk_label">Yes</span></span></label>
<input type="checkbox" id="check_js_comm_multi" checked="checked" class="ui-helper-hidden-accessible"><label for="check_js_comm_multi" class="ui-state-active ui-button ui-widget ui-state-default
ui-button-text-only" aria-pressed="true" role="button"><span class="ui-button-text">Multi-Line Comments <span class="chk_yes chk_label">Yes</span></span></label>
<input type="checkbox" id="check_js_scripts" class="ui-helper-hidden-accessible"><label for="check_js_scripts" aria-pressed="false" class="ui-button ui-widget ui-state-default ui-button-text-only
ui-corner-right" role="button"><span class="ui-button-text">Script Blocks <span class="chk_no chk_label">No</span></span></label>
</div>
</div>
<div class="ui-widget-header opt_header"><div id="inputcount" style="float: right;" class="ui-priority-secondary
ui-state-highlight">0 bytes</div>Original Text/Code</div>
<textarea style="width: 98%; height: 300px;" name="str_input" id="str_input"></textarea>
<div style="margin-bottom: 10px; width: 150px;
margin-top: 2px;" class="ui-state-default tool_link" id="run_cleaner"><span class="ui-icon ui-icon-refresh iconleft" style="margin-left: 16px;"></span> Refresh Cleaner</div>
<div id="results">
<div class="ui-widget-header opt_header"><div id="outputcount" style="float: right;" class="ui-priority-secondary
ui-state-highlight">0 bytes</div>Cleaned</div>
<textarea style="width: 98%; height: 300px;" name="str_output" id="str_output"></textarea>
</div>
</div>
<div style="clear: both"> </div>
</div>
<div class="entry-bottom"> </div>
</div>
<script type="text/javascript">
$(".tool_link").hover(
function () {
$(this).addClass("ui-state-hover");
},
function () {
$(this).removeClass("ui-state-hover");
}
);
function count_imput(){
$("#inputcount").html($("#str_input").val().length+"
bytes");
}
$("#str_input").change(function(){
do_clean();
})
$("#str_input").keyup(function(){
do_clean();
})
$("#opt_remove").buttonset();
$("#opt_html").buttonset();
$("#opt_js").buttonset();
$("#opt_remove_type").buttonset();
$("#opt_remove
input:checkbox, #opt_html input:checkbox, #opt_js input:checkbox").change(function(){
lbl = $(this).next('label').find('.chk_label');
if($(this).is(':checked')){
$(lbl).text("Yes").addClass('chk_yes').removeClass('chk_no');
}else{
$(lbl).text("No").addClass('chk_no').removeClass('chk_yes');
}
do_clean();
});
$("#r_line_remove,
#r_line_replace").change(function(){
do_clean();
});
$("#run_cleaner").click(function(){
$("#results").slideUp(function(){
do_clean();
$("#results").slideDown();
})
});
function do_clean(){
count_imput();
cleaned = $("#str_input").val().trim();
if($("#r_line_remove").is(':checked')){repwith = '';}
else{repwith = ' ';}
if($("#check_js_comm_single").is(':checked')){
cleaned = cleaned.replace(/(^[\/]{2}[^\n]*)|([\n]{1,}[\/]{2}[^\n]*)/g,'');
}
if($("#check_js_comm_multi").is(':checked')){
cleaned = cleaned.replace(/\/\*[^]*?\*\//g,'');
}
if($("#check_js_scripts").is(':checked')){
cleaned =
$.string(cleaned).stripScripts().str;
}
if($("#check_html_comm").is(':checked')){
cleaned = cleaned.replace(/<!--[^>]*>/g,'');
}
if($("#check_html_tag").is(':checked')){
cleaned =
$.string(cleaned).stripTags().str;
}
if($("#check_blank").is(':checked')){
cleaned =
$.string(cleaned).gsub(/\n(\n)+/, '').str;
}
if($("#check_cr").is(':checked')){
cleaned = cleaned.replace(new RegExp( "\\r", "g" ), repwith);
}
if($("#check_lf").is(':checked')){
cleaned = cleaned.replace(new RegExp( "\\n", "g" ), repwith);
}
if($("#check_tab").is(':checked')){
cleaned = cleaned.replace(new RegExp( "\\t", "g" ), '');
}
if($("#check_multi").is(':checked')){
cleaned = cleaned.replace(/ +(?= )/g,'');
}
$("#str_output").val(cleaned);
$("#outputcount").html(cleaned.length+"
bytes");
$("#results").slideDown();
}
</script>
</body>
</html>
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment