Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Cumulus MX V4 beta test release 4.0.0 (build 4019) - 03 April 2024

Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

Adding java script to templates?

Discussion and questions about Cumulus weather station software version 1. This section is the main place to get help with Cumulus 1 software developed by Steve Loft that ceased development in November 2014.
Post Reply
christer
Posts: 18
Joined: Sun 20 Sep 2009 12:15 pm
Weather Station: Jenkinsbird Weather Pro = FineOf
Operating System: Windows XP
Location: Luleå, Sweden

Adding java script to templates?

Post by christer »

Hello, I have installed Piwik Webanalyzer (http://piwik.org/) on my server. And this need taht some java script is in the html code to send usage of a certian page to Piwik.
However, I tried to add this script to the template "gaugesT.htm, but it seems that Cumules stripp out this script when uploading.
What to do? I vant to see how many (and often) my weather site is visited.
Here is the script (note that MY_SITE.se is an example):
<!-- Piwik -->
<script type="text/javascript">
var pkBaseURL = (("https:" == document.location.protocol) ? "https://MY_SITE.se/piwik/" : "http://MY_SITE.se/piwik/");
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
</script><script type="text/javascript">
try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 1);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
} catch( err ) {}
</script><noscript><p><img src="http://mfkjupiter.se/piwik/piwik.php?idsite=1" style="border:0" alt="" /></p></noscript>
<!-- End Piwik Tracking Code -->


Regards
Christer in Sweden
User avatar
steve
Cumulus Author
Posts: 26701
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: Adding java script to templates?

Post by steve »

Cumulus doesn't strip anything out of the files, javascript or otherwise. In fact, the standard gaugesT.htm file has javascript in it. I think that perhaps you have edited the wrong file, or made some other error. If you attach your edited file, I'll have a look.
Steve
christer
Posts: 18
Joined: Sun 20 Sep 2009 12:15 pm
Weather Station: Jenkinsbird Weather Pro = FineOf
Operating System: Windows XP
Location: Luleå, Sweden

Re: Adding java script to templates?

Post by christer »

Hello Steve!
Here is my template:
You do not have the required permissions to view the files attached to this post.
User avatar
steve
Cumulus Author
Posts: 26701
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: Adding java script to templates?

Post by steve »

Works fine for me; here's the start of the processed file:

Code: Select all

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" src="wz_jsgraphics.js" type="text/javascript"></script>

<meta name="description" content="Test weather data">
<meta name="keywords" content="Cumulus, Test weather data, weather, data, weather station">
<title>Test weather</title>

<link href="weatherstyle.css" rel="stylesheet" type="text/css">
</head>

<!-- Piwik -->
<script type="text/javascript">
var pkBaseURL = (("https:" == document.location.protocol) ? "https://mfkjupiter.se/piwik/" : "http://mfkjupiter.se/piwik/");
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));

</script><script type="text/javascript">
try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 1);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
} catch( err ) {}
</script><noscript><p><img src="http://mfkjupiter.se/piwik/piwik.php?idsite=1" style="border:0" alt="" /></p></noscript>
<!-- End Piwik Tracking Code -->

<body>
<div id=content>
<h1>Test väder</h1>
<h2 style="text-align: left; text-transform: none;">&nbsp;Latitude&nbsp;N&nbsp;59&deg;&nbsp;06'&nbsp;02"&nbsp;&nbsp;&nbsp;&nbsp;Longitude&nbsp;W&nbsp;02&deg;&nbsp;11'&nbsp;23"&nbsp;&nbsp;&nbsp;&nbsp;Höjd 
ö.h.&nbsp;15&nbsp;ft</h2>

<p></p>
So I think you're doing something wrong, but I can't think what it would be (other than editing the wrong file, or looking at the wrong output file). The gauges.htm file you attached; that came from your PC, yes?

I don't think you want to be putting your code in 'no man's land' neither in the <head> nor the <body>, by the way; perhaps that's your problem. But Cumulus will process the file anyway; it doesn't understand HTML.
Steve
christer
Posts: 18
Joined: Sun 20 Sep 2009 12:15 pm
Weather Station: Jenkinsbird Weather Pro = FineOf
Operating System: Windows XP
Location: Luleå, Sweden

Re: Adding java script to templates?

Post by christer »

Thank you Steve!
Problem solved. Cumulus is running on a remote PC on another location. On that PC:s desktop I had a folder named Web. I thaugt that this was a shortcut o the folder inside Cumulus. Now it is. So I edited a backup file.
Everything works fine now.

Thank´s for your attension!
Christer
Post Reply