News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Add Sitepreviews to posted urls

Started by Marook, December 26, 2007, 06:02:54 PM

Previous topic - Next topic

ALEJO

#20
Quote from: Marook on January 07, 2008, 11:42:38 PM
The latest version does not support every link on the pages... the bubble only appears to links posted with [ url] tag... so there is nothing more to fix ;)

@ BRFRWebGuy! : download the new version 1.2, there the setting is turned on by default
this happens on post with [url] tags too, when i pass the pointer over a url the pop up goes always down, and not up when is at the end of the browser
solo el mas paranoico sobrevive

perro88

sorry for bothering but just want to know if you have a idea if wouldn't be too difficult to integrate the mod with for example smf links (the links are internal because they have a click counter so it won't show the preview). well probably is very hard to do or don't even possible, the only chance might be delete that counter number of clicks counter on the smf links and make the links externals

Marook

The space between the last post and the footer is in most case heigh enough to display the preview bubble. Maybe in the future i will implement a detecting mechanism. It needs another flipped image of the bubble and some more lines of code...

@ perro88: gimme the link of the mod or whatever it is, i wil look through the code and post a modified one...
SMF Rulez ;) | Meet me home ! | My Mods

perro88

#23
Quote from: Marook on January 08, 2008, 07:43:00 PM
The space between the last post and the footer is in most case heigh enough to display the preview bubble. Maybe in the future i will implement a detecting mechanism. It needs another flipped image of the bubble and some more lines of code...

@ perro88: gimme the link of the mod or whatever it is, i wil look through the code and post a modified one...
whoa mate thanks.
http://custom.simplemachines.org/mods/index.php?mod=381
the other mod is a listing of links(sorted by categories etc) with a option to rate and a counter of how many times someone on the forum clicked on the link, so that counter seems to work something like the links on the mod are not the external links but a internal link to probably make a query and incremment the number of clicks of the link and then redirect to the real external link. I don't  know javascript but maybe it's possible to do something like post the external link and then with javascript increment the number of clicks? well dunno, really thanks for checking this even when is not 100% related to your mod and probably you're a busy man hehe

Marook

its very easy to modify the template.

Open themedir/Link.template.php and search for sa=visit;id=
In every line you found this string, change the <a> tag by adding class="preview"

For example... line 118
<a class="preview" href="' . $scripturl . '?action=links;sa=visit;id=' . $row['ID_LINK'] . '" target="blank">' . $row['title'] . '</a>&nbsp;';
SMF Rulez ;) | Meet me home ! | My Mods

perro88

#25
Quote from: Marook on January 08, 2008, 08:09:46 PM
its very easy to modify the template.

Open themedir/Link.template.php and search for sa=visit;id=
In every line you found this string, change the <a> tag by adding class="preview"

For example... line 118
<a class="preview" href="' . $scripturl . '?action=links;sa=visit;id=' . $row['ID_LINK'] . '" target="blank">' . $row['title'] . '</a>&nbsp;';

tried on the virtual server on my pc and didn't do the trick, will upload the links.template.php to the server to check if there's a difference.
Still, how adding that class could make show the external link if the <a> tag is of one internal link?
EDIT: wait I'm a idiot I didn't installed the new version hehe. strange. installed mannualy the 1.2 version and the preview image is not being dysplayed, just the buble. well I'll check it tomorrow

Marook

locally it doesnt work, because the link points to localhost or 127.0.0.1 and the tumbnailservice can't serve this address to get a thumbnail... i tried it online and it works fine. Btw, it seems that websnapr.com is offline again, thats the reason why you didn't get any thumbs.... i'm currently workin on v1.3, there the admin can choose between 5 different thumbnailingservices... stay tuned ;)
SMF Rulez ;) | Meet me home ! | My Mods

perro88

Quote from: Marook on January 08, 2008, 09:51:47 PM
locally it doesnt work, because the link points to localhost or 127.0.0.1 and the tumbnailservice can't serve this address to get a thumbnail... i tried it online and it works fine. Btw, it seems that websnapr.com is offline again, thats the reason why you didn't get any thumbs.... i'm currently workin on v1.3, there the admin can choose between 5 different thumbnailingservices... stay tuned ;)
that's a great idea like that one of create a preview class, with that options will be very easy to customize the mod as the user want, great mod thanks :P, yep the thumbnails site was down hehe

ALEJO

Quote from: Marook on January 08, 2008, 07:43:00 PM
The space between the last post and the footer is in most case heigh enough to display the preview bubble. Maybe in the future i will implement a detecting mechanism. It needs another flipped image of the bubble and some more lines of code...
thx ;)
solo el mas paranoico sobrevive

perro88

#29
Quote from: Marook on January 08, 2008, 08:09:46 PM
its very easy to modify the template.

Open themedir/Link.template.php and search for sa=visit;id=
In every line you found this string, change the <a> tag by adding class="preview"

For example... line 118
<a class="preview" href="' . $scripturl . '?action=links;sa=visit;id=' . $row['ID_LINK'] . '" target="blank">' . $row['title'] . '</a>&nbsp;';

if I make this and it gives a invalid request on the buble probably because it's a internal the link, the only chance in this case is probably delete that counter and make that links externals(dunno if it's possible to still use the counter with external links maybe with javascript )
btw on the new version of your mod I can't see preview of urls with the http:// before(added without the url tag, but without the url tag and also without the http:// works). well will do more tests

Marook

I'm also using a link script and i also have the same problem, but i found out that the first time the preview appears, you will see a thumbnail of your own site. Because its an internal link, but waiting  a few seconds (sometimes maybe some minutes) you will see the correct thumbnail of the linked site. It seems, that the spider (or bot) follows the internal link and will redirected to the corrected site. Try to test this, otherwise im gonna have a close look into the source...
SMF Rulez ;) | Meet me home ! | My Mods

perro88

#31
Quote from: Marook on January 09, 2008, 03:39:10 PM
I'm also using a link script and i also have the same problem, but i found out that the first time the preview appears, you will see a thumbnail of your own site. Because its an internal link, but waiting  a few seconds (sometimes maybe some minutes) you will see the correct thumbnail of the linked site. It seems, that the spider (or bot) follows the internal link and will redirected to the corrected site. Try to test this, otherwise im gonna have a close look into the source...
thanks I'll try it.
I noticed something dunno if it is because other mod I have installed but for example on the first version of your mod
if you post something like
www.simplemachines.org
http://www.simplemachines.org
www.simplemachines.org
http://www.simplemachines.org
the preview would work on the 4 links but on my site with the new version the links with http and without url tag never get the preview :P

Marook

#32
ah yeah, i changed the mod displaying the preview only on link posted with the [ url] tag.
But it should doesnt matter, if the http:// prefix is added or not...

If you want to display the preview on any other urls, simply add the preview-class to the <a> tag
for example <a class="preview" href=http://www.google.com>Google</a>
SMF Rulez ;) | Meet me home ! | My Mods

ALEJO

i got an idea, when u put r mouse over a link that is .zip .rar o something like that it says "frobbiden request" i would be great if it shows in the rar files the winrar logo on the zip files the winzip logo... and so on... ;) just an idea
solo el mas paranoico sobrevive

debbiem626

I tried adding this mod today and lost the entire forum.   Can you tell me what files I need to edit to get it back?

I'm getting these errors..

function sitepreview(){ global $context, $settings, $options, $scripturl, $txt, $modSettings; $service_urls = array('http://www.artviper.net/screenshots/screener.php?url=';, 'http://images.websnapr.com/?size=S&url=';, 'http://shots.snap.com/preview/?url=';, 'http://www.iwebtool2.com/img/?domain=';, 'http://snapr.seekxl.de/?size=s&url=';, 'http://www.thumbalizr.com/api/?width=202&url='; ); $bubbles = array('bg.png','bg2.png','bg3.png'); if (!isset($modSettings['sitepreview_disabled']) || $modSettings['sitepreview_disabled'] == 0){ if (!empty($options['sitepreview']) || !isset($options['sitepreview'])) echo ' '; if (!empty($options['sitepreview']) || !isset($options['sitepreview'])) echo ' '; } }



Fatal error: Call to undefined function: sitepreview() in /home/summer51/public_html/Sources/Load.php(1729) : eval()'d code on line 80


Thanks.. help is greatly appreciated.

Marook

you can open your index.template.php and remove the call to the function sitepreview();

Or open the install.xml inside the zip and reverse the changes....
SMF Rulez ;) | Meet me home ! | My Mods

DHC

Quote from: Marook on January 09, 2008, 05:33:35 PM
ah yeah, i changed the mod displaying the preview only on link posted with the [ url] tag.
But it should doesnt matter, if the http:// prefix is added or not...

If you want to display the preview on any other urls, simply add the preview-class to the <a> tag
for example <a class="preview" href=http://www.google.com>Google</a>

We have noticed that when the "Insert Hyperlink" is used, the preview works fine. When the site is referenced as www.sitexyx.com, the preview works fine. However, when the site is referenced as http://www.sitexyz.com, the preview does NOT work at all.

It seems the preview does NOT work whenever the URL is preceeded with 'http://'. Can that be changed so that preview DOES work with the 'http://' in the URL?

Marook

Yeah you're right... damn ;(

But its easy to fix, i'm gonna update the mod in the next days...

Just open $sourcedir/Subs.php and find

'content' => '<a href="$1" target="_blank">$1</a>',


and replace it with


'content' => '<a class="preview" href="$1" target="_blank">$1</a>',


Thats it...
SMF Rulez ;) | Meet me home ! | My Mods

DHC

Quote from: Marook on January 23, 2008, 12:07:40 AM
Yeah you're right... damn ;(

But its easy to fix, i'm gonna update the mod in the next days...

Just open $sourcedir/Subs.php and find

'content' => '<a href="$1" target="_blank">$1</a>',


and replace it with


'content' => '<a class="preview" href="$1" target="_blank">$1</a>',


Thats it...

Nope - that didn't work either. It caused some strange behavior, so I've reverted and will wait for the update.

Thanks!

Marook

update is already available, but i just added this one change.... gimme you'r subs.php, i will fix that for you. Please use my NoPaste instead of posting code here with the code tag...
SMF Rulez ;) | Meet me home ! | My Mods

Advertisement: