Coffeenole
Members
Offline
Posts: 33
|
 |
« on: December 02, 2007, 07:58:51 pm » |
|
This is the first code modification that I've attempted...this is the URL prompt code that Agent Moose wrote, which I modified slightly to include image prompts and e-mail prompts. (For lack of a better name, I called it "Agent Moose's Coffee Time Supercode".) This is working well on my forum, so I thought I'd share, if it's OK with Moosie... <!--Agent Moose's Coffee Time Supercode--> <script> $("img[alt='Insert Hyperlink']").parent("a").attr("href","java"+"script:Hyper();"); $("img[alt='Insert Hyperlink']").parent("a").attr("onclick",""); function Hyper(){ //Created by Agent Moose with slight modifications by Coffeenole (smcodes.smfforfree3.com) var hyperlink = prompt("Enter URL for Link:","http://"); if(!hyperlink){ alert("You must enter a URL for your Link!"); return; }; var hypername = prompt("Enter Link Name:",""); if(!hypername){ alert("You must enter a Name for your URL!"); return; }; document.postmodify.message.value += "\[url="+hyperlink+"\]"+hypername+"\[/url\]";} $("img[alt='Insert Image']").parent("a").attr("href","java"+"script:image();"); $("img[alt='Insert Image']").parent("a").attr("onclick",""); function image(){ var image = prompt("Enter URL for Image:","http://"); if(!image){ alert("You must enter a URL for your Image!"); return; }; document.postmodify.message.value += "\[img\]"+image+"\[/img\]";} $("img[alt='Insert Email']").parent("a").attr("href","java"+"script:email();"); $("img[alt='Insert Email']").parent("a").attr("onclick",""); function email(){ var email = prompt("Enter the E-Mail address:",""); if(!email){ alert("You must enter a vaild E-mail address!"); return; }; document.postmodify.message.value += "\[email\]"+email+"\[/email\]";} </script> Moose, if there is any way to make this better, it won't hurt my feelings...I'm not very well-versed in coding, but this does provide a couple of decent functions.
|
|
|
|
« Last Edit: December 02, 2007, 09:53:02 pm by Agent Moose »
|
Report Spam
Logged
|
|
|
|
Agent Moose
Administrator
Offline
Gender: 
Posts: 2,664
|
 |
« Reply #1 on: December 02, 2007, 09:54:05 pm » |
|
Very nice. I was accually going to add more to it soon, but now I don't have to  Great job.
|
|
|
|
|
|
Sassy Pants
Members
Offline
Gender: 
Posts: 42
|
 |
« Reply #2 on: December 02, 2007, 10:54:40 pm » |
|
Sorry, I dont quite understand what this code does
|
|
|
|
|
Agent Moose
Administrator
Offline
Gender: 
Posts: 2,664
|
 |
« Reply #3 on: December 02, 2007, 10:58:32 pm » |
|
If you have this code on, when you click on the URL/Email/Image BBCode Button, a box will pop up asking for a URL/Email
|
|
|
|
|
|
Agent Moose
Administrator
Offline
Gender: 
Posts: 2,664
|
 |
« Reply #5 on: December 02, 2007, 11:01:57 pm » |
|
Glad you like his code 
|
|
|
|
Celebrus
Artificially Conscious
Administrator
Offline
Gender: 
Posts: leet
aka Omikron
|
 |
« Reply #6 on: December 17, 2007, 07:52:09 am » |
|
This is the first code modification that I've attempted...this is the URL prompt code that Agent Moose wrote, which I modified slightly to include image prompts and e-mail prompts. (For lack of a better name, I called it "Agent Moose's Coffee Time Supercode".) This is working well on my forum, so I thought I'd share, if it's OK with Moosie... <!--Agent Moose's Coffee Time Supercode--> <script> $("img[alt='Insert Hyperlink']").parent("a").attr("href","java"+"script:Hyper();"); $("img[alt='Insert Hyperlink']").parent("a").attr("onclick",""); function Hyper(){ //Created by Agent Moose with slight modifications by Coffeenole (smcodes.smfforfree3.com) var hyperlink = prompt("Enter URL for Link:","http://"); if(!hyperlink){ alert("You must enter a URL for your Link!"); return; }; var hypername = prompt("Enter Link Name:",""); if(!hypername){ alert("You must enter a Name for your URL!"); return; }; document.postmodify.message.value += "\[url="+hyperlink+"\]"+hypername+"\[/url\]";} $("img[alt='Insert Image']").parent("a").attr("href","java"+"script:image();"); $("img[alt='Insert Image']").parent("a").attr("onclick",""); function image(){ var image = prompt("Enter URL for Image:","http://"); if(!image){ alert("You must enter a URL for your Image!"); return; }; document.postmodify.message.value += "\[img\]"+image+"\[/img\]";} $("img[alt='Insert Email']").parent("a").attr("href","java"+"script:email();"); $("img[alt='Insert Email']").parent("a").attr("onclick",""); function email(){ var email = prompt("Enter the E-Mail address:",""); if(!email){ alert("You must enter a vaild E-mail address!"); return; }; document.postmodify.message.value += "\[email\]"+email+"\[/email\]";} </script> Moose, if there is any way to make this better, it won't hurt my feelings...I'm not very well-versed in coding, but this does provide a couple of decent functions. Did you know that my first ever attempt at coding was trying to add the Chronicles stylesheet to Agent's Skin Chooser code. It never worked, though. I just switched to the All Skin Chooser then.
|
|
|
|
Agent Moose Jr.
Ultra Contagious
Global Moderator
Offline
Gender: 
Posts: 1,044
|
 |
« Reply #7 on: January 02, 2008, 11:47:31 am » |
|
nice code
|
Newest: 
|
|
|
|