Skip to content
This repository has been archived by the owner on Dec 14, 2017. It is now read-only.

Commit

Permalink
Follow up to Fix #32
Browse files Browse the repository at this point in the history
Added code to handle changes in IE 11 (versus prior versions), for View
Partial Source
  • Loading branch information
Mark Novak committed Dec 23, 2014
1 parent 9b73a91 commit 2efbc5a
Showing 1 changed file with 41 additions and 3 deletions.
44 changes: 41 additions & 3 deletions wat/scripts/partial-source.ws
Original file line number Diff line number Diff line change
@@ -1,11 +1,49 @@
function main()
// borrowed getSelectionHtml() from web @ http://stackoverflow.com/questions/5222814/window-getselection-return-html
function getSelectionHtml() {
var html = "";
if (typeof window.getSelection != "undefined") {
var sel = window.getSelection();
if (sel.rangeCount) {
var container = document.createElement("div");
for (var i = 0, len = sel.rangeCount; i < len; ++i) {
container.appendChild(sel.getRangeAt(i).cloneContents());
}
html = container.innerHTML;
}
} else if (typeof document.selection != "undefined") {
if (document.selection.type == "Text") {
html = document.selection.createRange().htmlText;
}
}
return html;
}

function main()
{
try
{
q=(f_length?'':document.selection.createRange().htmlText);
if (window.getSelection())
q=(f_length?'':getSelectionHtml()); // could just do same thing as below with the GetFrames, instead of calling the function
else
q=(f_length?'':document.selection.createRange().htmlText);

for(i=0;i<f_length;i++)
{
q=GetFrame(i).document.selection.createRange().htmlText;
if (window.getSelection())
{
var a = GetFrame(i).getSelection();
if (a.rangeCount)
{
var container = document.createElement("div");
for (var i = 0, len = a.rangeCount; i < len; ++i)
{
container.appendChild(a.getRangeAt(i).cloneContents());
}
q = container.innerHTML;
}
}
else
q=GetFrame(i).document.selection.createRange().htmlText;
//alert(q);
if(q!='')break;
}
Expand Down

0 comments on commit 2efbc5a

Please sign in to comment.