Artifact 0b04b1e4ed40e8c909143a74c0c83f10b379bfe29ca9367c32b0456511bf056b:
- File
README.markdown
— part of check-in
[ce00796b89]
at
2014-03-07 10:12:27
on branch master
— Minor change - keybinding for read later
Realised it was conflicting with redrawing the elinks window. (user: base@atomicules.co.uk size: 2136)
0000: 23 20 50 69 6e 62 6f 61 72 64 20 4c 75 61 20 53 # Pinboard Lua S
0010: 63 72 69 70 74 20 66 6f 72 20 45 4c 69 6e 6b 73 cript for ELinks
0020: 0a 0a 41 64 64 73 20 74 68 65 20 66 6f 6c 6c 6f ..Adds the follo
0030: 77 69 6e 67 20 66 75 6e 63 74 69 6f 6e 61 6c 69 wing functionali
0040: 74 79 20 74 6f 20 45 4c 69 6e 6b 73 3a 0a 0a 2d ty to ELinks:..-
0050: 20 22 43 54 52 4c 2b 70 22 20 41 64 64 73 20 63 "CTRL+p" Adds c
0060: 75 72 72 65 6e 74 20 70 61 67 65 20 74 6f 20 50 urrent page to P
0070: 69 6e 62 6f 61 72 64 2c 20 77 69 74 68 20 64 69 inboard, with di
0080: 61 6c 6f 67 20 62 6f 78 20 66 6f 72 20 64 65 73 alog box for des
0090: 63 72 69 70 74 69 6f 6e 20 61 6e 64 20 74 61 67 cription and tag
00a0: 73 0a 2d 20 22 43 54 52 4c 2b 6f 22 20 41 64 64 s.- "CTRL+o" Add
00b0: 73 20 63 75 72 72 65 6e 74 20 70 61 67 65 20 74 s current page t
00c0: 6f 20 50 69 6e 62 6f 61 72 64 20 61 6e 64 20 6d o Pinboard and m
00d0: 61 72 6b 73 20 61 73 20 22 52 65 61 64 20 4c 61 arks as "Read La
00e0: 74 65 72 22 0a 2d 20 52 65 66 6f 72 6d 61 74 73 ter".- Reformats
00f0: 20 74 68 65 20 6d 6f 62 69 6c 65 20 73 69 74 65 the mobile site
0100: 20 74 6f 20 62 65 20 62 65 74 74 65 72 20 66 6f to be better fo
0110: 72 20 45 4c 69 6e 6b 73 20 28 41 64 64 73 20 77 r ELinks (Adds w
0120: 6f 72 6b 69 6e 67 20 65 64 69 74 2f 64 65 6c 65 orking edit/dele
0130: 74 65 20 6c 69 6e 6b 73 29 0a 0a 4a 61 76 61 73 te links)..Javas
0140: 63 72 69 70 74 20 73 75 70 70 6f 72 74 20 69 6e cript support in
0150: 20 45 4c 69 6e 6b 73 20 69 73 20 61 20 62 69 74 ELinks is a bit
0160: 20 6c 61 63 6b 69 6e 67 20 28 69 74 27 73 20 6e lacking (it's n
0170: 65 76 65 72 20 77 6f 72 6b 65 64 20 77 65 6c 6c ever worked well
0180: 20 66 6f 72 20 6d 65 20 61 6e 79 77 61 79 29 20 for me anyway)
0190: 73 6f 20 69 74 27 73 20 6e 6f 74 20 70 6f 73 73 so it's not poss
01a0: 69 62 6c 65 20 74 6f 20 75 73 65 20 74 68 65 20 ible to use the
01b0: 50 69 6e 62 6f 61 72 64 20 62 6f 6f 6b 6d 61 72 Pinboard bookmar
01c0: 6b 6c 65 74 73 2e 20 4c 75 61 20 73 75 70 70 6f klets. Lua suppo
01d0: 72 74 20 69 6e 20 45 4c 69 6e 6b 73 20 69 73 20 rt in ELinks is
01e0: 6d 75 63 68 20 62 65 74 74 65 72 2c 20 73 6f 20 much better, so
01f0: 74 68 69 73 20 73 63 72 69 70 74 20 64 6f 65 73 this script does
0200: 20 77 68 61 74 20 74 68 65 20 62 6f 6f 6b 6d 61 what the bookma
0210: 72 6b 6c 65 74 73 20 77 6f 75 6c 64 20 64 6f 2c rklets would do,
0220: 20 62 75 74 20 76 69 61 20 6c 75 61 2e 20 53 69 but via lua. Si
0230: 6e 63 65 20 43 53 53 20 73 75 70 70 6f 72 74 20 nce CSS support
0240: 69 6e 20 45 4c 69 6e 6b 73 20 69 73 20 61 6c 73 in ELinks is als
0250: 6f 20 61 20 62 69 74 20 6c 61 63 6b 69 6e 67 20 o a bit lacking
0260: 2d 20 74 68 65 72 65 27 73 20 61 20 6c 6f 74 20 - there's a lot
0270: 6f 66 20 63 72 75 66 74 20 6f 6e 20 74 68 65 20 of cruft on the
0280: 50 69 6e 62 6f 61 72 64 20 6d 6f 62 69 6c 65 20 Pinboard mobile
0290: 73 69 67 68 74 20 69 6e 20 45 4c 69 6e 6b 73 20 sight in ELinks
02a0: 28 73 74 75 66 66 20 74 68 61 74 27 73 20 73 65 (stuff that's se
02b0: 74 20 61 73 20 60 64 69 73 70 6c 61 79 3a 20 6e t as `display: n
02c0: 6f 6e 65 60 2c 20 65 74 63 29 20 2d 20 74 68 69 one`, etc) - thi
02d0: 73 20 73 63 72 69 70 74 20 61 6c 73 6f 20 63 6c s script also cl
02e0: 65 61 6e 73 20 74 68 61 74 20 75 70 2e 20 54 68 eans that up. Th
02f0: 65 20 50 69 6e 62 6f 61 72 64 20 65 64 69 74 20 e Pinboard edit
0300: 61 6e 64 20 64 65 6c 65 74 65 20 6c 69 6e 6b 73 and delete links
0310: 20 77 6f 6e 27 74 20 77 6f 72 6b 20 69 6e 20 45 won't work in E
0320: 4c 69 6e 6b 73 20 62 65 63 61 75 73 65 20 6f 66 Links because of
0330: 20 6a 61 76 61 73 63 72 69 70 74 20 61 67 61 69 javascript agai
0340: 6e 2c 20 73 6f 20 74 68 69 73 20 73 63 72 69 70 n, so this scrip
0350: 74 20 67 65 6e 65 72 61 74 65 73 20 72 65 70 6c t generates repl
0360: 61 63 65 6d 65 6e 74 20 6f 6e 65 73 3a 20 45 64 acement ones: Ed
0370: 69 74 69 6e 67 20 69 73 20 64 6f 6e 65 20 62 79 iting is done by
0380: 20 22 73 61 76 69 6e 67 22 20 74 68 65 20 62 6f "saving" the bo
0390: 6f 6b 6d 61 72 6b 20 61 67 61 69 6e 2c 20 73 69 okmark again, si
03a0: 6e 63 65 20 74 68 65 20 61 64 64 20 70 61 67 65 nce the add page
03b0: 20 77 6f 72 6b 73 20 66 69 6e 65 3b 20 44 65 6c works fine; Del
03c0: 65 74 69 6e 67 20 69 73 20 64 6f 6e 65 20 76 69 eting is done vi
03d0: 61 20 74 68 65 20 41 50 2c 20 73 69 6e 63 65 20 a the AP, since
03e0: 69 74 20 69 73 20 69 6d 6d 65 64 69 61 74 65 6c it is immediatel
03f0: 79 20 64 65 73 74 72 75 63 74 69 76 65 20 74 68 y destructive th
0400: 65 20 64 65 6c 65 74 65 20 6c 69 6e 6b 20 69 73 e delete link is
0410: 20 6f 6e 6c 79 20 76 69 73 69 62 6c 65 20 6f 6e only visible on
0420: 20 74 68 65 20 69 6e 64 69 76 69 64 75 61 6c 20 the individual
0430: 62 6f 6f 6b 6d 61 72 6b 20 70 61 67 65 2c 20 6e bookmark page, n
0440: 6f 74 20 77 68 65 6e 20 62 72 6f 77 73 69 6e 67 ot when browsing
0450: 20 74 68 72 6f 75 67 68 20 61 20 6c 69 73 74 20 through a list
0460: 6f 66 20 62 6f 6f 6b 6d 61 72 6b 73 2e 0a 0a 23 of bookmarks...#
0470: 23 49 6e 73 74 61 6c 6c 61 74 69 6f 6e 0a 0a 53 #Installation..S
0480: 6f 75 72 63 65 20 66 72 6f 6d 20 79 6f 75 72 20 ource from your
0490: 60 7e 2f 2e 65 6c 69 6e 6b 73 2f 68 6f 6f 6b 73 `~/.elinks/hooks
04a0: 2e 6c 75 61 60 20 66 69 6c 65 20 77 69 74 68 20 .lua` file with
04b0: 60 64 6f 66 69 6c 65 28 22 70 69 6e 62 6f 61 72 `dofile("pinboar
04c0: 64 2e 6c 75 61 22 29 60 0a 49 66 20 79 6f 75 20 d.lua")`.If you
04d0: 77 61 6e 74 20 74 6f 20 62 65 20 61 62 6c 65 20 want to be able
04e0: 74 6f 20 64 65 6c 65 74 65 20 62 6f 6f 6b 6d 61 to delete bookma
04f0: 72 6b 73 20 6f 6e 20 50 69 6e 62 6f 61 72 64 20 rks on Pinboard
0500: 74 68 65 6e 20 79 6f 75 20 6e 65 65 64 20 74 6f then you need to
0510: 20 61 64 64 20 69 6e 20 79 6f 75 72 20 61 75 74 add in your aut
0520: 68 5c 5f 74 6f 6b 65 6e 20 74 6f 20 61 20 60 7e h\_token to a `~
0530: 2f 2e 6e 65 74 72 63 60 20 66 69 6c 65 20 69 6e /.netrc` file in
0540: 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 66 the following f
0550: 6f 72 6d 61 74 3a 0a 0a 09 6d 61 63 68 69 6e 65 ormat:...machine
0560: 20 70 69 6e 62 6f 61 72 64 2e 69 6e 0a 09 09 6c pinboard.in...l
0570: 6f 67 69 6e 20 3c 59 6f 75 72 20 70 69 6e 62 6f ogin <Your pinbo
0580: 61 72 64 20 6c 6f 67 69 6e 20 6e 61 6d 65 3e 0a ard login name>.
0590: 09 09 70 61 73 73 77 6f 72 64 20 3c 59 6f 75 72 ..password <Your
05a0: 20 70 69 6e 62 6f 61 72 64 20 41 50 49 20 74 6f pinboard API to
05b0: 6b 65 6e 3e 0a 0a 23 23 4e 6f 74 65 73 0a 0a 44 ken>..##Notes..D
05c0: 65 76 65 6c 6f 70 65 64 20 61 6e 64 20 74 65 73 eveloped and tes
05d0: 74 65 64 20 77 69 74 68 20 45 4c 69 6e 6b 73 20 ted with ELinks
05e0: 30 2e 31 32 70 72 65 36 20 61 6e 64 20 4c 75 61 0.12pre6 and Lua
05f0: 20 35 2e 31 2e 34 2e 0a 0a 23 23 45 78 74 72 61 5.1.4...##Extra
0600: 73 0a 0a 52 61 74 68 65 72 20 74 68 61 6e 20 75 s..Rather than u
0610: 73 65 20 4c 75 61 20 74 6f 20 68 69 6a 61 63 6b se Lua to hijack
0620: 20 74 68 65 20 67 6f 74 6f 5c 5f 75 72 6c 20 62 the goto\_url b
0630: 6f 78 2c 20 6a 75 73 74 20 61 64 64 20 74 68 65 ox, just add the
0640: 20 66 6f 6c 6c 6f 77 69 6e 67 20 74 6f 20 60 7e following to `~
0650: 2f 2e 65 6c 69 6e 6b 73 2f 65 6c 69 6e 6b 73 2e /.elinks/elinks.
0660: 63 6f 6e 66 60 20 74 6f 20 73 65 61 72 63 68 20 conf` to search
0670: 79 6f 75 72 20 50 69 6e 62 6f 61 72 64 20 62 6f your Pinboard bo
0680: 6f 6b 6d 61 72 6b 73 20 75 73 69 6e 67 20 61 20 okmarks using a
0690: 60 70 60 20 70 72 65 66 69 78 3a 0a 0a 09 73 65 `p` prefix:...se
06a0: 74 20 70 72 6f 74 6f 63 6f 6c 2e 72 65 77 72 69 t protocol.rewri
06b0: 74 65 2e 73 6d 61 72 74 2e 70 20 3d 20 22 68 74 te.smart.p = "ht
06c0: 74 70 73 3a 2f 2f 6d 2e 70 69 6e 62 6f 61 72 64 tps://m.pinboard
06d0: 2e 69 6e 2f 73 65 61 72 63 68 2f 3f 6d 69 6e 65 .in/search/?mine
06e0: 3d 31 26 71 75 65 72 79 3d 25 73 22 0a 0a 23 23 =1&query=%s"..##
06f0: 54 6f 64 6f 0a 0a 2d 20 43 6f 6e 73 69 64 65 72 Todo..- Consider
0700: 65 64 20 61 6c 77 61 79 73 20 72 65 64 69 72 65 ed always redire
0710: 63 74 69 6e 67 20 74 6f 20 6d 6f 62 69 6c 65 20 cting to mobile
0720: 73 69 74 65 2c 20 62 75 74 20 63 6f 6e 66 6c 69 site, but confli
0730: 63 74 65 64 20 77 69 74 68 20 73 61 76 69 6e 67 cted with saving
0740: 20 74 68 65 20 61 63 74 75 61 6c 20 62 6f 6f 6b the actual book
0750: 6d 61 72 6b 2c 20 73 6f 20 6e 6f 74 20 64 6f 69 mark, so not doi
0760: 6e 67 20 66 6f 72 20 6e 6f 77 2e 0a 2d 20 54 61 ng for now..- Ta
0770: 62 20 73 65 74 73 20 77 6f 75 6c 64 20 62 65 20 b sets would be
0780: 63 6f 6f 6c 2c 20 62 75 74 20 64 6f 6e 27 74 20 cool, but don't
0790: 74 68 69 6e 6b 20 74 68 65 72 65 20 69 73 20 61 think there is a
07a0: 6e 79 77 61 79 20 74 6f 20 67 65 74 20 6c 69 73 nyway to get lis
07b0: 74 20 6f 66 20 6f 70 65 6e 20 74 61 62 73 20 76 t of open tabs v
07c0: 69 61 20 4c 75 61 20 69 6e 74 65 72 66 61 63 65 ia Lua interface
07d0: 3f 20 50 65 72 68 61 70 73 20 72 65 61 64 20 73 ? Perhaps read s
07e0: 65 73 73 69 6f 6e 20 73 6e 61 70 73 68 6f 74 20 ession snapshot
07f0: 66 72 6f 6d 20 62 6f 6f 6b 6d 61 72 6b 73 20 66 from bookmarks f
0800: 69 6c 65 3f 20 48 6d 6d 6d 2e 2e 2e 20 62 75 74 ile? Hmmm... but
0810: 20 74 68 65 6e 20 73 74 69 6c 6c 20 74 68 69 6e then still thin
0820: 6b 20 49 27 64 20 6e 65 65 64 20 61 20 50 69 6e k I'd need a Pin
0830: 62 6f 61 72 64 20 41 50 49 20 6d 65 74 68 6f 64 board API method
0840: 20 74 6f 20 61 63 74 75 61 6c 6c 79 20 73 61 76 to actually sav
0850: 65 20 74 68 65 6d 2e 0a e them..