function Geturlarray (e, type) { var urls = $.trim ($ ("#report_url_list"). Val ()); URLs = Urls.replace (/s*n+s*/ig, "n"); $ ("#report_url_list"). Val (URLs); Format the URL if (type = = "Blur") { Reporturlelm.val (URLs); } if (e && e.keycode = 13) { Reporturlelm.val (URLs + "n"); }
URLs = Urls.split ("n"); User_urls = URLs; return URLs; } function Checkurls (e, type) { $ ("#errorList"). Find ("span"). Hide (); URLs = Geturlarray (e, type); var urlfag = true; Url_index = 0; var urltext= "Please fill in the report site, you can report multiple URLs, one per line, no more than 20." "; if (!urls[0] | | | urls[0] = = Urltext) { $ ("#report_url_list"). Val (urltext). CSS ("Color", "#757575"); $ ("#report_url_list"). Next (' P '). HTML (' * Please enter the correct URL '); $.urlfag=false; return false; } if (Urls.length > 20) { $ ("#report_url_list"). Next (' P '). HTML ("Over 20, please report in batches") $.urlfag=false; return false; } $.urlfag=true; for (url_index=0;url_index<urls.length;url_index++) { $.urlfag = Checkeachurl (URLs, url_index) && $.urlfag; } return URLFAG; } function Checkeachurl (URLs, index) { var e=urls[index]; A = E.replace (/^http:///, "");
if (A.indexof ("/")!=-1) { A = a.substring (0, A.indexof ("/")); } var RG =/^ (https?| Ftp|news)://)? ([w-]+.) +(.) + (:d +)? (/[w-./?%&=]*) $/i; if (!rg.test (a)) { Urlerror ("Malformed", index,-1); return false; } if (Inurlarray (Urls,index)) { Urlerror ("Please do not report the same website", index,-1); return false; } $.ajax ({ Async:false, URL: "http://api.pc.qq.com/tapi/url_report.php?url=http://" +a, DataType: "Jsonp", Method: ' Get ', Success:function (a) { if (a.is_existed== "yes") { Urlerror ("The site has been reported", index,-1); $.urlfag= false; } } }); Urlerror ("normal", index,0); return true; } function Inurlarray (urls,index) { var r=false for (i=index+1;i<urls.length;i++) { A = Urls[index].replace (/^http (s?):/ //, ""); b = Urls[i].replace (/^http (s?):/ //, ""); if (a==b) R=true; } return R; } function Urlerror (msg,index,type) { type=type| | 0; var test = $ ("#errorList div"). Find ("span"). EQ (index); Test.show (); if (type<0) { Test.attr (' title ', msg). CSS ("background-position", " -20px 0px"); }else{ Test.attr (' title ', msg). CSS ("background-position", "0px 0px"); } } |