User:Firefly/checkuseragenthelper.js

$( function($) {	if (mw.config.get("wgPageName") == "Special:CheckUser")	{	   $(".mw-checkuser-agent").each(function{ var el = $(this); var ua = el.text; $.ajax({	           type: "GET",	            url: "https://www.whatsmyua.info/api/v1/ua?ua="+encodeURIComponent(ua),	            success: function(d) { 	                var tooltip = "";	                try{	                    tooltip = d[3]["device"]["description"];	                }	                catch (e){	                    console.log("Unable to get friendly name from API for ( " + ua + " ), falling back to components.");	                }

try{ tooltip += d[0]['ua']['family']; tooltip += " "; tooltip += d[0]['ua']['major']; tooltip += " "; tooltip += d[0]['ua']['minor']; tooltip += " "; tooltip += d[0]['ua']['patch']; tooltip += " "; tooltip += d[0]['os']['family']; tooltip += " "; tooltip += d[0]['os']['major']; tooltip += " "; tooltip += d[0]['os']['minor']; tooltip += " "; tooltip += d[0]['os']['patch']; } catch (e) {	                   console.log("Unable to get anything from API for ( " +ua+" )."); }	               tooltip = el.attr("title", tooltip); }	       });	    });	} });