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

View file

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

View file

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