标签:style class blog code tar ext
$_format = function (source, params) { if (arguments.length == 1) return function () { var args = $.makeArray(arguments); args.unshift(source); return $.validator.format.apply(this, args); }; if (arguments.length > 2 && params.constructor != Array) { params = $.makeArray(arguments).slice(1); } if (params.constructor != Array) { params = [params]; } $.each(params, function (i, n) { source = source.replace(new RegExp("\\{" + i + "\\}", "g"), isNull(n) ? ‘‘ : n); }); return source; };
//获取URL参数 function GetQueryString(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); var r = window.location.search.substr(1).match(reg); if (r != null) return r[2]; return null; }
function FilterPasteText(str) { if (!str) { return ‘‘; } //str = str.replace(/[\n\r]/ig, ""); //remove html body form str = str.replace(/<\/?(html|body|form)(?=[\s\/>])[^>]*>/ig, ""); //remove doctype str = str.replace(/<(!DOCTYPE)([^<>])*?>/ig, ""); //remove xml tags str = str.replace(/<(\/?(\?xml(:\w+)?|xml|\w+:\w+)(?=[\s\/>]))[^>]*>/gi, ""); //remove head str = str.replace(/<head[^>]*>[\s\S]*?<\/head>/ig, ""); //remove <xxx /> str = str.replace(/<(script|style|link|title|meta|textarea|option|select|iframe|hr)[\s\S]*?\/>/ig, ""); //remove empty span str = str.replace(/<span[^>]*?><\/span>/ig, ""); //remove <xxx>...</xxx> str = str.replace(/<(head|script|style|textarea|button|select|option|iframe)[^>]*?>[\s\S]*?<\/\1>/ig, ""); str = str.replace(/<(head|script|style|textarea|button|select|option|iframe)[^>]*?>/ig, ""); //remove table and <a> tag, <img> tag,<input> tag (this can help filter unclosed tag) str = str.replace(/<\/?(a|table|tr|td|tbody|thead|th|img|input|iframe|div)[^>]*>/ig, ""); //remove bad attributes do { len = str.length; str = str.replace(/(<[a-z][^>]*\s)(?:id|name|language|type|class|on\w+|\w+:\w+)=(?:"[^"]*"|\w+)\s?/gi, "$1"); str = str.replace(/[<>]/gi, ""); } while (len != str.length); return str; }
标签:style class blog code tar ext
原文地址:http://www.cnblogs.com/wzq806341010/p/3786150.html