Thread: Who can spot the html???
-
06-10-2011, 08:26 AM #1
Who can spot the html???
Here's the HTML for the LS THCI lock screen theme, but where the hell does it let me change the country from the UK to the USA? I found where to change the zip code but it's still giving me UK cities. Can't figure it out.......who's gonna find it?
<?xml version="1.0" encoding="UTF-16"?>
<html><head>
<style>
#Layer{width: 322px; height: 482px; position: absolute; top: -1px; right: 0px; down: 0px; left: -1px;}
.stretch {width:100%; height:100%;}
</style>
<table><td>
<div id="Layer"><img src="Layer.png" class="stretch"/></img></div>
<style>
td#Backgrounds
{
margin-top: 0px;
position: absolute; top: 0px; right: 0px; down: 0px; left: 0px;
}
SPAN#clock
{
font-family: Helvetica;
font-weight: 100;
text-align: center;
color: orange;
text-shadow: 0px 0px 10px black;
font-size: 143px;
opacity: 0.9;
text-transform: Capitalize;
-webkit-mask-image: -webkit-gradient(linear, left top, left bottom, from(#666), to(transparent), color-stop(0.43, #666));
}
SPAN#mins
{
font-family: Helvetica;
font-weight: 100;
color: white;
text-shadow: 0px 0px 10px black;
text-align:center;
font-size: 140px;
opacity: 0.7;
text-transform: Capitalize;
-webkit-mask-image: -webkit-gradient(linear, left top, left bottom, from(#666), to(transparent), color-stop(0.5, #666));
}
TD#month
{
font-family: Helvetica;
font-weight: 100;
color: transparent;
text-shadow: 0px 0px 30px black;
font-size: 80px;
opacity: 0.4;
text-transform: Capitalize;
-webkit-text-stroke: 2px white;
-webkit-text-fill-color: transparent;
-webkit-mask-image: -webkit-gradient(linear, left top, left bottom, from(#666), to(transparent), color-stop(0.4, #666));
}
</style>
<script type="text/javascript">
<!--
var this_weekday_name_array = new Array("Sunday","Monday","Tuesday","Wednesday","Thu rsday","Friday","Saturday")
var this_month_name_array = new Array("January","February","March","April","May"," June","July","August","September","October","Novem ber","December") //predefine month names
var this_date_timestamp = new Date()
var this_weekday = this_date_timestamp.getDay()
var this_date = this_date_timestamp.getDate()
var this_month = this_date_timestamp.getMonth()
var this_year = this_date_timestamp.getYear()
if (this_year < 1000)
this_year+= 1900;
if (this_year==101)
this_year=2001;
var this_date_string = this_weekday_name_array[this_weekday] + " " + this_date + " " + this_month_name_array[this_month]//concat long date string
// -->
function init ( )
{
timeDisplay = document.createTextNode ( "" );
document.getElementById("clock").appendChild ( timeDisplay );
}
function updateClock ( )
{
var currentTime = new Date ( );
var currentHours = currentTime.getHours ( );
var currentMinutes = currentTime.getMinutes ( );
var currentSeconds = currentTime.getSeconds ( );
// Pad the minutes and seconds with leading zeros, if required
currentHours = ( currentHours < 10 ? "0" : "" ) + currentHours;
currentMinutes = ( currentMinutes < 10 ? "0" : "" ) + currentMinutes;
currentSeconds = ( currentSeconds < 10 ? "0" : "" ) + currentSeconds;
/*---------------------------------------------------------------------------------------------------------------------------------12 hours to 24 hour Edit------*/
/* Remove the /* from under this line to display the 12 hours clock */ /* NEW!! */
// Choose either "AM" or "PM" as appropriate
var timeOfDay = ( currentHours < 12 ) ? "AM" : "PM";
// Convert the hours component to 12-hour format if needed
currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours;
// Convert an hours component of "0" to "12"
currentHours = ( currentHours == 0 ) ? 12 : currentHours;
/*-----------------------------------------------------------------------------------------------------------------------------------------------*/
// Compose the string for display
var currentTimeString = currentHours;
var currentTimeString1 = currentMinutes;
// Update the time display
document.getElementById("clock").firstChild.nodeVa lue = currentTimeString;
document.getElementById("mins").firstChild.nodeVal ue = currentTimeString1;
}
function init2 ( )
{
timeDisplay = document.createTextNode ( "" );
document.getElementById("ampm").appendChild ( timeDisplay );
}
function amPm ( )
{
var currentTime = new Date ( );
var currentHours = currentTime.getHours ( );
/*---------------------------------------------------------------------------------------------------------------------------------AM PM Edit------*/
/* Remove the /* from under this line to display am or pm after the 12 hours clock */ /* NEW!! */
// Choose either "AM" or "PM" as appropriate
var timeOfDay = ( currentHours < 12 ) ? "AM" : "PM";
// Convert the hours component to 12-hour format if needed
currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours;
// Convert an hours component of "0" to "12"
currentHours = ( currentHours == 0 ) ? 12 : currentHours;
// Compose the string for display
var currentTimeString = timeOfDay;
// Update the time display
document.getElementById("ampm").firstChild.nodeVal ue = currentTimeString;
}
function init3 ( )
{
timeDisplay = document.createTextNode ( "" );
document.getElementById("date").appendChild ( timeDisplay );
}
function calendarDate ( )
{
var this_weekday_name_array = new Array("Sunday","Monday","Tuesday","Wednesday","Thu rsday","Friday","Saturday")
var this_month_name_array = new Array("January","February","March","April","May"," June","July","August","September","October","Novem ber","December") //predefine month names
var this_date_timestamp = new Date()
var this_weekday = this_date_timestamp.getDay()
var this_date = this_date_timestamp.getDate()
var this_month = this_date_timestamp.getMonth()
document.getElementById("month").firstChild.nodeVa lue = this_month_name_array[this_month] //concat long date string
}
// -->
</script>
</head>
<body >
<table style="position: absolute;top: 120px; left: 0px; width: 321px; height: 481px;">
<tr align="center" valign="top" border="0" cellpadding="0">
<td height="12" valign="top" margin-left="20" >
<span id="mins">
<script language="JavaScript">updateClock(); setInterval('updateClock()', 1000 )</script>
</span>
<td></td>
</tr>
</table>
<table style="position: absolute;top: 50px; left: 0px; width: 321px; height: 481px;">
<tr align="center" valign="top" border="0" cellpadding="0">
<td height="12" valign="top" margin-left="20" >
<span id="clock">
<script language="JavaScript">updateClock(); setInterval('updateClock()', 1000 )</script>
</span>
<td></td>
</tr>
</table>
<table style="position: absolute;top: 267px; left: 0px; width: 321px; height: 481px;">
<tr>
<td id=month valign="top" TD STYLE="text-align: center">
<script language="JavaScript">calendarDate(); setInterval('calendarDate()', 1000 )</script>
</span>
<td></td>
</tr>
</table>
</body></html>
<html>
<head><title>weather</title></head>
<head>
<base href="Private/"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta http-equiv="refresh" Content="3600">
</head>
</script>
<script type="text/javascript">
var locale = '19020'
var isCelsius = true
var useRealFeel = false
var enableWallpaper = true;
var enableLockScreen = true;
var stylesheetWall = 'Style'
var stylesheetLock = 'Style'
var stylesheet = 'Style'
var iconSetWall = 'stardock'
var iconExtWall = ".png"
var iconSetLock = 'stardock'
var iconExtLock = '.png'
var source = 'yahooWeather'
var updateInterval = 1200
var postal;
var demoMode = false;
var enabled;
if (location.href.indexOf("LockBackground") == -1){
stylesheet = stylesheetWall;
iconSet = iconSetWall;
iconExt = iconExtWall;
enabled = enableWallpaper;
}else{
stylesheet = stylesheetLock;
iconSet = iconSetLock;
iconExt = iconExtLock;
enabled = enableLockScreen;
}
if(enabled == true){
if(iconSet == null || iconSet == 'null' || iconSet == ""){
var iconSet = stylesheet;
}
var headID = document.getElementsByTagName("head")[0];
var styleNode = document.createElement('link');
styleNode.type = 'text/css';
styleNode.rel = 'stylesheet';
styleNode.href = 'Stylesheets/'+stylesheet+'.css';
headID.appendChild(styleNode);
var scriptNode = document.createElement('script');
scriptNode.type = 'text/javascript';
scriptNode.src = 'Sources/'+source+'.js';
headID.appendChild(scriptNode);
}
function onLoad(){
if (enabled == true){
if (demoMode == true){
document.getElementById("weatherIcon").src="Icon Sets/"+iconSet+"/"+"30"+iconExt;
document.getElementById("city").innerText="Somewhe re";
document.getElementById("desc").innerText="Partly Cloudy";
document.getElementById("temp").innerText="100°";
}else{
document.getElementById("weatherIcon").src="Icon Sets/"+iconSet+"/"+"dunno"+iconExt;
validateWeatherLocation(escape(locale).replace(/^%u/g, "%"), setPostal)
}
}else{
document.getElementsByTagName("body")[0].innerText='';
}
}
function convertTemp(num)
{
if (isCelsius == true)
return Math.round ((num - 32) * 5 / 9);
else
return num;
}
function setPostal(obj){
if (obj.error == false){
if(obj.cities.length > 0){
postal = escape(obj.cities[0].zip).replace(/^%u/g, "%")
document.getElementById("WeatherContainer").classN ame = "";
weatherRefresherTemp();
}else{
document.getElementById("city").innerText="Not Found";
document.getElementById("WeatherContainer").classN ame = "errorLocaleNotFound";
}
}else{
document.getElementById("city").innerText=obj.erro rString;
document.getElementById("WeatherContainer").classN ame = "errorLocaleValidate";
setTimeout('validateWeatherLocation(escape(locale) .replace(/^%u/g, "%"), setPostal)', Math.round(1000*60*5));
}
}
function dealWithWeather(obj){
if (obj.error == false){
document.getElementById("city").innerText=obj.city ;
document.getElementById("desc").innerText=obj.desc ription.toLowerCase();
if(useRealFeel == true){
tempValue = convertTemp(obj.realFeel);
}else{
tempValue = convertTemp(obj.temp)
}
document.getElementById("temp").innerHTML=tempValu e+ "°";
document.getElementById("weatherIcon").src="Icon Sets/"+iconSet+"/"+MiniIcons[obj.icon]+iconExt;
document.getElementById("WeatherContainer").classN ame = "";
}else{
//Could be down to any number of things, which is unhelpful...
document.getElementById("WeatherContainer").classN ame = "errorWeatherDataFetch";
}
}
function weatherRefresherTemp(){
fetchWeatherData(dealWithWeather,postal);
setTimeout(weatherRefresherTemp, 60*1000*updateInterval);
}
var MiniIcons =
[
"0", //0 tornado
"1", //1 tropical storm
"2", //2 hurricane
"3", //3 severe thunderstorms
"4", //4 thunderstorms
"5", //5 mixed rain and snow
"6", //6 mixed rain and sleet
"7", //7 mixed snow and sleet
"8", //8 freezing drizzle
"9", //9 drizzle
"10", //10 freezing rain
"11", //11 showers
"12", //12 showers
"13", //13 snow flurries
"14", //14 light snow showers
"15", //15 blowing snow
"16", //16 snow
"17", //17 hail
"17", //18 sleet
"19", //19 dust
"20", //20 foggy
"21", //21 haze
"22", //22 smoky
"23", //23 blustery
"24", //24 windy
"25", //25 cold
"26", //26 cloudy
"27", //27 mostly cloudy (night)
"28", //28 mostly cloudy (day)
"29", //29 partly cloudy (night)
"30", //30 partly cloudy (day)
"31", //31 clear (night)
"32", //32 sunny
"33", //33 fair (night)
"34", //34 fair (day)
"35", //35 mixed rain and hail
"36", //36 hot
"37", //37 isolated thunderstorms
"38", //38 scattered thunderstorms
"39", //39 scattered thunderstorms
"40", //40 scattered showers
"41", //41 heavy snow
"42", //42 scattered snow showers
"43", //43 heavy snow
"44", //44 partly cloudy
"45", //45 thundershowers
"46", //46 snow showers
"47", //47 isolated thundershowers
"dunno", //3200 not available
];
function constructError (string)
{
return {error:true, errorString:string};
}
function findChild (element, nodeName)
{
var child;
for (child = element.firstChild; child != null; child = child.nextSibling)
{
if (child.nodeName == nodeName)
return child;
}
return null;
}
function fetchWeatherData (callback, zip)
{
url="http://weather.yahooapis.com/forecastrss?u=f&w=" //u=Farenheit, because accuWeather sucks
var xml_request = new XMLHttpRequest();
xml_request.onload = function(e) {xml_loaded(e, xml_request, callback);}
xml_request.overrideMimeType("text/xml");
xml_request.open("GET", url+zip);
xml_request.setRequestHeader("Cache-Control", "no-cache");
xml_request.send(null);
return xml_request;
}
function xml_loaded (event, request, callback)
{
if (request.responseXML)
{
var obj = {error:false, errorString:null};
var effectiveRoot = findChild(findChild(request.responseXML, "rss"), "channel");
obj.city = findChild(effectiveRoot, "yweather:location").getAttribute("city");
obj.realFeel = findChild(effectiveRoot, "yweather:wind").getAttribute("chill");//Only accounts for windChill
conditionTag = findChild(findChild(effectiveRoot, "item"), "yweather:condition");
obj.temp = conditionTag.getAttribute("temp");
obj.icon = conditionTag.getAttribute("code");
obj.description = conditionTag.getAttribute("text");
callback (obj);
}else{
callback ({error:true, errorString:"XML request failed. no responseXML"});
}
}
function validateWeatherLocation (location, callback)
{
var obj = {error:false, errorString:null, cities: new Array};
obj.cities[0] = {zip: location}; //Not very clever, are we?
callback (obj);
}
</script>
<script>
var EnableCalendar = true;
var EnableWordCalendar = false;
var EnableSpringBoardCalendar = true;
var MCal = false;
var LineCal = true;
enableIOsWallpaper = false;
weekdays = new Array('S', 'M', 'T', 'W', 'Th', 'F', 'S');
months = new Array('January', 'February', 'Mars', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
</script>
<style>
body {
background-color: none;
margin: 0;
height: 481px;
width: 320px;
font-family: Helvetica;
font-weight: 100;
color: white;
text-shadow: 0px 0px 5px black;
}
/* ----------------------------------------------------------------------------------------------------------------------------------- */
<!-- Line Calendar Style Section-->
* {
margin: 0;
padding: 0;
}
.hidden {
display: none;
}
#linebackground {
width: 250px;
height: 482px;
position: absolute;
top: 0px;
left: 0px;
}
#linecalendarcontainer {
position: absolute;
top: 290px;
left: 0px;
width: 250px;
height: 300px;
}
#linecalendar {
position:absolute; top:10px; left: 0px; width: 320px; height: 300px; text-align: center;
font-size: 26px;
color: white;
text-shadow: 0px 0px 1px black;
-webkit-mask-image: -webkit-gradient(linear, left top, left bottom, from(#666), to(transparent), color-stop(0.6, #666));
}
#lineweek {
margin-top: 20px;
}
.linedaysofweek, #linedays {
font-size: 14px;
padding: 0 2px;
}
.linehidden {
display: none;
}
.yearofweek {
color: orange;
font-size: 14px;
padding: 0px 2px;
text-shadow: 0px 0px 4px black;
-webkit-mask-image: -webkit-gradient(linear, left top, left bottom, from(#666), to(transparent), color-stop(0.6, #666));
}
.linetoday {
color: orange;
font-size: 14px;
padding: 0px 2px;
text-shadow: 0px 0px 4px black;
-webkit-mask-image: -webkit-gradient(linear, left top, left bottom, from(#666), to(transparent), color-stop(0.6, #666));
}
#linetextcontainer {
font-size: 50px;
}
.linetextcontainer p {
margin: 0;
}
</style>
<!---------------------------------------------------------------------------------------------------------------->
<!-- Display Wallpaper and Overlay here -->
<div id="background">
<img src="" width="320" height="480" id="HomeBackground" />
<img src="" width="320" height="480">
</div>
<script type="text/javascript">
function init() {
clearInterval(load_timer);
if (enableIOsWallpaper == false) {
$('HomeBackground').className = 'hidden';
}
setInterval('updateElements()', 1000);
}
/* -----------------------------------------------------------------------------------------------------------------
Lineair Calendar Script
----------------------------------------------------------------------------------------------------------------- */
function $(selector) {
return document.getElementById(selector);
}
function updateElements() {
updateDate();
updatelineClock();
getCurrentTime();
}
function updatelineClock() {
var ampm = '',
currentTime = new Date(),
currentHours = currentTime.getHours(),
currentMinutes = currentTime.getMinutes();
if(use24Hour == false) {
if (enableAMPM == true) {
ampm = (currentHours > 11) ? ' pm' : ' am';
}
currentHours = (currentHours > 12) ? currentHours-12 : currentHours;
}
if (leadingZero == true) {
currentHours = (currentHours < 10 ? '0' : '') + currentHours;
}
currentMinutes = (currentMinutes < 10 ? '0' : '') + currentMinutes;
var currentTimeString = currentHours + ':' + currentMinutes + ampm,
texto = document.createTextNode(currentTimeString),
lineclock = $('lineclock').firstChild;
if (clock)
$('lineclock').replaceChild(texto, lineclock);
else
$('lineclock').appendChild(texto);
}
function updateDate() {
var this_weekday_name_array = weekdays,
this_month_name_array = months,
this_date_timestamp = new Date(),
this_weekday = this_date_timestamp.getDay(),
this_date = this_date_timestamp.getDate(),
this_month = this_date_timestamp.getMonth(),
this_year = this_date_timestamp.getFullYear(),
dim = [31,0,31,30,31,30,31,31,30,31,30,31],
oD = new Date(this_year, this_date-1, 1),
linecalendar = $('linecalendar').firstChild;
oD.od = oD.getDay()+1;
dim[1]=(((oD.getFullYear()%100 != 0) && (oD.getFullYear()%4 == 0)) || (oD.getFullYear()%400 == 0)) ? 29 : 28;
var t = '',
k = 0,
days_TM = dim[this_month],
days_PM = (this_month == 0) ? dim[11] : dim[this_month-1],
days_NM = (this_month == 11) ? dim[0] : dim[this_month+1];
do {
var k2 = this_date-k,
wkstart = (k2<=0) ? days_PM+k2 : k2;
k++;
} while(k <= this_weekday);
for (s=0;s<7;s++) {
t += (s == this_weekday) ? '<span class="linetoday">' + this_weekday_name_array[s] + '</span>' : '<span class="linedaysofweek">' + this_weekday_name_array[s] + '</span>';
}
t += '<span class="yearofweek"> (2011) </span>';
for (L=0;L<this_weekday;L++) {
var L2 = L+wkstart;
if(L2>days_PM)
L2 = L2-days_PM;
t += (L2 == this_date) ? '<span class="linetoday">' + L2 + '</span>' : '<span class="linedaysofweek">' + L2 + '</span>';
}
for (M=0;M<=6-this_weekday;M++) {
var M2 = M+this_date;
if(M2 > days_TM)
M2 = M2-days_TM;
t += (M2 == this_date) ? '<span class="linetoday">' + M2 + '</span>' : '<span class="linedaysofweek">' + M2 + '</span>';
}
if (EnableSpringBoardCalendar == true){
if (LineCal == true) {
var texto = document.createElement('div');
texto.innerHTML = '<div id="lineweek">' + t + '</div>';
if (linecalendar)
$('linecalendar').replaceChild(texto, linecalendar);
else
$('linecalendar').appendChild(texto);
}
}
}
function capitAll(str) {
str = str.toLowerCase().replace(/([-\.']) */g,'$1 ');
var rx = /\b([a-z'-\.]+)\b/ig;
str = str.replace(rx,function(w){ return w.charAt(0).toUpperCase()+w.substring(1); });
return str.replace(/^ *|(\-|') *| *$/g,'$1');
}
function constructError(string) {
return {error:true, errorString:string};
}
function findChild(element, nodeName) {
var child;
for (child = element.firstChild; child != null; child = child.nextSibling) {
if (child.nodeName == nodeName)
return child;
}
return null;
}
load_timer = setInterval(function() {
var state = document.readyState;
if (state == 'loaded' || state == 'complete') {
init();
}
}, 50);
</script>
<body bgcolor="Transparent" onload="onLoad()"; "setInterval('getCurrentTime()', 1000);">
<div>
<div id="time"></div>
<div id="linebackground">
<div id="linecalendarcontainer">
<span id="linecalendar"></span>
</div>
</style>
</script>
<body onload="onLoad()">
<div id="WeatherContainer">
<div id="TextContainer">
<p id="city">Loading...</p>
<p id="temp">-</p>
<p id="desc">...</p>
</div>
<img id="weatherIcon" src=""/>
</div>
</body>
</html>
-
06-10-2011, 10:38 AM #2
var locale = '19020
-
06-11-2011, 10:35 AM #3
bgattis is correct. You may have a problem, because the number 19020 above is a zip code, and the city is defined by the zip code, as indicated by the following line (it's even commented by the coder):
obj.cities[0] = {zip: location}; //Not very clever, are we?
So, it seems pretty US-centric and, frankly, not very robust on the part of the coder. I think you'd have to define another variable (call it 'country') and then define it in an array. I'd use ccTLD's (eg., us, uk, fr, de, etc.), and then a conditional function (ie, something like "if country =='us', then location = zip; else if 'country' = 'uk', then location = postal code", etc.) I'm not trying to be syntactically correct, but rather simply to give you an idea of what would have to go on.
Nice double-post by the way.
Oops-- you want to go from UK>US. Okay, let me look again...Last edited by Amadomon; 06-11-2011 at 10:37 AM.
Quaerite et invenietis.
-
06-14-2011, 01:16 AM #4



LinkBack URL
About LinkBacks
Reply With Quote
