Author Topic: making Colored background or image changes of Rain levels  (Read 1483 times)

0 Members and 1 Guest are viewing this topic.

Offline pimohdaimaoh

  • Forecaster
  • *****
  • Posts: 300
  • "Be aware to our nature"
    • PIMOHWEATHER
making Colored background or image changes of Rain levels
« on: December 23, 2018, 01:36:13 AM »
Hello Sir ken,

I want to create a script in which the RAIN in current conditions in ajax dashboad changes its background color depending the Warning intensity of RAIN accumulated. can you help me how to do it? because in the philippines we have a color coded Warning rain intensity to identify. I hope you may give a script to attach on my ajax dashboard.




Offline Jasiu

  • Forecaster
  • *****
  • Posts: 949
    • LexMAWeather
Re: making Colored background or image changes of Rain levels
« Reply #1 on: December 23, 2018, 09:36:23 AM »
Is this the right element you are trying to color?
https://lexmaweather.info
On Mastodon: @LexMAWeather@toot.community

Offline pimohdaimaoh

  • Forecaster
  • *****
  • Posts: 300
  • "Be aware to our nature"
    • PIMOHWEATHER
Re: making Colored background or image changes of Rain levels
« Reply #2 on: December 24, 2018, 03:23:10 AM »
yes like that or the icon images changes depends on the rain rates which changes to colored icon images (like I want to put an animated an clouds) then it changes to colored icon animation images to signifies the rate of the rai, since we have 3-4 color rain codes in PH. Hope you could provide one and may also to add this idea to your ajax dashboards
« Last Edit: December 24, 2018, 03:30:27 AM by pimohdaimaoh »

Offline the beteljuice

  • the beteljuice
  • Forecaster
  • *****
  • Posts: 316
    • test site
Re: making Colored background or image changes of Rain levels
« Reply #3 on: December 24, 2018, 09:58:46 AM »
That element is rain (so far) 'today', and your 'rain rate' is a small entry that wouldn't really stand out even with its background colour changed.

The main problem is that we shouldn't mess with the actual ajax grab / format routine even though it is the ideal place to make addittions / changes. This is because it is a large 'common' file and you would have reapply your mods whenever there was an update. The script uses functions to format the output and unfortunately for 'tweakers' it has been done properly. i.e. no variables are available outside of the functions, not even the data array (Hint to those read  ;))

BTW your site has a lot of broken / duplicated tags in the first few hundred lines, it's surprising the layout isn't badly broken.

Anyway, let's boldly go etc. etc. ....

It looks like you have enough space under your rain graphic / large day rain advisory to make another row with what you want. So here's the beteljuice thoughts ...

Code: [Select]
                <tr>
                    <td valign="middle" style="text-align: center;" >
                        <img src="./ajax-images/raindrop.gif" alt="Current Rain" />                    </td>
                    <td valign="middle" style="text-align: center; border: 1px solid gray;" >
                        Rain:<br/>
                        <span style="font-size: 18px" class="ajax" id="ajaxrain">
                        0.0 mm</span>
                    </td>
                </tr>
 
<!-- additional - beteljuice NEW rain rate / warning -->
                 <tr>
                    <td valign="middle" style="text-align: center;" >
                        <img id="rain_alert" src="rain_white.gif" alt="Rain Warning" title="Rain Warning" />
                    </td>
                    <td  id="rrateContainer" valign="middle" style="text-align: center; border: 1px solid gray;" >
                        Rain Rate;<br/>
                        <span style="font-size: 18px;" id="rain_rate2">0.0 mm</span>
                    </td>
                </tr>
<!-- END beteljuice NEW rain rate / warning -->
 

.... then just before the closing <body> tag ....

 <script>
// self executing function here (effectively body onload)
(function() {
   // the DOM should be available here
   alunsina = document.getElementById ("rain_alert"); // NEW rain alert image
   hiraya = document.getElementById ("rain_rate2"); // NEW duplicate rain rate advisory
   dalisay = document.getElementById ("ajaxrainratehr"); // existing 'in-use' element
   melissa = document.getElementById ("rrateContainer"); // container which may 'flash'
   flashCount = 0;
   warn = thebg = "white";
 
   mutateObserver = new MutationObserver(function() {   // rain rate has been updated by ajax
      dama = document.getElementById ("ajaxrainratehr").innerHTML; // returns the formated TEXT string (we'll be reusing this)
      var chunks = dama.split(" "); // chunks[0] => value as TEXT, chunks[1] => uom (mm, in)
      var check = chunks[0] *1;
      if(chunks[1] == "mm") {
          if(check < 7.5) warn = "white";
          if(check >= 7.5 && check < 15) warn = "yellow";
          if(check >= 15 && check <= 30) warn = "orange";
          if(check > 30) warn = "red";
       } else { // uom must be in.
          if(check < 0.295) warn = "white";
          if(check >= 0.295 && check < 0.590) warn = "yellow";
          if(check >= 0.590 && check <= 1.180) warn = "orange";
          if(check > 1.181) warn = "red";
       }
       // let's update the new custom advisories
       alunsina.src = "rain_"+warn+".gif";
       if(warn == "yellow") {
          rainColour = "black";
       } else {
          rainColour = "white";
       }
       melissa.style.color = rainColour;
       hiraya.innerHTML = dama;
       thebg = warn;
       if(thebg == "white") thebg = "black"; // optional - set background colour of new rainrate
       melissa.style.background = thebg; // optional - set background colour of new rainrate
   // We be done ;-)
   });
   
   mutateObserver.observe(dalisay, {     // configure observer
      childList: true,                   // capture child add/remove on target element.
      characterData: true,               // capture text changes on target element
      subtree: true,                     // capture childs changes too
      characterDataOldValue: true        // keep prev value
   });
   
   
   var bertie = setInterval(function() { // optional background 'flasher' - free running timer - red 500ms, orange 1000ms
       if(flashCount == 0 && (thebg == "orange" || thebg == "red")) {
           melissa.style.background = thebg;
       }
       if(flashCount == 1 && thebg == "red") {
           melissa.style.background = "black";
       }
       if(flashCount == 2) {
           if(thebg == "red") melissa.style.background = "red";
           if(thebg == "orange") melissa.style.background = "black";
       }   
       if(flashCount == 3 && thebg == "red") melissa.style.background = "black";
       flashCount++;
       if(flashCount == 4) flashCount = 0;
   }, 500);

})();
</script>


There are advisory graphics (which of course you can change), there is a duplicate large rainrate advisory which can have a coloured background (optional), the coloured background can be static (no warning / yellow), slow flash (orange), fast flash (red) [optional]

The code has NOT been tested but may contain silly errors / typos, as always with these things MAKE AND MODIFY A DUPLICATE PAGE FOR TESTING PURPOSES !!

 [ You are not allowed to view attachments ]  [ You are not allowed to view attachments ]  [ You are not allowed to view attachments ]  [ You are not allowed to view attachments ]

The reason it's untested is because I don't have a weather statiion and can't run any of the softwares !

Edit: Two typos and one logic hole fixed Very basic test bed - a little unpolished in places, but you or others can play with that  #-o
« Last Edit: December 24, 2018, 08:20:34 PM by beteljuice »
Imagine what you will KNOW tomorrow !

Offline pimohdaimaoh

  • Forecaster
  • *****
  • Posts: 300
  • "Be aware to our nature"
    • PIMOHWEATHER
Re: making Colored background or image changes of Rain levels
« Reply #4 on: December 25, 2018, 12:38:52 AM »
That element is rain (so far) 'today', and your 'rain rate' is a small entry that wouldn't really stand out even with its background colour changed.

The main problem is that we shouldn't mess with the actual ajax grab / format routine even though it is the ideal place to make addittions / changes. This is because it is a large 'common' file and you would have reapply your mods whenever there was an update. The script uses functions to format the output and unfortunately for 'tweakers' it has been done properly. i.e. no variables are available outside of the functions, not even the data array (Hint to those read  ;))

BTW your site has a lot of broken / duplicated tags in the first few hundred lines, it's surprising the layout isn't badly broken.

Anyway, let's boldly go etc. etc. ....

It looks like you have enough space under your rain graphic / large day rain advisory to make another row with what you want. So here's the beteljuice thoughts ...

Code: [Select]
                <tr>
                    <td valign="middle" style="text-align: center;" >
                        <img src="./ajax-images/raindrop.gif" alt="Current Rain" />                    </td>
                    <td valign="middle" style="text-align: center; border: 1px solid gray;" >
                        Rain:<br/>
                        <span style="font-size: 18px" class="ajax" id="ajaxrain">
                        0.0 mm</span>
                    </td>
                </tr>
 
<!-- additional - beteljuice NEW rain rate / warning -->
                 <tr>
                    <td valign="middle" style="text-align: center;" >
                        <img id="rain_alert" src="rain_white.gif" alt="Rain Warning" title="Rain Warning" />
                    </td>
                    <td  id="rrateContainer" valign="middle" style="text-align: center; border: 1px solid gray;" >
                        Rain Rate;<br/>
                        <span style="font-size: 18px;" id="rain_rate2">0.0 mm</span>
                    </td>
                </tr>
<!-- END beteljuice NEW rain rate / warning -->
 

.... then just before the closing <body> tag ....

 <script>
// self executing function here (effectively body onload)
(function() {
   // the DOM should be available here
   alunsina = document.getElementById ("rain_alert"); // NEW rain alert image
   hiraya = document.getElementById ("rain_rate2"); // NEW duplicate rain rate advisory
   dalisay = document.getElementById ("ajaxrainratehr"); // existing 'in-use' element
   melissa = document.getElementById ("rrateContainer"); // container which may 'flash'
   flashCount = 0;
   warn = thebg = "white";
 
   mutateObserver = new MutationObserver(function() {   // rain rate has been updated by ajax
      dama = document.getElementById ("ajaxrainratehr").innerHTML; // returns the formated TEXT string (we'll be reusing this)
      var chunks = dama.split(" "); // chunks[0] => value as TEXT, chunks[1] => uom (mm, in)
      var check = chunks[0] *1;
      if(chunks[1] == "mm") {
          if(check < 7.5) warn = "white";
          if(check >= 7.5 && check < 15) warn = "yellow";
          if(check >= 15 && check <= 30) warn = "orange";
          if(check > 30) warn = "red";
       } else { // uom must be in.
          if(check < 0.295) warn = "white";
          if(check >= 0.295 && check < 0.590) warn = "yellow";
          if(check >= 0.590 && check <= 1.180) warn = "orange";
          if(check > 1.181) warn = "red";
       }
       // let's update the new custom advisories
       alunsina.src = "rain_"+warn+".gif";
       if(warn == "yellow") {
          rainColour = "black";
       } else {
          rainColour = "white";
       }
       melissa.style.color = rainColour;
       hiraya.innerHTML = dama;
       thebg = warn;
       if(thebg == "white") thebg = "black"; // optional - set background colour of new rainrate
       melissa.style.background = thebg; // optional - set background colour of new rainrate
   // We be done ;-)
   });
   
   mutateObserver.observe(dalisay, {     // configure observer
      childList: true,                   // capture child add/remove on target element.
      characterData: true,               // capture text changes on target element
      subtree: true,                     // capture childs changes too
      characterDataOldValue: true        // keep prev value
   });
   
   
   var bertie = setInterval(function() { // optional background 'flasher' - free running timer - red 500ms, orange 1000ms
       if(flashCount == 0 && (thebg == "orange" || thebg == "red")) {
           melissa.style.background = thebg;
       }
       if(flashCount == 1 && thebg == "red") {
           melissa.style.background = "black";
       }
       if(flashCount == 2) {
           if(thebg == "red") melissa.style.background = "red";
           if(thebg == "orange") melissa.style.background = "black";
       }   
       if(flashCount == 3 && thebg == "red") melissa.style.background = "black";
       flashCount++;
       if(flashCount == 4) flashCount = 0;
   }, 500);

})();
</script>


There are advisory graphics (which of course you can change), there is a duplicate large rainrate advisory which can have a coloured background (optional), the coloured background can be static (no warning / yellow), slow flash (orange), fast flash (red) [optional]

The code has NOT been tested but may contain silly errors / typos, as always with these things MAKE AND MODIFY A DUPLICATE PAGE FOR TESTING PURPOSES !!

 [ You are not allowed to view attachments ]  [ You are not allowed to view attachments ]  [ You are not allowed to view attachments ]  [ You are not allowed to view attachments ]

The reason it's untested is because I don't have a weather statiion and can't run any of the softwares !

Edit: Two typos and one logic hole fixed Very basic test bed - a little unpolished in places, but you or others can play with that  #-o

Thank you fo this, I will try to test on my ajax, (actually I currently editing it now) yes you noticed that my site has many broken tags, I do try to remove those however when I attempt to remove those duplicated tags it results a mess on my page thats why I decided to leave it there unchanged since my page works well and no problem at all even thought the tags broken my page

but my last Question is where should I put those <script> . . .</script> codes since in ajax theres no <body> on it, since you mentioned that it should put before <body> closing? should I put those on my wxindex.php or in ajax-dashboard.php? on my wxindex.php consist of <body> but not in ajax-dashboard, just to need clarification so that I wouldnt mistakenly mess again the page T_T;

Thanks for the help by the way and Merry Christmas to you .
« Last Edit: December 25, 2018, 02:50:53 AM by pimohdaimaoh »

Offline the beteljuice

  • the beteljuice
  • Forecaster
  • *****
  • Posts: 316
    • test site
Re: making Colored background or image changes of Rain levels
« Reply #5 on: December 25, 2018, 09:14:25 AM »
As you say, there are no </body> tags in your include scripts, also I said the idea was that you did not modify any of your 'base' js scripts - ergo It goes at the bottom of your html / php page  ;)

Enjoy your Christmas present, but I'd wait a day or two before tweaking  \:D/
Imagine what you will KNOW tomorrow !

Offline pimohdaimaoh

  • Forecaster
  • *****
  • Posts: 300
  • "Be aware to our nature"
    • PIMOHWEATHER
Re: making Colored background or image changes of Rain levels
« Reply #6 on: December 26, 2018, 01:00:29 PM »
As you say, there are no </body> tags in your include scripts, also I said the idea was that you did not modify any of your 'base' js scripts - ergo It goes at the bottom of your html / php page  ;)

Enjoy your Christmas present, but I'd wait a day or two before tweaking  \:D/

Well it worked now, however i dont know how to hide this. Do you know how to hide since it should avoid to delete this or else it will cause errors or ccrainrate tag based on my tests?

Offline the beteljuice

  • the beteljuice
  • Forecaster
  • *****
  • Posts: 316
    • test site
Re: making Colored background or image changes of Rain levels
« Reply #7 on: December 26, 2018, 05:21:15 PM »
It wasn't in that position on your original page, and I see you have moved it since your screen shot.

There was no need to move it all ! - the difficult part of the script is to detect a change in that value and clone it for our purposes.

If you really want to hide it just add to the <span id="ajaxrainratehr" style="display: none;">

Glad you got it working and looking good  =D&gt;

To paraphrase the ghost of Dumbledore - "Help is always given by the beteljuice to those that desrve it"

You are providing a very real and worthwhile service to your community - well done.
Imagine what you will KNOW tomorrow !

Offline pimohdaimaoh

  • Forecaster
  • *****
  • Posts: 300
  • "Be aware to our nature"
    • PIMOHWEATHER
Re: making Colored background or image changes of Rain levels
« Reply #8 on: December 27, 2018, 08:15:26 AM »
It wasn't in that position on your original page, and I see you have moved it since your screen shot.

There was no need to move it all ! - the difficult part of the script is to detect a change in that value and clone it for our purposes.

If you really want to hide it just add to the <span id="ajaxrainratehr" style="display: none;">

Glad you got it working and looking good  =D&gt;

To paraphrase the ghost of Dumbledore - "Help is always given by the beteljuice to those that desrve it"

You are providing a very real and worthwhile service to your community - well done.

As expected, its done. thank you so much on this, it makes me challenge to understand the basic of hiding text using style=none command. I expand by the way its condition since light rain icon should included, this took me 2 days to figure and set this up. you helped me a lot this time. now I create my own icons with animated affects for better presentation, this will be very understandable in our country.

thanks a lot, Till your next assistance. . . . .

-Mike-

Offline the beteljuice

  • the beteljuice
  • Forecaster
  • *****
  • Posts: 316
    • test site
Re: making Colored background or image changes of Rain levels
« Reply #9 on: December 27, 2018, 08:46:09 AM »
Quote
.. I expand by the way its condition since light rain icon should included, this took me 2 days to figure and set this up. you helped me a lot this time. now I create my own icons with animated affects for better presentation, this will be very understandable in our country.
That's what it is all about, sharing knowledge and technique - then adapting for your target audience / purposes.

You're welcome Mike.  :-)
Imagine what you will KNOW tomorrow !

Offline the beteljuice

  • the beteljuice
  • Forecaster
  • *****
  • Posts: 316
    • test site
Re: making Colored background or image changes of Rain levels
« Reply #10 on: December 30, 2018, 09:48:49 PM »
the beteljuice was getting bored over the festered season, and rather than take on any serious coding / debugging decided to do some "In Your Face" graphics Test site only and for amusement
Imagine what you will KNOW tomorrow !

Offline pimohdaimaoh

  • Forecaster
  • *****
  • Posts: 300
  • "Be aware to our nature"
    • PIMOHWEATHER
Re: making Colored background or image changes of Rain levels
« Reply #11 on: January 02, 2019, 02:58:21 AM »
the beteljuice was getting bored over the festered season, and rather than take on any serious coding / debugging decided to do some "In Your Face" graphics Test site only and for amusement

Ok, do you want to get challenged in coding? well I have another problem regards that which it could give me  a proper script to it:

I plan to create a page with IMAGE that it automatically changes the folder names INSIDE the code since the source of the image is came from web server site (this helps me to produce my own animated images on the net). can you give me a scrop codes how to do it? example the source image files are sequence by?

<span style="display:none">
<img src="https://imagesource.com/folder/2019010118/navgem_mslp_pcpn_wpac_1.png">
<img src="https://imagesource.com/folder/2019010118/navgem_mslp_pcpn_wpac_2.png">
<img src="https://imagesource.com/folder/2019010118/navgem_mslp_pcpn_wpac_3.png">

</span>

<img name="MainImage" src="https://imagesource.com/folder/2019010118/navgem_mslp_pcpn_wpac_3.png" border="0">

<script language="javascript">
img1= new Image();
img1.src="https://imagesource.com/folder/2019010118/navgem_mslp_pcpn_wpac_1.png";
img2= new Image();
img2.src="https://imagesource.com/folder/2019010118/navgem_mslp_pcpn_wpac_2.png";
img3= new Image();
img3.src="https://imagesource.com/folder/2019010118/navgem_mslp_pcpn_wpac_3.png";

imgarray = new Array(10);
imgarray[1] = new Image();
imgarray[1].src = "https://imagesource.com/folder/2019010118/navgem_mslp_pcpn_wpac_1.png";
imgarray[2] = new Image();
imgarray[2].src = "https://imagesource.com/folder/2019010118/navgem_mslp_pcpn_wpac_2.png";

var timeoutValue = 200;
var animDelay = 3000;
var numOfImages = 24;

</script>

When everytime the time changes or the date changes, these folder names automatically change too for example: "/2019010118/" will changed to "/2019010218/" to "/2019010318/" so on and so forth which for example will automatically changes folder name everyday which also I need to automatically update the script above. Do you know how to do it? it maybe a challenge for you to this new year

Thank you and i will wait for the results

-Mike-
« Last Edit: January 02, 2019, 03:08:33 AM by pimohdaimaoh »

Offline the beteljuice

  • the beteljuice
  • Forecaster
  • *****
  • Posts: 316
    • test site
Re: making Colored background or image changes of Rain levels
« Reply #12 on: January 02, 2019, 09:12:09 AM »
This is now a seperate topic / request !

If I understand you correctly you wish to grab time-stamped images from the web and stitch them together in an animation. Possibly you also wish to resize / crop the images as well ?

Most likely you will be in some sort of violation of terms of use of the original source material.
Can it be done - is the beteljuice upto it ?

Not For Resale ! - demonstration ONLY

Clarify your aims and re-post your question as a new topic ...
Imagine what you will KNOW tomorrow !

Offline pimohdaimaoh

  • Forecaster
  • *****
  • Posts: 300
  • "Be aware to our nature"
    • PIMOHWEATHER
Re: making Colored background or image changes of Rain levels
« Reply #13 on: January 02, 2019, 11:05:59 AM »
This is now a seperate topic / request !

If I understand you correctly you wish to grab time-stamped images from the web and stitch them together in an animation. Possibly you also wish to resize / crop the images as well ?

Most likely you will be in some sort of violation of terms of use of the original source material.
Can it be done - is the beteljuice upto it ?

Not For Resale ! - demonstration ONLY

Clarify your aims and re-post your question as a new topic ...

Ok, I get your point, if its a violation to terms, just ignore my above request.

and Thanks for your response ^_^;

Offline pimohdaimaoh

  • Forecaster
  • *****
  • Posts: 300
  • "Be aware to our nature"
    • PIMOHWEATHER
Re: making Colored background or image changes of Rain levels
« Reply #14 on: March 12, 2019, 12:17:49 PM »
This is now a seperate topic / request !

If I understand you correctly you wish to grab time-stamped images from the web and stitch them together in an animation. Possibly you also wish to resize / crop the images as well ?

Most likely you will be in some sort of violation of terms of use of the original source material.
Can it be done - is the beteljuice upto it ?

Not For Resale ! - demonstration ONLY

Clarify your aims and re-post your question as a new topic ...

Hello There beteljuice,

I have some sort of new favor to ask here if you have time, this is almost similar to the last help you gave me regarding Rain BG color changes, this time is about the BAROMETRIC data. Nowadays I am migrating my website data to weewx, but still manage to do some kit bashing sort  of to the ajax dashboard making the UOM readable to weewx-WD clientraw files because if using weewx these clientraw files produced by weewxWD is not the same clientraw produced with weather display in which unrecognizable when using the old ajax-dashboard, if you try to check my site you see my ajax-dashboard is already stand alone working uom without the wdw3x.js embedded because this .js script can only reads WD clientraw.txt which it gets troubled if I include once to the settings, and when I try to do it in weewx clientraw, it shows not in the right units given to my ajax dashboard, so I make some modifications and by dissabling its java script, the ajax-dashboard works fine however of course the condition icons and the counter refresh will not work anymore without the .js script therefore I decided to make it a meta refresh every 30 seconds making the whole ajax-dashboard reloads every 30 seconds. . . well (HOPE SOMEDAY YOU CAN HAVE DO SOME MODIFICATIONS TO THIS AJAX DASHBOARD) that can read clientraw.txt produced by weewxWD.

so about the barometer as you can see in this attached file, that the status is not anymore available because in weewx, theres no output regards the current conditions icons unlike in weather display can. My proposed is I will use the barometer units to change this icon images corresponding its weather conditions, if you know already the use of barometer is simple to Identoify the weather conditions/forecasts like this example in this attachement image you see every corresponding units equal to weather conditions. THESE is I want to go into my dashboard which icon image changes depending on the barometric reading example: if barometer reads 1013 hpa = Fair weather and if it reads 1007 hpa = mostly cloudy <------ this changes the image as corresponds so on and so forth.

I hope you get what I mean, this is closely similar to rain change colors with image but this time it reads directly to clientraw.txt or by using "echo print $"

Thank you for the time and hope you can have a time to create this ajax-dashboard that can be read clientraw.txt from weewx clientraw.txt

Regards

-mike-

« Last Edit: March 12, 2019, 12:37:45 PM by pimohdaimaoh »

Offline pimohdaimaoh

  • Forecaster
  • *****
  • Posts: 300
  • "Be aware to our nature"
    • PIMOHWEATHER
Re: making Colored background or image changes of Rain levels
« Reply #15 on: March 17, 2019, 07:13:49 AM »
the beteljuice was getting bored over the festered season, and rather than take on any serious coding / debugging decided to do some "In Your Face" graphics Test site only and for amusement

I am transfering to weeWX using interceptor and clientrawWD so that it can still accumulate data to my page however after I transfering it these script you shared me soesnt work anymore, I try to figure out why since checking it in clientraw parser still intact? what do you think is the problem? I try to change values and still it doesnt changes the image anymore. I observe when changing this to <span class="ajax" id="ajaxrainratehr"><?php echo strip_units($currentrainratehr) . $uomRain; ?></span>
the values of rain rate is now showing but not the image, is there a way to change the image using this tag? $currentrainratehr instead of get get document by ID= thing?

when I try to changed them here

(function() {
   // the DOM should be available here
   alunsina = document.getElementById ("rain_alert"); // NEW rain alert image
   hiraya = echo strip_units($currentrainratehr); // NEW duplicate rain rate advisory
   dalisay = echo strip_units($currentrainratehr); // existing 'in-use' element
   melissa = document.getElementById ("rrateContainer"); // container which may 'flash'
   flashCount = 0;
   warn = thebg = "white";

it doesnt effect. Maybe you could help me to integrate this. Thanks

Offline the beteljuice

  • the beteljuice
  • Forecaster
  • *****
  • Posts: 316
    • test site
Re: making Colored background or image changes of Rain levels
« Reply #16 on: March 17, 2019, 10:28:14 AM »
You are now using php values ( I don't know if that's a one-shot or a cyclic call), so use php instead of the js to directly write your img html values.
Imagine what you will KNOW tomorrow !

Offline pimohdaimaoh

  • Forecaster
  • *****
  • Posts: 300
  • "Be aware to our nature"
    • PIMOHWEATHER
Re: making Colored background or image changes of Rain levels
« Reply #17 on: March 17, 2019, 11:29:42 AM »
You are now using php values ( I don't know if that's a one-shot or a cyclic call), so use php instead of the js to directly write your img html values.


yes, actually I tried to use .php but it doesnt work, maybe some of your help to work on this, I try to use the tags like $rainratehr to explode but it doesnt work, maybe some strings needed first which I dont know :(  ](*,)

do you mean i should create separated .php then include once this?


(Update)

I try to use .js it is working, however it gives wrong output data like:

in 3.9 km/hr its Gust data is 59 kph and if its rain total is 1.3 mm/hr it rain rate is 246 mm/hr in which its too huge to 1.3 mm only, including the year value, how come its 1929 instead of year 1929 since theres no 1929 in clientraw.txt I dont know where to adjust its computation in scripts. Where should I look it so that I can correct the wrong values?

(see the attached image)


regards

Mike
« Last Edit: March 17, 2019, 12:23:31 PM by pimohdaimaoh »

Offline the beteljuice

  • the beteljuice
  • Forecaster
  • *****
  • Posts: 316
    • test site
Re: making Colored background or image changes of Rain levels
« Reply #18 on: March 17, 2019, 12:59:40 PM »
I have no idea what you are doing (and have no knowledge of weewx).

Is there an ajax routine that refreshes the weewx data on the page ?
If so then the js routine should work unless the <span id> have changed.

If the page is ONLY built by php on initial load, then you create php code to either directly write the html you want, or pass vars to to the js portion, removing the 'bubble' routine looking for change, and execute it immediately on page load, - the pure php method would be good practise for you.

Someone must have done this before ...
Imagine what you will KNOW tomorrow !

Offline pimohdaimaoh

  • Forecaster
  • *****
  • Posts: 300
  • "Be aware to our nature"
    • PIMOHWEATHER
Re: making Colored background or image changes of Rain levels
« Reply #19 on: March 17, 2019, 02:24:29 PM »
I have no idea what you are doing (and have no knowledge of weewx).

Is there an ajax routine that refreshes the weewx data on the page ?


No actually, weewx creates html files itself then it sends via FTP, and resync it. To refresh weewx page you simple refresh the entire page
http://pimohweather.webutu.com/pimohweewx/ while weewxWD embedded to weewx creates clientraw files then automatically sends these clientraw files to suits the need of your WD support page, HOWEVER although created from weewx not all features in it will give similar to the clientraw files created from weather display itself.

heres the overview of it https://bitbucket.org/ozgreg/weewx-wd/overview
« Last Edit: March 17, 2019, 02:29:43 PM by pimohdaimaoh »

Offline the beteljuice

  • the beteljuice
  • Forecaster
  • *****
  • Posts: 316
    • test site
Re: making Colored background or image changes of Rain levels
« Reply #20 on: March 17, 2019, 04:48:11 PM »
Quote
Weewx-WD consists of a number of weewx services, Search List Extensions (SLE)
and skins that produce the following data files:

Weather Display live
So someone must be able to say if there is an ajax routine which effectively give you your 'dashboard' back.

I can't believe the users here would tolerate a page that can't refresh itself invisibly rather than complete page reload !
Imagine what you will KNOW tomorrow !

Offline pimohdaimaoh

  • Forecaster
  • *****
  • Posts: 300
  • "Be aware to our nature"
    • PIMOHWEATHER
Re: making Colored background or image changes of Rain levels
« Reply #21 on: March 19, 2019, 07:51:38 AM »
Quote
Weewx-WD consists of a number of weewx services, Search List Extensions (SLE)
and skins that produce the following data files:

Weather Display live
So someone must be able to say if there is an ajax routine which effectively give you your 'dashboard' back.

I can't believe the users here would tolerate a page that can't refresh itself invisibly rather than complete page reload !

Well according to most of weewx users, they reduced weewx archiving routines to avoid overloading to its archives because every page is processed by weewx furthermore to add more extensions such WD extension but for me it doesnt need to archiving the .js since it is a script which it stays on the webserver and no need to include in weewx archives. Well at least someone could resolve this or someone who can create it