github.com/insionng/yougam@v0.0.0-20170714101924-2bc18d833463/public/libs/abplayer/js/ABPLibxml.js (about) 1 /*********************** 2 * XMLParser 3 * == Licensed Under the MIT License : /LICENSING 4 * Copyright (c) 2012 Jim Chen ( CQZ, Jabbany ) 5 ************************/ 6 function CommentLoader(url,xcm,callback){ 7 if(callback == null) 8 callback = function(){return;}; 9 var xmlhttp = null; 10 if (window.XMLHttpRequest){ 11 xmlhttp=new XMLHttpRequest(); 12 } 13 else{ 14 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 15 } 16 xmlhttp.open("GET",url,true); 17 xmlhttp.send(); 18 var cm = xcm; 19 xmlhttp.onreadystatechange = function(){ 20 if (xmlhttp.readyState==4 && xmlhttp.status==200){ 21 if(navigator.appName == 'Microsoft Internet Explorer'){ 22 var f = new ActiveXObject("Microsoft.XMLDOM"); 23 f.async = false; 24 f.loadXML(xmlhttp.responseText); 25 cm.load(BilibiliParser(f)); 26 callback(); 27 }else{ 28 cm.load(BilibiliParser(xmlhttp.responseXML)); 29 callback(); 30 } 31 } 32 } 33 } 34 function createCORSRequest(method, url){ 35 var xhr = new XMLHttpRequest(); 36 if ("withCredentials" in xhr){ 37 xhr.open(method, url, true); 38 } else if (typeof XDomainRequest != "undefined"){ 39 xhr = new XDomainRequest(); 40 xhr.open(method, url); 41 } else { 42 xhr = null; 43 } 44 return xhr; 45 }