pinboard-elinks

Check-in [ce00796b89]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Minor change - keybinding for read later

Realised it was conflicting with redrawing the elinks window.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256: ce00796b8971157b9a7868c0f8c08aeb9bed8966ec0dd1ae6881b754ea64e6a3
User & Date: base@atomicules.co.uk 2014-03-07 10:12:27
Context
2014-03-07
10:13
Merge branch 'master' of github.com:atomicules/pinboard-elinks check-in: d04a0af032 user: base@atomicules.co.uk tags: master, trunk
10:12
Minor change - keybinding for read later

Realised it was conflicting with redrawing the elinks window. check-in: ce00796b89 user: base@atomicules.co.uk tags: master, trunk

2013-06-21
08:56
It wasn't an off by one error, think was rounding error instead

*think*. Still don't know for sure. Perhaps was a different in Lua
versions after all. check-in: fc0e0c9425 user: atomicules@lavabit.com tags: master, trunk

Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to README.markdown.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Pinboard Lua Script for ELinks

Adds the following functionality to ELinks:

- "CTRL+p" Adds current page to Pinboard, with dialog box for description and tags
- "CTRL+l" Adds current page to Pinboard and marks as "Read Later"
- Reformats the mobile site to be better for ELinks (Adds working edit/delete links)

Javascript support in ELinks is a bit lacking (it's never worked well for me anyway) so it's not possible to use the Pinboard bookmarklets. Lua support in ELinks is much better, so this script does what the bookmarklets would do, but via lua. Since CSS support in ELinks is also a bit lacking - there's a lot of cruft on the Pinboard mobile sight in ELinks (stuff that's set as `display: none`, etc) - this script also cleans that up. The Pinboard edit and delete links won't work in ELinks because of javascript again, so this script generates replacement ones: Editing is done by "saving" the bookmark again, since the add page works fine; Deleting is done via the AP, since it is immediately destructive the delete link is only visible on the individual bookmark page, not when browsing through a list of bookmarks.

##Installation

Source from your `~/.elinks/hooks.lua` file with `dofile("pinboard.lua")`
If you want to be able to delete bookmarks on Pinboard then you need to add in your auth\_token to a `~/.netrc` file in the following format:

	machine pinboard.in
		login <Your pinboard login name>
		password <Your pinboard API token>

##Notes

Developed and tested with ELinks 0.12pre5 and Lua 5.0 (both of which are well out of date, but if it works there it should work with if you are building from the repository master and using Lua 5.1, etc; and if it doesn't since you are clever enough to build yourself I'm sure you can adapt the scripts as necessary). 

##Extras

Rather than use Lua to hijack the goto\_url box, just add the following to `~/.elinks/elinks.conf` to search your Pinboard bookmarks using a `p` prefix:

	set protocol.rewrite.smart.p = "https://m.pinboard.in/search/?mine=1&query=%s"

##Todo

- Considered always redirecting to mobile site, but conflicted with saving the actual bookmark, so not doing for now.
- Tab sets would be cool, but don't think there is anyway to get list of open tabs via Lua interface? Perhaps read session snapshot from bookmarks file? Hmmm... but then still think I'd need a Pinboard API method to actually save them.





|















|











1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Pinboard Lua Script for ELinks

Adds the following functionality to ELinks:

- "CTRL+p" Adds current page to Pinboard, with dialog box for description and tags
- "CTRL+o" Adds current page to Pinboard and marks as "Read Later"
- Reformats the mobile site to be better for ELinks (Adds working edit/delete links)

Javascript support in ELinks is a bit lacking (it's never worked well for me anyway) so it's not possible to use the Pinboard bookmarklets. Lua support in ELinks is much better, so this script does what the bookmarklets would do, but via lua. Since CSS support in ELinks is also a bit lacking - there's a lot of cruft on the Pinboard mobile sight in ELinks (stuff that's set as `display: none`, etc) - this script also cleans that up. The Pinboard edit and delete links won't work in ELinks because of javascript again, so this script generates replacement ones: Editing is done by "saving" the bookmark again, since the add page works fine; Deleting is done via the AP, since it is immediately destructive the delete link is only visible on the individual bookmark page, not when browsing through a list of bookmarks.

##Installation

Source from your `~/.elinks/hooks.lua` file with `dofile("pinboard.lua")`
If you want to be able to delete bookmarks on Pinboard then you need to add in your auth\_token to a `~/.netrc` file in the following format:

	machine pinboard.in
		login <Your pinboard login name>
		password <Your pinboard API token>

##Notes

Developed and tested with ELinks 0.12pre6 and Lua 5.1.4.

##Extras

Rather than use Lua to hijack the goto\_url box, just add the following to `~/.elinks/elinks.conf` to search your Pinboard bookmarks using a `p` prefix:

	set protocol.rewrite.smart.p = "https://m.pinboard.in/search/?mine=1&query=%s"

##Todo

- Considered always redirecting to mobile site, but conflicted with saving the actual bookmark, so not doing for now.
- Tab sets would be cool, but don't think there is anyway to get list of open tabs via Lua interface? Perhaps read session snapshot from bookmarks file? Hmmm... but then still think I'd need a Pinboard API method to actually save them.

Changes to pinboard.lua.

1
2
3
4
5
6
7
8
9
10
11
12
--Pinboard tools for ELinks
--source from your ~/.elinks/hooks.lua file with `dofile("pinboard.lua")`

--CTRL+p to save a bookmark. Brings up an XDialog, first row is to enter a description, second row is for tags
--CTRL+l to read later. 
--Reformats the mobile site to be better for ELinks

--In order to be able to delete need to enter auth_token in `.netrc`. See README
local pb_base = 'https://pinboard.in/add?'
local pb_url

function addto_pinboard (description, tags)




|







1
2
3
4
5
6
7
8
9
10
11
12
--Pinboard tools for ELinks
--source from your ~/.elinks/hooks.lua file with `dofile("pinboard.lua")`

--CTRL+p to save a bookmark. Brings up an XDialog, first row is to enter a description, second row is for tags
--CTRL+o to read later (It's next to p. You try and find a none conflicting keyboard shortcut in Elinks)
--Reformats the mobile site to be better for ELinks

--In order to be able to delete need to enter auth_token in `.netrc`. See README
local pb_base = 'https://pinboard.in/add?'
local pb_url

function addto_pinboard (description, tags)
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
		end)
	end)


function readlater_pinboard ()
	local url = current_url ()
	local title = current_title ()
	local doc_url = pb_base..'later=yes&next=same&noui=yes&jump=close&url='..escape (url)..'&title='..escape (title)..' ','Pinboard','toolbar=no,width=100,height=100';
	--Uses &next=same to immediately return to page being bookmarked
    return doc_url
end
	bind_key ("main", "Ctrl-l",
		function () return "goto_url", readlater_pinboard () end)


function pre_format_html_hook (url, html)
	--strip stuff that shouldnae be displayed anyway
	if string.find(url, "://m.pinboard.in") then
		pb_url = url --since can't pass additional args to new_edit_link







|



|







23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
		end)
	end)


function readlater_pinboard ()
	local url = current_url ()
	local title = current_title ()
	local doc_url = pb_base..'later=yes&next=same&noui=yes&jump=close&url='..escape (url)..'&title='..escape (title);
	--Uses &next=same to immediately return to page being bookmarked
    return doc_url
end
	bind_key ("main", "Ctrl-o",
		function () return "goto_url", readlater_pinboard () end)


function pre_format_html_hook (url, html)
	--strip stuff that shouldnae be displayed anyway
	if string.find(url, "://m.pinboard.in") then
		pb_url = url --since can't pass additional args to new_edit_link