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

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:
<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');'absolute';'-99999px';
   newdiv.innerHTML = copytext;
   window.setTimeout(function() {
document.oncopy = addLink;

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"?

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

Male Posts : 60
Reputation : 2
Language : English

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

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

Back to top Go down

Back to top

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