How to do it?

Off-topic posts of interest to the "Everything" community.
Post Reply
salazor
Posts: 258
Joined: Tue Jun 17, 2014 10:52 am

How to do it?

Post by salazor »

.
.
*** NSFW ****



I need to use a user script to replace one link to another

https://www.thenude.eu/index.php?page=t ... odel_pages - to: http://www.amkingdom.com/model/photo/

For now i got: http://www.amkingdom.com/model/photo/ang127&class=model - but how to remove "&class=model_pages" on the end

Code: Select all

// ==UserScript==
// @name         ATKGALLERIA_1
// @namespace    http://www.thenude.eu/
// @version      1.0
// @description  try to take over the world!
// @author       You
// @match        www.thenude.eu/*
// @include      www.thenude.eu/*
// @exclude      
// @grant        none
// ==/UserScript==

var links,thisLink;
links = document.evaluate("//a[@href]",
    document,
    null,
    XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
    null);
for (var i=0;i<links.snapshotLength;i++) {
    var thisLink = links.snapshotItem(i);

    thisLink.href = thisLink.href.replace('https://www.thenude.eu/index.php?page=tnap&action=outgoingLink&out_url=http%3A%2F%2Frefer.ccbill.com%2Fcgi-bin%2Fclicks.cgi%3FCA%3D903646-0000%26PA%3D672208%26HTML%3Dhttp%3A%2F%2Fwww.amkingdom.com%2Ftour%2Fmodel%2F',
                                          'http://www.amkingdom.com/model/photo/');
}
I hope this does not violate the rules
therube
Posts: 4977
Joined: Thu Sep 03, 2009 6:48 pm

Re: How to do it?

Post by therube »

Bookmarklet: remove redirects

So maybe you can work that code into your code.

Code: Select all

javascript:(function(){var%20k,x,t,i,j,p;%20for(k=0;x=document.links[k];k++){t=x.href.replace(/[%]3A/ig,':').replace(/[%]2f/ig,'/');i=t.lastIndexOf('http');if(i>0){%20t=t.substring(i);%20j=t.indexOf('&');%20if(j>0)t=t.substring(0,j);%20p=/https?\:\/\/[^\s]*[^.,;'">\s\)\]]/.exec(unescape(t));%20if(p)%20x.href=p[0];%20}%20else%20if%20(x.onmouseover&&x.onmouseout){x.onmouseover();%20if%20(window.status%20&&%20window.status.indexOf('://')!=-1)x.href=window.status;%20x.onmouseout();%20}%20x.onmouseover=null;%20x.onmouseout=null;%20}})();
salazor
Posts: 258
Joined: Tue Jun 17, 2014 10:52 am

Re: How to do it?

Post by salazor »

Theoretically, it works, but after the page changes, you need to re-run the script - needs something else.
Post Reply