html: include JQuery as an inline script to prevent file access errors. Fixes #501

This commit is contained in:
Hylke Bons 2012-01-13 18:44:36 +00:00
parent 793a74268c
commit 329d26149b
3 changed files with 18 additions and 12 deletions

View file

@ -161,13 +161,13 @@ namespace SparkleShare {
get {
string resource_path = NSBundle.MainBundle.ResourcePath;
string html_path = Path.Combine (resource_path, "HTML", "event-log.html");
StreamReader reader = new StreamReader (html_path);
string html = reader.ReadToEnd ();
reader.Close ();
string html = File.ReadAllText (html_path);
html = html.Replace ("<!-- $jquery-url -->", "file://" +
Path.Combine (NSBundle.MainBundle.ResourcePath, "HTML", "jquery.js"));
string jquery_file_path = Path.Combine (NSBundle.MainBundle.ResourcePath,
"HTML", "jquery.js");
string jquery = File.ReadAllText (jquery_file_path);
html = html.Replace ("<!-- $jquery -->", jquery);
return html;
}

View file

@ -175,13 +175,16 @@ namespace SparkleShare {
public override string EventLogHTML {
get {
string path = new string [] {Defines.PREFIX,
"share", "sparkleshare", "html", "event-log.html"}.Combine ();
string html_path = new string [] {Defines.PREFIX, "share",
"sparkleshare", "html", "event-log.html"}.Combine ();
string html = String.Join (Environment.NewLine, File.ReadAllLines (path));
string html = File.ReadAllText (html_path);
html = html.Replace ("<!-- $jquery-url -->", "file://" +
new string [] {Defines.PREFIX, "share", "sparkleshare", "html", "jquery.js"}.Combine ());
string jquery_file_path = new string [] {Defines.PREFIX, "share",
"sparkleshare", "html", "jquery.js"}.Combine ()
string jquery = File.ReadAllText (jquery_file_path);
html = html.Replace ("<!-- $jquery -->", jquery);
return html;
}

View file

@ -2,7 +2,10 @@
<html>
<head>
<title>SparkleShare Event Log</title>
<script type="text/javascript" src="<!-- $jquery-url -->"></script>
<script type="text/javascript">
<!-- $jquery -->
</script>
<script type="text/javascript">
$(document).ready(function () {