Added support for text selection: selected text will be wrapped in hyperlink to source URL and used as default value for text input

This commit is contained in:
Tobi Schäfer 2012-06-04 18:42:19 +00:00
parent 0a9be160dd
commit b1cc83945c
2 changed files with 22 additions and 24 deletions

View file

@ -224,7 +224,7 @@ referrers.push(new Antville.Referrer("<% param.referrer %>",
</tr>
<tr>
<td class='small'><% gettext 'Bookmarklet' %>:</td>
<td><a href="javascript: var site = '<% site.href %>'; window.open('<% site.static %>../www/formica.html#' + encodeURIComponent(site) + '&' + encodeURIComponent(location.href) + '&400&400', 'formica', 'width=630, height=350'); void(0);" title="<% gettext 'Drag to Bookmarks Bar' %>"><% gettext "Post to {0}" <% site.title %> %></a></td>
<td><a href="javascript: var siteUrl = '<% site.href %>'; var selection = (window.getSelection) ? window.getSelection() : document.selection.createRange(); selection = selection.text || selection; selection = selection + ''; var url='<% site.static %>../www/formica.html?s=' + encodeURIComponent(siteUrl) + '&l=' + encodeURIComponent(location.href) + '&w=400&h=400&c=' + encodeURIComponent(selection); window.open(url, 'formica', 'width=630, height=350'); void(0);" title="<% gettext 'Drag to Bookmarks Bar' %>"><% gettext "Post to {0}" <% site.title %> %></a></td>
</tr>
<tr>
<td colspan="2"><div class="listSeparator"> </div>