DokuWiki

It's better when it's simple

User Tools

Site Tools


Sidebar

Translations of this page?:

Learn about DokuWiki

Advanced Use

Corporate Use

Our Community


Follow us on Facebook, Twitter and other social networks.

Our Privacy Policy

devel:ideas:add_license_text_to_copy_n_pasted_content
function addLink() {
        var body_element = document.getElementsByTagName("body")[0];
        var selection = window.getSelection();
        var pagelink = '\n\nLicense: CC Attribution-Share Alike 3.0 Unported\nSource: http://test.com/\n'; 
        var copytext = selection + pagelink;
        var newdiv = document.createElement('pre');
        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;

Make this dependent on a setting. Under the “license” (Under which license should your content be released?) add an input line to accept any text string and have 2 plceholders:

  • %s for the base URL of the site
  • %u for the URL of the page copied from
  • %l for the license that the site uses

The default can be:

\n\nLicense: %l\nSource: %u\n

TODO: think about how to make the language dependent.

devel/ideas/add_license_text_to_copy_n_pasted_content.txt · Last modified: 2014-05-25 09:39 by Pallieter