Fix posting unicode characters to scuttle

This commit is contained in:
Tom Willemse 2015-01-20 14:25:16 +01:00
parent fac5beab6b
commit 4a1f8b915c

View file

@ -52,22 +52,26 @@ interactive("scuttle-post",
function (I) { function (I) {
check_buffer(I.buffer, content_buffer); check_buffer(I.buffer, content_buffer);
let posturl = 'https://ryuslash.org/scuttle/api/posts_add.php?&url=' + let posturl = 'https://ryuslash.org/scuttle/api/posts_add.php?&url=' +
encodeURIComponent( escape(load_spec_uri_string(load_spec(I.buffer.top_frame))) +
load_spec_uri_string(
load_spec(I.buffer.top_frame))) +
'&description=' + '&description=' +
encodeURIComponent( escape((
yield I.minibuffer.read( yield I.minibuffer.read(
$prompt = "name (required): ", $prompt = "name (required): ",
$initial_value = I.buffer.title)) + $initial_value = I.buffer.title
)
)) +
'&tags=' + '&tags=' +
encodeURIComponent( escape((
yield I.minibuffer.read( yield I.minibuffer.read(
$prompt = "tags (space delimited): ")) + $prompt = "tags (space delimited): "
)
)) +
'&extended=' + '&extended=' +
encodeURIComponent( escape((
yield I.minibuffer.read( yield I.minibuffer.read(
$prompt = "extended description: ")); $prompt = "extended description: "
)
));
try { try {
var content = yield send_http_request( var content = yield send_http_request(
@ -90,20 +94,26 @@ interactive("scuttle-post-link",
load_spec(encodeURIComponent(bo))); load_spec(encodeURIComponent(bo)));
check_buffer(I.buffer, content_buffer); check_buffer(I.buffer, content_buffer);
let postlinkurl = 'https://ryuslash.org/scuttle/api/posts_add.php?&url=' + let postlinkurl = 'https://ryuslash.org/scuttle/api/posts_add.php?&url=' +
mylink + mylink +
'&description=' + '&description=' +
encodeURIComponent( escape((
yield I.minibuffer.read( yield I.minibuffer.read(
$prompt = "name (required): ", $prompt = "name (required): ",
$initial_value = bo.textContent)) + $initial_value = bo.textContent
'&tags=' + )
encodeURIComponent( )) +
yield I.minibuffer.read( '&tags=' +
$prompt = "tags (space delimited): ")) + escape((
'&extended=' + yield I.minibuffer.read(
encodeURIComponent( $prompt = "tags (space delimited): "
yield I.minibuffer.read( )
$prompt = "extended description: ")); )) +
'&extended=' +
escape((
yield I.minibuffer.read(
$prompt = "extended description: "
)
));
try { try {
var content = yield send_http_request( var content = yield send_http_request(