[ease] Combine HTML header and JavaScript strings.
- From: Nate Stedman <natesm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ease] Combine HTML header and JavaScript strings.
- Date: Thu, 24 Jun 2010 17:33:35 +0000 (UTC)
commit c8a4e992d586416622a2ac2e1b2b947ad3f7d74f
Author: Nate Stedman <natesm gmail com>
Date: Thu Jun 24 12:20:22 2010 -0400
Combine HTML header and JavaScript strings.
src/ease-document.vala | 23 +----------
src/ease-html-exporter.vala | 91 +++++++++++++++++++++++++++----------------
2 files changed, 58 insertions(+), 56 deletions(-)
---
diff --git a/src/ease-document.vala b/src/ease-document.vala
index 3bb48c4..16e62b8 100644
--- a/src/ease-document.vala
+++ b/src/ease-document.vala
@@ -126,28 +126,7 @@ public class Ease.Document : SlideSet
}
// intialize the html string
- var html = """<!DOCTYPE html>
-<html>
-<head>
- <title>Presentation</title>
- %s
- <style>
- .slide {
- width: %ipx;
- height: %ipx;
- display: none;
- overflow: hidden;
- position: relative;
- margin: 20px auto 20px auto;
- }
- html {
- padding: 0px;
- margin: 0px;
- background-color: black;
- }
- </style>
-</head>
-<body onload=load()>""".printf(exporter.js, width, height);
+ var html = exporter.HEADER.printf(width, height);
// substitute in the values
diff --git a/src/ease-html-exporter.vala b/src/ease-html-exporter.vala
index 88b15d5..eee6d72 100644
--- a/src/ease-html-exporter.vala
+++ b/src/ease-html-exporter.vala
@@ -142,48 +142,71 @@ public class Ease.HTMLExporter : GLib.Object
}
/**
- * JavaScript needed to run HTML presentations
+ * HTML header for presentations.
*/
- public static const string js =
-"""<script type="text/javascript">
-var slide = -1;
+ public static const string HEADER =
+"""<!DOCTYPE html>
+<html>
+<head>
+ <title>Presentation</title>
+
+ <script type="text/javascript">
+ var slide = -1;
-function load() {
- advance();
-}
+ function load() {
+ advance();
+ }
-function keydown(e) {
- var code = e.keyCode;
- if (code == 32 || code == 39 || code == 13 || code == 40 || code == 39) {
- advance();
- }
+ function keydown(e) {
+ var code = e.keyCode;
+ if (code == 32 || code == 39 || code == 13 || code == 40 || code == 39) {
+ advance();
+ }
- else if (code == 8 || code == 46 || code == 37 || code == 38) {
- retreat();
- }
-}
-
-function advance() {
- if (document.getElementById("slide" + (slide + 1)) != null) {
- if (slide >= 0) {
- document.getElementById("slide" + slide).style.display = "none";
+ else if (code == 8 || code == 46 || code == 37 || code == 38) {
+ retreat();
+ }
}
- slide++;
- document.getElementById("slide" + slide).style.display = "block";
- }
-}
-function retreat() {
- if (slide > 0) {
- document.getElementById("slide" + slide).style.display = "none";
- slide--;
- document.getElementById("slide" + slide).style.display = "block";
- }
-}
+ function advance() {
+ if (document.getElementById("slide" + (slide + 1)) != null) {
+ if (slide >= 0) {
+ document.getElementById("slide" + slide).style.display = "none";
+ }
+ slide++;
+ document.getElementById("slide" + slide).style.display = "block";
+ }
+ }
-document.onkeydown = keydown;
+ function retreat() {
+ if (slide > 0) {
+ document.getElementById("slide" + slide).style.display = "none";
+ slide--;
+ document.getElementById("slide" + slide).style.display = "block";
+ }
+ }
-</script>""";
+ document.onkeydown = keydown;
+ </script>
+
+ <style>
+ .slide {
+ width: %ipx;
+ height: %ipx;
+ display: none;
+ overflow: hidden;
+ position: relative;
+ margin: 20px auto 20px auto;
+ }
+ html {
+ padding: 0px;
+ margin: 0px;
+ background-color: black;
+ }
+ </style>
+</head>
+<body onload=load()>
+""";
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]