Current status of the Ning Platform is always available on the Ning Status Blog.

FORUM

Trick 3.0: Link to comment

Hello everyone!

Last week one of our support representatives have been contacted by one of the new creators, and he has mentioned that he wishes to have the easy way to share links to the comments (the functionality that we have on 2.0 and which is not presented on 3.0 unfortunately). Of course, the suggestion has been created and passed to the management, however, if the immediate solution is required you can use the following code :

<script>
var com_link;
var split1, split2, split3, split4;
var com_id;
var func_click = function(elmnt, e){
e.preventDefault();
com_link = x$(elmnt).attr('href');
x$('#myInput').attr('value', com_link);
var copyText = document.getElementById("myInput");
copyText.select();
document.execCommand("Copy");
x$(elmnt).append('<div class="temp1" style="position:absolute; padding: 15px; border: 1px solid; border-color: black; background-color:white; color:black;z-index:9999"><p>Link copied to the clipboard</p><div>');
setTimeout(function(){ x$('.temp1').remove(); }, 3000);
};

x$(window).load(function ()
{
var del = setInterval(function ()
{
if (x$('.comments-comment ').length)
{
if(x$('.entry-comments .com_link').length==0)
{x$('.entry-comments .comments-comment ').each( function(){
com_id = x$(this).attr('data-comment-id');
com_link = window.location.href;
split1 = com_link.split("?");
split2 = split1[0].split("=");
split3 = split2[0].split("&");
split4 = split3[0].split("#");
x$(this).children('.comments-commentBody').children('.media-body').children('.comments-actions').append('<a class="comments-action com_link" href="'+ split4[0] +'=show?commentId=' +com_id +'" onclick="func_click(this, event);">Link</a>');
});
}
if(x$('.commentWallSection .com_link').length==0)
{x$('.commentWallSection .comments-comment ').each( function(){
com_id = x$(this).attr('data-comment-id');
com_link = window.location.href;
split1 = com_link.split("?");
split2 = split1[0].split("=");
split3 = split2[0].split("&");
split4 = split3[0].split("#");
x$(this).children('.comments-commentBody').children('.media-body').children('.comments-actions').append('<a class="comments-action com_link" href="'+ split4[0] +'?commentId=' +com_id +'" onclick="func_click(this, event);">Link</a>');
});
}
}
}, 100);
});
</script>
<input type="text" value="test" id="myInput" style="height:20px; margin-bottom:-20px; position: absolute; left:-9999px;">

The code should be inserted into the custom code, end of page field, after the code you have there.

About its work, there simply one new link called "Link" would appear in the action panel of the comments, once pressed the link to the comment would be copied to the clipboard and the message would show up that the link has been copied to the clipboard. 

If there are any suggestions how the functionality could be modified to be more user-friendly, please let me know and I'll update teh code :-)

P.S. I know regex could be used to split the link, but I'm still not good at it, that's why we have 4 beautiful variables :-)

P.S.S If there are any suggestions to optimize the code, don't hesitate to post them in the replies

Hope it helps

Ning Team.

You need to be a member of Ning Creators Social Network to add comments!

Join Ning Creators Social Network

Email me when people reply –

Replies

  • NC for Hire

    Looks interesting..

    • Glad you have found it interesting :-)

  • Update:

    Just notice that I there was a typo "don't hesitate to post them in the replies", I have posted "do hesitate to post them in the replies".

    Sorry for that :-)

    Best regards,

    Ning Team.

    • Hello Kyryl, two versions, optimized.. :)


      <!--  Kyryls - share links to the comments -->
      <!-- Reloads to the comment you coppyed the link from. -->
      <!-- Custom Code - End of Page Code box -->
      <script src="https://bit.ly/2oqk588" type="text/javascript"></script>


      OR


      <!--  Kyryls - share links to the comments -->
      <!-- NO reload, drops to bottom of page on first use. -->
      <!-- Custom Code - End of Page Code box -->
      <script src="https://bit.ly/2kCFfLb" type="text/javascript"></script>

      https://api.ning.com/files/YKhPqyP9lyTqHUTS6ZaBIz9Svzpw6Qmv57BiP3TYcIMsWgpGv-ZDriVS307mw9mOnxKTnQst…
      • Really nice, George!

        Thanks.

        https://api.ning.com/files/YKhPqyP9lyTqHUTS6ZaBIz9Svzpw6Qmv57BiP3TYcIMsWgpGv-ZDriVS307mw9mOnxKTnQst…
  • Thank you for this!  Works well on first try. 

    Best wishes for a happier, better 2018 ~ 

    Holly

    • Hi Holly,

      Glad you've found this trick useful :-)

      Best wishes,

      Ning Team.

This reply was deleted.

Announcements

 

Some interesting articles related to community management, digital marketing etc. could be found in our digest. Don't hesitate to leave a feedback so we would know that we should continue :-)

Latest Activity

Gavin Brown replied to Kyryl_Ning_Support's discussion
Changes on facebook, and new instructions how the app should be set up
"Thanks Kyryl, I've added you as a developer"
8 minutes ago
Fernando Bisbal replied to Fernando Bisbal's discussion
emails that do not arrive
"It's not a spam issue, we've verified it. If so, can not you do anything to remove NING from spam l…"
45 minutes ago
Matthew Aukai Wright replied to Jen's discussion
Make Your Image Avatars Stand Out On Home Page
"thank you so much kyryl. How can I make the border and stuff rainbow? "
3 hours ago
Matthew Aukai Wright replied to Elson Tan's discussion
[2/3.0 TIP] How to use Ning's User Profile Variable
"I want it to be the picture of the logged in member above the sign out link in the picture"
3 hours ago
Kyryl_Ning_Support replied to Fernando Bisbal's discussion
emails that do not arrive
"Hi there!
Are you sure that none of our IPs are blocked by those email service providers? It's pret…"
4 hours ago
Kyryl_Ning_Support replied to Elson Tan's discussion
[2/3.0 TIP] How to use Ning's User Profile Variable
"Hi there!
I'm not sure what exactly are you trying to do, where the picture should be added exactly…"
4 hours ago
Kyryl_Ning_Support replied to Jen's discussion
Make Your Image Avatars Stand Out On Home Page
"Hi there!
If you are ok with using this for every avatar on your network, you can use the following…"
4 hours ago
Kyryl_Ning_Support replied to Kyryl_Ning_Support's discussion
Changes on facebook, and new instructions how the app should be set up
"Hi there!
You can add me as the developer of the app so I could take a look what is wrong. To do th…"
4 hours ago
Gavin Brown replied to Kyryl_Ning_Support's discussion
Changes on facebook, and new instructions how the app should be set up
"I have completed the instructions above and made the app live. It's not working yet, I will give it…"
9 hours ago
Kyryl_Ning_Support replied to Kyryl_Ning_Support's discussion
Changes on facebook, and new instructions how the app should be set up
"My pleasure :-)"
21 hours ago
Matthew Aukai Wright replied to Elson Tan's discussion
[2/3.0 TIP] How to use Ning's User Profile Variable
"Thanks so much Kyryl! :) How can I add the members profile picture at the top?"
22 hours ago
Matthew Aukai Wright replied to Jen's discussion
Make Your Image Avatars Stand Out On Home Page
"Hi there Jen I am on ning 3.0 and it is not working for me. Do you think maybe you or somebody can…"
23 hours ago
More…

Meanwhile, you can check our social media channels