NEWS1/NFC link fixer

in Script development
Subscribe to NEWS1/NFC link fixer 17 posts, 4 voices

Post doesn't exist



simon! Scriptwright

from: http://www.news1.co.il/BringHtmlDoc.aspx?docid=174754&subjectid=1
I'll, eventually, get to: http://www.news1.co.il/Archive/001-D-174754-00.html

from:http://www.news1.co.il/BringHtmlDoc.aspx?docid=22024&subjectId=3
I'll, eventually, get to: http://www.news1.co.il/Archive/003-D-22024-00.html

how to change BringHtmlDoc.aspx?docid=22024&subjectId=3 to Archive/003-D-22024-00.html?

any suggestions...

see also: ?.jpg

 
VIPPER Scriptwright

I'm not sure why you need that, since its automatic...

l = document.location;
n1 = l.match(/[0-9]+[0-9]/);
n2 = l.match(/[0-9]*$/);
document.location.replace("http://www.news1.co.il/Archive/00" + n2[0] + "-D-" + n1[0] + "-00.html");

 
simon! Scriptwright
It's not working for me. maybe I'm doing something wrong?
the link is in this page

from:
http://www.news1.co.il/BringHtmlDoc.aspx?docid=22024&subjectId=3

to:
http://www.news1.co.il/Archive/003-D-22024-00.html

Free Image Hosting at www.ImageShack.us

and about your query: because this is a very heavy and leaking site (this is the only Jewish/Hebraic NON-Fascist site in Israel -- bad luck)
 
Aquilax Scriptwright


if (location.search.match(/docid=(\d+)&subjectId=(\d+)/mi)) location.replace("http://www.news1.co.il/Archive/00"+RegExp.$2+"-D-"+RegExp.$1+"-00.html");

Edit: Yes I had forgot to close a parenthesis, thanks, I write them on the fly without testing them, but the script should work now.

 
simon! Scriptwright

not working :(

btw, if ( ( ( ) ( ) ) ( ) -- seem like you forgot to close something...

 
simon! Scriptwright

still, not working...

I need a script to do the mentioned above on the links on a page

@Aquilax: your script is affecting this page, btw.

 
VIPPER Scriptwright

on the links on a page

links = document.getElementsByTagName("a");
for(i = 0; i < links.length; i++) {
	ref = links[i].href;
	n1 = ref.match(/[0-9]+[0-9]/);
	n2 = ref.match(/[0-9]*$/);
	if(n1 && n2 && ref.match("BringHtmlDoc")) ref = "http://www.news1.co.il/Archive/00" + n2[0] + "-D-" + n1[0] + "-00.html";
	links[i].href = ref;
}

 
JoeSimmons Scriptwright

Yeah. The redirecting is automatic already....
but here's a script to change the links to the direct page so you can avoid that redirection.
http://userscripts.org/scripts/show/34717

 
simon! Scriptwright

I'm sooooooooo HAPPY ^_^

 
simon! Scriptwright
JoeSimmons is more specific as it is working only on News1.co.il

VIPPER can also work on Us.o, for instance...

thank you very much guys ;)
 
JoeSimmons Scriptwright

Just change the included pages; my script will work on any page.
It just looks for links with BringHtmlDoc.aspx?docid= in them and changes them.

 
simon! Scriptwright

It is not working at this current page (where I'm write on right now). It works at this page though
edit: this page: http://userscripts.org/scripts/show/34726) -- wtf is wrong with the < a > tag?!!

It is not working at this page (joenotworkingdn6.png).

See the main page -- not working on all the links, for some reason (see this snapshot).

And last but not least, maybe there is a conflict with one or more other script of mine? (I already disabled the other 2 NEWS1 scripts).

 
JoeSimmons Scriptwright

Nothing is wrong with the a tag, you have to put href="linkhere" in.

<a href="LINK HERE">LINK TEXT HERE</a>

 
simon! Scriptwright

Whoops! I did <a herf="http://userscripts.org/scripts/show/34726">this page</a>

[edit:] So what about your script (is it only me or the script itself?)?

 
JoeSimmons Scriptwright

Oh it's because some links have DocId and the script is looking for docid (case sensitive)
Try the script now - http://userscripts.org/scripts/show/34717

 
simon! Scriptwright

works :D

 
JoeSimmons Scriptwright

Cool. Glad to help.

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel