var tab_url = params.tab_url;
var doctitle = params.doctitle;

function getSelectionText() {
	var selected_text = 'none';
    if (window.getSelection) {
        selected_text = window.getSelection().toString();
	}
	return selected_text;
}

function getSelectionPrefix(selection) {
	var prefix = 'none';
    var base = window.getSelection().baseNode.textContent;
	var selection_starts_at = base.indexOf(selection);
	if (  (base.length - selection_starts_at) >= 30 )
		prefix = base.substring(selection_starts_at - 30, selection_starts_at);
	return prefix;
}

var selected_text = getSelectionText();
var prefix = getSelectionPrefix(selected_text);
var selected_range = document.getSelection().getRangeAt(0);
var position_selector = anchoring.TextPositionAnchor.fromRange(document.body, selected_range);
var quote_selector = anchoring.TextQuoteAnchor.fromRange(document.body, selected_range);

chrome.runtime.sendMessage(
	{
		action:'receive_selection',
		selected_text: selected_text,
		prefix: prefix,
		tab_url: tab_url,
		doctitle: doctitle,
		position_selector: position_selector,
		quote_selector: quote_selector,
	},
	function(data) {
		console.log(data);
	});



@@ -60,1109 +60,1005 @@
 e;%0A%0A
-function getSelectionText() %7B%0A%09var selected_text = 'none';%0A    if (window.getSelection) %7B%0A        selected_text = window.getSelection().toString();%0A%09%7D%0A%09return selected_text;%0A%7D%0A%0Afunction getSelectionPrefix(selection) %7B%0A%09var prefix = 'none';%0A    var base = window.getSelection().baseNode.textContent;%0A%09var selection_starts_at = base.indexOf(selection);%0A%09if (  (base.length - selection_starts_at) %3E= 30 )%0A%09%09prefix = base.substring(selection_starts_at - 30, selection_starts_at);%0A%09return prefix;%0A%7D%0A%0Avar selected_text = getSelectionText();%0Avar prefix = getSelectionPrefix(selected_text);%0Avar selected_range = document.getSelection().getRangeAt(0);%0Avar position_selector = anchoring.TextPositionAnchor.fromRange(document.body, selected_range);%0Avar quote_selector = anchoring.TextQuoteAnchor.fromRange(document.body, selected_range);%0A%0Achrome.runtime.sendMessage(%0A%09%7B%0A%09%09action:'receive_selection',%0A%09%09selected_text: selected_text,%0A%09%09prefix: prefix,%0A%09%09tab_url: tab_url,%0A%09%09doctitle: doctitle,%0A%09%09position_selector: position_selector,%0A%09%09quote_selector: quote_selector,%0A%09%7D,%0A%09function(data) %7B%0A%09%09console.log(data);%0A%09%7D);
+var selected_range = document.getSelection().getRangeAt(0);%0Avar position_selector = anchoring.TextPositionAnchor.fromRange(document.body, selected_range);%0Avar quote_selector = anchoring.TextQuoteAnchor.fromRange(document.body, selected_range);%0A%0Achrome.runtime.sendMessage(%0A%09%7B%0A%09%09action:'receive_selection',%0A%09%09tab_url: tab_url,%0A%09%09doctitle: doctitle,%0A%09%09position_selector: position_selector,%0A%09%09quote_selector: quote_selector,%0A%09%7D,%0A%09function(data) %7B%0A%09%09console.log(data);%0A%09%7D);%0A%0A/* use TextQuoteAnchor instead%0Afunction getSelectionText() %7B%0A%09var selected_text = 'none';%0A    if (window.getSelection) %7B%0A        selected_text = window.getSelection().toString();%0A%09%7D%0A%09return selected_text;%0A%7D%0A%0Afunction getSelectionPrefix(selection) %7B%0A%09var prefix = 'none';%0A    var base = window.getSelection().baseNode.textContent;%0A%09var selection_starts_at = base.indexOf(selection);%0A%09if (  (base.length - selection_starts_at) %3E= 30 )%0A%09%09prefix = base.substring(selection_starts_at - 30, selection_starts_at);%0A%09return prefix;%0A%7D%0A*/
 %0A%0A%0A

remove non-TextQuote-based machinery