Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
JesseWx2011 authored Nov 1, 2023
1 parent 810efc0 commit ecf1664
Show file tree
Hide file tree
Showing 6 changed files with 3,610 additions and 811 deletions.
2,691 changes: 2,691 additions & 0 deletions website-scripts/weather-display-templates/my-website-saratoga/ajaxWDwx3.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
// <![CDATA[
// ----------------------------------------------------------------------
// Rotate content display -- Ken True -- saratoga-weather.org
// This script is for use with the ajaxwx.js to create a rotating gizmo
// display of AJAX conditions marked with <span class="contentN" style="display: none"></span>
// where N=0..8
//
// Version 1.00 - initial release
// Version 1.01 - changed to look for class="ajaxcontentN" to prevent interference with buoy-data.php
// Version 1.02 - fixed rotation for Internet Explorer 8
//
//
// --------- begom settomgs ---------------------------------------------------------------
var ajaxrotatedelay=4000; // Rotate display every 4 secs (= 4000 ms)
var showUV = false ; // set to false if you don't have a Davis VP UV sensor
// --------- emd settomgs -----------------------------------------------------------------
//
// you shouldn't need to change things below this line
//
var ie4=document.all;
var browser = navigator.appName;
var ie8 = false;
if (ie4 && /MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x;
var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
if (ieversion>=8) {
ie4=false;
ie8=true;
}
}
var ajaxcurindex = 0;
var ajaxtotalcontent = 0;
var ajaxrunrotation = 1;
var browser = navigator.appName;

function get_content_tags ( tag ) {
// search all the span tags and return the list with class=tag
//
if (ie4 && browser != "Opera" && ! ie8) {
var elem = document.getElementsByTagName('span');
var lookfor = 'className';
} else {
var elem = document.getElementsByTagName('span');
var lookfor = 'class';
}
var arr = new Array();
var i = 0;
var iarr = 0;

for(i = 0; i < elem.length; i++) {
var att = elem[i].getAttribute(lookfor);
if(att == tag) {
arr[iarr] = elem[i];
iarr++;
}
}

return arr;
}


function ajax_get_total() {
ajaxtotalcontent = 8; // content0 .. content7
if (showUV) { ajaxtotalcontent++ ; } // UV display is in last content area
}

function ajax_contract_all() {
for (var y=0;y<ajaxtotalcontent;y++) {
var elements = get_content_tags("ajaxcontent"+y);
var numelements = elements.length;
// alert("ajax_contract_all: content"+y+" numelements="+numelements);
for (var index=0;index!=numelements;index++) {
var element = elements[index];
element.style.display="none";
}
}
}

function ajax_expand_one(which) {
ajax_contract_all();
var elements = get_content_tags("ajaxcontent"+which);
var numelements = elements.length;
for (var index=0;index!=numelements;index++) {
var element = elements[index];
element.style.display="inline";
}
}
function ajax_step_content() {
ajax_get_total();
ajax_contract_all();
ajaxcurindex=(ajaxcurindex<ajaxtotalcontent-1)? ajaxcurindex+1: 0;
ajax_expand_one(ajaxcurindex);
}
function ajax_set_run(val) {
ajaxrunrotation = val;
ajax_rotate_content();
}
function ajax_rotate_content() {
if (ajaxrunrotation) {
ajax_get_total();
ajax_contract_all();
ajax_expand_one(ajaxcurindex);
ajaxcurindex=(ajaxcurindex<ajaxtotalcontent-1)? ajaxcurindex+1: 0;
setTimeout("ajax_rotate_content()",ajaxrotatedelay);
}
}

ajax_rotate_content();

// ]]>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit ecf1664

Please sign in to comment.