Skip to content

Instantly share code, notes, and snippets.

@lukeholder
Forked from anonymous/anonymous.js
Last active December 16, 2015 07:49
Show Gist options
  • Select an option

  • Save lukeholder/5401734 to your computer and use it in GitHub Desktop.

Select an option

Save lukeholder/5401734 to your computer and use it in GitHub Desktop.

Revisions

  1. lukeholder revised this gist Apr 17, 2013. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion anonymous.js
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,7 @@

    //This script redirects all the links via blankrefer.com - except for the sites that were included in the protected_links string
    //Example:
    //var protected_links = "myspace,ebay";
    var protected_links = "";
    var a_to_va = 0;
    var a_to_vb = 0;
    @@ -65,4 +69,5 @@ function a_to_fa()
    protected_links = protected_links.replace(" ", "");
    a_to_vf = protected_links.split(",");
    return a_to_vf;
    }
    }
    blank_refer();
  2. @invalid-email-address Anonymous created this gist Apr 17, 2013.
    68 changes: 68 additions & 0 deletions anonymous.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,68 @@
    var protected_links = "";
    var a_to_va = 0;
    var a_to_vb = 0;
    var a_to_vc = "";
    function blank_refer()
    {
    blankrefer();
    }
    function blankrefer()
    {
    var a_to_vd = window.location.hostname;
    if(protected_links != "" && !protected_links.match(a_to_vd))
    {
    protected_links += ", " + a_to_vd;
    }
    else if(protected_links == "")
    {
    protected_links = a_to_vd;
    }
    var a_to_ve = "";
    var a_to_vf = new Array();
    var a_to_vg = 0;
    a_to_ve = document.getElementsByTagName("a");
    a_to_va = a_to_ve.length;
    a_to_vf = a_to_fa();
    a_to_vg = a_to_vf.length;
    var a_to_vh = false;
    var j = 0;
    var a_to_vi = "";
    for(var i = 0; i < a_to_va; i++)
    {
    a_to_vh = false;
    j = 0;
    while(a_to_vh == false && j < a_to_vg)
    {
    a_to_vi = a_to_ve[i].href;
    if(a_to_vi.match(a_to_vf[j]) || !a_to_vi || !a_to_vi.match("http://"))
    {
    a_to_vh = true;
    }
    j++;
    }

    if(a_to_vh == false)
    {
    a_to_ve[i].href = "http://blankrefer.com/?" + a_to_vi;
    a_to_vb++;
    a_to_vc += i + ":::" + a_to_ve[i].href + "\n" ;
    }
    }
    var a_to_vj = document.getElementById("anonyminized");
    var a_to_vk = document.getElementById("found_links");
    if(a_to_vj)
    {
    a_to_vj.innerHTML += a_to_vb;
    }
    if(a_to_vk)
    {
    a_to_vk.innerHTML += a_to_va;
    }
    }
    function a_to_fa()
    {
    var a_to_vf = new Array();
    protected_links = protected_links.replace(" ", "");
    a_to_vf = protected_links.split(",");
    return a_to_vf;
    }