我看到了http://www.tynt.com/ ......我喜欢他们的服务。只有我正在尝试为我开发定制的东西..他们的库很大。我想在过去的10个小时里做这件事。
这里我得到了..
====
$(document).ready(function() {
var ctrlDown = false;
var ctrlKey = 17, vKey = 86, cKey = 67;
$(document).keydown(function(e) {
if (e.keyCode == ctrlKey) {
if (getSelText() != null)
{ alert(getSelText()); }
ctrlDown = true;
}
}).keyup(function(e) {
if (e.keyCode == ctrlKey) {
ctrlDown = false;
//alert("Control is NOOOOOOOOOOOOOT pressed");
}
});
$(".no-copy-paste").keydown(function(e) {
if (ctrlDown && (e.keyCode == vKey || e.keyCode == cKey)) return false;
});
});
function getSelText() {
var txt = '';
if (window.getSelection) {
txt = window.getSelection();
if (txt.type == "Range") {
return txt + " <br /><br /><a href='" + window.location.pathname + "'>View Original Link</a>";
}
}
else if (document.getSelection) {
txt = document.getSelection();
if (txt.type == "Range") {
return txt + " <br /><br /><a href='" + window.location.pathname + "'>View Original Link</a>";
}
}
else if (document.selection) {
txt = document.selection.createRange().text;
if (txt.type == "Range") {
return txt + " <br /><br /><a href='" + window.location.pathname + "'>View Original Link</a>";
}
}
else return;
return null;
}
==== 我有两个问题; - 1.附加文本只有在我有此行警报时才有效(getSelText()); ......不知道为什么。 2.附加的文本没有格式化为HTML
我已经查看了zeroclipboard,但它使用了闪存,这是arrrah ......
由于