remove iframe

This commit is contained in:
Matt Walsh 2020-09-17 14:37:54 -05:00
parent afe5966738
commit 36144f9eb1
20 changed files with 969 additions and 2008 deletions

2
dist/index.html vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1 +0,0 @@
@font-face{font-family:Star4000;src:url(../fonts/Star4000.woff) format('woff')}@font-face{font-family:"Star 4 Radar";src:url('../fonts/Star 4 Radar.woff') format('woff')}@font-face{font-family:'Star4000 Extended';src:url('../fonts/Star4000 Extended.woff') format('woff')}@font-face{font-family:Star4000LCN;src:url(../fonts/Star4000LCN.woff) format('woff')}@font-face{font-family:'Star4000 Large Compressed';src:url('../fonts/Star4000 Large Compressed.woff') format('woff')}@font-face{font-family:'Star4000 Large';src:url('../fonts/Star4000 Large.woff') format('woff')}@font-face{font-family:'Star4000 Small';src:url('../fonts/Star4000 Small.woff') format('woff')}body{font-family:Star4000;margin:0;overflow:hidden}input{font-family:Star4000}jsgif{display:none}.fontPreload{visibility:hidden;position:absolute}#Star4000{font-family:Star4000}#Star4000Extended{font-family:'Star4000 Extended'}#Star4000LargeCompressed{font-family:'Star4000 Large Compressed'}#Star4000Large{font-family:'Star4000 Large'}#Star4000LargeCompressedNumbers{font-family:Star4000LCN}#Star4000Small{font-family:'Star4000 Small'}#Star4Radar{font-family:'Star 4 Radar'}.HideCursor{cursor:none!important}#container{position:absolute}#container canvas{position:absolute}

View file

@ -1 +1 @@
@font-face{font-family:Star4000;src:url(../fonts/Star4000.woff) format('woff')}body{font-family:Star4000}button,input{font-family:Star4000}#imgGetGps{height:13px;vertical-align:middle}#txtAddress{width:490px;font-size:16pt}#btnClearQuery,#btnGetGps,#btnGetLatLng{font-size:16pt}.autocomplete-suggestions{background-color:#fff;border:1px solid #000}.autocomplete-suggestion{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:16pt}.autocomplete-selected{background-color:#00f;color:#fff}#divTwc{display:block;background-color:#000;color:#fff;width:640px}#divTwcMiddle{display:flex}#divTwcLeft{visibility:hidden;text-align:right;display:flex;flex-direction:column;vertical-align:middle}#divTwcLeft>div{flex:1;padding-right:12px;display:flex;flex-direction:column;justify-content:center}#divTwcRight{visibility:hidden;text-align:left;display:flex;flex-direction:column;vertical-align:middle}#divTwcRight>div{flex:1;padding-left:12px;display:flex;flex-direction:column;justify-content:center}#divTwcBottom{visibility:hidden;display:flex;flex-direction:row;background-color:#000;color:#fff;width:100%}#divTwcBottom>div{padding-left:6px;padding-right:6px}#divTwcBottomLeft{flex:1;text-align:left}#divTwcBottomMiddle{flex:0;text-align:center}#divTwcBottomRight{flex:1;text-align:right}#divTwcNavContainer{display:none}#divTwcNav{display:flex;flex-direction:row;background-color:#000;color:#fff;width:640px}#divTwcNav>div{padding-left:6px;padding-right:6px}#divTwcNavLeft{flex:1;text-align:left}#divTwcNavMiddle{flex:0;text-align:center}#divTwcNavRight{flex:1;text-align:right}#imgPause1x,#imgPause2x{visibility:hidden;position:absolute}#iframeTwc{width:640px;height:480px;overflow:hidden;border:0}.HideCursor{cursor:none!important}#txtScrollText{width:475px} @font-face{font-family:Star4000;src:url(../fonts/Star4000.woff) format('woff')}body{font-family:Star4000}button,input{font-family:Star4000}#imgGetGps{height:13px;vertical-align:middle}#txtAddress{width:490px;font-size:16pt}#btnClearQuery,#btnGetGps,#btnGetLatLng{font-size:16pt}.autocomplete-suggestions{background-color:#fff;border:1px solid #000}.autocomplete-suggestion{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:16pt}.autocomplete-selected{background-color:#00f;color:#fff}#divTwc{display:block;background-color:#000;color:#fff;width:640px}#divTwcMiddle{display:flex}#divTwcLeft{visibility:hidden;text-align:right;display:flex;flex-direction:column;vertical-align:middle}#divTwcLeft>div{flex:1;padding-right:12px;display:flex;flex-direction:column;justify-content:center}#divTwcRight{visibility:hidden;text-align:left;display:flex;flex-direction:column;vertical-align:middle}#divTwcRight>div{flex:1;padding-left:12px;display:flex;flex-direction:column;justify-content:center}#divTwcBottom{visibility:hidden;display:flex;flex-direction:row;background-color:#000;color:#fff;width:100%}#divTwcBottom>div{padding-left:6px;padding-right:6px}#divTwcBottomLeft{flex:1;text-align:left}#divTwcBottomMiddle{flex:0;text-align:center}#divTwcBottomRight{flex:1;text-align:right}#divTwcNavContainer{display:none}#divTwcNav{display:flex;flex-direction:row;background-color:#000;color:#fff;width:640px}#divTwcNav>div{padding-left:6px;padding-right:6px}#divTwcNavLeft{flex:1;text-align:left}#divTwcNavMiddle{flex:0;text-align:center}#divTwcNavRight{flex:1;text-align:right}#imgPause1x,#imgPause2x{visibility:hidden;position:absolute}.HideCursor{cursor:none!important}#txtScrollText{width:475px}@font-face{font-family:Star4000;src:url(../fonts/Star4000.woff) format('woff')}@font-face{font-family:"Star 4 Radar";src:url('../fonts/Star 4 Radar.woff') format('woff')}@font-face{font-family:'Star4000 Extended';src:url('../fonts/Star4000 Extended.woff') format('woff')}@font-face{font-family:Star4000LCN;src:url(../fonts/Star4000LCN.woff) format('woff')}@font-face{font-family:'Star4000 Large Compressed';src:url('../fonts/Star4000 Large Compressed.woff') format('woff')}@font-face{font-family:'Star4000 Large';src:url('../fonts/Star4000 Large.woff') format('woff')}@font-face{font-family:'Star4000 Small';src:url('../fonts/Star4000 Small.woff') format('woff')}#display{font-family:Star4000;margin:0;overflow:hidden;width:640px;height:480px}jsgif{display:none}#Star4000{font-family:Star4000}#Star4000Extended{font-family:'Star4000 Extended'}#Star4000LargeCompressed{font-family:'Star4000 Large Compressed'}#Star4000Large{font-family:'Star4000 Large'}#Star4000LargeCompressedNumbers{font-family:Star4000LCN}#Star4000Small{font-family:'Star4000 Small'}#Star4Radar{font-family:'Star 4 Radar'}#container{position:absolute}#container canvas{position:absolute}

File diff suppressed because one or more lines are too long

View file

@ -1,60 +0,0 @@
// eslint-disable-next-line no-unused-vars
const states = (() => {
const stateList = {
'Arizona': 'AZ',
'Alabama': 'AL',
'Alaska': 'AK',
'Arkansas': 'AR',
'California': 'CA',
'Colorado': 'CO',
'Connecticut': 'CT',
'Delaware': 'DE',
'Florida': 'FL',
'Georgia': 'GA',
'Hawaii': 'HI',
'Idaho': 'ID',
'Illinois': 'IL',
'Indiana': 'IN',
'Iowa': 'IA',
'Kansas': 'KS',
'Kentucky': 'KY',
'Louisiana': 'LA',
'Maine': 'ME',
'Maryland': 'MD',
'Massachusetts': 'MA',
'Michigan': 'MI',
'Minnesota': 'MN',
'Mississippi': 'MS',
'Missouri': 'MO',
'Montana': 'MT',
'Nebraska': 'NE',
'Nevada': 'NV',
'New Hampshire': 'NH',
'New Jersey': 'NJ',
'New Mexico': 'NM',
'New York': 'NY',
'North Carolina': 'NC',
'North Dakota': 'ND',
'Ohio': 'OH',
'Oklahoma': 'OK',
'Oregon': 'OR',
'Pennsylvania': 'PA',
'Rhode Island': 'RI',
'South Carolina': 'SC',
'South Dakota': 'SD',
'Tennessee': 'TN',
'Texas': 'TX',
'Utah': 'UT',
'Vermont': 'VT',
'Virginia': 'VA',
'Washington': 'WA',
'West Virginia': 'WV',
'Wisconsin': 'WI',
'Wyoming': 'WY',
};
return {
getTwoDigitCode: (stateFullName) => stateList[stateFullName],
};
})();

876
dist/scripts/index.js vendored
View file

@ -1,876 +0,0 @@
/* globals NoSleep, states */
let frmGetLatLng;
let txtAddress;
let btnClearQuery;
let btnGetGps;
let divTwc;
let divTwcTop;
let divTwcMiddle;
let divTwcBottom;
let divTwcLeft;
let divTwcRight;
let divTwcNavContainer;
let iframeTwc;
let spanLastRefresh;
let chkAutoRefresh;
let spanRefreshCountDown;
let frmScrollText;
let chkScrollText;
let txtScrollText;
let _AutoSelectQuery = false;
let _IsPlaying = false;
let _NoSleep = new NoSleep();
let _LastUpdate = null;
let _AutoRefreshIntervalId = null;
let _AutoRefreshIntervalMs = 500;
let _AutoRefreshTotalIntervalMs = 600000; // 10 min.
let _AutoRefreshCountMs = 0;
let _FullScreenOverride = false;
let _WindowHeight = 0;
let _WindowWidth = 0;
let latLon;
const FullScreenResize = () => {
const WindowWidth = $(window).width();
const WindowHeight = $(window).height();
const inFullScreen = InFullScreen();
let IFrameWidth;
let IFrameHeight;
let LeftWidth;
let RightWidth;
let TopHeight;
let BottomHeight;
let Offset;
if (inFullScreen) {
if ((WindowWidth / WindowHeight) >= 1.583333333333333) {
divTwcTop.hide();
divTwcBottom.hide();
divTwcLeft.show();
divTwcRight.show();
divTwcMiddle.attr('style', 'width:100%; height:100%; border:none; margin:0; padding:0; overflow:hidden; z-index:999999;');
LeftWidth = ((WindowWidth - (WindowHeight * 1.33333333333333333333)) / 2);
if (LeftWidth < 60) {
LeftWidth = 60;
}
divTwcLeft.attr('style', 'width:' + LeftWidth + 'px; height:100%; border:none; margin:0; padding:0; overflow:hidden; z-index:999999;');
divTwcLeft.css('visibility', 'visible');
RightWidth = ((WindowWidth - (WindowHeight * 1.33333333333333333333)) / 2);
if (RightWidth < 60) {
RightWidth = 60;
}
divTwcRight.attr('style', 'width:' + RightWidth + 'px; height:100%; border:none; margin:0; padding:0; overflow:hidden; z-index:999999;');
divTwcRight.css('visibility', 'visible');
IFrameWidth = WindowWidth - LeftWidth - RightWidth;
iframeTwc.attr('style', 'width:' + IFrameWidth + 'px; height:100%; border:none; margin:0; padding:0; overflow:hidden; z-index:999999;');
} else {
divTwcTop.show();
divTwcBottom.show();
divTwcLeft.hide();
divTwcRight.hide();
Offset = 0;
TopHeight = ((WindowHeight - ((WindowWidth - Offset) * 0.75)) / 2);
if (TopHeight < 0) {
TopHeight = 0;
}
divTwcTop.attr('style', 'width:100%; height:' + TopHeight + 'px; border:none; margin:0; padding:0; overflow:hidden; z-index:999999;');
BottomHeight = ((WindowHeight - ((WindowWidth - Offset) * 0.75)) / 2);
if (BottomHeight < 30) {
BottomHeight = 30;
}
divTwcBottom.attr('style', 'width:100%; height:' + BottomHeight + 'px; border:none; margin:0; padding:0; overflow:hidden; z-index:999999;');
divTwcBottom.css('visibility', 'visible');
IFrameHeight = WindowHeight - TopHeight - BottomHeight;
iframeTwc.attr('style', 'width:100%; height:' + IFrameHeight + 'px; border:none; margin:0; padding:0; overflow:hidden; z-index:999999;');
divTwcMiddle.attr('style', 'width:100%; height:' + IFrameHeight + 'px; border:none; margin:0; padding:0; overflow:hidden; z-index:999999;');
}
}
if (!inFullScreen) {
divTwcTop.hide();
divTwcBottom.hide();
divTwcLeft.hide();
divTwcRight.hide();
divTwc.attr('style', '');
divTwcMiddle.attr('style', '');
iframeTwc.attr('style', '');
$(window).off('resize', FullScreenResize);
}
if (inFullScreen) {
$('body').css('overflow', 'hidden');
$('.ToggleFullScreen').val('Exit Full Screen');
if (!GetFullScreenElement()) {
EnterFullScreen();
}
} else {
$('body').css('overflow', '');
$('.ToggleFullScreen').val('Full Screen');
}
divTwcNavContainer.show();
};
const _lockOrientation = screen.lockOrientation || screen.mozLockOrientation || screen.msLockOrientation;
const _unlockOrientation = screen.unlockOrientation || screen.mozUnlockOrientation || screen.msUnlockOrientation || (screen.orientation && screen.orientation.unlock);
const OnFullScreen = () => {
if (InFullScreen()) {
divTwc.attr('style', 'position:fixed; top:0px; left:0px; bottom:0px; right:0px; width:100%; height:100%; border:none; margin:0; padding:0; overflow:hidden; z-index:999999;');
FullScreenResize();
$(window).on('resize', FullScreenResize);
//FullScreenResize();
if (_lockOrientation) try { _lockOrientation('landscape-primary'); } catch (ex) { console.log('Unable to lock screen orientation.'); }
} else {
divTwc.attr('style', '');
divTwcMiddle.attr('style', '');
iframeTwc.attr('style', '');
$(window).off('resize', FullScreenResize);
FullScreenResize();
if (_unlockOrientation) try { _unlockOrientation(); } catch (ex) { console.log('Unable to unlock screen orientation.'); }
}
};
const InFullScreen = () => ((_FullScreenOverride) || (GetFullScreenElement()) || (window.innerHeight === screen.height) || (window.innerHeight === (screen.height - 1)));
const GetFullScreenElement = () => {
if (_FullScreenOverride) return document.body;
return (document.fullScreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement);
};
const btnFullScreen_click = () => {
if (!InFullScreen()) {
EnterFullScreen();
} else {
ExitFullscreen();
}
if (_IsPlaying) {
_NoSleep.enable();
} else {
_NoSleep.disable();
}
UpdateFullScreenNavigate();
return false;
};
const EnterFullScreen = () => {
const element = document.body;
// Supports most browsers and their versions.
const requestMethod = element.requestFullScreen || element.webkitRequestFullScreen || element.mozRequestFullScreen || element.msRequestFullscreen;
if (requestMethod) {
// Native full screen.
requestMethod.call(element, { navigationUI: 'hide' }); // https://bugs.chromium.org/p/chromium/issues/detail?id=933436#c7
} else {
// iOS doesn't support FullScreen API.
window.scrollTo(0, 0);
_FullScreenOverride = true;
$(window).resize();
}
UpdateFullScreenNavigate();
};
const ExitFullscreen = () => {
// exit full-screen
if (_FullScreenOverride) {
_FullScreenOverride = false;
$(window).resize();
}
if (document.exitFullscreen) {
// Chrome 71 broke this if the user pressed F11 to enter full screen mode.
document.exitFullscreen();
} else if (document.webkitExitFullscreen) {
document.webkitExitFullscreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.msExitFullscreen) {
document.msExitFullscreen();
}
};
const btnNavigateMenu_click = () => {
postMessage('navButton', 'menu');
UpdateFullScreenNavigate();
return false;
};
const LoadTwcData = () => {
txtAddress.blur();
StopAutoRefreshTimer();
_LastUpdate = null;
AssignLastUpdate();
postMessage('latLon', latLon);
FullScreenResize();
if (chkScrollText.is(':checked')) {
postMessage('assignScrollText', txtScrollText.val());
}
postMessage('units', $('input[type=\'radio\'][name=\'radUnits\']:checked').val());
if (_IsPlaying) postMessage('navButton', 'playToggle');
$(iframeTwc[0].contentWindow.document).on('mousemove', document_mousemove);
$(iframeTwc[0].contentWindow.document).on('mousedown', document_mousemove);
$(iframeTwc[0].contentWindow.document).on('keydown', document_keydown);
const SwipeCallBack = (event, direction) => {
switch (direction) {
case 'left':
btnNavigateNext_click();
break;
case 'right':
default:
btnNavigatePrevious_click();
break;
}
};
$(iframeTwc[0].contentWindow.document).swipe({
//Generic swipe handler for all directions
swipeRight: SwipeCallBack,
swipeLeft: SwipeCallBack,
});
};
const AssignLastUpdate = () => {
let LastUpdate = '(None)';
if (_LastUpdate) {
switch ($('input[type=\'radio\'][name=\'radUnits\']:checked').val()) {
case 'ENGLISH':
LastUpdate = _LastUpdate.toLocaleString('en-US', { weekday: 'short', month: 'short', day: 'numeric', year: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric', timeZoneName: 'short' });
break;
default:
LastUpdate = _LastUpdate.toLocaleString('en-GB', { weekday: 'short', month: 'short', day: 'numeric', year: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric', timeZoneName: 'short' });
break;
}
}
spanLastRefresh.html(LastUpdate);
if (_LastUpdate && chkAutoRefresh.is(':checked')) StartAutoRefreshTimer();
};
const btnNavigateRefresh_click = () => {
LoadTwcData();
UpdateFullScreenNavigate();
return false;
};
const btnNavigateNext_click = () => {
postMessage('navButton', 'next');
UpdateFullScreenNavigate();
return false;
};
const btnNavigatePrevious_click = () => {
postMessage('navButton', 'previous');
UpdateFullScreenNavigate();
return false;
};
const window_resize = () => {
const $window = $(window);
if ($window.height() === _WindowHeight || $window.width() === _WindowWidth) return;
_WindowHeight = $window.height();
_WindowWidth = $window.width();
try {
postMessage('navButton', 'reset');
} catch (ex) {
console.log(ex);
}
UpdateFullScreenNavigate();
};
let _NavigateFadeIntervalId = null;
const UpdateFullScreenNavigate = () => {
$(document.activeElement).blur();
$('body').removeClass('HideCursor');
$(iframeTwc[0].contentWindow.document).find('body').removeClass('HideCursor');
divTwcLeft.fadeIn2();
divTwcRight.fadeIn2();
divTwcBottom.fadeIn2();
if (_NavigateFadeIntervalId) {
window.clearTimeout(_NavigateFadeIntervalId);
_NavigateFadeIntervalId = null;
}
_NavigateFadeIntervalId = window.setTimeout(() => {
//console.log("window_mousemove: TimeOut");
if (InFullScreen()) {
$('body').addClass('HideCursor');
$(iframeTwc[0].contentWindow.document).find('body').addClass('HideCursor');
divTwcLeft.fadeOut2();
divTwcRight.fadeOut2();
divTwcBottom.fadeOut2();
}
}, 2000);
};
const document_mousemove = (e) => {
if (InFullScreen() && (e.originalEvent.movementX === 0 && e.originalEvent.movementY === 0 && e.originalEvent.buttons === 0)) return;
UpdateFullScreenNavigate();
};
const document_keydown = (e) => {
const code = (e.keyCode || e.which);
if (InFullScreen() || document.activeElement === document.body) {
switch (code) {
case 32: // Space
btnNavigatePlay_click();
return false;
case 39: // Right Arrow
case 34: // Page Down
btnNavigateNext_click();
return false;
case 37: // Left Arrow
case 33: // Page Up
btnNavigatePrevious_click();
return false;
case 36: // Home
btnNavigateMenu_click();
return false;
case 48: // Restart
btnNavigateRefresh_click();
return false;
case 70: // F
btnFullScreen_click();
return false;
default:
}
}
};
$.fn.fadeIn2 = function () {
const _self = this;
let opacity = 0.0;
let IntervalId = null;
if (_self.css('opacity') !== '0') return;
_self.css('visibility', 'visible');
_self.css('opacity', '0.0');
IntervalId = window.setInterval(() => {
opacity += 0.1;
opacity = Math.round2(opacity, 1);
_self.css('opacity', opacity.toString());
if (opacity === 1.0) {
//_self.css("visibility", "");
_self.css('visibility', 'visible');
window.clearInterval(IntervalId);
}
}, 50);
return _self;
};
$.fn.fadeOut2 = function () {
const _self = this;
let opacity = 1.0;
let IntervalId = null;
if (_self.css('opacity') !== '1') return;
_self.css('visibility', 'visible');
_self.css('opacity', '1.0');
IntervalId = window.setInterval(() => {
opacity -= 0.2;
opacity = Math.round2(opacity, 1);
_self.css('opacity', opacity.toString());
if (opacity === 0) {
_self.css('visibility', 'hidden');
window.clearInterval(IntervalId);
}
}, 50);
return _self;
};
Math.round2 = (value, decimals) => Number(Math.round(value + 'e' + decimals) + 'e-' + decimals);
const btnNavigatePlay_click = () => {
postMessage('navButton', 'playToggle');
UpdateFullScreenNavigate();
return false;
};
$(() => {
_WindowHeight = $(window).height();
_WindowWidth = $(window).width();
frmGetLatLng = $('#frmGetLatLng');
txtAddress = $('#txtAddress');
btnClearQuery = $('#btnClearQuery');
btnGetGps = $('#btnGetGps');
iframeTwc = $('#iframeTwc');
divTwc = $('#divTwc');
divTwcTop = $('#divTwcTop');
divTwcMiddle = $('#divTwcMiddle');
divTwcBottom = $('#divTwcBottom');
divTwcLeft = $('#divTwcLeft');
divTwcRight = $('#divTwcRight');
divTwcNavContainer = $('#divTwcNavContainer');
frmScrollText = $('#frmScrollText');
chkScrollText = $('#chkScrollText');
txtScrollText = $('#txtScrollText');
frmScrollText.on('submit', frmScrollText_submit);
txtScrollText.on('focus', function () {
txtScrollText.select();
});
chkScrollText.on('change', chkScrollText_change);
txtAddress.on('focus', function () {
txtAddress.select();
});
txtAddress.focus();
$('.NavigateMenu').on('click', btnNavigateMenu_click);
$('.NavigateRefresh').on('click', btnNavigateRefresh_click);
$('.NavigateNext').on('click', btnNavigateNext_click);
$('.NavigatePrevious').on('click', btnNavigatePrevious_click);
$('.NavigatePlay').on('click', btnNavigatePlay_click);
$(btnGetGps).on('click', btnGetGps_click);
$(window).on('resize', OnFullScreen);
$(window).on('resize', window_resize);
$(document).on('mousemove', document_mousemove);
$(document).on('mousedown', document_mousemove);
divTwc.on('mousedown', document_mousemove);
$(document).on('keydown', document_keydown);
document.addEventListener('touchmove', e => { if (_FullScreenOverride) e.preventDefault(); });
$('.ToggleFullScreen').on('click', btnFullScreen_click);
FullScreenResize();
// listen for messages (from iframe) and handle accordingly
window.addEventListener('message', messageHandler, false);
const categories = [
'Land Features',
'Bay', 'Channel', 'Cove', 'Dam', 'Delta', 'Gulf', 'Lagoon', 'Lake', 'Ocean', 'Reef', 'Reservoir', 'Sea', 'Sound', 'Strait', 'Waterfall', 'Wharf', // Water Features
'Amusement Park', 'Historical Monument', 'Landmark', 'Tourist Attraction', 'Zoo', // POI/Arts and Entertainment
'College', // POI/Education
'Beach', 'Campground', 'Golf Course', 'Harbor', 'Nature Reserve', 'Other Parks and Outdoors', 'Park', 'Racetrack',
'Scenic Overlook', 'Ski Resort', 'Sports Center', 'Sports Field', 'Wildlife Reserve', // POI/Parks and Outdoors
'Airport', 'Ferry', 'Marina', 'Pier', 'Port', 'Resort', // POI/Travel
'Postal', 'Populated Place',
];
const cats = categories.join(',');
const overrides = {
// '32899, Orlando, Florida, USA': { x: -80.6774, y: 28.6143 },
};
const roundToPlaces = function (num, decimals) {
var n = Math.pow(10, decimals);
return Math.round((n * num).toFixed(decimals)) / n;
};
const doRedirectToGeometry = (geom) => {
latLon = {lat:roundToPlaces(geom.y, 4), lon:roundToPlaces(geom.x, 4)};
LoadTwcData();
// Save the query
localStorage.setItem('TwcQuery', txtAddress.val());
};
let PreviousSuggestionValue = null;
let PreviousSuggestion = null;
const OnSelect = (suggestion) => {
let request;
// Do not auto get the same city twice.
if (PreviousSuggestionValue === suggestion.value) return;
PreviousSuggestionValue = suggestion.value;
PreviousSuggestion = suggestion;
if (overrides[suggestion.value]) {
doRedirectToGeometry(overrides[suggestion.value]);
} else {
request = $.ajax({
url: location.protocol + '//geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/find',
data: {
text: suggestion.value,
magicKey: suggestion.data,
f: 'json',
},
jsonp: 'callback',
dataType: 'jsonp',
});
request.done((data) => {
const loc = data.locations[0];
if (loc) {
doRedirectToGeometry(loc.feature.geometry);
} else {
alert('An unexpected error occurred. Please try a different search string.');
}
});
}
};
$('#frmGetLatLng #txtAddress').devbridgeAutocomplete({
serviceUrl: location.protocol + '//geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/suggest',
deferRequestBy: 300,
paramName: 'text',
params: {
f: 'json',
countryCode: 'USA', //'USA,PRI,VIR,GUM,ASM',
category: cats,
maxSuggestions: 10,
},
dataType: 'jsonp',
transformResult: (response) => {
if (_AutoSelectQuery) {
_AutoSelectQuery = false;
window.setTimeout(() => {
$(ac.suggestionsContainer.children[0]).click();
}, 1);
}
return {
suggestions: $.map(response.suggestions, function (i) {
return {
value: i.text,
data: i.magicKey,
};
}),
};
},
minChars: 3,
showNoSuggestionNotice: true,
noSuggestionNotice: 'No results found. Please try a different search string.',
onSelect: OnSelect,
width: 490,
});
const ac = $('#frmGetLatLng #txtAddress').devbridgeAutocomplete();
frmGetLatLng.submit(function () {
if (ac.suggestions[0]) {
$(ac.suggestionsContainer.children[0]).click();
return false;
}
if (PreviousSuggestion) {
PreviousSuggestionValue = null;
OnSelect(PreviousSuggestion);
}
return false;
});
// Auto load the previous query
const TwcQuery = localStorage.getItem('TwcQuery');
if (TwcQuery) {
_AutoSelectQuery = true;
txtAddress.val(TwcQuery);
txtAddress.blur();
txtAddress.focus();
}
const TwcPlay = localStorage.getItem('TwcPlay');
if (!TwcPlay || TwcPlay === 'true') {
_IsPlaying = true;
}
const TwcScrollText = localStorage.getItem('TwcScrollText');
if (TwcScrollText) {
txtScrollText.val(TwcScrollText);
}
const TwcScrollTextChecked = localStorage.getItem('TwcScrollTextChecked');
if (TwcScrollTextChecked && TwcScrollTextChecked === 'true') {
chkScrollText.prop('checked', 'checked');
} else {
chkScrollText.prop('checked', '');
}
btnClearQuery.on('click', () => {
$('#spanCity').text('');
$('#spanState').text('');
$('#spanStationId').text('');
$('#spanRadarId').text('');
$('#spanZoneId').text('');
chkScrollText.prop('checked', '');
txtScrollText.val('');
localStorage.removeItem('TwcScrollText');
localStorage.removeItem('TwcScrollTextChecked');
chkAutoRefresh.prop('checked', 'checked');
localStorage.removeItem('TwcAutoRefresh');
$('#radEnglish').prop('checked', 'checked');
localStorage.removeItem('TwcUnits');
localStorage.removeItem('TwcPlay');
_IsPlaying = true;
localStorage.removeItem('TwcQuery');
PreviousSuggestionValue = null;
PreviousSuggestion = null;
LoadTwcData('');
});
const TwcUnits = localStorage.getItem('TwcUnits');
if (!TwcUnits || TwcUnits === 'ENGLISH') {
$('#radEnglish').prop('checked', 'checked');
} else if (TwcUnits === 'METRIC') {
$('#radMetric').prop('checked', 'checked');
}
$('input[type=\'radio\'][name=\'radUnits\']').on('change', (e) => {
const Units = $(e.target).val();
e;
localStorage.setItem('TwcUnits', Units);
AssignLastUpdate();
postMessage('units', Units);
});
spanLastRefresh = $('#spanLastRefresh');
chkAutoRefresh = $('#chkAutoRefresh');
spanRefreshCountDown = $('#spanRefreshCountDown');
chkAutoRefresh.on('change', (e) => {
const Checked = $(e.target).is(':checked');
if (_LastUpdate) {
if (Checked) {
StartAutoRefreshTimer();
} else {
StopAutoRefreshTimer();
}
}
localStorage.setItem('TwcAutoRefresh', Checked);
});
const TwcAutoRefresh = localStorage.getItem('TwcAutoRefresh');
if (!TwcAutoRefresh || TwcAutoRefresh === 'true') {
chkAutoRefresh.prop('checked', 'checked');
} else {
chkAutoRefresh.prop('checked', '');
}
});
// read and dispatch an event from the iframe
const messageHandler = (event) => {
// test for trust
if (!event.isTrusted) return;
// get the data
const data = JSON.parse(event.data);
// dispatch event
if (!data.type) return;
switch (data.type) {
case 'loaded':
_LastUpdate = new Date();
AssignLastUpdate();
break;
case 'weatherParameters':
populateWeatherParameters(data.message);
break;
case 'isPlaying':
_IsPlaying = data.message;
localStorage.setItem('TwcPlay', _IsPlaying);
if (_IsPlaying) {
_NoSleep.enable();
$('img[src=\'images/nav/ic_play_arrow_white_24dp_1x.png\']').attr('title', 'Pause');
$('img[src=\'images/nav/ic_play_arrow_white_24dp_1x.png\']').attr('src', 'images/nav/ic_pause_white_24dp_1x.png');
$('img[src=\'images/nav/ic_play_arrow_white_24dp_2x.png\']').attr('title', 'Pause');
$('img[src=\'images/nav/ic_play_arrow_white_24dp_2x.png\']').attr('src', 'images/nav/ic_pause_white_24dp_2x.png');
} else {
_NoSleep.disable();
$('img[src=\'images/nav/ic_pause_white_24dp_1x.png\']').attr('title', 'Play');
$('img[src=\'images/nav/ic_pause_white_24dp_1x.png\']').attr('src', 'images/nav/ic_play_arrow_white_24dp_1x.png');
$('img[src=\'images/nav/ic_pause_white_24dp_2x.png\']').attr('title', 'Play');
$('img[src=\'images/nav/ic_pause_white_24dp_2x.png\']').attr('src', 'images/nav/ic_play_arrow_white_24dp_2x.png');
}
break;
default:
console.error(`Unknown event '${data.eventType}`);
}
};
// post a message to the iframe
const postMessage = (type, message = {}) => {
const iframeWindow = document.getElementById('iframeTwc').contentWindow;
iframeWindow.postMessage(JSON.stringify({type, message}, window.location.origin));
};
const StartAutoRefreshTimer = () => {
// Ensure that any previous timer has already stopped.
//StopAutoRefreshTimer();
if (_AutoRefreshIntervalId) {
// Timer is already running.
return;
}
// Reset the time elapsed.
_AutoRefreshCountMs = 0;
const AutoRefreshTimer = () => {
// Increment the total time elapsed.
_AutoRefreshCountMs += _AutoRefreshIntervalMs;
// Display the count down.
let RemainingMs = (_AutoRefreshTotalIntervalMs - _AutoRefreshCountMs);
if (RemainingMs < 0) {
RemainingMs = 0;
}
const dt = new Date(RemainingMs);
spanRefreshCountDown.html((dt.getMinutes() < 10 ? '0' + dt.getMinutes() : dt.getMinutes()) + ':' + (dt.getSeconds() < 10 ? '0' + dt.getSeconds() : dt.getSeconds()));
// Time has elapsed.
if (_AutoRefreshCountMs >= _AutoRefreshTotalIntervalMs) LoadTwcData();
};
_AutoRefreshIntervalId = window.setInterval(AutoRefreshTimer, _AutoRefreshIntervalMs);
AutoRefreshTimer();
};
const StopAutoRefreshTimer = () => {
if (_AutoRefreshIntervalId) {
window.clearInterval(_AutoRefreshIntervalId);
spanRefreshCountDown.html('--:--');
_AutoRefreshIntervalId = null;
}
};
const btnGetGps_click = async () => {
if (!navigator.geolocation) return;
const position = await (() => {
return new Promise(resolve => {
navigator.geolocation.getCurrentPosition(resolve);
});
})();
const latitude = position.coords.latitude;
const longitude = position.coords.longitude;
let data;
try {
data = await $.ajax({
url: location.protocol + '//geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode',
data: {
location: longitude + ',' + latitude,
distance: 1000, // Find location up to 1 KM.
f: 'json',
},
});
} catch (e) {
console.error('Unable to fetch reverse geocode');
console.error(e);
}
const ZipCode = data.address.Postal;
const City = data.address.City;
const State = states.getTwoDigitCode(data.address.Region);
const Country = data.address.CountryCode;
const TwcQuery = `${ZipCode}, ${City}, ${State}, ${Country}`;
txtAddress.val(TwcQuery);
txtAddress.blur();
txtAddress.focus();
// Save the query
localStorage.setItem('TwcQuery', TwcQuery);
};
const populateWeatherParameters = (weatherParameters) => {
$('#spanCity').text(weatherParameters.city + ', ');
$('#spanState').text(weatherParameters.state);
$('#spanStationId').text(weatherParameters.stationId);
$('#spanRadarId').text(weatherParameters.radarId);
$('#spanZoneId').text(weatherParameters.zoneId);
};
const frmScrollText_submit = () => {
chkScrollText_change();
return false;
};
const chkScrollText_change = () => {
txtScrollText.blur();
let ScrollText = txtScrollText.val();
localStorage.setItem('TwcScrollText', ScrollText);
const ScrollTextChecked = chkScrollText.is(':checked');
localStorage.setItem('TwcScrollTextChecked', ScrollTextChecked);
if (chkScrollText.is(':checked') === false) {
ScrollText = '';
}
postMessage('assignScrollText', ScrollText);
};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,2 +0,0 @@
// NoSleep.min.js v0.5.0 - git.io/vfn01 - Rich Tibbett - MIT license
!function(A){function e(A,e,o){var t=document.createElement("source");t.src=o,t.type="video/"+e,A.appendChild(t)}var o={Android:/Android/gi.test(navigator.userAgent),iOS:/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent)},t={WebM:"data:video/webm;base64,GkXfo0AgQoaBAUL3gQFC8oEEQvOBCEKCQAR3ZWJtQoeBAkKFgQIYU4BnQI0VSalmQCgq17FAAw9CQE2AQAZ3aGFtbXlXQUAGd2hhbW15RIlACECPQAAAAAAAFlSua0AxrkAu14EBY8WBAZyBACK1nEADdW5khkAFVl9WUDglhohAA1ZQOIOBAeBABrCBCLqBCB9DtnVAIueBAKNAHIEAAIAwAQCdASoIAAgAAUAmJaQAA3AA/vz0AAA=",MP4:"data:video/mp4;base64,AAAAHGZ0eXBpc29tAAACAGlzb21pc28ybXA0MQAAAAhmcmVlAAAAG21kYXQAAAGzABAHAAABthADAowdbb9/AAAC6W1vb3YAAABsbXZoZAAAAAB8JbCAfCWwgAAAA+gAAAAAAAEAAAEAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAIVdHJhawAAAFx0a2hkAAAAD3wlsIB8JbCAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAAIAAAACAAAAAABsW1kaWEAAAAgbWRoZAAAAAB8JbCAfCWwgAAAA+gAAAAAVcQAAAAAAC1oZGxyAAAAAAAAAAB2aWRlAAAAAAAAAAAAAAAAVmlkZW9IYW5kbGVyAAAAAVxtaW5mAAAAFHZtaGQAAAABAAAAAAAAAAAAAAAkZGluZgAAABxkcmVmAAAAAAAAAAEAAAAMdXJsIAAAAAEAAAEcc3RibAAAALhzdHNkAAAAAAAAAAEAAACobXA0dgAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAIAAgASAAAAEgAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABj//wAAAFJlc2RzAAAAAANEAAEABDwgEQAAAAADDUAAAAAABS0AAAGwAQAAAbWJEwAAAQAAAAEgAMSNiB9FAEQBFGMAAAGyTGF2YzUyLjg3LjQGAQIAAAAYc3R0cwAAAAAAAAABAAAAAQAAAAAAAAAcc3RzYwAAAAAAAAABAAAAAQAAAAEAAAABAAAAFHN0c3oAAAAAAAAAEwAAAAEAAAAUc3RjbwAAAAAAAAABAAAALAAAAGB1ZHRhAAAAWG1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAAK2lsc3QAAAAjqXRvbwAAABtkYXRhAAAAAQAAAABMYXZmNTIuNzguMw=="},i=function(){return o.iOS?this.noSleepTimer=null:o.Android&&(this.noSleepVideo=document.createElement("video"),this.noSleepVideo.setAttribute("loop",""),e(this.noSleepVideo,"webm",t.WebM),e(this.noSleepVideo,"mp4",t.MP4)),this};i.prototype.enable=function(A){o.iOS?(this.disable(),this.noSleepTimer=window.setInterval(function(){window.location.href='/',window.setTimeout(window.stop,0)},A||15e3)):o.Android&&this.noSleepVideo.play()},i.prototype.disable=function(){o.iOS?this.noSleepTimer&&(window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):o.Android&&this.noSleepVideo.pause()},A.NoSleep=i}(this);

1
dist/twc3.html vendored
View file

@ -1 +0,0 @@
<!DOCTYPE html><html lang="en" xmlns="http://www.w3.org/1999/xhtml"><head><meta charset="utf-8"><link rel="preload" href="fonts/Star4000.woff" as="font" crossorigin="anonymous"><link rel="preload" href="fonts/Star 4 Radar.woff" as="font" crossorigin="anonymous"><link rel="preload" href="fonts/Star4000 Extended.woff" as="font" crossorigin="anonymous"><link rel="preload" href="fonts/Star4000 Large Compressed.woff" as="font" crossorigin="anonymous"><link rel="preload" href="fonts/Star4000 Large.woff" as="font" crossorigin="anonymous"><link rel="preload" href="fonts/Star4000 Small.woff" as="font" crossorigin="anonymous"><link rel="stylesheet" type="text/css" href="resources/twc3.min.css?_=2.4.2"><script type="text/javascript" src="resources/data.min.js"></script><script type="text/javascript" src="resources/ws.min.js?_=2.4.2"></script></head><body><div id="version" style="display:none">2.4.2</div><div id="container"></div></body></html>

View file

@ -18,6 +18,7 @@ const js_sources_data = [
'server/scripts/data/travelcities.js', 'server/scripts/data/travelcities.js',
'server/scripts/data/regionalcities.js', 'server/scripts/data/regionalcities.js',
'server/scripts/data/stations.js', 'server/scripts/data/stations.js',
'server/scripts/data/states.js',
]; ];
gulp.task('compress_js_data', () => gulp.task('compress_js_data', () =>
gulp.src(js_sources_data) gulp.src(js_sources_data)
@ -28,6 +29,10 @@ gulp.task('compress_js_data', () =>
const js_sources = [ const js_sources = [
'server/scripts/vendor/jquery-3.5.1.min.js', 'server/scripts/vendor/jquery-3.5.1.min.js',
'server/scripts/vendor/jquery.autocomplete.min.js',
'server/scripts/vendor/nosleep.min.js',
'server/scripts/vendor/jquery.touchSwipe.min.js',
'server/scripts/index.js',
'server/scripts/vendor/libgif.js', 'server/scripts/vendor/libgif.js',
'server/scripts/vendor/luxon.js', 'server/scripts/vendor/luxon.js',
'server/scripts/vendor/suncalc.js', 'server/scripts/vendor/suncalc.js',
@ -53,22 +58,12 @@ gulp.task('compress_js', () =>
.pipe(gulp.dest('./dist/resources')), .pipe(gulp.dest('./dist/resources')),
); );
const css_sources_index = [ const css_sources = [
'server/styles/index.css', 'server/styles/index.css',
]; ];
gulp.task('compress_css_index', () => gulp.task('compress_css', () =>
gulp.src(css_sources_index) gulp.src(css_sources)
.pipe(concat('index.min.css')) .pipe(concat('ws.min.css'))
.pipe(cleanCSS())
.pipe(gulp.dest('./dist/resources')),
);
const css_sources_twc3 = [
'server/styles/twc3.css',
];
gulp.task('compress_css_twc3', () =>
gulp.src(css_sources_twc3)
.pipe(concat('twc3.min.css'))
.pipe(cleanCSS()) .pipe(cleanCSS())
.pipe(gulp.dest('./dist/resources')), .pipe(gulp.dest('./dist/resources')),
); );
@ -90,12 +85,6 @@ gulp.task('compress_html', () =>
const other_files = [ const other_files = [
'server/robots.txt', 'server/robots.txt',
'server/manifest.json', 'server/manifest.json',
'server/scripts/index.js',
'server/scripts/data/states.js',
'server/scripts/vendor/jquery-3.5.1.min.js',
'server/scripts/vendor/jquery.autocomplete.min.js',
'server/scripts/vendor/nosleep.min.js',
'server/scripts/vendor/jquery.touchSwipe.min.js',
]; ];
gulp.task('copy_other_files', () => gulp.task('copy_other_files', () =>
gulp.src(other_files, {base: 'server/'}) gulp.src(other_files, {base: 'server/'})
@ -118,7 +107,6 @@ gulp.task('upload', () =>
maps: { maps: {
CacheControl: (keyname) => { CacheControl: (keyname) => {
if (keyname.indexOf('index.html') > -1) return 'max-age=300'; // 10 minutes if (keyname.indexOf('index.html') > -1) return 'max-age=300'; // 10 minutes
if (keyname.indexOf('twc3.html') > -1) return 'max-age=300'; // 10 minutes
return 'max-age=2592000'; // 1 month return 'max-age=2592000'; // 1 month
}, },
}, },
@ -143,4 +131,4 @@ gulp.task('invalidate', async () => {
}).promise(); }).promise();
}); });
module.exports = gulp.series('clean', gulp.parallel('compress_js','compress_js_data','compress_css_index','compress_css_twc3', 'compress_html', 'copy_other_files'), 'upload', 'invalidate'); module.exports = gulp.series('clean', gulp.parallel('compress_js','compress_js_data','compress_css','compress_html', 'copy_other_files'), 'upload', 'invalidate');

View file

@ -1,9 +1,9 @@
/* globals NoSleep, states */ /* globals NoSleep, states, navigation */
let frmGetLatLng; $(() => {
let txtAddress; index.init();
let btnClearQuery; });
let btnGetGps;
const index = (() => {
let divTwc; let divTwc;
let divTwcTop; let divTwcTop;
let divTwcMiddle; let divTwcMiddle;
@ -11,25 +11,17 @@ let divTwcBottom;
let divTwcLeft; let divTwcLeft;
let divTwcRight; let divTwcRight;
let divTwcNavContainer; let divTwcNavContainer;
let iframeTwc;
let spanLastRefresh;
let chkAutoRefresh;
let spanRefreshCountDown;
let frmScrollText;
let chkScrollText;
let txtScrollText; let txtScrollText;
const _NoSleep = new NoSleep();
let _AutoSelectQuery = false; let _AutoSelectQuery = false;
let _IsPlaying = false; let _IsPlaying = false;
let _NoSleep = new NoSleep();
let _LastUpdate = null; let _LastUpdate = null;
let _AutoRefreshIntervalId = null; let _AutoRefreshIntervalId = null;
let _AutoRefreshIntervalMs = 500; const _AutoRefreshIntervalMs = 500;
let _AutoRefreshTotalIntervalMs = 600000; // 10 min. const _AutoRefreshTotalIntervalMs = 600000; // 10 min.
let _AutoRefreshCountMs = 0; let _AutoRefreshCountMs = 0;
let _FullScreenOverride = false; let _FullScreenOverride = false;
@ -37,7 +29,248 @@ let _FullScreenOverride = false;
let _WindowHeight = 0; let _WindowHeight = 0;
let _WindowWidth = 0; let _WindowWidth = 0;
let latLon; const init = () => {
_WindowHeight = $(window).height();
_WindowWidth = $(window).width();
divTwc = $('#divTwc');
divTwcTop = $('#divTwcTop');
divTwcMiddle = $('#divTwcMiddle');
divTwcBottom = $('#divTwcBottom');
divTwcLeft = $('#divTwcLeft');
divTwcRight = $('#divTwcRight');
divTwcNavContainer = $('#divTwcNavContainer');
txtScrollText = $('#txtScrollText');
$('#frmScrollText').on('submit', frmScrollText_submit);
txtScrollText.on('focus', (e) => {
$(e.target).select();
});
$('#chkScrollText').on('change', chkScrollText_change);
$('#txtAddress').on('focus', (e) => {
$(e.target).select();
}).focus();
$('.NavigateMenu').on('click', btnNavigateMenu_click);
$('.NavigateRefresh').on('click', btnNavigateRefresh_click);
$('.NavigateNext').on('click', btnNavigateNext_click);
$('.NavigatePrevious').on('click', btnNavigatePrevious_click);
$('.NavigatePlay').on('click', btnNavigatePlay_click);
$('#btnGetGps').on('click', btnGetGps_click);
$(window).on('resize', OnFullScreen);
$(window).on('resize', window_resize);
$(document).on('mousemove', document_mousemove);
$(document).on('mousedown', document_mousemove);
divTwc.on('mousedown', document_mousemove);
$(document).on('keydown', document_keydown);
document.addEventListener('touchmove', e => { if (_FullScreenOverride) e.preventDefault(); });
$('.ToggleFullScreen').on('click', btnFullScreen_click);
FullScreenResize();
// listen for messages (from iframe) and handle accordingly
window.addEventListener('message', messageHandler, false);
const categories = [
'Land Features',
'Bay', 'Channel', 'Cove', 'Dam', 'Delta', 'Gulf', 'Lagoon', 'Lake', 'Ocean', 'Reef', 'Reservoir', 'Sea', 'Sound', 'Strait', 'Waterfall', 'Wharf', // Water Features
'Amusement Park', 'Historical Monument', 'Landmark', 'Tourist Attraction', 'Zoo', // POI/Arts and Entertainment
'College', // POI/Education
'Beach', 'Campground', 'Golf Course', 'Harbor', 'Nature Reserve', 'Other Parks and Outdoors', 'Park', 'Racetrack',
'Scenic Overlook', 'Ski Resort', 'Sports Center', 'Sports Field', 'Wildlife Reserve', // POI/Parks and Outdoors
'Airport', 'Ferry', 'Marina', 'Pier', 'Port', 'Resort', // POI/Travel
'Postal', 'Populated Place',
];
const cats = categories.join(',');
const overrides = {
// '32899, Orlando, Florida, USA': { x: -80.6774, y: 28.6143 },
};
const roundToPlaces = function (num, decimals) {
var n = Math.pow(10, decimals);
return Math.round((n * num).toFixed(decimals)) / n;
};
const doRedirectToGeometry = (geom) => {
const latLon = {lat:roundToPlaces(geom.y, 4), lon:roundToPlaces(geom.x, 4)};
LoadTwcData(latLon);
// Save the query
localStorage.setItem('TwcQuery', $('#txtAddress').val());
};
let PreviousSuggestionValue = null;
let PreviousSuggestion = null;
const OnSelect = (suggestion) => {
let request;
// Do not auto get the same city twice.
if (PreviousSuggestionValue === suggestion.value) return;
PreviousSuggestionValue = suggestion.value;
PreviousSuggestion = suggestion;
if (overrides[suggestion.value]) {
doRedirectToGeometry(overrides[suggestion.value]);
} else {
request = $.ajax({
url: location.protocol + '//geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/find',
data: {
text: suggestion.value,
magicKey: suggestion.data,
f: 'json',
},
});
request.done((data) => {
const loc = data.locations[0];
if (loc) {
doRedirectToGeometry(loc.feature.geometry);
} else {
alert('An unexpected error occurred. Please try a different search string.');
}
});
}
};
$('#frmGetLatLng #txtAddress').devbridgeAutocomplete({
serviceUrl: location.protocol + '//geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/suggest',
deferRequestBy: 300,
paramName: 'text',
params: {
f: 'json',
countryCode: 'USA', //'USA,PRI,VIR,GUM,ASM',
category: cats,
maxSuggestions: 10,
},
dataType: 'json',
transformResult: (response) => {
if (_AutoSelectQuery) {
_AutoSelectQuery = false;
window.setTimeout(() => {
$(ac.suggestionsContainer.children[0]).click();
}, 1);
}
return {
suggestions: $.map(response.suggestions, function (i) {
return {
value: i.text,
data: i.magicKey,
};
}),
};
},
minChars: 3,
showNoSuggestionNotice: true,
noSuggestionNotice: 'No results found. Please try a different search string.',
onSelect: OnSelect,
width: 490,
});
const ac = $('#frmGetLatLng #txtAddress').devbridgeAutocomplete();
$('#frmGetLatLng').submit(function () {
if (ac.suggestions[0]) {
$(ac.suggestionsContainer.children[0]).click();
return false;
}
if (PreviousSuggestion) {
PreviousSuggestionValue = null;
OnSelect(PreviousSuggestion);
}
return false;
});
// Auto load the previous query
const TwcQuery = localStorage.getItem('TwcQuery');
if (TwcQuery) {
_AutoSelectQuery = true;
$('#txtAddress').val(TwcQuery)
.blur()
.focus();
}
const TwcPlay = localStorage.getItem('TwcPlay');
if (!TwcPlay || TwcPlay === 'true') {
_IsPlaying = true;
}
const TwcScrollText = localStorage.getItem('TwcScrollText');
if (TwcScrollText) {
txtScrollText.val(TwcScrollText);
}
const TwcScrollTextChecked = localStorage.getItem('TwcScrollTextChecked');
if (TwcScrollTextChecked && TwcScrollTextChecked === 'true') {
$('#chkScrollText').prop('checked', 'checked');
} else {
$('#chkScrollText').prop('checked', '');
}
$('#btnClearQuery').on('click', () => {
$('#spanCity').text('');
$('#spanState').text('');
$('#spanStationId').text('');
$('#spanRadarId').text('');
$('#spanZoneId').text('');
$('#chkScrollText').prop('checked', '');
txtScrollText.val('');
localStorage.removeItem('TwcScrollText');
localStorage.removeItem('TwcScrollTextChecked');
$('#chkAutoRefresh').prop('checked', 'checked');
localStorage.removeItem('TwcAutoRefresh');
$('#radEnglish').prop('checked', 'checked');
localStorage.removeItem('TwcUnits');
localStorage.removeItem('TwcPlay');
_IsPlaying = true;
localStorage.removeItem('TwcQuery');
PreviousSuggestionValue = null;
PreviousSuggestion = null;
});
const TwcUnits = localStorage.getItem('TwcUnits');
if (!TwcUnits || TwcUnits === 'ENGLISH') {
$('#radEnglish').prop('checked', 'checked');
} else if (TwcUnits === 'METRIC') {
$('#radMetric').prop('checked', 'checked');
}
$('input[type=\'radio\'][name=\'radUnits\']').on('change', (e) => {
const Units = $(e.target).val();
e;
localStorage.setItem('TwcUnits', Units);
AssignLastUpdate();
postMessage('units', Units);
});
$('#chkAutoRefresh').on('change', (e) => {
const Checked = $(e.target).is(':checked');
if (_LastUpdate) {
if (Checked) {
StartAutoRefreshTimer();
} else {
StopAutoRefreshTimer();
}
}
localStorage.setItem('TwcAutoRefresh', Checked);
});
const TwcAutoRefresh = localStorage.getItem('TwcAutoRefresh');
if (!TwcAutoRefresh || TwcAutoRefresh === 'true') {
$('#chkAutoRefresh').prop('checked', 'checked');
} else {
$('#chkAutoRefresh').prop('checked', '');
}
};
const FullScreenResize = () => { const FullScreenResize = () => {
const WindowWidth = $(window).width(); const WindowWidth = $(window).width();
@ -75,7 +308,7 @@ const FullScreenResize = () => {
divTwcRight.css('visibility', 'visible'); divTwcRight.css('visibility', 'visible');
IFrameWidth = WindowWidth - LeftWidth - RightWidth; IFrameWidth = WindowWidth - LeftWidth - RightWidth;
iframeTwc.attr('style', 'width:' + IFrameWidth + 'px; height:100%; border:none; margin:0; padding:0; overflow:hidden; z-index:999999;'); $('#display').attr('style', 'width:' + IFrameWidth + 'px; height:100%; border:none; margin:0; padding:0; overflow:hidden; z-index:999999;');
} else { } else {
divTwcTop.show(); divTwcTop.show();
@ -98,7 +331,7 @@ const FullScreenResize = () => {
divTwcBottom.css('visibility', 'visible'); divTwcBottom.css('visibility', 'visible');
IFrameHeight = WindowHeight - TopHeight - BottomHeight; IFrameHeight = WindowHeight - TopHeight - BottomHeight;
iframeTwc.attr('style', 'width:100%; height:' + IFrameHeight + 'px; border:none; margin:0; padding:0; overflow:hidden; z-index:999999;'); $('#display').attr('style', 'width:100%; height:' + IFrameHeight + 'px; border:none; margin:0; padding:0; overflow:hidden; z-index:999999;');
divTwcMiddle.attr('style', 'width:100%; height:' + IFrameHeight + 'px; border:none; margin:0; padding:0; overflow:hidden; z-index:999999;'); divTwcMiddle.attr('style', 'width:100%; height:' + IFrameHeight + 'px; border:none; margin:0; padding:0; overflow:hidden; z-index:999999;');
} }
} }
@ -111,7 +344,6 @@ const FullScreenResize = () => {
divTwc.attr('style', ''); divTwc.attr('style', '');
divTwcMiddle.attr('style', ''); divTwcMiddle.attr('style', '');
iframeTwc.attr('style', '');
$(window).off('resize', FullScreenResize); $(window).off('resize', FullScreenResize);
} }
@ -147,7 +379,6 @@ const OnFullScreen = () => {
} else { } else {
divTwc.attr('style', ''); divTwc.attr('style', '');
divTwcMiddle.attr('style', ''); divTwcMiddle.attr('style', '');
iframeTwc.attr('style', '');
$(window).off('resize', FullScreenResize); $(window).off('resize', FullScreenResize);
FullScreenResize(); FullScreenResize();
@ -227,8 +458,15 @@ const btnNavigateMenu_click = () => {
return false; return false;
}; };
const LoadTwcData = () => { const LoadTwcData = (_latLon) => {
txtAddress.blur(); // if latlon is provided store it locally
if (_latLon) LoadTwcData.latLon = _latLon;
// get the data
const latLon = LoadTwcData.latLon;
// if there's no data stop
if (!latLon) return;
$('#txtAddress').blur();
StopAutoRefreshTimer(); StopAutoRefreshTimer();
_LastUpdate = null; _LastUpdate = null;
AssignLastUpdate(); AssignLastUpdate();
@ -237,7 +475,7 @@ const LoadTwcData = () => {
FullScreenResize(); FullScreenResize();
if (chkScrollText.is(':checked')) { if ($('#chkScrollText').is(':checked')) {
postMessage('assignScrollText', txtScrollText.val()); postMessage('assignScrollText', txtScrollText.val());
} }
@ -245,10 +483,11 @@ const LoadTwcData = () => {
if (_IsPlaying) postMessage('navButton', 'playToggle'); if (_IsPlaying) postMessage('navButton', 'playToggle');
const display = $('#display');
$(iframeTwc[0].contentWindow.document).on('mousemove', document_mousemove); display.on('mousemove', document_mousemove);
$(iframeTwc[0].contentWindow.document).on('mousedown', document_mousemove); display.on('mousedown', document_mousemove);
$(iframeTwc[0].contentWindow.document).on('keydown', document_keydown); display.on('keydown', document_keydown);
const SwipeCallBack = (event, direction) => { const SwipeCallBack = (event, direction) => {
switch (direction) { switch (direction) {
@ -263,7 +502,7 @@ const LoadTwcData = () => {
} }
}; };
$(iframeTwc[0].contentWindow.document).swipe({ display.swipe({
//Generic swipe handler for all directions //Generic swipe handler for all directions
swipeRight: SwipeCallBack, swipeRight: SwipeCallBack,
swipeLeft: SwipeCallBack, swipeLeft: SwipeCallBack,
@ -284,9 +523,9 @@ const AssignLastUpdate = () => {
} }
} }
spanLastRefresh.html(LastUpdate); $('#spanLastRefresh').html(LastUpdate);
if (_LastUpdate && chkAutoRefresh.is(':checked')) StartAutoRefreshTimer(); if (_LastUpdate && $('#chkAutoRefresh').is(':checked')) StartAutoRefreshTimer();
}; };
const btnNavigateRefresh_click = () => { const btnNavigateRefresh_click = () => {
@ -333,7 +572,6 @@ const UpdateFullScreenNavigate = () => {
$(document.activeElement).blur(); $(document.activeElement).blur();
$('body').removeClass('HideCursor'); $('body').removeClass('HideCursor');
$(iframeTwc[0].contentWindow.document).find('body').removeClass('HideCursor');
divTwcLeft.fadeIn2(); divTwcLeft.fadeIn2();
divTwcRight.fadeIn2(); divTwcRight.fadeIn2();
divTwcBottom.fadeIn2(); divTwcBottom.fadeIn2();
@ -347,7 +585,6 @@ const UpdateFullScreenNavigate = () => {
//console.log("window_mousemove: TimeOut"); //console.log("window_mousemove: TimeOut");
if (InFullScreen()) { if (InFullScreen()) {
$('body').addClass('HideCursor'); $('body').addClass('HideCursor');
$(iframeTwc[0].contentWindow.document).find('body').addClass('HideCursor');
divTwcLeft.fadeOut2(); divTwcLeft.fadeOut2();
divTwcRight.fadeOut2(); divTwcRight.fadeOut2();
@ -457,267 +694,6 @@ const btnNavigatePlay_click = () => {
return false; return false;
}; };
$(() => {
_WindowHeight = $(window).height();
_WindowWidth = $(window).width();
frmGetLatLng = $('#frmGetLatLng');
txtAddress = $('#txtAddress');
btnClearQuery = $('#btnClearQuery');
btnGetGps = $('#btnGetGps');
iframeTwc = $('#iframeTwc');
divTwc = $('#divTwc');
divTwcTop = $('#divTwcTop');
divTwcMiddle = $('#divTwcMiddle');
divTwcBottom = $('#divTwcBottom');
divTwcLeft = $('#divTwcLeft');
divTwcRight = $('#divTwcRight');
divTwcNavContainer = $('#divTwcNavContainer');
frmScrollText = $('#frmScrollText');
chkScrollText = $('#chkScrollText');
txtScrollText = $('#txtScrollText');
frmScrollText.on('submit', frmScrollText_submit);
txtScrollText.on('focus', function () {
txtScrollText.select();
});
chkScrollText.on('change', chkScrollText_change);
txtAddress.on('focus', function () {
txtAddress.select();
});
txtAddress.focus();
$('.NavigateMenu').on('click', btnNavigateMenu_click);
$('.NavigateRefresh').on('click', btnNavigateRefresh_click);
$('.NavigateNext').on('click', btnNavigateNext_click);
$('.NavigatePrevious').on('click', btnNavigatePrevious_click);
$('.NavigatePlay').on('click', btnNavigatePlay_click);
$(btnGetGps).on('click', btnGetGps_click);
$(window).on('resize', OnFullScreen);
$(window).on('resize', window_resize);
$(document).on('mousemove', document_mousemove);
$(document).on('mousedown', document_mousemove);
divTwc.on('mousedown', document_mousemove);
$(document).on('keydown', document_keydown);
document.addEventListener('touchmove', e => { if (_FullScreenOverride) e.preventDefault(); });
$('.ToggleFullScreen').on('click', btnFullScreen_click);
FullScreenResize();
// listen for messages (from iframe) and handle accordingly
window.addEventListener('message', messageHandler, false);
const categories = [
'Land Features',
'Bay', 'Channel', 'Cove', 'Dam', 'Delta', 'Gulf', 'Lagoon', 'Lake', 'Ocean', 'Reef', 'Reservoir', 'Sea', 'Sound', 'Strait', 'Waterfall', 'Wharf', // Water Features
'Amusement Park', 'Historical Monument', 'Landmark', 'Tourist Attraction', 'Zoo', // POI/Arts and Entertainment
'College', // POI/Education
'Beach', 'Campground', 'Golf Course', 'Harbor', 'Nature Reserve', 'Other Parks and Outdoors', 'Park', 'Racetrack',
'Scenic Overlook', 'Ski Resort', 'Sports Center', 'Sports Field', 'Wildlife Reserve', // POI/Parks and Outdoors
'Airport', 'Ferry', 'Marina', 'Pier', 'Port', 'Resort', // POI/Travel
'Postal', 'Populated Place',
];
const cats = categories.join(',');
const overrides = {
// '32899, Orlando, Florida, USA': { x: -80.6774, y: 28.6143 },
};
const roundToPlaces = function (num, decimals) {
var n = Math.pow(10, decimals);
return Math.round((n * num).toFixed(decimals)) / n;
};
const doRedirectToGeometry = (geom) => {
latLon = {lat:roundToPlaces(geom.y, 4), lon:roundToPlaces(geom.x, 4)};
LoadTwcData();
// Save the query
localStorage.setItem('TwcQuery', txtAddress.val());
};
let PreviousSuggestionValue = null;
let PreviousSuggestion = null;
const OnSelect = (suggestion) => {
let request;
// Do not auto get the same city twice.
if (PreviousSuggestionValue === suggestion.value) return;
PreviousSuggestionValue = suggestion.value;
PreviousSuggestion = suggestion;
if (overrides[suggestion.value]) {
doRedirectToGeometry(overrides[suggestion.value]);
} else {
request = $.ajax({
url: location.protocol + '//geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/find',
data: {
text: suggestion.value,
magicKey: suggestion.data,
f: 'json',
},
jsonp: 'callback',
dataType: 'jsonp',
});
request.done((data) => {
const loc = data.locations[0];
if (loc) {
doRedirectToGeometry(loc.feature.geometry);
} else {
alert('An unexpected error occurred. Please try a different search string.');
}
});
}
};
$('#frmGetLatLng #txtAddress').devbridgeAutocomplete({
serviceUrl: location.protocol + '//geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/suggest',
deferRequestBy: 300,
paramName: 'text',
params: {
f: 'json',
countryCode: 'USA', //'USA,PRI,VIR,GUM,ASM',
category: cats,
maxSuggestions: 10,
},
dataType: 'jsonp',
transformResult: (response) => {
if (_AutoSelectQuery) {
_AutoSelectQuery = false;
window.setTimeout(() => {
$(ac.suggestionsContainer.children[0]).click();
}, 1);
}
return {
suggestions: $.map(response.suggestions, function (i) {
return {
value: i.text,
data: i.magicKey,
};
}),
};
},
minChars: 3,
showNoSuggestionNotice: true,
noSuggestionNotice: 'No results found. Please try a different search string.',
onSelect: OnSelect,
width: 490,
});
const ac = $('#frmGetLatLng #txtAddress').devbridgeAutocomplete();
frmGetLatLng.submit(function () {
if (ac.suggestions[0]) {
$(ac.suggestionsContainer.children[0]).click();
return false;
}
if (PreviousSuggestion) {
PreviousSuggestionValue = null;
OnSelect(PreviousSuggestion);
}
return false;
});
// Auto load the previous query
const TwcQuery = localStorage.getItem('TwcQuery');
if (TwcQuery) {
_AutoSelectQuery = true;
txtAddress.val(TwcQuery);
txtAddress.blur();
txtAddress.focus();
}
const TwcPlay = localStorage.getItem('TwcPlay');
if (!TwcPlay || TwcPlay === 'true') {
_IsPlaying = true;
}
const TwcScrollText = localStorage.getItem('TwcScrollText');
if (TwcScrollText) {
txtScrollText.val(TwcScrollText);
}
const TwcScrollTextChecked = localStorage.getItem('TwcScrollTextChecked');
if (TwcScrollTextChecked && TwcScrollTextChecked === 'true') {
chkScrollText.prop('checked', 'checked');
} else {
chkScrollText.prop('checked', '');
}
btnClearQuery.on('click', () => {
$('#spanCity').text('');
$('#spanState').text('');
$('#spanStationId').text('');
$('#spanRadarId').text('');
$('#spanZoneId').text('');
chkScrollText.prop('checked', '');
txtScrollText.val('');
localStorage.removeItem('TwcScrollText');
localStorage.removeItem('TwcScrollTextChecked');
chkAutoRefresh.prop('checked', 'checked');
localStorage.removeItem('TwcAutoRefresh');
$('#radEnglish').prop('checked', 'checked');
localStorage.removeItem('TwcUnits');
localStorage.removeItem('TwcPlay');
_IsPlaying = true;
localStorage.removeItem('TwcQuery');
PreviousSuggestionValue = null;
PreviousSuggestion = null;
LoadTwcData('');
});
const TwcUnits = localStorage.getItem('TwcUnits');
if (!TwcUnits || TwcUnits === 'ENGLISH') {
$('#radEnglish').prop('checked', 'checked');
} else if (TwcUnits === 'METRIC') {
$('#radMetric').prop('checked', 'checked');
}
$('input[type=\'radio\'][name=\'radUnits\']').on('change', (e) => {
const Units = $(e.target).val();
e;
localStorage.setItem('TwcUnits', Units);
AssignLastUpdate();
postMessage('units', Units);
});
spanLastRefresh = $('#spanLastRefresh');
chkAutoRefresh = $('#chkAutoRefresh');
spanRefreshCountDown = $('#spanRefreshCountDown');
chkAutoRefresh.on('change', (e) => {
const Checked = $(e.target).is(':checked');
if (_LastUpdate) {
if (Checked) {
StartAutoRefreshTimer();
} else {
StopAutoRefreshTimer();
}
}
localStorage.setItem('TwcAutoRefresh', Checked);
});
const TwcAutoRefresh = localStorage.getItem('TwcAutoRefresh');
if (!TwcAutoRefresh || TwcAutoRefresh === 'true') {
chkAutoRefresh.prop('checked', 'checked');
} else {
chkAutoRefresh.prop('checked', '');
}
});
// read and dispatch an event from the iframe // read and dispatch an event from the iframe
const messageHandler = (event) => { const messageHandler = (event) => {
// test for trust // test for trust
@ -766,17 +742,13 @@ const messageHandler = (event) => {
// post a message to the iframe // post a message to the iframe
const postMessage = (type, message = {}) => { const postMessage = (type, message = {}) => {
const iframeWindow = document.getElementById('iframeTwc').contentWindow; navigation.message({type, message});
iframeWindow.postMessage(JSON.stringify({type, message}, window.location.origin));
}; };
const StartAutoRefreshTimer = () => { const StartAutoRefreshTimer = () => {
// Ensure that any previous timer has already stopped. // Ensure that any previous timer has already stopped.
//StopAutoRefreshTimer(); // check if timer is running
if (_AutoRefreshIntervalId) { if (_AutoRefreshIntervalId) return;
// Timer is already running.
return;
}
// Reset the time elapsed. // Reset the time elapsed.
_AutoRefreshCountMs = 0; _AutoRefreshCountMs = 0;
@ -791,7 +763,7 @@ const StartAutoRefreshTimer = () => {
RemainingMs = 0; RemainingMs = 0;
} }
const dt = new Date(RemainingMs); const dt = new Date(RemainingMs);
spanRefreshCountDown.html((dt.getMinutes() < 10 ? '0' + dt.getMinutes() : dt.getMinutes()) + ':' + (dt.getSeconds() < 10 ? '0' + dt.getSeconds() : dt.getSeconds())); $('#spanRefreshCountDown').html((dt.getMinutes() < 10 ? '0' + dt.getMinutes() : dt.getMinutes()) + ':' + (dt.getSeconds() < 10 ? '0' + dt.getSeconds() : dt.getSeconds()));
// Time has elapsed. // Time has elapsed.
if (_AutoRefreshCountMs >= _AutoRefreshTotalIntervalMs) LoadTwcData(); if (_AutoRefreshCountMs >= _AutoRefreshTotalIntervalMs) LoadTwcData();
@ -802,7 +774,7 @@ const StartAutoRefreshTimer = () => {
const StopAutoRefreshTimer = () => { const StopAutoRefreshTimer = () => {
if (_AutoRefreshIntervalId) { if (_AutoRefreshIntervalId) {
window.clearInterval(_AutoRefreshIntervalId); window.clearInterval(_AutoRefreshIntervalId);
spanRefreshCountDown.html('--:--'); $('#spanRefreshCountDown').html('--:--');
_AutoRefreshIntervalId = null; _AutoRefreshIntervalId = null;
} }
}; };
@ -838,9 +810,9 @@ const btnGetGps_click = async () => {
const Country = data.address.CountryCode; const Country = data.address.CountryCode;
const TwcQuery = `${ZipCode}, ${City}, ${State}, ${Country}`; const TwcQuery = `${ZipCode}, ${City}, ${State}, ${Country}`;
txtAddress.val(TwcQuery); $('#txtAddress').val(TwcQuery)
txtAddress.blur(); .blur()
txtAddress.focus(); .focus();
// Save the query // Save the query
localStorage.setItem('TwcQuery', TwcQuery); localStorage.setItem('TwcQuery', TwcQuery);
@ -860,7 +832,8 @@ const frmScrollText_submit = () => {
return false; return false;
}; };
const chkScrollText_change = () => { const chkScrollText_change = (e) => {
const chkScrollText = $(e.target);
txtScrollText.blur(); txtScrollText.blur();
let ScrollText = txtScrollText.val(); let ScrollText = txtScrollText.val();
@ -874,3 +847,9 @@ const chkScrollText_change = () => {
} }
postMessage('assignScrollText', ScrollText); postMessage('assignScrollText', ScrollText);
}; };
return {
init,
};
})();

View file

@ -21,12 +21,10 @@ const navigation = (() => {
let progress; let progress;
const init = async () => { const init = async () => {
// set up message receive and dispatch accordingly // nothing to do
window.addEventListener('message', (event) => { };
// test for trust
if (!event.isTrusted) return; const message = (data) => {
// get the data
const data = JSON.parse(event.data);
// dispatch event // dispatch event
if (!data.type) return; if (!data.type) return;
@ -46,7 +44,7 @@ const navigation = (() => {
default: default:
console.error(`Unknown event ${data.type}`); console.error(`Unknown event ${data.type}`);
} }
}, false);
}; };
const postMessage = (type, message = {}) => { const postMessage = (type, message = {}) => {
@ -256,6 +254,7 @@ const navigation = (() => {
return { return {
init, init,
message,
updateStatus, updateStatus,
units, units,
isPlaying, isPlaying,

View file

@ -166,14 +166,6 @@ input, button
position: absolute; position: absolute;
} }
#iframeTwc
{
width: 640px;
height: 480px;
overflow: hidden;
border: 0;
}
.HideCursor .HideCursor
{ {
cursor: none !important; cursor: none !important;
@ -183,3 +175,90 @@ input, button
{ {
width: 475px; width: 475px;
} }
@font-face
{
font-family: "Star4000";
src: url('../fonts/Star4000.woff') format('woff');
}
@font-face
{
font-family: "Star 4 Radar";
src: url('../fonts/Star 4 Radar.woff') format('woff');
}
@font-face
{
font-family: 'Star4000 Extended';
src: url('../fonts/Star4000 Extended.woff') format('woff');
}
@font-face
{
font-family: 'Star4000LCN';
src: url('../fonts/Star4000LCN.woff') format('woff');
}
@font-face
{
font-family: 'Star4000 Large Compressed';
src: url('../fonts/Star4000 Large Compressed.woff') format('woff');
}
@font-face
{
font-family: 'Star4000 Large';
src: url('../fonts/Star4000 Large.woff') format('woff');
}
@font-face
{
font-family: 'Star4000 Small';
src: url('../fonts/Star4000 Small.woff') format('woff');
}
#display
{
font-family: "Star4000";
margin: 0 0 0 0;
overflow: hidden;
width: 640px;
height: 480px;
}
jsgif
{
display: none;
}
#Star4000
{
font-family: 'Star4000';
}
#Star4000Extended
{
font-family: 'Star4000 Extended';
}
#Star4000LargeCompressed
{
font-family: 'Star4000 Large Compressed';
}
#Star4000Large
{
font-family: 'Star4000 Large';
}
#Star4000LargeCompressedNumbers
{
font-family: 'Star4000LCN';
}
#Star4000Small
{
font-family: 'Star4000 Small';
}
#Star4Radar
{
font-family: 'Star 4 Radar';
}
#container {
position: absolute;
}
#container canvas {
position: absolute;
}

View file

@ -1,102 +1 @@
@font-face 
{
font-family: "Star4000";
src: url('../fonts/Star4000.woff') format('woff');
/*font-weight: bold;
font-style: italic;*/
}
@font-face
{
font-family: "Star 4 Radar";
src: url('../fonts/Star 4 Radar.woff') format('woff');
}
@font-face
{
font-family: 'Star4000 Extended';
src: url('../fonts/Star4000 Extended.woff') format('woff');
}
@font-face
{
/*font-family: 'Star4000 Large Compressed Numbers';*/
font-family: 'Star4000LCN';
/*src: url('../fonts/Star4000 Large Compressed Numbers.woff') format('woff');*/
src: url('../fonts/Star4000LCN.woff') format('woff');
}
@font-face
{
font-family: 'Star4000 Large Compressed';
src: url('../fonts/Star4000 Large Compressed.woff') format('woff');
}
@font-face
{
font-family: 'Star4000 Large';
src: url('../fonts/Star4000 Large.woff') format('woff');
}
@font-face
{
font-family: 'Star4000 Small';
src: url('../fonts/Star4000 Small.woff') format('woff');
}
body
{
font-family: "Star4000";
margin: 0 0 0 0;
overflow: hidden;
}
input
{
font-family: "Star4000";
}
jsgif
{
display: none;
}
.fontPreload {
visibility: hidden;
position: absolute;
}
#Star4000
{
font-family: 'Star4000';
}
#Star4000Extended
{
font-family: 'Star4000 Extended';
}
#Star4000LargeCompressed
{
font-family: 'Star4000 Large Compressed';
}
#Star4000Large
{
font-family: 'Star4000 Large';
}
#Star4000LargeCompressedNumbers
{
font-family: 'Star4000LCN';
}
#Star4000Small
{
font-family: 'Star4000 Small';
}
#Star4Radar
{
font-family: 'Star 4 Radar';
}
.HideCursor
{
cursor: none !important;
}
#container {
position: absolute;
}
#container canvas {
position: absolute;
}

View file

@ -1 +1 @@
module.exports = '2.4.2'; module.exports = '3.0.0';

View file

@ -4,6 +4,12 @@
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<link rel="preload" href="fonts/Star4000.woff" as="font" crossorigin="anonymous" /> <link rel="preload" href="fonts/Star4000.woff" as="font" crossorigin="anonymous" />
<link rel="preload" href="fonts/Star 4 Radar.woff" as="font" crossorigin="anonymous" />
<link rel="preload" href="fonts/Star4000 Extended.woff" as="font" crossorigin="anonymous" />
<link rel="preload" href="fonts/Star4000 Large Compressed.woff" as="font" crossorigin="anonymous" />
<link rel="preload" href="fonts/Star4000 Large.woff" as="font" crossorigin="anonymous" />
<link rel="preload" href="fonts/Star4000 Small.woff" as="font" crossorigin="anonymous" />
<title>WeatherStar 4000+</title> <title>WeatherStar 4000+</title>
<meta name="description" content="Web based WeatherStar 4000 simulator that reports current and forecast weather conditions plus a few extras!" /> <meta name="description" content="Web based WeatherStar 4000 simulator that reports current and forecast weather conditions plus a few extras!" />
<meta name="keywords" content="WeatherStar 4000+" /> <meta name="keywords" content="WeatherStar 4000+" />
@ -17,13 +23,9 @@
<link rel="icon" href="images/Logo192.png" /> <link rel="icon" href="images/Logo192.png" />
<% if (production) { %> <% if (production) { %>
<link rel="stylesheet" type="text/css" href="resources/index.min.css?_=<%=production%>" /> <link rel="stylesheet" type="text/css" href="resources/ws.min.css?_=<%=production%>" />
<script type="text/javascript" src="scripts/vendor/jquery-3.5.1.min.js"></script> <script type="text/javascript" src="resources/data.min.js"></script>
<script type="text/javascript" src="scripts/vendor/jquery.autocomplete.min.js"></script> <script type="text/javascript" src="resources/ws.min.js?_=<%=production%>"></script>
<script type="text/javascript" src="scripts/vendor/nosleep.min.js"></script>
<script type="text/javascript" src="scripts/vendor/jquery.touchSwipe.min.js"></script>
<script type="text/javascript" src="scripts/index.js"></script>
<script type="text/javascript" src="scripts/data/states.js"></script>
<% } else { %> <% } else { %>
<link rel="stylesheet" type="text/css" href="styles/index.css" /> <link rel="stylesheet" type="text/css" href="styles/index.css" />
<script type="text/javascript" src="scripts/vendor/jquery-3.5.1.min.js"></script> <script type="text/javascript" src="scripts/vendor/jquery-3.5.1.min.js"></script>
@ -32,6 +34,28 @@
<script type="text/javascript" src="scripts/vendor/jquery.touchSwipe.min.js"></script> <script type="text/javascript" src="scripts/vendor/jquery.touchSwipe.min.js"></script>
<script type="text/javascript" src="scripts/index.js"></script> <script type="text/javascript" src="scripts/index.js"></script>
<script type="text/javascript" src="scripts/data/states.js"></script> <script type="text/javascript" src="scripts/data/states.js"></script>
<script type="text/javascript" src="scripts/vendor/libgif.js"></script>
<script type="text/javascript" src="scripts/vendor/luxon.js"></script>
<script type="text/javascript" src="scripts/vendor/suncalc.js"></script>
<script type="text/javascript" src="scripts/data/travelcities.js"></script>
<script type="text/javascript" src="scripts/data/regionalcities.js"></script>
<script type="text/javascript" src="scripts/data/stations.js"></script>
<script type="text/javascript" src="scripts/modules/draw.js"></script>
<script type="text/javascript" src="scripts/modules/weatherdisplay.js"></script>
<script type="text/javascript" src="scripts/modules/icons.js"></script>
<script type="text/javascript" src="scripts/modules/utilities.js"></script>
<script type="text/javascript" src="scripts/modules/currentweather.js"></script>
<script type="text/javascript" src="scripts/modules/latestobservations.js"></script>
<script type="text/javascript" src="scripts/modules/travelforecast.js"></script>
<script type="text/javascript" src="scripts/modules/regionalforecast.js"></script>
<script type="text/javascript" src="scripts/modules/localforecast.js"></script>
<script type="text/javascript" src="scripts/modules/extendedforecast.js"></script>
<script type="text/javascript" src="scripts/modules/almanac.js"></script>
<script type="text/javascript" src="scripts/modules/radar.js"></script>
<script type="text/javascript" src="scripts/modules/progress.js"></script>
<script type="text/javascript" src="scripts/modules/navigation.js"></script>
<% } %> <% } %>
</head> </head>
@ -78,7 +102,11 @@
</div> </div>
</div> </div>
</div> </div>
<iframe id="iframeTwc" src="twc3.html"></iframe> <div id='display'>
<div id="version" style="display:none"><%- version %> </div>
<div id="container">
</div>
</div>
<div id="divTwcRight"> <div id="divTwcRight">
<div> <div>
<div> <div>

View file

@ -1,47 +0,0 @@
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<link rel="preload" href="fonts/Star4000.woff" as="font" crossorigin="anonymous" />
<link rel="preload" href="fonts/Star 4 Radar.woff" as="font" crossorigin="anonymous" />
<link rel="preload" href="fonts/Star4000 Extended.woff" as="font" crossorigin="anonymous" />
<link rel="preload" href="fonts/Star4000 Large Compressed.woff" as="font" crossorigin="anonymous" />
<link rel="preload" href="fonts/Star4000 Large.woff" as="font" crossorigin="anonymous" />
<link rel="preload" href="fonts/Star4000 Small.woff" as="font" crossorigin="anonymous" />
<% if (production) { %>
<link rel="stylesheet" type="text/css" href="resources/twc3.min.css?_=<%=production%>">
<script type="text/javascript" src="resources/data.min.js"></script>
<script type="text/javascript" src="resources/ws.min.js?_=<%=production%>"></script>
<% } else { %>
<link rel="stylesheet" type="text/css" href="styles/twc3.css">
<script type="text/javascript" src="scripts/vendor/jquery-3.5.1.min.js"></script>
<script type="text/javascript" src="scripts/vendor/libgif.js"></script>
<script type="text/javascript" src="scripts/vendor/luxon.js"></script>
<script type="text/javascript" src="scripts/vendor/suncalc.js"></script>
<script type="text/javascript" src="scripts/data/travelcities.js"></script>
<script type="text/javascript" src="scripts/data/regionalcities.js"></script>
<script type="text/javascript" src="scripts/data/stations.js"></script>
<script type="text/javascript" src="scripts/modules/draw.js"></script>
<script type="text/javascript" src="scripts/modules/weatherdisplay.js"></script>
<script type="text/javascript" src="scripts/modules/icons.js"></script>
<script type="text/javascript" src="scripts/modules/utilities.js"></script>
<script type="text/javascript" src="scripts/modules/currentweather.js"></script>
<script type="text/javascript" src="scripts/modules/latestobservations.js"></script>
<script type="text/javascript" src="scripts/modules/travelforecast.js"></script>
<script type="text/javascript" src="scripts/modules/regionalforecast.js"></script>
<script type="text/javascript" src="scripts/modules/localforecast.js"></script>
<script type="text/javascript" src="scripts/modules/extendedforecast.js"></script>
<script type="text/javascript" src="scripts/modules/almanac.js"></script>
<script type="text/javascript" src="scripts/modules/radar.js"></script>
<script type="text/javascript" src="scripts/modules/progress.js"></script>
<script type="text/javascript" src="scripts/modules/navigation.js"></script>
<% } %>
</head>
<body>
<div id="version" style="display:none"><%- version %> </div>
<div id="container">
</div>
</body>
</html>