MyBB Community Forums

Full Version: Trying convert quickquote plugin to jquery
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Trying convert Thread.quickquote.js of plugin quickquote (http://mods.mybb.com/view/quickquote ) to jquery...
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...