aboutsummaryrefslogtreecommitdiff
path: root/frontend
diff options
context:
space:
mode:
authorWojciech Polak <polak@gnu.org>2010-04-11 19:58:20 +0200
committerWojciech Polak <polak@gnu.org>2010-04-11 19:58:20 +0200
commit41146e31bc4154f74ac643f2d399b667202e40d1 (patch)
tree11753c6f65e7e81de4d24bf79386316a59f7b801 /frontend
parenta837817dc6a43a1664819c78250b083074550a7b (diff)
downloadcheetah-41146e31bc4154f74ac643f2d399b667202e40d1.tar.gz
cheetah-41146e31bc4154f74ac643f2d399b667202e40d1.tar.bz2
Drop initial XHR weather request.
Diffstat (limited to 'frontend')
-rw-r--r--frontend/fetch.php22
-rw-r--r--frontend/reader.php13
2 files changed, 29 insertions, 6 deletions
diff --git a/frontend/fetch.php b/frontend/fetch.php
index aa46f71..6270ade 100644
--- a/frontend/fetch.php
+++ b/frontend/fetch.php
@@ -130,8 +130,26 @@ if ($session->status['afterlogged'] == 'yes')
if ($i++ < $end)
echo ",\n";
}
- echo " };
-};";
+ echo " };\n";
+
+ /* weather data */
+ $db->query ("SELECT * FROM weather WHERE userid='".$session->id."'");
+ $i = 1; $end = $db->num_rows ();
+ if ($end > 0) {
+ echo " this.weather = {\n";
+ while ($db->next_record ()) {
+ echo " '".$db->f ('id')."': ['".encodeJsEntities ($db->f ('description')).
+ "','".encodeJsEntities ($db->f ('code')).
+ "','".encodeJsEntities ($db->f ('unit'))."']";
+ if ($i++ < $end) echo ',';
+ echo "\n";
+ }
+ echo " };";
+ }
+ else {
+ echo " this.weather = null;\n";
+ }
+ echo "\n};";
}
// feed fetch
diff --git a/frontend/reader.php b/frontend/reader.php
index dca46c8..a90a83f 100644
--- a/frontend/reader.php
+++ b/frontend/reader.php
@@ -350,10 +350,15 @@ var SIGS = {'js':'<?=$SIGS["js"]?>', 'tr':'<?=$SIGS["tr"]?>', 'wt':'<?=$SIGS["wt
</div>
<?php if (isset ($CONF['google.analytics'])) { ?>
-<script type="text/javascript" src="http://www.google-analytics.com/ga.js"></script>
-<script type="text/javascript">if (typeof _gat != 'undefined') {
-var tracker = _gat._getTracker ('<?=$CONF["google.analytics"]?>');
-tracker._initData (); tracker._trackPageview (); }</script>
+<script type="text/javascript">
+var tracker;
+setTimeout (function () {
+ $.getScript ('http://www.google-analytics.com/ga.js', function () {
+ if (typeof _gat != 'undefined') {
+ tracker = _gat._getTracker ('<?=$CONF["google.analytics"]?>');
+ tracker._initData (); tracker._trackPageview ();
+ }}); }, 5000);
+</script>
<?php } ?>
</body>

Return to:

Send suggestions and report system problems to the System administrator.