The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Problem with "Add a Copyright Notice to Copied Text" script

View previous topic View next topic Go down

Solved Problem with "Add a Copyright Notice to Copied Text" script

Post by Przmus on April 29th 2013, 4:49 am

I found a script:
Source: http://bavotasan.com/2010/add-a-copyright-notice-to-copied-text/
Code:
<script type="text/javascript">
function addLink() {
   var body_element = document.getElementsByTagName('body')[0];
   var selection;
   selection = window.getSelection();
   var pagelink = "<br /><br /> Read more at: <a href='"+document.location.href+"'>"+document.location.href+"</a><br />Copyright © c.bavota"; // change this if you want
   var copytext = selection + pagelink;
   var newdiv = document.createElement('div');
   newdiv.style.position='absolute';
   newdiv.style.left='-99999px';
   body_element.appendChild(newdiv);
   newdiv.innerHTML = copytext;
   selection.selectAllChildren(newdiv);
   window.setTimeout(function() {
      body_element.removeChild(newdiv);
   },0);
}
document.oncopy = addLink;
</script>

I added it to: "Javascript codes management" and it doesn't work.
When I added it to: "Announcements" - it works fine.
Why? I don't want this script in announcements, because it creates an additional break on top of the page.
I also tried to add this script to "Templates" (overall_header, simple_header, overall_footer_begin, overall_footer_end) and it didn't work.

I use phpBB2 (subsilver) theme version of the forum.

Why this script works in "Announcements", but doesn't work in "Javascript codes management"?


SOLVED:
It still doesn't work in "Javascript codes management", but when I removed:
Code:
// change this if you want
it works in overall_header.

Przmus
Forumember

Male Posts : 60
Reputation : 2
Language : English

http://easywinclan.forummotion.com/

Back to top Go down

Solved Re: Problem with "Add a Copyright Notice to Copied Text" script

Post by Jophy on April 29th 2013, 6:27 am

Thanks for sharing the solution thumleft

Since this was marked solved...

Topic Solved & Locked

Jophy
ForumGuru

Male Posts : 17924
Reputation : 835
Language : English
Location : Somewhere

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum