Libraryless. Click here for Pure Java version (3346L/20K).
1 | // needs JQuery |
2 | sS hjs_handleOwnedClicks(S code default "") { |
3 | ret hjs(replaceDollarVars([[ |
4 | function handleOwnedClick(e) { |
5 | var link = $(e.target).closest("a[href], a[onclick]").get(); |
6 | if (link == null) return; |
7 | console.log("link: " + link); |
8 | var owner = $(link).closest("[data-owner]").get(); |
9 | if (owner == null) return; |
10 | console.log("owner: " + owner); |
11 | owner = $(owner).attr("data-owner"); |
12 | console.log("You clicked on link " + link + " owned by " + owner); |
13 | $code |
14 | } |
15 | |
16 | document.addEventListener("click", handleOwnedClick); |
17 | ]], code := unnull(code)); |
18 | } |
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
Snippet ID: | #1031444 |
Snippet name: | hjs_handleOwnedClicks [dev.] |
Eternal ID of this version: | #1031444/5 |
Text MD5: | 1e32ee2b93e697c7a866ec5601795b20 |
Transpilation MD5: | 7b5804442660a3845525cc84b8e866af |
Author: | stefan |
Category: | javax / javascript |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-06-14 02:51:12 |
Source code size: | 636 bytes / 18 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 145 / 239 |
Version history: | 4 change(s) |
Referenced in: | [show references] |