This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Lockbackground

By: a guest on Apr 13th, 2013  |  syntax: None  |  size: 20.46 KB  |  views: 19  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?xml version="1.0" encoding="UTF-16"?>
  2.  
  3. <html><head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  5. <meta http-equiv="refresh" content="900; url=Wallpaper.html"/>
  6. </head>
  7. <!---------------------------------------------------------------------------------------------------------------->
  8. <!-- Option menu -->
  9. <script>
  10.         var EnableClock         =       true;
  11.         var EnableCalendar      =       true;
  12.         var EnableWeather       =       true;
  13. </script>
  14.  
  15. <!---------------------------------------------------------------------------------------------------------------->
  16. <!-- Style section -->
  17. <style>
  18. #Layer{width: 322px; height: 482px; position: absolute; top: -1px; right: 0px; down: 0px; left: -1px;}
  19. .stretch {width:100%; height:100%;}
  20.  
  21. body {
  22.         background-color: none;
  23.         margin: 0;
  24.         height: 481px;
  25.         width: 320px;
  26. }
  27.  
  28. td#Backgrounds
  29. {
  30.         margin-top: -1px;
  31.         position: absolute; top: 0px; right: 0px; down: 0px; left: -1px;
  32. }
  33.  
  34. SPAN#clock
  35. {
  36.         text-align: center;
  37.         font-family: Helvetica;
  38.         font-weight: bold;
  39.         color: #FFFFFF;
  40.     text-shadow: #FFFFFF 0px 0px 1px; opacity: 1;
  41.         font-size: 55px;
  42.         font-weight: 100;
  43.         opacity: 0.89;
  44. }
  45.  
  46. TD#date
  47. {
  48.         font-family: Helvetica;
  49.         font-weight: 300;
  50.         text-align: left;
  51.         color:#FFFFFF;
  52.         text-shadow: 0px 0px 8px #FFFFFF;
  53.         font-size: 17px;
  54.         text-transform: uppercase;
  55.         opacity: 0.9;
  56.         letter-spacing: 0.01em;
  57.        
  58. }
  59.  
  60.     SPAN#ampm
  61. {
  62.         font-family: Helvetica;
  63.         font-weight: 100;
  64.         color:  #306EFF;
  65.         text-shadow: 1px 1px 1px #000;  
  66.         font-size: 17px;
  67.         text-transform: uppercase;
  68.         text-align: left;
  69.         opacity: 0;
  70.         letter-spacing: 2px;
  71.  
  72.  
  73. }
  74.  
  75. TD#vmonth
  76. {
  77.         float:top;
  78.         font-family: Helvetica;
  79.         font-weight: 300;
  80.         text-align: left;
  81.         color:#FFFFFF;
  82.         text-shadow: 0px 0px 8px #FFFFFF;
  83.         font-size: 17px;
  84.         text-transform: uppercase;
  85.         opacity: 0.9;
  86.         letter-spacing: 0.01em;
  87. }
  88.  
  89. TD#vweek
  90. {
  91.         float:top;
  92.         font-family: Helvetica;
  93.         font-weight: 300;
  94.         text-align: left;
  95.         color:#FFFFFF;
  96.         text-shadow: 0px 0px 18px #FFFFFF;
  97.         font-size: 17px;
  98.         opacity: 0.9;
  99.         text-transform: uppercase;      
  100.         letter-spacing: 0.01em;
  101. }
  102.  
  103. TD#vyear
  104. {
  105.         font-family: Helvetica;
  106.         font-weight: 300;
  107.         text-align: left;
  108.         color:#FFFFFF;
  109.     text-shadow: #FFFFFF 0px 0px 8px;
  110.         font-size: 17px;
  111.         letter-spacing: 0.01em;
  112.     text-transform: uppercase;
  113.         opacity: 0.8;
  114.  
  115.        
  116. }
  117.  
  118. #WeatherContainer{
  119.     background-color: rgba(0,0,0,0);
  120. }
  121.  
  122. #TextContainer{
  123.     font-size:20px;
  124.         font-family: Helvetica;
  125.     font-weight: 300;
  126.     color: white;
  127.  
  128. }
  129.  
  130. #temp{
  131.         position: absolute; top: 200px; left: 135; down: 0px; width: 320px; height: 461px;
  132.         text-align: left;
  133.         font-family: Century Gothic;
  134.         font-size: 14px;
  135.         font-weight: 500;
  136.         color: #FFFFFF;
  137.         text-shadow: 0px 0px 0px #FFFFFF;
  138.         text-transform: uppercase;
  139.         opacity: 0.8;
  140. }
  141.  
  142. #desc{
  143.         position: absolute; top: 463px; down: 0px; width: 320px; height: 461px;
  144.         text-align: left;
  145.         font-family: Helvetica;
  146.         font-weight: 800;
  147.         font-size: 14px;
  148.         color: fffffff;
  149.         text-shadow: none;
  150.         text-transform: uppercase;
  151.         text-shadow: 0px 0px 2px #FFFFFF;
  152.         letter-spacing: 0.0em;
  153.         opacity: 0.6;
  154.         display: none;
  155.  
  156.        
  157. }
  158.  
  159. #TextContainer p{
  160.         margin:0;
  161. }
  162.  
  163. #weatherIcon{
  164.         position: absolute; top: 210px;down: 0px; left: 85px; width: 115px; height: 461px;
  165.         height:60;
  166.         width:60;
  167.         opacity: 0.8;
  168. }
  169.  
  170. </style>
  171.  
  172. <!---------------------------------------------------------------------------------------------------------------->
  173. <!-- Display Wallpaper and Overlay here -->
  174. <div id="Layer"><img src="LockBackground.png" class="stretch"/></div>
  175. <div id="Layer"><img src="Overlay.png" class="stretch"/></img></div>
  176.  
  177. <!---------------------------------------------------------------------------------------------------------------->
  178. <!-- Direct the script to the general folder where the weather icons are located -->
  179. <base href="Weather/"/>
  180.  
  181. <!---------------------------------------------------------------------------------------------------------------->
  182. <!-- Clock and Date Script -->
  183. <script type="text/javascript">
  184.  
  185. function updateClock ( )
  186. {
  187.         var currentHours_name_array = new Array ("00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "00")
  188.         var currentMinutes_name_array = new Array ("00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28","29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", "00")
  189.         var currentTime = new Date ( );
  190.         var currentHours = currentTime.getHours ( );
  191.         var currentMinutes = currentTime.getMinutes ( );
  192.         var currentSeconds = currentTime.getSeconds ( );
  193.  
  194. // Convert an hours component of "0" to "12"
  195.         //currentHours = ( currentHours == 0 ) ? currentHours + 24 : currentHours;
  196.  
  197. // Convert the hours component to 12-hour format if needed
  198.         currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours;
  199.         currentHours = ( currentHours < 10 ? "0" : "" ) + currentHours;
  200.  
  201.  
  202. // Convert an hours component of "0" to "12"
  203.         currentHours = ( currentHours == 0 ) ? 12 : currentHours;
  204.     currentMinutes = ( currentMinutes < 10 ? "0" : "" ) + currentMinutes;
  205. // Compose the string for display
  206.         var currentTimeString = currentHours + ":" + currentMinutes;
  207.  
  208. // Update the time display
  209.         document.getElementById("clock").firstChild.nodeValue = currentTimeString ;
  210.  
  211. //Pad the minutes and seconds with leading zeros, if required
  212.         currentHours = ( currentHours < 10 ? "0" : "" ) + currentHours;
  213.     currentMinutes = ( currentMinutes < 10 ? "0" : "" ) + currentMinutes;
  214.     currentSeconds = ( currentSeconds < 10 ? "0" : "" ) + currentSeconds;
  215. }
  216.  
  217. function amPm ( )
  218. {
  219.         var currentTime = new Date ( );
  220.         var currentHours = currentTime.getHours ( );
  221.  
  222. <!-- Convert hours component of "12" to "24" -->
  223.         currentHours = currentHours;
  224.         currentHours = ( currentHours < 0 ) ? currentHours + 24 : currentHours;
  225.  
  226. <!-- Defines either "AM" or "PM" as appropriate -->
  227.         var timeOfDay = ( currentHours < 12 ) ? "AM" : "PM";
  228.  
  229. <!-- Compose the string for display-->
  230.         var currentTimeString = timeOfDay;
  231.  
  232. <!-- Update the string for display of AM/PM-->
  233.         if (EnableClock == true){
  234.                 document.getElementById("ampm").firstChild.nodeValue = currentTimeString;
  235.         }
  236. }
  237.  
  238. function calendarDate ( )
  239. {
  240.     var this_date_name_array = new Array ("0", "first", "second", "third", "fourth", "fifth", "sixth", "seventh", "eighth", "ninth", "tenth", "eleventh", "twelvth", "thirteenth", "fourteenth", "fifteenth", "sixteenth", "seventeenth", "eighteenth", "nineteenth", "twentieth", "twenty-first", "twenty-second", "twenty-third", "twenty-fourth", "twenty-fifth", "twenty-sixth", "twenty-seventh" ,"twenty-eighth", "twenty-ninth" ,"thirtieth", "thirtieth-one")
  241.         var this_weekday_name_array = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
  242.     var this_month_name_array = new Array("january","february","march","april","may","june","july","august","september","october","november","december")            //predefine month names
  243.        
  244.        
  245.         var this_date_timestamp = new Date()
  246.         var this_weekday = this_date_timestamp.getDay()
  247.         var this_date = this_date_timestamp.getDate()
  248.         var this_month = this_date_timestamp.getMonth()
  249.         var this_year = this_date_timestamp.getYear()
  250.  
  251.         if (this_year < 1000)
  252.                 this_year+= 1900;
  253.         if (this_year==101)
  254.                 this_year=2001;
  255.  
  256.         var month = this_date_timestamp.getMonth();
  257.  
  258.         if (EnableCalendar == true){
  259.                 document.getElementById("calendar").firstChild.nodeValue = this_date_name_array[this_date]
  260.                 document.getElementById("vmonth").firstChild.nodeValue = this_month_name_array[this_month]
  261.                 document.getElementById("vweek").firstChild.nodeValue = this_weekday_name_array[this_weekday]
  262.                 document.getElementById("vyear").firstChild.nodeValue = this_year
  263.         }
  264. }
  265.  
  266. <!---------------------------------------------------------------------------------------------------------------->
  267. <!-- Weather Script -->
  268.  
  269.         var locale = "USWA0395"
  270.         var isCelsius = false
  271.         var useRealFeel = false
  272.         var enableWallpaper = true;
  273.         var enableLockScreen = true;
  274.         var stylesheetWall = 'mini'
  275.         var stylesheetLock = 'mini'
  276.         var stylesheet = 'mini'
  277.         var iconSetWall = 'stardock white'
  278.         var iconExtWall = ".png"
  279.         var iconSetLock = 'stardock white'
  280.         var iconExtLock = '.png'
  281.         var source = 'yahooWeather'
  282.         var updateInterval = 30
  283.         var postal;
  284.         var demoMode = false;
  285.         var enabled;
  286.  
  287. if (location.href.indexOf("LockBackground")  == -1){
  288.  
  289.         stylesheet = stylesheetWall;
  290.         iconSet = iconSetWall;
  291.         iconExt = iconExtWall;
  292.         enabled = enableWallpaper;
  293. }else{
  294.         stylesheet = stylesheetLock;
  295.         iconSet = iconSetLock;
  296.         iconExt = iconExtLock;
  297.         enabled = enableLockScreen;
  298. }
  299.  
  300.  
  301. if(enabled == true){
  302.         if(iconSet == null || iconSet == 'null' || iconSet == ""){
  303.                 var iconSet = stylesheet;
  304. }
  305.  
  306. var headID = document.getElementsByTagName("head")[0];
  307. var styleNode = document.createElement('link');
  308. styleNode.type = 'text/css';
  309. styleNode.rel = 'stylesheet';
  310. styleNode.href = 'Stylesheets/'+stylesheet+'.css';
  311. headID.appendChild(styleNode);
  312.  
  313. var scriptNode = document.createElement('script');
  314. scriptNode.type = 'text/javascript';
  315. scriptNode.src = 'Sources/'+source+'.js';
  316. headID.appendChild(scriptNode);
  317. }
  318.  
  319. function onLoad(){
  320.         if (EnableWeather == true){
  321.         if (demoMode == true){
  322.                 document.getElementById("weatherIcon").src="Icon Sets/"+iconSet+"/"+"cloudy1"+iconExt;
  323.                 document.getElementById("city").innerText="Somewhere";
  324.                 document.getElementById("desc").innerText="Partly Cloudy";
  325.                 document.getElementById("temp").innerText="100º";
  326.         }else{
  327.                 document.getElementById("weatherIcon").src="Icon Sets/"+iconSet+"/"+"dunno"+iconExt;
  328.                 validateWeatherLocation(escape(locale).replace(/^%u/g, "%"), setPostal)
  329.         }
  330.         }else{
  331.                 document.getElementById("weatherIcon").src="Icon Sets/"+iconSet+"/"+"blank"+iconExt;
  332.                 document.getElementById("city").innerText="";
  333.                 document.getElementById("desc").innerText="";
  334.                 document.getElementById("temp").innerText="";
  335.  
  336.         }
  337. }
  338.  
  339.  
  340. function convertTemp(num)
  341. {
  342.         if (isCelsius == true)
  343.                 return Math.round ((num - 32) * 5 / 9);
  344.         else
  345.                 return num;
  346. }
  347.  
  348.  
  349. function setPostal(obj){
  350.         if (obj.error == false){
  351.                 if(obj.cities.length > 0){
  352.                         postal = escape(obj.cities[0].zip).replace(/^%u/g, "%")
  353.                         document.getElementById("WeatherContainer").className = "";
  354.                         weatherRefresherTemp();
  355.                 }else{
  356.                         document.getElementById("city").innerText="Not Found";
  357.                         document.getElementById("WeatherContainer").className = "errorLocaleNotFound";
  358.                 }
  359.         }else{
  360.                 document.getElementById("city").innerText=obj.errorString;
  361.                 document.getElementById("WeatherContainer").className = "errorLocaleValidate";
  362.                 setTimeout('validateWeatherLocation(escape(locale).replace(/^%u/g, "%"), setPostal)', Math.round(1000*60*5));
  363.         }
  364. }
  365.  
  366.  
  367. function dealWithWeather(obj){
  368.         if (obj.error == false){
  369.                 document.getElementById("city").innerText=obj.city;
  370.                 document.getElementById("desc").innerText=obj.description.toLowerCase();
  371.                 if(useRealFeel == true){
  372.                         tempValue = convertTemp(obj.realFeel);
  373.                 }else{
  374.                         tempValue = convertTemp(obj.temp)
  375.                 }
  376.                 document.getElementById("temp").innerHTML=tempValue+ "&#176;";
  377.                 document.getElementById("weatherIcon").src="Icon Sets/"+iconSet+"/"+MiniIcons[obj.icon]+iconExt;
  378.                 document.getElementById("WeatherContainer").className = "";
  379.         }else{
  380.                 document.getElementById("WeatherContainer").className = "errorWeatherDataFetch";
  381.         }
  382. }
  383.  
  384.  
  385. function weatherRefresherTemp(){
  386.         fetchWeatherData(dealWithWeather,postal);
  387.         setTimeout(weatherRefresherTemp, 60*1000*updateInterval);
  388. }
  389.  
  390.  
  391. var MiniIcons =
  392. [
  393.         "00",                  //0      tornado
  394.         "01",                  //1      tropical storm
  395.         "02",                  //2      hurricane
  396.         "03",                  //3      severe thunderstorms
  397.         "04",                  //4      thunderstorms
  398.         "05",                  //5      mixed rain and snow
  399.         "06",                  //6      mixed rain and sleet
  400.         "07",                  //7      mixed snow and sleet
  401.         "08",                  //8      freezing drizzle
  402.         "09",                  //9      drizzle
  403.         "10",                  //10     freezing rain
  404.         "11",                  //11     showers
  405.         "12",                  //12     showers
  406.         "13",                  //13     snow flurries
  407.         "14",                  //14     light snow showers
  408.         "15",                  //15     blowing snow
  409.         "16",                  //16     snow
  410.         "17",                  //17     hail
  411.         "18",                  //18     sleet
  412.         "19",                  //19     dust
  413.         "20",                  //20     foggy
  414.         "21",                  //21     haze
  415.         "22",                  //22     smoky
  416.         "23",                  //23     blustery
  417.         "24",                  //24     windy
  418.         "25",                  //25     cold
  419.         "26",                  //26     cloudy
  420.         "27",                 //27      mostly cloudy (night)
  421.         "28",                  //28     mostly cloudy (day)
  422.         "29",                 //29      partly cloudy (night)
  423.         "30",                  //30     partly cloudy (day)
  424.         "31",                 //31      clear (night)
  425.         "32",                  //32     sunny
  426.         "33",                  //33     fair (night)
  427.         "34",                  //34     fair (day)
  428.         "35",                  //35     mixed rain and hail
  429.         "36",                  //36     hot
  430.         "37",                  //37     isolated thunderstorms
  431.         "38",                  //38     scattered thunderstorms
  432.         "39",                  //39     scattered thunderstorms
  433.         "40",                  //40     scattered showers
  434.         "41",                  //41     heavy snow
  435.         "42",                  //42     scattered snow showers
  436.         "43",                  //43     heavy snow
  437.         "44",                  //44     partly cloudy
  438.         "45",                  //45     thundershowers
  439.         "46",                  //46     snow showers
  440.         "47",                  //47     isolated thundershowers
  441.         "dunno",                //3200 not available
  442. ]
  443.  
  444.  
  445. function constructError (string)
  446. {
  447.         return {error:true, errorString:string};
  448. }
  449.  
  450.  
  451. function findChild (element, nodeName)
  452. {
  453.         var child;
  454.         for (child = element.firstChild; child != null; child = child.nextSibling)
  455.         {
  456.                 if (child.nodeName == nodeName)
  457.                         return child;
  458.         }
  459.         return null;
  460. }
  461.  
  462.  
  463. function fetchWeatherData (callback, zip)
  464. {
  465.         url="http://weather.yahooapis.com/forecastrss?u=f&p=" //u=Farenheit, because accuWeather sucks
  466.         var xml_request = new XMLHttpRequest();
  467.         xml_request.onload = function(e) {xml_loaded(e, xml_request, callback);}
  468.         xml_request.overrideMimeType("text/xml");
  469.         xml_request.open("GET", url+zip);
  470.         xml_request.setRequestHeader("Cache-Control", "no-cache");
  471.         xml_request.send(null);
  472.         return xml_request;
  473. }
  474.  
  475.  
  476. function xml_loaded (event, request, callback)
  477. {
  478.         if (request.responseXML)
  479.         {
  480.                 var obj = {error:false, errorString:null};
  481.                 var effectiveRoot = findChild(findChild(request.responseXML, "rss"), "channel");
  482.                 obj.city = findChild(effectiveRoot, "yweather:location").getAttribute("city");
  483.                 obj.realFeel = findChild(effectiveRoot, "yweather:wind").getAttribute("chill");//Only accounts for windChill
  484.                 conditionTag = findChild(findChild(effectiveRoot, "item"), "yweather:condition");
  485.                 obj.temp = conditionTag.getAttribute("temp");
  486.                 obj.icon = conditionTag.getAttribute("code");
  487.                 obj.description = conditionTag.getAttribute("text");
  488.                 callback (obj);
  489.         }else{
  490.                 callback ({error:true, errorString:"XML request failed. no responseXML"});
  491.         }
  492. }
  493.  
  494. function validateWeatherLocation (location, callback)
  495. {
  496.         var obj = {error:false, errorString:null, cities: new Array};
  497.         obj.cities[0] = {zip: location}; //Not very clever, are we?
  498.         callback (obj);
  499. }
  500.        
  501.  
  502. </script>
  503.  
  504.  
  505. <!---------------------------------------------------------------------------------------------------------------->
  506. <!-- Display All - Weather-Clock-Date  -->
  507. <body bgcolor="Transparent" onload="onLoad()">
  508. <div>
  509. <div id="WeatherContainer"> <div id="TextContainer"> <p id="city">Somewhere</p> <p id="temp">32&#176;</p> <p id="desc">cloudy</p> </div>
  510.  
  511. <img id="weatherIcon" src=""/> </div>
  512. <table style="position: absolute;top: 95px; left: 88px; width: 320x; height: 461px;">
  513. <tr align="center" valign="top"  border="0" cellpadding="0">
  514.     <td height="12" valign="top" margin-left="20">
  515.     <span id="clock">
  516.         <script language="JavaScript">updateClock(); setInterval('updateClock()', 1000 )</script></span>
  517.     </td>
  518. </tr>
  519. </table>
  520.  
  521. <table style="position: absolute;top: 150px; left: 184px; width: 320px; height: 461px;">
  522. <tr align="left" valign="top"  border="0" cellpadding="0">
  523.     <td height="12" valign="top" margin-left="20" >
  524. <span id="ampm">
  525.         <script language="JavaScript">amPm(); setInterval('amPm()', 1000 )</script>
  526.     </span>
  527.     </td>
  528. </tr></table>
  529.  
  530.  
  531. <table style="position: absolute;top: 236px; left: 173; width: 320px; height: 480px;">
  532. <td id="vweek" width="254" height="12" align="center" valign="top" margin-left="20">
  533. <span id="vdate" valign="top">
  534. <script language="JavaScript">calendarDate(); setInterval('calendarDate()', 1000 )</script></font>
  535. </span>
  536. </td>
  537. </tr>
  538. </table>
  539.  
  540. <table style="position: absolute; top: 200px; left: 173; width: 320px; height: 480px;">
  541. <tr>
  542. <td id="date" width="254" height="12" align="center" valign="top" margin-left="20">
  543. <span id="calendar">
  544. <script language="JavaScript">calendarDate(); setInterval('calendarDate()', 1000 )</script>
  545. </span>
  546. </tr>
  547. </table>
  548.  
  549. <table style="position: absolute;top: 218px; left: 173; width: 320px; height: 480px;">
  550. <td id="vmonth" width="254" height="12" align="center" valign="top" margin-left="20">
  551. <span id="vdate" valign="top">
  552. <script language="JavaScript">calendarDate(); setInterval('calendarDate()', 1000 )</script></font>
  553. </span>
  554. </td>
  555. </tr>
  556. </table>
  557.  
  558. <table style="position: fixed;top: 255px; left: 173px; width: 320px; height: 480px; z-index:1;">
  559. <td id="vyear" width="254" height="12" align="right;" valign="top" margin-left="20">
  560. <span id="vyear" valign="top">
  561. <script language="JavaScript">calendarDate(); setInterval('calendarDate()', 1000 )</script></font>
  562. </span>
  563. </td>
  564. </tr>
  565. </table>
  566.  
  567. </div>
  568. </body>
  569.  
  570. </html>
clone this paste RAW Paste Data