pinboard-elinks

Check-in [c50d4e18be]
Login

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

Overview
Comment:Move todo comments to README
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256: c50d4e18beb1e8344a2d59f7d20649f65b6ac726983568eb71054988f0065539
User & Date: atomicules@lavabit.com 2012-12-16 13:29:20
Context
2012-12-16
23:11
Bug fix: Redirect back to original page after bookmarking check-in: 54472f67b0 user: atomicules@lavabit.com tags: master, trunk
13:29
Move todo comments to README check-in: c50d4e18be user: atomicules@lavabit.com tags: master, trunk
13:23
Add a replacement Edit button

Just "save" the bookmark again as a way of editing it that doesn't
require JavaScript check-in: b6e3ff3447 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

# Pinboard Lua Script for ELinks

Adds the following functionality to ELinks:

- "ALT+p" Adds current page to Pinboard, with dialog box for description and tags
- "ALT+l" Adds current page to Pinboard and marks as "Read Later"


##Installation

Source from your `~/.elinks/hooks.lua` file with `dofile("pinboard.lua")`

##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


See the notes at the bottom of the source code.







>

















>
|
>
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
# Pinboard Lua Script for ELinks

Adds the following functionality to ELinks:

- "ALT+p" Adds current page to Pinboard, with dialog box for description and tags
- "ALT+l" Adds current page to Pinboard and marks as "Read Later"
- Reformats the mobile site to be better for ELinks

##Installation

Source from your `~/.elinks/hooks.lua` file with `dofile("pinboard.lua")`

##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.
- See if there is anyway can enable deleting bookmarks.
- 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...

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")`

--ALT+p to save a bookmark. Brings up an XDialog, first row is to enter a description, second row is for tags
--ALT+l to read later. 



function addto_pinboard (description, tags)
	pinboardBase = 'https://pinboard.in/add?'
	url = current_url ()
	title = current_title ()
	docURL = pinboardBase..'url='..escape (url)..'&title='..escape (title)..'&description='..escape (description)..'&tags='..escape (tags)..' ','Pinboard','toolbar=no,width=700,height=350';





>







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

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


function addto_pinboard (description, tags)
	pinboardBase = 'https://pinboard.in/add?'
	url = current_url ()
	title = current_title ()
	docURL = pinboardBase..'url='..escape (url)..'&title='..escape (title)..'&description='..escape (description)..'&tags='..escape (tags)..' ','Pinboard','toolbar=no,width=700,height=350';
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
    return '%'..hx (string.byte (c) / 16)..hx (math.mod(string.byte (c), 16))
end

function escape (str)
    return string.gsub (str, "(%W)", char2hex)
end
--end stealing


--Todo and Ideas
--==============

--Always redirect to mobile site? But this conflicts with the actual bookmarking up above. So maybe not!
--[[
function follow_url_hook(url)
	if string.find(url, "://pinboard.in") then
		return "http://m.pinboard.in"
	else
		return url
	end
end
--]]

--Re-format the mobile site and see if can add Lua implementatons for deleting, editing bookmarks. For deleting just need to make a POST. If can't do this in browser could do it in Curl, via Lua.

--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...







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
73
74
75
76
77
78
79



















    return '%'..hx (string.byte (c) / 16)..hx (math.mod(string.byte (c), 16))
end

function escape (str)
    return string.gsub (str, "(%W)", char2hex)
end
--end stealing