1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-07-26 16:45:12 -04:00

Merge with git+ssh://pasky.or.cz/srv/git/elinks.git

This commit is contained in:
Witold Filipczyk 2006-10-21 13:55:45 +02:00 committed by Witold Filipczyk
commit c87186e156
8 changed files with 70 additions and 12 deletions

View File

@ -74,7 +74,7 @@ function block_pr0n(uri) {
return "";
}
return true;
return uri;
}
elinks.follow_url_hooks.push(block_pr0n);

30
contrib/smjs/pornotube.js Normal file
View File

@ -0,0 +1,30 @@
/* Play videos at pornotube.com with minimal niggling. Just follow the link
* from the front page or the search page, and the video will automatically
* be loaded. */
function pornotube_callback(cached) {
var user_re = /\<user_id\>(\d+)\<\/user_id\>/;
var media_re = /\<media_id\>(\d+)\<\/media_id\>/;
var user = cached.content.match(user_re)[1];
var media = cached.content.match(media_re)[1];
var uri = "http://video.pornotube.com/" + user + "/" + media + ".flv";
elinks.location = uri;
}
function load_pornotube(cached, vs) {
if (!cached.uri.match(/^http:\/\/(?:www\.)?pornotube\.com\/media\.php/))
return true;
var re = /SWFObject\("player\/v\.swf\?v=(.*?)"/;
var hash = cached.content.match(re)[1];
var uri = "http://www.pornotube.com/player/player.php?" + hash;
elinks.load_uri(uri, pornotube_callback);
return true;
}
elinks.preformat_html_hooks.push(load_pornotube);

27
contrib/smjs/youtube.js Normal file
View File

@ -0,0 +1,27 @@
/* Play videos at YouTube with minimal niggling. Just load the page for a video,
* and the video will automatically be loaded. */
function load_youtube(cached, vs) {
if (!cached.uri.match(/http:\/\/(?:www\.)?youtube\.com\/(?:watch(?:\.php)?)?\?v=(?:[^&]+).*/))
return true;
var params_match = cached.content.match(/player2\.swf\?([^"]+)"/);
if (!params_match) return true;
var url = 'http://www.youtube.com/get_video?' + params_match[1];
var meta = '<meta http-equiv="refresh" content="1; url=' + url + '" />';
cached.content = cached.content.replace(/<head>/, "<head>" + meta);
return true;
}
elinks.preformat_html_hooks.push(load_youtube);
/* When one tries to follow a link to <http://www.youtube.com/v/foo>,
* redirect to <http://www.youtube.com/watch?v=foo>, which has the information
* that is necessary to get the actual video file. */
function redirect_embedded_youtube(uri) {
var uri_match = uri.match(/http:\/\/(?:www\.)?youtube\.com\/v\/([^&]+).*/);
if (!uri_match) return true;
return 'http://www.youtube.com/watch?v=' + uri_match[1];
}
elinks.follow_url_hooks.push(redirect_embedded_youtube);

View File

@ -474,7 +474,8 @@ check_dialog(struct dialog_data *dlg_data)
continue;
if (widget_data->widget->handler &&
widget_data->widget->handler(dlg_data, widget_data)) {
widget_data->widget->handler(dlg_data, widget_data)
== EVENT_NOT_PROCESSED) {
select_widget(dlg_data, widget_data);
redraw_dialog(dlg_data, 0);
return 1;

View File

@ -383,6 +383,7 @@ tree_dup(struct option *opt, struct option *template)
struct option *new_opt = copy_option(option);
if (!new_opt) continue;
object_nolock(new_opt, "option");
add_to_list_end(*new, new_opt);
new_opt->root = opt;

View File

@ -285,7 +285,7 @@ shrink_format_cache(int whole)
assertm(format_cache_entries >= 0, "format_cache_entries underflow on entry");
if_assert_failed format_cache_entries = 0;
foreachback (document, format_cache) {
foreachbacksafe (document, next, format_cache) {
if (is_object_used(document)) continue;
/* If we are not purging the whole format cache, stop
@ -293,10 +293,7 @@ shrink_format_cache(int whole)
if (!whole && format_cache_entries <= format_cache_size)
break;
/* Jump back to already processed entry (or list head), and let
* the foreachback move it to the next entry to go. */
document = document->next;
done_document(document->prev);
done_document(document);
format_cache_entries--;
}

View File

@ -159,7 +159,7 @@ do_real_lookup(unsigned char *name, struct sockaddr_storage **addrs, int *addrno
memset(&hint, 0, sizeof(hint));
hint.ai_family = AF_UNSPEC;
hint.ai_socktype = SOCK_STREAM;
if (getaddrinfo(name, NULL, &hint, &ai) != 0) return -1;
if (getaddrinfo(name, NULL, &hint, &ai) != 0) return DNS_ERROR;
#else
/* Seems there are problems on Mac, so we first need to try
@ -386,7 +386,7 @@ do_queued_lookup(struct dnsquery *query)
assertm(!dns_queue->next_in_queue, "DNS queue corrupted");
dns_queue->next_in_queue = query;
dns_queue = query;
return -1;
return DNS_ERROR;
}
dns_queue = query;
@ -512,7 +512,7 @@ kill_dns_request(void **queryref)
assert(query);
query->done = NULL;
done_dns_lookup(query, -1);
done_dns_lookup(query, DNS_ERROR);
}
void

View File

@ -360,14 +360,16 @@ handle_interlink_event(struct terminal *term, struct interlink_event *ilev)
}
}
if (key < 0x80 || key > 0xFF || !utf8_io) {
/* Note: We know that key <= 0xFF. */
if (key < 0x80 || !utf8_io) {
/* This byte is not part of a multibyte character
* encoding: either it is outside of the ranges for
* UTF-8 start and continuation bytes or UTF-8 I/O mode
* is disabled. */
#ifdef CONFIG_UTF8
if (key >= 0 && key <= 0xFF && !utf8_io) {
if (key >= 0 && !utf8_io) {
/* Not special and UTF-8 mode is disabled:
* recode from the terminal charset to UCS-4. */