[bijiben] avoid showing js in thumbnails...



commit ed162978f286d2c90966c0cbe90e7372b53fc2d3
Author: Pierre-Yves Luyten <py luyten fr>
Date:   Tue Jul 29 00:05:39 2014 +0200

    avoid showing js in thumbnails...

 src/libbiji/deserializer/biji-lazy-deserializer.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/src/libbiji/deserializer/biji-lazy-deserializer.c 
b/src/libbiji/deserializer/biji-lazy-deserializer.c
index 695118b..aa242cf 100644
--- a/src/libbiji/deserializer/biji-lazy-deserializer.c
+++ b/src/libbiji/deserializer/biji-lazy-deserializer.c
@@ -316,6 +316,16 @@ process_tomboy_xml_content (BijiLazyDeserializer *self)
 
 /* Bijiben Inner HTML */
 
+
+/*
+ * as of today js is injected in the middle of the body,
+ * and interpreted as text.
+ * we need to prevent js to be included in note's
+ * raw content. This way works
+ */
+static gboolean is_node_script = FALSE;
+
+
 static void
 process_bijiben_start_elem (BijiLazyDeserializer *self)
 {
@@ -324,6 +334,10 @@ process_bijiben_start_elem (BijiLazyDeserializer *self)
 
   element_name = (const gchar *) xmlTextReaderConstName(priv->inner);
 
+  if (g_strcmp0 (element_name, "script") == 0)
+    is_node_script = TRUE;
+
+
   /* Block level elements introduce a new line, except that blocks
      at the very beginning of their parent don't, and <br/> at the
      end of a block causes the next block to skip the new line.
@@ -361,6 +375,13 @@ process_bijiben_text_elem (BijiLazyDeserializer *self)
   gchar *text;
   BijiLazyDeserializerPrivate *priv = self->priv;
 
+  /* in case this is js, skip this node */
+  if (is_node_script == TRUE)
+  {
+    is_node_script = FALSE;
+    return;
+  }
+
   text = (gchar *) xmlTextReaderConstValue (priv->inner);
 
   if (text)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]