1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-27 02:56:18 -04:00

[js] test commit. Scroll version 3

This commit is contained in:
Witold Filipczyk 2021-06-14 21:29:22 +02:00
parent 8be72ca243
commit c3330e4452
3 changed files with 26 additions and 22 deletions

View File

@ -20,6 +20,7 @@
#include "dialogs/menu.h"
#include "dialogs/status.h"
#include "document/html/frames.h"
#include "document/xml/renderer.h"
#include "document/document.h"
#include "document/forms.h"
#include "document/renderer.h"
@ -443,8 +444,7 @@ delayed_reload(void *data)
struct delayed_rel *rel = data;
assert(rel);
doc_rerender_after_document_update(rel->ses);
free_document(rel->doc);
render_source_document_cxx(rel->cached, rel->document, NULL);
mem_free(rel);
}
@ -460,29 +460,14 @@ check_for_rerender(struct ecmascript_interpreter *interpreter, const char* text)
//fprintf(stderr, "%s\n", text);
if (document->dom && f && f->length) {
xmlpp::Document *docu = (xmlpp::Document *)document->dom;
std::string doc1_string = docu->write_to_string_formatted();
//delete docu;
document->dom = NULL;
size_t fd_len=f->length;
delete_entry_content(cached);
/* This is very ugly, indeed. And Yes fd_len isn't
* logically correct. But using nu_len will cause
* the document to render improperly.
* TBD: somehow better rerender the document
* now it's places on the session level in doc_loading_callback */
int ret = add_fragment(cached, 0, doc1_string.c_str(), doc1_string.size());
normalize_cache_entry(cached, doc1_string.size());
document->ecmascript_counter++;
if (document->dom) {
interpreter->changed = false;
struct delayed_rel *rel = mem_calloc(1, sizeof(*rel));
if (rel) {
rel->ses = ses;
rel->doc = docu;
rel->cached = cached;
rel->document = document;
register_bottom_half(delayed_reload, rel);
}
}

View File

@ -14,6 +14,8 @@
extern "C" {
#endif
struct cache_entry;
struct document;
struct document_view;
struct link;
struct location;
@ -32,8 +34,8 @@ struct delayed_open {
};
struct delayed_rel {
struct session *ses;
void *doc;
struct cache_entry *cached;
struct document *document;
};
enum remote_session_flags {

View File

@ -0,0 +1,17 @@
<head>
<script>
var tekst = 'ELinks scroll innerHTML part 3. 11.06.2021 EURO ';
function scrollText() {
var znak = tekst.charAt(0);
tekst = tekst.substring(1, tekst.length) + znak;
return tekst;
}
function scroll() {
document.getElementById('s').innerHTML = scrollText();
setTimeout(scroll, 1000);
}
</script>
</head>
<body onload="scroll()">
<div id="s"></div>
</body>