MediaWiki:Common.js: Revizyonlar arasındaki fark
Gezinti kısmına atla
Arama kısmına atla
Değişiklik özeti yok |
Değişiklik özeti yok |
||
| 8. satır: | 8. satır: | ||
selection = window.getSelection(); | selection = window.getSelection(); | ||
var pagelink = "<br /><br /> Kaynak: <a href='"+document.location.href+"'>"+document.location.href+"</a><br />"; | var pagelink = "<br/> <br/> Kaynak: <a href='"+document.location.href+"'>"+decodeURI(document.location.href)+"</a><br/> "; if(selection.toString().length>150) | ||
if(selection.toString().length>150) | |||
{ | { | ||
var copytext = selection + pagelink; | var copytext = selection + pagelink; | ||
| 32. satır: | 32. satır: | ||
} | } | ||
} | } | ||
document.oncopy = addLink; | document.oncopy = addLink; | ||
23.47, 29 Kasım 2018 tarihindeki hâli
function addLink() {
var body_element = document.getElementsByTagName('body')[0];
var selection;
selection = window.getSelection();
var pagelink = "<br/> <br/> Kaynak: <a href='"+document.location.href+"'>"+decodeURI(document.location.href)+"</a><br/> "; if(selection.toString().length>150)
{
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;