
MEKAEEL
User
Dec 4, 2006, 9:00 PM
Post #1 of 2
(1060 views)
Shortcut
|
Tutorial: add "Copy Article To Clipboard" to your articles
|
Can't Post
|
|
Hello guys, This is a tutorial of how to make a "Copy Article To Clipboard" link in your articles so users can copy the text and paste it somewhere else neatly with the author, link, and title. This may seem silly but it's a nice addition really if you see the result. You'll get something like this copied when the link is clicked: ------------------------- Title: Article Title Author: mekaeel Link: Link to Article ------------------------- This is the article's text! I didn't write this code really, all I did was implementing it in AM. Anyway here is what you need to do: 1- In your articlePage template file add this in the HEAD section: <SCRIPT LANGUAGE="JavaScript"> function ClipBoard() { Copied = holdtext.createTextRange(); Copied.execCommand("Copy"); alert("Article Copied!"); }</SCRIPT> 2- Down in the body section you need to put this too, you can put it anywhere really since it will be hidden: <TEXTAREA ID="holdtext" STYLE="display:none;"> ------------------------- Title: $article.title$ Author: $article.art_field1$ Link: $published.articlePage.url$ ------------------------- $article.content$ ------------------------- </TEXTAREA> This will add a hidden text area which will contain your article's information. 3- Add the copy link. This is it: <a href="javascript:ClipBoard();" style="text-decoration: none">Copy The Article</a> See where you like to put it and just add it then don't forget to publish your article pages. I hope it works well for you, I only tried it quickly so please feel free to ask or add anything you want. best wishes, mekaeel
(This post was edited by MEKAEEL on Dec 5, 2006, 7:51 PM)
|