2014-07-28, 01:45 AM
Trying convert Thread.quickquote.js of plugin quickquote (http://mods.mybb.com/view/quickquote ) to jquery...
but i having problem in initial line...
What can i use in place of "try" and "catch" of code above to convert to jquery ?
Thanks...
but i having problem in initial line...
try {
var selectionObject = false;
var userSelectionText = "";
if (window.getSelection) {
selectionObject = window.getSelection();
if(selectionObject.getRangeAt) {
userSelection = selectionObject.getRangeAt(0).cloneContents();
userSelectionText = userSelection.toString();
} else {
userSelection = document.createRange();
userSelection.setStart(selectionObject.anchorNode,selectionObject.anchorOffset);
userSelection.setEnd(selectionObject.focusNode, selectionObject.focusOffset);
userSelectionText = userSelection.toString();
}
}
else if (document.selection) {
selectionObject = document.selection.createRange();
userSelection = document.createElement("DIV");
userSelection.innerHTML = selectionObject.htmlText;
userSelectionText = selectionObject.text;
}
else {
userSelection = false;
}
} catch(err) {
userSelection = false;
}
What can i use in place of "try" and "catch" of code above to convert to jquery ?
Thanks...