MediaWiki:Common.js: Revizyonlar arasındaki fark
Gezinti kısmına atla
Arama kısmına atla
(" →Buraya konulacak JavaScript kodu sitedeki her kullanıcı için her sayfa yüklendiğinde çalışacaktır: function addLink() { var body_element = doc..." içeriğiyle yeni sayfa oluşturdu) |
Değişiklik özeti yok |
||
| 1. satır: | 1. satır: | ||
function addLink() { | function addLink() { | ||
var body_element = document.getElementsByTagName( | var body_element = document.getElementsByTagName('body')[0]; | ||
var selection; | var selection; | ||
| 9. satır: | 8. satır: | ||
selection = window.getSelection(); | selection = window.getSelection(); | ||
var pagelink = | var pagelink = "<br /><br /> Kaynak: <a href='"+document.location.href+"'>"+document.location.href+"</a><br />"; | ||
if(selection.toString().length>150) | |||
{ | |||
var copytext = selection + pagelink; | |||
var | var newdiv = document.createElement('div'); | ||
newdiv.style.position='absolute'; | |||
newdiv.style. | newdiv.style.left='-99999px'; | ||
newdiv | body_element.appendChild(newdiv); | ||
newdiv.innerHTML = copytext; | |||
newdiv | selection.selectAllChildren(newdiv); | ||
window.setTimeout(function() { | |||
body_element.removeChild(newdiv); | |||
},0); | |||
},0); | |||
} | |||
} | } | ||
document.oncopy = addLink; | document.oncopy = addLink; | ||
23.38, 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+"'>"+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;