1jQuery (function() { 2 var selector = 'a.urlextern'; 3 if(typeof JSINFO !== 'undefined' && 'linkcheck_selector' in JSINFO && JSINFO['linkcheck_selector']){ 4 selector=JSINFO['linkcheck_selector']; 5 } 6 jQuery(selector).each (function( index ) { 7 var lnk = jQuery( this ); 8 var url = jQuery( this ).attr('href'); 9 var dbg=0; 10 11 if(!url || !url.match(/^https?:\/\//)&&!url.match(/^\/\//)){ 12 //if(dbg) console.log('Skipping '+url+' because it does not appear to be an external http(s) url.'); 13 return; 14 } 15 if(typeof LINKCHECKDATA !== 'undefined' && url in LINKCHECKDATA) { 16 if(dbg) console.log('Found in LINKCHECKDATA: '+url+' -> '+LINKCHECKDATA[url]); 17 lnk.removeClass('urlextern').addClass("linkcheck_"+LINKCHECKDATA[url]); 18 return; 19 } 20 21 if(!lnk.hasClass('linkcheck')){ 22 if(dbg){ 23 if(lnk.attr('class') && lnk.attr('class').match(/linkcheck_/)) console.log('Skipping '+url+' because it has a static class'); 24 else console.log('Skipping '+url+' because it has no linkcheck class. linkcheck plugin may be off globally or turned of for this page with {{linkcheck>off}}.'); 25 } 26 return; 27 } 28 29 var request = jQuery.ajax({ 30 url: DOKU_BASE + 'lib/exe/ajax.php', 31 type: 'POST', 32 data: { 33 call: 'linkcheck', 34 url: url 35 }, 36 dataType: "json" 37 }); 38 39 jQuery.when(request).done(function(data,status) { 40 if(dbg) console.log('Got ajax codegroup for '+url+' -> '+data['codegroup']); 41 lnk.removeClass('urlextern').addClass("linkcheck_"+data['codegroup']); 42 if(data['msg']!='') 43 lnk.attr('title',lnk.attr('title')+': '+data['msg']); 44 }); 45}); });