HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.

Intra-vanilla link preview

TomTesterTomTester New
edited April 2007 in Vanilla 1.0 Help
When reading these forums I see references to other sites, discussions, etc. I find myself opening these up in different tabs, but easily get lost in a see of vanilla-leaves. How hard would it be to make a little AJAXy "tip-tool-type" preview for those intra-forum references? Sample sites (perhaps useful): http://www.websnapr.com/previewbubble/ http://en.wikipedia.org/wiki/Wikipedia:Tools/Navigation_popups http://codylindley.com/Javascript/257/thickbox-one-box-to-rule-them-all
«1

Comments

  • Doesn't Browster do that for you?
  • TomTesterTomTester New
    edited October 2006
    It might, but I'm paranoid plus I feel 'link-pre-cachers' like browster are the scourge of the earth for webmasters [Every user needs 10 connections, even though they never really visit the page?] Functionality-wise though it resembles what I'd like to see, i.e. a floating container with the contents of a link (and as you might guess, timed so it appear only after a website friendly "hovering-time-out") One more link that might help get it done (perhaps): http://www.frequency-decoder.com/2006/10/12/link-preview-experiment
  • All of your references look interesting. However, I used Browster for several months and really never found it useful. I did find it slowed down accessing web pages. I guess it's nice to see a place before you visit it, but what is the real value in that? It is one more clue that might entail you to visit that link along with looking at the url, the context in which it is referenced, the page on which the link is, or the person who sent it to you. It's just another way to help but not necessarily for everyone. Just some thoughts.
  • Browster is probably slow because it pre-caches every link on the page (or something like that) I'm not interested in seeing places outside the present forum. Totally agree context is important... that said, I just want to 'preview' a link within the same forum (could be a permalink to a comment above on the same page, a previous page, or a completely different topic) Example: Let's say I wanted to add one more link to the list of links I mentioned in this post http://lussumo.com/community/discussion/4227/#Item_1 [*] Instead of clicking on the [*] link, reading the post, scrolling down again to this one, and continue reading where you left off, you can just hover over the [*] a pop-up shows (part of) the comment, you read it and you continue, without interrupting your "reading flow". Note: not married to this exact implementation, just think it would help navigating these forums (and improve performance when many people access a forum)
  • That would be most cool if the implementation really is feasible; I have no idea personally.

    Now, if only someone would do that remotely analogous (I'll find any excuse) extension for which I beg; a user-option to display 'x' characters of the first post in discussions. This is functionally akin to what displays when a search result is returned - and for just the same reason, so a user can get a bit of guidance on whether they want to read the whole post/browse a discussion or not. Hovering over a [*] feature in discussion or category lists wouldn't be quite as good but I'd settle for it ;-).

    l wish I could pay for such an extension but just can't. I am beginning to analyze Vanilla code but only have hobby-time for it, alas, so it will take my tired old brain a loooong time.
  • edited October 2006
    Here is a modified version of the Extended Text Formatter of Mark:
    if (in_array($Context->SelfUrl, array("comments.php", "post.php"))) { // An implementation of the string filter interface for plain text strings class ExtendedTextFormatter extends StringFormatter { function Parse ($String, $Object, $FormatPurpose) { $sReturn = $String; // Only format plain text strings if they are being displayed (save in database as is) if ($FormatPurpose == FORMAT_STRING_FOR_DISPLAY) { $sReturn = $this->AutoLink($sReturn); $sReturn = preg_replace("/\/\bme\b/", $this->GetAccountLink($Object), $sReturn); } return $sReturn; } function AutoLink($String) { $String = str_replace(array(""","&"),array('"','&'),$String); $String = preg_replace( "/ (?<!<a href=\") (?<!\")(?<!\">) ((https?|ftp):\/\/) ([\@a-z0-9\x21\x23-\x27\x2a-\x2e\x3a\x3b\/;\x3f-\x7a\x7e\x3d]+) /msxi", "<a class=\"previewlink\" href=\"$0\" target=\"_blank\" rel=\"nofollow\">$0</a>", $String); return $String; } function GetAccountLink($Object) { if ($Object->AuthUserID != "" && $Object->AuthUsername != "") { return '<a href="'.GetUrl($Object->Context->Configuration, 'account.php', '', 'u', $Object->AuthUserID).'">'.$Object->AuthUsername.'</a>'; } else { return '/me'; } } } $ExtendedTextFormatter = $Context->ObjectFactory->NewObject($Context, "ExtendedTextFormatter"); $Context->StringManipulator->Formatters[$Configuration["DEFAULT_FORMAT_TYPE"]]->AddChildFormatter($ExtendedTextFormatter); $Head->AddScript('js/websnapr/previewbubble.js'); }
  • tomtester u want to actually read it not just preview it.
    then u will need thickbox It will open the link in an iframe so u can read it and later close it
  • Dinoboff: I tried your code and it empties every comment that I add.
  • edited November 2006
    There is no reason...

    You just need to:
    1. Extract previewbubble.zip into /js/websnapr/
    2. edit /js/websnapr/previewbubble.js. Replace var bubbleImagePath = '/images/bg.png';by var bubbleImagePath = '/vanilla/js/websnapr/bg.png';(of course put the correct path for your forum).
    3. edit extensions/ExtendedTextFormatter/default.php. Line 42, replace "<a href=\"$0\" target=\"_blank\" rel=\"nofollow\">$0</a>", by"<a class=\"previewlink\" href=\"$0\" target=\"_blank\" rel=\"nofollow\">$0</a>",
    4. Add at the end of extensions/ExtendedTextFormatter/default.php$Head->AddScript('js/websnapr/previewbubble.js');
  • Schiz, familiar with thickbox (even suggested it elsewhere here today) but it's just so... 'thick' (50kB). If we limit ourselves to intra-forum links, would AJAXy access to the DB be an option?
  • edited October 2006
    The ThickBox JavaScript code and CSS file only add an additional 12k on top of the jQuery code. Together, the compressed jQuery code and ThickBox only total 27k. u can remove stuff from thickbox that u don't need
  • I don't believe my problem has anything to do with this extension. I have a test local forum and haven't made any comments on it in a few weeks/ So, I'll have to try an retrace my steps to see what I might have done to cause comments to disappear as soon as I submit them. If I preview the comment it it is, but then disappears when I save. Oh well, that's the price of developing extensions and fooling around with php code.
  • [quote]then u will need thickbox It will open the link in an iframe so u can read it and later close it[/quote]

    The only problem with that is that many sites nowadays use javascript to remove all iframes and make it the focus of the screen
  • Dino, will you turn this into an add-on (possible?)
  • No, that just the script of websnapr.com + an add-on of Mark.

    You can ask Mark to add it.
  • Man, I'm starting to feel guilty... I'm like 'Mr. Featurecreep'...
  • Have you tried to modification to the Extended Text Formatter addons?
  • I'll do it in a bit. First testing the whisper notification. Thinking about hacking myself a new whispers tab too... (other discussion)
  • edited November 2006
    I just created the extension.

    My knowledge in js are limitated so I used jquery for... Just for 3 lines of code lol$(document).ready(function() { $("div.CommentBody a").addClass("previewlink"); });

    http://lussumo.com/addons/?PostBackAction=AddOn&AddOnID=203
  • Hmm, I just tried installing this on my site without any luck at all, it doesn't seem to be even attempting to load the jquery file etc :(
This discussion has been closed.