4 ms·
Good point. https://en.wikipedia.org/wiki/Nelson_Mandela#aHRtbCA%2BIGJvZHkubWVkaWF3aWtpLmx0ci5zaXRlZGlyLWx0ci5tdy1oaWRlLWVtcHR5LWVsdC5ucy0wLm5zLXN1YmplY3QucGFnZ
by Rumperuu 8y ago
Good point. https://en.wikipedia.org/wiki/Nelson_Mandela#aHRtbCA%2BIGJvZHkubWVkaWF3aWtpLmx0ci5zaXRlZGlyLWx0ci5tdy1oaWRlLWVtcHR5LWVsdC5ucy0wLm5zLXN1YmplY3QucGFnZS1OZWxzb25fTWFuZGVsYS5yb290cGFnZS1OZWxzb25fTWFuZGVsYS5za2luLXZlY3Rvci5hY3Rpb24tdmlldyA%2BIGRpdiNjb250ZW50ID4gZGl2I2JvZHlDb250ZW50ID4gZGl2I213LWNvbnRlbnQtdGV4dCA%2BIGRpdi5tdy1wYXJzZXItb3V0cHV0ID4gcDpudGgtb2YtdHlwZSgzKQ%3D%3D https://en.wikipedia.org/wiki/Nelson_Mandela#aHRtbCA%2BIGJvZ...
(I wasn't kidding about needing to shorten those links.)
- yorwba 8y agoShorter link that still works with your addon: https://en.wikipedia.org/wiki/Nelson_Mandela#cDpudGgtb2YtdHlwZSgzKQ== https://en.wikipedia.org/wiki/Nelson_Mandela#cDpudGgtb2YtdHl... I simply tried to find a suffix of the path that still identifies the element uniquely. Turns out that p:nth-of-type(3) is good enough already. If you want to be a bit more robust to changes on the page, you could also search for the last element with an ID in the path, i.e. #mw-content-text > div.mw-parser-output > p:nth-of-type(3).
- deleted 8y ago[deleted]
- dmortin 8y agoIt kind of defeats the point that you need the extension to view the generated links. You may want to add an option to select only from the anchors/ids from the page to generate links which work in any browser. Though there may already be an extension for this.
- Rumperuu 8y agoIf you mean what I think you mean, you can already send a link that specifies a valid element ID on the page to anybody and have their browser focus on it — that's what fragment identifiers are for. However, if the page designer has neglected to provide a unique ID for each page element (and they probably have), you're out of luck. Ideally, you'd be able to specify any valid CSS selector that only selects one element as a fragment identifier, but that's not the case (and is basically what this extension makes possible).
- supermdguy 8y agoCypress (the testing framework) has a way to get a short, unique selector for any element on a page. It's even in its own npm package: https://www.npmjs.com/package/@cypress/unique-selector https://www.npmjs.com/package/@cypress/unique-selector
- idbehold 8y agoWould an XPath work for this? Seems like that would be easiest considering Firefox already has built-in support for getting the XPath from an element on the page.