Simple Machine Codes
July 30, 2010, 01:50:03 am
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Welcome to SMC, the best place for your SMF For Free Codes
 
  Home Help Search Arcade Affiliates Code Index Staff List Calendar Members Login Register  

Combination image-url-email prompts


Pages: [1]   Go Down
  Print  
Author Topic: Combination image-url-email prompts  (Read 503 times)
0 Members and 1 Guest are viewing this topic.
Coffeenole
Members

Offline Offline

Posts: 33


View Profile
« 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...

Code:
<!--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 » Share Report Spam   Logged
Agent Moose
Administrator

Offline Offline

Gender: Male
Posts: 2,671



View Profile WWW
« 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 Smiley

Great job.
Report Spam   Logged

Sassy Pants
Members

Offline Offline

Gender: Female
Posts: 42



View Profile
« Reply #2 on: December 02, 2007, 10:54:40 pm »

Sorry, I dont quite understand what this code does
Report Spam   Logged
Agent Moose
Administrator

Offline Offline

Gender: Male
Posts: 2,671



View Profile WWW
« 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
Report Spam   Logged

Sassy Pants
Members

Offline Offline

Gender: Female
Posts: 42



View Profile
« Reply #4 on: December 02, 2007, 11:00:24 pm »

 Afro
Report Spam   Logged
Agent Moose
Administrator

Offline Offline

Gender: Male
Posts: 2,671



View Profile WWW
« Reply #5 on: December 02, 2007, 11:01:57 pm »

Glad you like his code Smiley
Report Spam   Logged

Celebrus
Artificially Conscious
Administrator

Offline Offline

Gender: Male
Posts: leet


aka Omikron


View Profile WWW
« 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...

Code:
<!--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.
Report Spam   Logged

Agent Moose Jr.
Ultra Contagious
Global Moderator

Offline Offline

Gender: Male
Posts: 1,044



View Profile WWW
« Reply #7 on: January 02, 2008, 11:47:31 am »

nice code
Report Spam   Logged

Newest:

Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Bookmark this site! | Upgrade This Forum
SMF For Free - Create your own Forum

Powered by SMF | SMF © 2006-2009, Simple Machines LLC
Hostgator Hosting