Is there an easy way to copy a link to a specific topic or post?

Service: Hoop.la

Is there an easy way to copy a link to a specific topic or post?

Service: Hoop.la

I'm looking for an easy way to copy a link to a topic or specific post.

When I'm viewing a topic, it would be great if there was a link that I could copy that includes the text and the underlying URL, so that I could paste it elsewhere. This would work!

When I'm viewing a post, I often need an easy way to create a link to that specific post.

I know that I can click Take Action | Permalink but then I still have to copy the URL from the address bar and then build the link (type the text).

If you can display the title of the topic above a post as a link, then I could copy/paste that elsewhere.

Sometimes, if I have my wits about me, I'll copy the links I need from the Activity Stream.  But it would be much easier if I could do it while viewing a topic or post.

ST

Attachments

Photos (3)
Original Post

Activity Stream

Hi ST,

There's currently no way to get the link in the format you are looking for from the topic details page. You'll need to get it from the Activity Stream or the Topic List, as you mentioned.

I think that hyperlinking the topic subject in the ways you've suggested would likely lead to further confusion. Outside of the context of the Permalink (available from the Take Action dropdown), I'm not sure there's another valid reason to link back to the current page.

This is something that could be accomplished via a Customization, but as you know that would require the Enterprise plan. Alternatively, you could conceivably write a client-side script (e.g. via Greasemonkey) that runs on Hoop.la topic details pages to create the hyperlink for you. Since this is likely behavior that most users on your site don't need, this may be the most ideal solution for you.

I'll go ahead and convert this to a suggestion for you, as well!

Hope that helps,

Brian

Changed To Suggestion

This action was taken by Brian Lenz.

Hi, Brian.

Thanks for converting this to a suggestion.

I missed this as a feature because I've used it in other forum platforms. You're right.  I don't see many people actually using it. I'm something close to fanatical about providing links to references. 

In EVE I was able to use a keyboard scripting tool to construct the links for me but that tool doesn't work well in a full WYSIWYG editor.

I'll check out the client-side script idea when I have some cycles.

Thanks for the ideas.

ST

 

I got this part working.

When I'm viewing a topic, it would be great if there was a link that I could copy that includes the text and the underlying URL, so that I could paste it elsewhere.

I used some jQuery in the Control Panel | Display | End of Page HTML to convert the last breadcrumb to a link. It doesn't look like a link so it shouldn't confuse anybody.

breadcrumb link

/cp/display-settings | End of Page HTML

$(function() {
// replace current page breadcrumb with link
var theText = $("#currentPageBreadcrumb").html();
var theLink = $('<a>', {
text: theText,
title: theText,
href: window.location.href
});
$("#currentPageBreadcrumb").html(theLink);
});

I did this in jQuery in the End of Page HTML rather than using GreaseMonkey so this would work with any browser.

ST

Attachments

Photos (1)

You could also prevent click event on the "hidden" link which will prevent members from clicking and refreshing the page:

$("#currentPageBreadcrumb a").on("click", function(event) {
event.preventDefault();
});

Revised script using Bartek's suggestion.  Thank you Bartek.

I know that I could tighten this up but I want to make sure that I can understand what it's doing when I'm looking at this at some point in the distant future.

 

$(function() {
// replace current page breadcrumb with link
var theText = $("#currentPageBreadcrumb").html();
var theLink = $('<a>', {
text: theText,
title: theText,
href: window.location.href
});
$("#currentPageBreadcrumb").html(theLink)
.on("click", function(event) {
event.preventDefault();
});
});

This script also addresses my second request - to create a link that jumps to a specific post.

On the post of interest,  click Take Action | Permalink.

When the page reloads, scroll to the top of the page. (ctrl-home or shift-space a bunch of times).

Select the breadcrumb for the page and copy it. This is the link to the specific post in the thread.

Someday when I have more time I'd like to be able to click the breadcrumb and copy the link directly to the clipboard (without using flash). I started to research that but I'll have to leave that for another day.

Bartek - do you have an idea for an easy way to do that?  As an intermediate measure, I tried to use the .select() method to capture the link. No luck there.

I'm open to ideas.

Thanks,

ST

Hi Bartek,

I've got it working in all the Windows 10 browsers I've tried except Firefox. Firefox works too but it pastes the <li></li> around the link. The other browsers work fine.

From https://clipboardjs.com/ I put clipboard.min.js into the site Web Space

In Control Panel | Display

This is in Custom Code for Head Section

<script src="/ws/clipboard.min.js"></script>

This is in the End of Page HTML

$(function() {
// initiate clipboard
new Clipboard('.btn');
// replace current page breadcrumb with link
var theText = $("#currentPageBreadcrumb").html();
var theLink = $('<a>', {
id: "theLink",
text: theText,
title: theText,
href: window.location.href,
"data-clipboard-target": "#theLink",
"class": "btn"
});
$("#currentPageBreadcrumb").html(theLink)
.on("click", function(event) {
event.preventDefault();
});
});

 

ST

For anyone who has read this far, I found a bug and the following revision fixes it.

Line 5 was

var theText = $("#currentPageBreadcrumb").html();

 

This looks bad if the text contains html entities (e.g. and ampersand that gets transformed into &amp;

It is now

var theText = $("#currentPageBreadcrumb").text();

 

Here is the whole script.

$(function() {
// initiate clipboard
new Clipboard('.btn');
// replace current page breadcrumb with link
var theText = $("#currentPageBreadcrumb").text();
var theLink = $('<a>', {
id: "theLink",
text: theText,
title: theText,
href: window.location.href,
"data-clipboard-target": "#theLink",
"class": "btn"
});
$("#currentPageBreadcrumb").html(theLink)
.on("click", function(event) {
event.preventDefault();
});
});

 

ST

Add Reply

×
×
×
×