Link to Printer IPs

Link to Printer IPs.

  1. // ==UserScript==
  2. // @name Link to Printer IPs
  3. // @namespace thewildsun
  4. // @version 0.1
  5. // @description Link to Printer IPs.
  6. // @author thewildsun
  7. // @match http://printers.bah.com/
  8. // @grant none
  9. // @require https://code.jquery.com/jquery-3.3.1.min.js
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. var reg = /\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/;
  16. $('a').each(function(){
  17. var titlestr = $(this).attr('title');
  18. //console.log($(this).text().trim());
  19. if (titlestr && $(this).text().trim().length > 0) {
  20. var m = titlestr.match(reg);
  21. if (m) {
  22. $('<a>', {'href':'http://'+m[0], 'target':'_blank', 'class':'iplink', html:m[0]}).insertBefore($(this));
  23. }
  24. }
  25. });
  26. })();