[webkit-qt] disable selection of text and images
Jonni.Rainisto at nokia.com
Jonni.Rainisto at nokia.com
Mon Oct 18 23:53:18 PDT 2010
Am I missing something or couldn't you just do preventDefault() onmousedown-event in javascript? Like <body onmousedown="preventDefault();"> to disable it anywhere.
Or if wanting to prevent specific nodenames (like imges and text in body and td), then like (sorry Im not any good in javascript) this:
<script>
(function() {
var onmousedown;
if('onmousedown' in document && typeof document.onmousedown == 'function') {
onmousedown = document.onmousedown;
}
document.onmousedown = function(e) {
if(typeof e == 'undefined') {
e = window.event;
}
if(!e.target) {
e.target = e.srcElement || document;
}
if('nodeName' in e.target && (e.target.nodeName.toLowerCase() == 'img'
|| e.target.nodeName.toLowerCase() == 'body'
|| e.target.nodeName.toLowerCase() == 'td')) {
if(e.preventDefault) {
e.preventDefault();
}
// If you want to register mousedown events for
// elements containing images, you will want to
// remove the next four lines.
if(e.stopPropagation) {
e.stopPropagation();
}
e.cancelBubble = true;
e.returnValue = false;
return false;
}
if(onmousedown !== undefined) {
onmousedown(e);
}
};
})();
</script>
re, Jonni
________________________________
From: webkit-qt-bounces at lists.webkit.org [mailto:webkit-qt-bounces at lists.webkit.org] On Behalf Of ext Efan...
Sent: 19 October, 2010 08:51
To: Antonio Gomes
Cc: webkit-qt
Subject: Re: [webkit-qt] disable selection of text and images
I see this feature implementation is pending since several month, I was just thinking if sone one can give me some hint/.help I can do this and share
On Mon, Oct 18, 2010 at 10:39 PM, Efan... <efanharris at gmail.com> wrote:
I am really sorry for this.
Today only i register with these mailing list. I didnt knwo these rules, I apologize for this
On Mon, Oct 18, 2010 at 10:22 PM, Antonio Gomes <tonikitoo at gmail.com> wrote:
[Qt] Add APIs to disable text selection and image dragging
https://bugs.webkit.org/show_bug.cgi?id=38520
ps: Also, please do not cross-post like this.
On Tue, Oct 19, 2010 at 1:12 AM, Efan... <efanharris at gmail.com> wrote:
> Hi
> I am totally new to this group.
> I want to disable selection of Text and graphics in my QWebView, it seems
> that there is no way via Qt i can do this , so only option I am left with is
> to modify webkit code.
> I am new to webkit code too, but I am willing to put my time and effort to
> do this, Can any one please suggest what file/function should I be modifying
> in webkit?? Or does any one has any other solution other than modifying
> webkit?
> I will highly appreciate any input on this.
> BR
> --
> Efan Harris
>
> _______________________________________________
> webkit-qt mailing list
> webkit-qt at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-qt
>
>
--
--Antonio Gomes
--
Efan Harris
--
Efan Harris
More information about the webkit-qt
mailing list