From 8456151c3484736c47a429f3976711f34f27a555 Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Wed, 30 Jan 2013 15:17:18 +0100 Subject: [PATCH] Add and fix some information --- README.md | 2 ++ scraperscript.js | 27 +++++++-------------------- 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 8275490..825ed5c 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,8 @@ A simple bookmarklet that lets you click any element in a page and returns the s **How to make it stop killing my input:** Just click the X in the ScraperScript bar. ScraperScript will release your input. +**How to develop:** Modify the bookmarklet to point at a scraperscript.js that is hosted locally. It's loaded with a cachebuster, so you can simply use the same bookmarklet every time you change the local code. + Known bugs: * On certain kinds of elements (some submit buttons, some elements with click events), ScraperScript can't prevent the attached event from happening. I'm unsure what causes this. diff --git a/scraperscript.js b/scraperscript.js index 9e68263..8406c1a 100644 --- a/scraperscript.js +++ b/scraperscript.js @@ -1,3 +1,4 @@ +/* Load jQuery */ _jquery_script=document.createElement("SCRIPT"); _jquery_script.type="text/javascript"; _jquery_script.src="http://cryto.net/scraperscript/jquery.js"; @@ -124,26 +125,12 @@ function _jquery_done() /* We *still* haven't figured out a unique way to select the element. - * Last resort: nth-child. */ - - /*if(least_sibling_class) - { - var sibling_source = parent.children(node_name + "." + least_sibling_class.name); - node_index = sibling_source.index(real_node) + 1; - node_stack.push({name: node_name, class: least_sibling_class.name, index: node_index}); - node = parent; - continue; - } - else - {*/ - var sibling_source = parent.children(node_name); - node_index = sibling_source.index(real_node) + 1; - node_stack.push({name: node_name, index: node_index}); - node = parent; - continue; - /*}*/ - - /* name += ':nth-child(' + index + ')'; */ + * Last resort: nth-of-type. */ + var sibling_source = parent.children(node_name); + node_index = sibling_source.index(real_node) + 1; + node_stack.push({name: node_name, index: node_index}); + node = parent; + continue; } /* Check if it is indeed unique. */