JSFiddle - React, Tailwind, and code Playground

by 1337

HTML

<script src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
<div class="favicons">
<a href="http://www.gomoneyways.com/?p=50387" class="external" rel="nofollow" target="_blank">gomoneyways.com</a>
</div>

JavaScript

function addJavascript(jsname,pos) {
             var th =             document.getElementsByTagName(pos)[0];
             var s = document.createElement('script');
             s.setAttribute('type','text/javascript');
             s.setAttribute('src',jsname);
             th.appendChild(s);
             }           
$(document).ready(function()  {     
    var s = document.createElement("script");     
    s.type = "text/javascript";     
    s.src = "http://code.jquery.com/jquery-1.8.3.min.js";    
    $("head").append(s); 
});

addJavascript('http://code.jquery.com/jquery-1.8.3.min.js','head');           
    
jQuery(function ($) {
    
function favicognize($elink) {

    $elink.before($("<img>").attr({
      "src": "https://getfavicon.appspot.com/" + $elink.attr("href") + "?defaulticon=bluepng",
      "width": "16px"
    }).css("vertical-align", "text-bottom")).before(" ");

// $elink.prev("img").attr("width", "16px");

    if ($elink.attr("href") == $elink.text())
    $elink.text(get_hostname($elink.attr("href")).replace("http://", "").replace("https://", "").replace("www\.", ""));

    $elink.css("background-image", "none").css("padding", "0px");

    return;

  }

  var nonfavicognize = "[href*=webcitation]";

  if ($("div.favicognize").length) {

    $("div#bodyContent a.external").not(nonfavicognize).each(function() {

      favicognize($(this));

    });

  } else {

    $("div.favicons a.external").not(nonfavicognize).each(function() {

      favicognize($(this));

    });

  }

});