Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/Code)
 Added Feature - WebSnapr
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

CertGuard
Starting Member

United States
10 Posts

Posted - 21 November 2007 :  12:02:02  Show Profile  Visit CertGuard's Homepage  Reply with Quote
Everyone is familiar with WebSnapr, correct?

Well, I was playing around this morning and decided to see if I could get the links inside posts to show the site images and I got it to work.

It's fairly simple once you know what you're looking for, I hope I explain it well enough for everyone, if not, maybe others can help.

First, you'll need to go to the site listed above, download the free Javascript and register to get your "Developer Key". Once you have your key, and you've got the code, follow their instructions to get the code implemented. (I'll help with some of the install in a sec)

Now that you have (almost) completed their installation instructions, you'll need to modify two Snitz files to get it to work.

The first file is <b>inc_header.asp</b>:
- There are two locations you'll need to edit. Both instances are directly above areas that the Snitz creators have designated for NON-MODIFICATION.

If you search for this string: <b>'## START - REMOVAL,</b>, you'll find areas I'm referring to by backing up a couple of lines.

1. Find both instances of this code:

 Response.Write "<html>" & vbNewLine & _
   "<head>" & vbNewline & _
   "<title>" & strForumTitle & "</title>" & vbNewline

and append this code to it:

 & _
   "<script type=""text/javascript"" src=""previewbubble.js""></script>" & vbNewline

<b>NOTE: Make sure you've added the <i>& _</i> to the end of the last line.</b>


Then, in <b>inc_func_common.asp</b> you'll need to find the following block of code, which is found at the very bottom of the file.

<script language="javascript1.2" runat="server">
function edit_hrefs(sURL, iType) {
 sOutput = new String(sURL);

 if (iType == 1) {
  sOutput = sOutput.replace(/\b(http\:\/\/[\w+\.]+[\w+\.\:\/\@\_\?\=\&\-\'\#\%\~\;\,\$\!\+\*]+)/gi,
   "<a href=\"$1\" target=\"_blank\">$1<\/a>");
 } else if (iType == 2) {
  sOutput = sOutput.replace(/\b(https\:\/\/[\w+\.]+[\w+\.\:\/\@\_\?\=\&\-\'\#\%\~\;\,\$\!\+\*]+)/gi,
   "<a href=\"$1\" target=\"_blank\">$1<\/a>");
 } else if (iType == 3) {
  sOutput = sOutput.replace(/\b(www\.[\w+\.\:\/\@\_\?\=\&\-\'\#\%\~\;\,\$\!\+\*]+)/gi,
   "<a href=\"http://$1\" target=\"_blank\">$1<\/a>");
 } else if (iType == 4) {
  sOutput = sOutput.replace(/\b([\w+\-\'\#\%\.\_\,\$\!\+\*]+@[\w+\.?\-\'\#\%\~\_\.\;\,\$\!\+\*]+\.[\w+\.?\-\'\#\%\~\_\.\;\,\$\!\+\*]+)/gi,
   "<a href=\"mailto\:$1\">$1<\/a>");
 } else if (iType == 5) {
  sOutput = sOutput.replace(/\b(ftp\:\/\/[\w+\.]+[\w+\.\:\/\@\_\?\=\&\-\'\#\%\~\;\,\$\!\+\*]+)/gi,
   "<a href=\"$1\" target=\"_blank\">$1<\/a>");
 } else if (iType == 6) {
  sOutput = sOutput.replace(/\b(file\:\/\/\/[\w+\:\/\\]+[\w+\/\w+\.\:\/\\\@\_\?\=\&\-\'\#\%\~\;\,\$\!\+\*]+)/gi,
     "<a href=\"$1\" target=\"_blank\">$1<\/a>");
 }

 return sOutput;
}
</script>


Since you're only going to need to see images for HTTP, HTTPS, and WWW, what you're going to do is add the following information to 3 of the 6 lines.
class=\"previewlink\"


This is what your code should look like when you're done.

<script language="javascript1.2" runat="server">
function edit_hrefs(sURL, iType) {
 sOutput = new String(sURL);

 if (iType == 1) {
  sOutput = sOutput.replace(/\b(http\:\/\/[\w+\.]+[\w+\.\:\/\@\_\?\=\&\-\'\#\%\~\;\,\$\!\+\*]+)/gi,
   "<a class=\"previewlink\" href=\"$1\" target=\"_blank\">$1<\/a>");
 } else if (iType == 2) {
  sOutput = sOutput.replace(/\b(https\:\/\/[\w+\.]+[\w+\.\:\/\@\_\?\=\&\-\'\#\%\~\;\,\$\!\+\*]+)/gi,
   "<a class=\"previewlink\" href=\"$1\" target=\"_blank\">$1<\/a>");
 } else if (iType == 3) {
  sOutput = sOutput.replace(/\b(www\.[\w+\.\:\/\@\_\?\=\&\-\'\#\%\~\;\,\$\!\+\*]+)/gi,
   "<a class=\"previewlink\" href=\"http://$1\" target=\"_blank\">$1<\/a>");
 } else if (iType == 4) {
  sOutput = sOutput.replace(/\b([\w+\-\'\#\%\.\_\,\$\!\+\*]+@[\w+\.?\-\'\#\%\~\_\.\;\,\$\!\+\*]+\.[\w+\.?\-\'\#\%\~\_\.\;\,\$\!\+\*]+)/gi,
   "<a href=\"mailto\:$1\">$1<\/a>");
 } else if (iType == 5) {
  sOutput = sOutput.replace(/\b(ftp\:\/\/[\w+\.]+[\w+\.\:\/\@\_\?\=\&\-\'\#\%\~\;\,\$\!\+\*]+)/gi,
   "<a href=\"$1\" target=\"_blank\">$1<\/a>");
 } else if (iType == 6) {
  sOutput = sOutput.replace(/\b(file\:\/\/\/[\w+\:\/\\]+[\w+\/\w+\.\:\/\\\@\_\?\=\&\-\'\#\%\~\;\,\$\!\+\*]+)/gi,
     "<a href=\"$1\" target=\"_blank\">$1<\/a>");
 }

 return sOutput;
}
</script>


I hope that was clear enough, if there are any questions, post them here for me and I will try to clarify.

Oh, if you want to see a working example, visit this post: http://certguard.com/forums/topic.asp?TOPIC_ID=342

Robert Williams

Join the fight against braindumps!

Etymon
Advanced Member

United States
2385 Posts

Posted - 21 November 2007 :  12:11:23  Show Profile  Visit Etymon's Homepage  Reply with Quote
kewl! <
Go to Top of Page

phy1729
Average Member

USA
589 Posts

Posted - 21 November 2007 :  12:25:35  Show Profile  Reply with Quote
You may want to disable it on .doc links as those are forbidden by websnapr. But other than that it looks great.<
Go to Top of Page

CertGuard
Starting Member

United States
10 Posts

Posted - 21 November 2007 :  12:57:18  Show Profile  Visit CertGuard's Homepage  Reply with Quote
Hmmm...good point, I'm not sure how yet, but I'll look into it. Thanks!<

Robert Williams

Join the fight against braindumps!
Go to Top of Page

CertGuard
Starting Member

United States
10 Posts

Posted - 21 November 2007 :  16:31:19  Show Profile  Visit CertGuard's Homepage  Reply with Quote
I noticed also that this MOD affects any URLs you add below your forums. Basically it should affect anything that gets converted from [url] to "<a href="">"<

Robert Williams

Join the fight against braindumps!
Go to Top of Page

muzishun
Senior Member

United States
1079 Posts

Posted - 21 November 2007 :  16:50:12  Show Profile  Visit muzishun's Homepage  Reply with Quote
I would probably do this slightly differently. While I love the idea of having the WebSnapr integrated into the forum, I think I would probably rather not try and deal with having *every* link bring back a screenshot. One alternative would be to use the ExtraTags() function and have a new [websnapr][/websnapr] or [snap][/snap] tag that automatically converts the contained text to a link with the appropriate class. You could probably copy and modify the code for the [url][/url] tags to do this without a whole lot of extra work.

That aside, I think this is a great idea. And welcome to the forums!<

Bill Parrott
Senior Web Programmer, University of Kansas
Co-Owner and Code Monkey, Eternal Second Designs (www.eternalsecond.com)
Personal Website (www.chimericdream.com)

Edited by - muzishun on 21 November 2007 16:50:58
Go to Top of Page

balexandre
Junior Member

Denmark
418 Posts

Posted - 21 November 2007 :  18:46:05  Show Profile  Visit balexandre's Homepage  Send balexandre an ICQ Message  Reply with Quote
just wondering...

isn't that the same as www.snap.com ?

cause, if it is, all you need is to add the script that you get from them... simpler than the code in the 1st post right?


<

Bruno Alexandre
(Strøby, DANMARK)

"a Portuguese in Danmark"


Go to Top of Page

CertGuard
Starting Member

United States
10 Posts

Posted - 29 November 2007 :  11:47:11  Show Profile  Visit CertGuard's Homepage  Reply with Quote
Excellent suggestion muzishun, if I get a little extra time to play with it, I'll see if that will work.

balexandre, although they look similar I'm not sure if they're exactly the same or not. It is worth a shot though.
<

Robert Williams

Join the fight against braindumps!
Go to Top of Page

philsbbs
Junior Member

United Kingdom
397 Posts

Posted - 25 December 2007 :  07:02:05  Show Profile  Reply with Quote
Is it me or has websnapr.com been down for the last 3 days at least.
<

Phil
Go to Top of Page

muzishun
Senior Member

United States
1079 Posts

Posted - 25 December 2007 :  12:32:44  Show Profile  Visit muzishun's Homepage  Reply with Quote
Seems to be working right now for me, though now is the first time I have gone to the site in a week or two.<

Bill Parrott
Senior Web Programmer, University of Kansas
Co-Owner and Code Monkey, Eternal Second Designs (www.eternalsecond.com)
Personal Website (www.chimericdream.com)
Go to Top of Page

philsbbs
Junior Member

United Kingdom
397 Posts

Posted - 25 December 2007 :  19:31:56  Show Profile  Reply with Quote
yep its working now and ive installed it at www.forum.philsbbs.com<

Phil
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.13 seconds. Powered By: Snitz Forums 2000 Version 3.4.07