Author |
Topic |
|
CertGuard
Starting Member
United States
10 Posts |
Posted - 21 November 2007 : 12:02:02
|
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
|
kewl! < |
|
|
phy1729
Average Member
USA
589 Posts |
Posted - 21 November 2007 : 12:25:35
|
You may want to disable it on .doc links as those are forbidden by websnapr. But other than that it looks great.< |
|
|
CertGuard
Starting Member
United States
10 Posts |
Posted - 21 November 2007 : 12:57:18
|
Hmmm...good point, I'm not sure how yet, but I'll look into it. Thanks!< |
Robert Williams
Join the fight against braindumps! |
|
|
CertGuard
Starting Member
United States
10 Posts |
Posted - 21 November 2007 : 16:31:19
|
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! |
|
|
muzishun
Senior Member
United States
1079 Posts |
Posted - 21 November 2007 : 16:50:12
|
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 |
|
|
balexandre
Junior Member
Denmark
418 Posts |
Posted - 21 November 2007 : 18:46:05
|
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"
|
|
|
CertGuard
Starting Member
United States
10 Posts |
Posted - 29 November 2007 : 11:47:11
|
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! |
|
|
philsbbs
Junior Member
United Kingdom
397 Posts |
Posted - 25 December 2007 : 07:02:05
|
Is it me or has websnapr.com been down for the last 3 days at least. < |
Phil |
|
|
muzishun
Senior Member
United States
1079 Posts |
Posted - 25 December 2007 : 12:32:44
|
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) |
|
|
philsbbs
Junior Member
United Kingdom
397 Posts |
|
|
Topic |
|
|
|