vForums Support > Programming & Coding :: Code Requests & Support :: > [F] Pop up box code help

[F] Pop up box code help - Posted By Nick (nickb) on 28th Dec 07 at 6:02am
Code:
 
  1. <script language="JavaScript">
  2.  
  3. if(location.href.match(/action=post$/gi))
  4. {
  5. var a = window.prompt("What is your board URL?","http://");
  6.  
  7. if (a != 'http://') {
  8. if (a.indexOf('http://http://') != -1){
  9. a = 'ht'+ a.split('//ht')[1];
  10. }
  11. document.postForm.message.value+="Board URL: "+a+"nnProblem:nn";
  12. }
  13. }
  14.  
  15. </script>
  16.  
 


I made this code (Though I do not know how I did it, just followed a few steps.), it kinda works though it will not put the link into the post, and I want to put .virtualforums.co.uk in the non-url area, so you can only put your forums link, instead of putting http://Forums_link.virtualforums.co.uk.

Thanks,
Darkmage

Re: Pop up box code help - Posted By Michael (wrighty) on 29th Dec 07 at 11:35pm
to do that I would suggest some form of post request form... instead of a prompt...

What you could do I guess is check if it contains .virtualforums.co.uk

and if it doesn't add it... and if it does then don't add it.

(should be in code support! {Wink} )

Re: Pop up box code help - Posted By Nick (nickb) on 30th Dec 07 at 12:57am
I guess I can fix up Ross' Posting form, but I was thinking of having it, just like PBS form.

Re: Pop up box code help - Posted By Michael (wrighty) on 30th Dec 07 at 1:00am
PBS' is a form isn't it? It isn't a prompt box..

You can use a prompt box no problem...it's just the code to do it would be stupidly long when you could just code a post modification box...

I'm happy to help ya! {Smile}

Re: Pop up box code help - Posted By Nick (nickb) on 30th Dec 07 at 1:06am
I know PBS has a form, Awhile ago it used to be Prompt box, but all well. I guess no Biggie, thanks.

Re: Pop up box code help - Posted By Michael (wrighty) on 30th Dec 07 at 1:10am
Gimme 10 mins and I'll make you a prompt box one that automatically checks if it has virtual forums in it! {Smile}

Re: Pop up box code help - Posted By Michael (wrighty) on 30th Dec 07 at 1:20am
Code:
 
  1. <script>
  2. //Darkmage's Request
  3. //Created By Wrighty
  4.  
  5. function prompt_do(){
  6. var a = window.prompt("What is your board URL?","http://");
  7. url = '';
  8. if(a=="http://"||a==''){
  9. url='[i]Not Entered[/i]';
  10. }else if(!a.match(/.virtualforums.co.uk/i) && !a.match(/http:\/\//i)){
  11. url='http://'+a+'.viritualforums.co.uk';
  12. }else if(!a.match(/.virtualforums.co.uk/i)){
  13. url=a+'.viritualforums.co.uk';
  14. }
  15. document.post_form.message.value="Board URL: "+url+"\n\nProblem:\n\n";
  16. }
  17.  
  18. if(location.href.match(/\/post\//i) && !location.href.match(/\/topic\//i)){
  19. prompt_do();
  20. check_message_length();
  21. }
  22. </script>
  23.  
 


should do it! {Smile}


Even threw in a lil' special something for ya! {Smile}

Re: Pop up box code help - Posted By Nick (nickb) on 30th Dec 07 at 1:36am
ok thanks ^_^


Re: Pop up box code help - Posted By Michael (wrighty) on 30th Dec 07 at 1:37am
No worries! {Cheesy}

(it updates the characters left automatically! {Cheesy} )

Re: Pop up box code help - Posted By Nick (nickb) on 30th Dec 07 at 1:42am
it dont work: {Sad} Just click on new thread
http://magedesigns.virtualforums.co.uk/board/Support/

The box comes up I put in ffnation, then I click ok, and the link does not get added to the posting field.

Edit: on your forum why do you have "DarkMage's requests?" and BTW I don't capitalize my M on mage, So I keep it Darkmage.

Re: Pop up box code help - Posted By Michael (wrighty) on 30th Dec 07 at 1:44am
guest can't make a post..

put it in the footer... as I'm guessing you put it in the header? {Smile}

Re: Pop up box code help - Posted By Nick (nickb) on 30th Dec 07 at 1:46am
^_^ yes I did put it in the header. and guests should be able to post.
it works now, and I made guests enabled.

Re: Pop up box code help - Posted By Michael (wrighty) on 30th Dec 07 at 1:48am
so they can! {Cheesy}