|
|
|
|
![]() ![]() |
Dec 6 2006, 04:45 PM
Post
#1
|
|
|
Member [Level 2] ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 89 Joined: 26-August 06 Member No.: 28,938 |
Ok, to start, the purpose of the script. I'm trying to make a script that puts a link on every page on an Invisionfree forum (IPB 1.3) that takes you to a thread and automatically put in the url from which you clicked. I already have the whole thing working, but when I go to edit my signature, it inputs most of the url into the box. It replaces my whole sig with that, so it's a big problem.
The code: CODE This part makes the link on every page. <script LANGUAGE="JavaScript"> <!-- document.write('<A HREF="http://z14.invisionfree.com/worknplay/index.php?act=Post&CODE=02&f=25&t=31&Post=' + location.href +'">'); document.write('Report Topic'); document.write('</A>'); // --> </SCRIPT> CODE This part inputs the url variable into the post box. <FORM NAME="Post"> <INPUT TYPE="hidden" NAME="Posturl"> </FORM> <script LANGUAGE="javascript"> var locate = window.location document.Post.Posturl.value = locate var text = document.Post.Posturl.value function delineate(str) { theleft = str.indexOf("Post=") + 5; theright = str.lastIndexOf("&"); return(str.substring(theleft, theright)); } function delineat(str) { theleft = str.indexOf("showtopic=") + 10; theright = str.lastIndexOf("&"); return(str.substring(theleft, theright)); } if(delineat(text) == "31") { eval('document.REPLIER.Post.value = delineate(text)'); } </SCRIPT> So the idea is to report a thread if it is spam. It brings you to a thread made for reporting them and automatically puts the URL of the bad thread in. As I said, when the "Post" variable is passed in the url, it works fine for it's purpose. However, if there is no Post variable in the url it reports everything after http (IE ://z14.invisionfree.com/worknplay/index.php?act=Post&CODE=02&f=26) I just realised it did that to every post, and not just the signature. The thread I would like it to report into is "http://z14.invisionfree.com/worknplay/index.php?act=Post&CODE=02&f=26&t=7", how would I get that if... loop to work to only make it put in the text in that certain thread? I'm new to Javascript, so I'm not sure how to use if statements with a str. =\ EDIT: Mmk, I got it to where it would only put it in one url, but that url just so happens to change for every topic. So what I need is some sort of wildcard after "http://z14.invisionfree.com/worknplay/index.php?showtopic=31&st=0&#last" So it will enter the URL only on that thread. Second edit: All right, I got it completely figured out. If anyone wants the code for whatever reason, feel free to PM me... This post has been edited by Sharn: Dec 7 2006, 01:56 AM |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 22nd November 2008 - 02:58 AM |