Advertisement
Guest User

lockbackground

a guest
Feb 8th, 2013
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.89 KB | None | 0 0
  1.  
  2. <?xml version="1.0" encoding="UTF-8"?>
  3.  
  4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
  5.  
  6. "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
  7.  
  8. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  9. <head><title>LS Corner</title></head>
  10.  
  11. <!---------------------------------------------------------------------------------------------------------------->
  12. <!-- Style section Clock/Date-->
  13. Champagne-Limousines-webfont.ttf
  14. <style>
  15.  
  16. @font-face {
  17. font-family: Default;
  18. src: url(Default.ttf);
  19. }
  20.  
  21.  
  22. #Layer {
  23. width: 320px;
  24. height: 480px;
  25. position: absolute;
  26. top: 0px;
  27. right: 0px;
  28. down: 0px;
  29. left: 0px;
  30. }
  31.  
  32. .stretch {
  33. width:100%;
  34. height:100%;
  35. }
  36.  
  37. body {
  38. margin: 0;
  39. }
  40.  
  41. SPAN#clock {
  42. font-family: Default;
  43. font-weight: 200;
  44. color: #ffffff;
  45. //text-shadow: 0px 0px 1px #000;
  46. font-size: 27px;
  47. text-align: center;
  48. text-transform: uppercase;
  49. }
  50.  
  51. SPAN#date {
  52. font-family: Default;
  53. font-size: 14px;
  54. font-weight: 600;
  55. text-align: right;
  56. text-transform: none;
  57. color: #ffffff;
  58. //text-shadow: 0px 0px 1px #000;
  59. text-transform: uppercase;
  60. }
  61.  
  62. TD#vweek {
  63. float:top;
  64. font-family: Default;
  65. text-transform: uppercase;
  66. font-size: 14px;
  67. font-weight: 200;
  68. letter-spacing: 0.0em;
  69. text-align: left;
  70. color:#ffffff;
  71. //text-shadow: 0px 0px 1px #000;
  72. }
  73.  
  74. TD#vmonth {
  75. float:top;
  76. font-family: Default;
  77. font-size: 14px;
  78. text-transform: uppercase;
  79. font-weight: 200;
  80. text-align: center;
  81. color:#ffffff;
  82. //text-shadow: 0px 0px 1px #000;
  83. }
  84.  
  85. TD#vyear {
  86. float:top;
  87. font-family: Default;
  88. font-weight: bold;
  89. text-align: right;
  90. display: none;
  91. color:#ffffff;
  92. //text-shadow: 0px 0px 1px #000;
  93. font-size: 40px;
  94. }
  95.  
  96. <!---------------------------------------------------------------------------------------------------------------->
  97. <!-- Style section Weather Widget-->
  98.  
  99. #WeatherContainer {
  100. background-color: rgba(0,0,0,0);
  101. }
  102.  
  103. #TextContainer {
  104. font-size:55px;
  105. font-family: Default;
  106. font-weight: bold;
  107. color:#ffffff;
  108. }
  109.  
  110. #city {
  111. position: absolute; top: 30px; right: 0px; down: 0px; left: -73px; width: 256px; height: 481px;
  112. display: none;
  113. text-align: left;
  114. font-family: Default;
  115. font-size: 17px;
  116. font-weight: normal;
  117. //text-shadow: 0px 0px 1px #000;
  118. text-transform: lowercase;
  119. color: #ffffff;
  120. }
  121.  
  122. #temp {
  123. position: absolute; top: 183px; right: 0px; down: 0px; left: -40px; width: 320px; height: 481px;
  124. margin-top:0px;
  125. text-align: center;
  126. font-family: Default;
  127. font-size: 14px;
  128. font-weight: 800;
  129. //text-shadow: 0px 0px 1px #000;
  130. color: #ffffff;
  131. }
  132.  
  133. #desc {
  134. position: absolute; top: 186px; right: 0px; down: 0px; left: 95px; width: 320px; height: 481px;
  135. display: none;
  136. text-align: center;
  137. font-family: Default;
  138. font-size: 14px;
  139. font-weight: 800;
  140. padding-top:0px;
  141. //text-shadow: 0px 0px 1px #000;
  142. text-transform: lowercase;
  143. color: #ffffff;
  144. }
  145.  
  146. #TextContainer p {
  147. margin:0;
  148. }
  149.  
  150. #weatherIcon {
  151. position: absolute;top: 152px; right: 0px; down: 0px; left: 103px; 320px; height: 461px;
  152. height:33px;
  153. width:33px;
  154. }
  155.  
  156. </style>
  157.  
  158. <!---------------------------------------------------------------------------------------------------------------->
  159. <!-- Display Wallpaper (LockBackground.png) here -->
  160.  
  161. <div id="Layer"><img src="/var/mobile/Library/SpringBoard/Converted-LockBackground.jpg" class="stretch"/></div>
  162. <!--<div id="Layer"><img src="LockBackground.png" class="stretch"/></div>-->
  163.  
  164. <!---------------------------------------------------------------------------------------------------------------->
  165. <!-- Direct the script to the general folder where the weather icons are located -->
  166.  
  167. <base href="Private/"/>
  168.  
  169. <!---------------------------------------------------------------------------------------------------------------->
  170. <!-- Clock and Date Script -->
  171.  
  172. <script type="text/javascript">
  173.  
  174. function updateClock ( )
  175.  
  176.  
  177.  
  178. {
  179.  
  180. 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")
  181.  
  182. 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")
  183.  
  184.  
  185.  
  186. var currentTime = new Date ( );
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194. var currentHours = currentTime.getHours ( );
  195.  
  196.  
  197.  
  198. var currentMinutes = currentTime.getMinutes ( );
  199.  
  200.  
  201.  
  202. var currentSeconds = currentTime.getSeconds ( );
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215. // Convert an hours component of "0" to "12"
  216.  
  217.  
  218.  
  219. // currentHours = ( currentHours == 0 ) ? currentHours + 24 : currentHours;
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231. // Convert the hours component to 12-hour format if needed
  232.  
  233.  
  234. currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours;
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242. // Convert an hours component of "0" to "12"
  243.  
  244.  
  245.  
  246. currentHours = ( currentHours == 0 ) ? 12 : currentHours;
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254. // Compose the string for display
  255.  
  256.  
  257.  
  258. var currentTimeString = currentHours_name_array[currentHours] + ":" + currentMinutes_name_array[currentMinutes];
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266. // Update the time display
  267.  
  268.  
  269.  
  270. document.getElementById("clock").firstChild.nodeValue = currentTimeString;
  271.  
  272.  
  273.  
  274.  
  275. // Pad the minutes and seconds with leading zeros, if required
  276.  
  277.  
  278.  
  279. currentHours = ( currentHours < 10 ? "0" : "" ) + currentHours;
  280.  
  281.  
  282.  
  283. currentMinutes = ( currentMinutes < 10 ? "0" : "" ) + currentMinutes;
  284.  
  285.  
  286.  
  287. currentSeconds = ( currentSeconds < 10 ? "0" : "" ) + currentSeconds;
  288.  
  289.  
  290.  
  291.  
  292. }
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308. function amPm ( )
  309.  
  310.  
  311.  
  312. {
  313.  
  314.  
  315.  
  316. var currentTime = new Date ( );
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324. var currentHours = currentTime.getHours ( );
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332. // Choose either "AM" or "PM" as appropriate
  333.  
  334.  
  335.  
  336. // var timeOfDay = ( currentHours < 12 ) ? "AM" : "PM";
  337.  
  338.  
  339.  
  340.  
  341.  
  342.  
  343.  
  344. // Convert the hours component to 12-hour format if needed
  345.  
  346.  
  347.  
  348. // currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours;
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356. // Convert an hours component of "0" to "12"
  357.  
  358.  
  359.  
  360. currentHours = ( currentHours == 0 ) ? 12 : currentHours;
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368. // Compose the string for display
  369.  
  370.  
  371.  
  372. var currentTimeString = timeOfDay;
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380. // Update the time display
  381.  
  382.  
  383.  
  384. document.getElementById("ampm").firstChild.nodeValue = " " + currentTimeString;
  385.  
  386.  
  387.  
  388. }
  389.  
  390.  
  391. function calendarDate ( )
  392. {
  393. var this_date_name_array = new Array ("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27" ,"28", "29" ,"30", "31")
  394. var this_weekday_name_array = new Array("Sun,","Mon,","Tue,","Wed,","Thu,","Fri,","Sat,")
  395. var this_month_name_array = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
  396.  
  397. var this_date_timestamp = new Date()
  398.  
  399. var this_weekday = this_date_timestamp.getDay()
  400. var this_date = this_date_timestamp.getDate()
  401. var this_month = this_date_timestamp.getMonth()
  402. var this_year = this_date_timestamp.getYear()
  403.  
  404. if (this_year < 1000)
  405. this_year+= 1900;
  406. if (this_year==101)
  407. this_year=2001;
  408.  
  409. var month = this_date_timestamp.getMonth();
  410.  
  411. document.getElementById("date").firstChild.nodeValue = this_date_name_array[this_date]
  412. document.getElementById("calendar_weekday").firstChild.nodeValue = this_weekday_name_array[this_weekday]
  413. document.getElementById("calendar_month").firstChild.nodeValue = this_month_name_array[this_month]
  414. document.getElementById("calendar_year").firstChild.nodeValue = this_year
  415. }
  416.  
  417. <!---------------------------------------------------------------------------------------------------------------->
  418. <!-- Weather Script -->
  419.  
  420. var locale = "UKXX0162"
  421.  
  422. <!-- A few examples: ITXX0042=Milan/UKXX0085=London/USNY0996=NYC/USCA0638=LA/FRXX0023=Cannes-->
  423.  
  424. var isCelsius = false;
  425. var useRealFeel = false;
  426.  
  427. var enableWallpaper = true;
  428. var enableLockScreen = true;
  429.  
  430. var stylesheetWall = 'mini'
  431. var stylesheetLock = 'mini'
  432. var stylesheet = 'mini'
  433.  
  434. var iconSetWall = 'stardock'
  435. var iconExtWall = ".png"
  436. var iconSetLock = 'stardock'
  437. var iconExtLock = '.png'
  438.  
  439. var source = 'yahooWeather'
  440.  
  441. var updateInterval = 2
  442.  
  443. var postal;
  444. var demoMode = false;
  445. var enabled;
  446.  
  447. if (location.href.indexOf("LockBackground") == -1){
  448. stylesheet = stylesheetWall;
  449. iconSet = iconSetWall;
  450. iconExt = iconExtWall;
  451. enabled = enableWallpaper;
  452.  
  453. }else{
  454.  
  455. stylesheet = stylesheetLock;
  456. iconSet = iconSetLock;
  457. iconExt = iconExtLock;
  458. enabled = enableLockScreen;
  459. }
  460.  
  461. if(enabled == true){
  462.  
  463. if(iconSet == null || iconSet == 'null' || iconSet == ""){
  464. var iconSet = stylesheet;
  465. }
  466.  
  467. var headID = document.getElementsByTagName("head")[0];
  468. var styleNode = document.createElement('link');
  469. styleNode.type = 'text/css';
  470. styleNode.rel = 'stylesheet';
  471. styleNode.href = 'Stylesheets/'+stylesheet+'.css';
  472. headID.appendChild(styleNode);
  473.  
  474.  
  475.  
  476. var scriptNode = document.createElement('script');
  477. scriptNode.type = 'text/javascript';
  478. scriptNode.src = 'Sources/'+source+'.js';
  479. headID.appendChild(scriptNode);
  480. }
  481.  
  482. function onLoad(){
  483.  
  484. if (enabled == true){
  485. if (demoMode == true){
  486.  
  487. document.getElementById("weatherIcon").src="Icon Sets/"+iconSet+"/"+"cloudy1"+iconExt;
  488. document.getElementById("city").innerText="Somewhere";
  489. document.getElementById("desc").innerText="Partly Cloudy";
  490. document.getElementById("temp").innerText="100ΒΊ";
  491.  
  492. }else{
  493.  
  494. document.getElementById("weatherIcon").src="Icon Sets/"+iconSet+"/"+"dunno"+iconExt;
  495. validateWeatherLocation(escape(locale).replace(/^%u/g, "%"), setPostal)
  496. }
  497.  
  498. }else{
  499. document.getElementsByTagName("body")[0].innerText='';
  500. }
  501. }
  502.  
  503. function convertTemp(num)
  504. {
  505. if (isCelsius == true)
  506. return Math.round ((num - 32) * 5 / 9);
  507.  
  508. else
  509. return num;
  510. }
  511.  
  512. function setPostal(obj){
  513.  
  514. if (obj.error == false){
  515.  
  516. if(obj.cities.length > 0){
  517.  
  518. postal = escape(obj.cities[0].zip).replace(/^%u/g, "%")
  519. document.getElementById("WeatherContainer").className = "";
  520. weatherRefresherTemp();
  521.  
  522. }else{
  523.  
  524. document.getElementById("city").innerText="Not Found";
  525. document.getElementById("WeatherContainer").className = "errorLocaleNotFound";
  526. }
  527.  
  528. }else{
  529.  
  530. document.getElementById("city").innerText=obj.errorString;
  531. document.getElementById("WeatherContainer").className = "errorLocaleValidate";
  532. setTimeout('validateWeatherLocation(escape(locale).replace(/^%u/g, "%"), setPostal)', Math.round(1000*60*5));
  533. }
  534. }
  535.  
  536. function dealWithWeather(obj){
  537.  
  538. if (obj.error == false){
  539.  
  540. document.getElementById("city").innerText=obj.city;
  541. document.getElementById("desc").innerText=obj.description.toLowerCase();
  542.  
  543. if(useRealFeel == true){
  544.  
  545. tempValue = convertTemp(obj.realFeel);
  546.  
  547. }else{
  548.  
  549. tempValue = convertTemp(obj.temp)
  550. }
  551.  
  552. document.getElementById("temp").innerHTML=tempValue+ "&#176;";
  553. document.getElementById("weatherIcon").src="Icon Sets/"+iconSet+"/"+MiniIcons[obj.icon]+iconExt;
  554. document.getElementById("WeatherContainer").className = "";
  555.  
  556. }else{
  557.  
  558. //Could be down to any number of things, which is unhelpful...
  559.  
  560. document.getElementById("WeatherContainer").className = "errorWeatherDataFetch";
  561. }
  562. }
  563.  
  564. function weatherRefresherTemp(){
  565.  
  566. fetchWeatherData(dealWithWeather,postal);
  567. setTimeout(weatherRefresherTemp, 60*1000*updateInterval);
  568. }
  569.  
  570. var MiniIcons =
  571. [
  572. "0", //0 tornado
  573. "1", //1 tropical storm
  574. "2", //2 hurricane
  575. "3", //3 severe thunderstorms
  576. "4", //4 thunderstorms
  577. "5", //5 mixed rain and snow
  578. "6", //6 mixed rain and sleet
  579. "7", //7 mixed snow and sleet
  580. "8", //8 freezing drizzle
  581. "9", //9 drizzle
  582. "10", //10 freezing rain
  583. "11", //11 showers
  584. "12", //12 showers
  585. "13", //13 snow flurries
  586. "14", //14 light snow showers
  587. "15", //15 blowing snow
  588. "16", //16 snow
  589. "17", //17 hail
  590. "17", //18 sleet
  591. "19", //19 dust
  592. "20", //20 foggy
  593. "21", //21 haze
  594. "22", //22 smoky
  595. "23", //23 blustery
  596. "24", //24 windy
  597. "25", //25 cold
  598. "26", //26 cloudy
  599. "27", //27 mostly cloudy (night)
  600. "28", //28 mostly cloudy (day)
  601. "29", //29 partly cloudy (night)
  602. "30", //30 partly cloudy (day)
  603. "31", //31 clear (night)
  604. "32", //32 sunny
  605. "33", //33 fair (night)
  606. "34", //34 fair (day)
  607. "35", //35 mixed rain and hail
  608. "36", //36 hot
  609. "37", //37 isolated thunderstorms
  610. "38", //38 scattered thunderstorms
  611. "39", //39 scattered thunderstorms
  612. "40", //40 scattered showers
  613. "41", //41 heavy snow
  614. "42", //42 scattered snow showers
  615. "43", //43 heavy snow
  616. "44", //44 partly cloudy
  617. "45", //45 thundershowers
  618. "46", //46 snow showers
  619. "47", //47 isolated thundershowers
  620. "dunno", //3200 not available
  621. ]
  622.  
  623. function constructError (string)
  624. {
  625. return {error:true, errorString:string};
  626. }
  627.  
  628. function findChild (element, nodeName)
  629. {
  630. var child;
  631.  
  632. for (child = element.firstChild; child != null; child = child.nextSibling)
  633. {
  634.  
  635. if (child.nodeName == nodeName)
  636.  
  637. return child;
  638. }
  639.  
  640. return null;
  641. }
  642.  
  643. function fetchWeatherData (callback, zip)
  644. {
  645. url="http://weather.yahooapis.com/forecastrss?u=c&p=" //u=Farenheit, because accuWeather sucks
  646.  
  647. var xml_request = new XMLHttpRequest();
  648.  
  649. xml_request.onload = function(e) {xml_loaded(e, xml_request, callback);}
  650. xml_request.overrideMimeType("text/xml");
  651. xml_request.open("GET", url+zip);
  652. xml_request.setRequestHeader("Cache-Control", "no-cache");
  653. xml_request.send(null);
  654.  
  655. return xml_request;
  656. }
  657.  
  658. function xml_loaded (event, request, callback)
  659. {
  660. if (request.responseXML)
  661. {
  662. var obj = {error:false, errorString:null};
  663. var effectiveRoot = findChild(findChild(request.responseXML, "rss"), "channel");
  664.  
  665. obj.city = findChild(effectiveRoot, "yweather:location").getAttribute("city");
  666. obj.realFeel = findChild(effectiveRoot, "yweather:wind").getAttribute("chill");//Only accounts for windChill
  667.  
  668. conditionTag = findChild(findChild(effectiveRoot, "item"), "yweather:condition");
  669.  
  670. obj.temp = conditionTag.getAttribute("temp");
  671. obj.icon = conditionTag.getAttribute("code");
  672. obj.description = conditionTag.getAttribute("text");
  673.  
  674. callback (obj);
  675.  
  676. }else{
  677.  
  678. callback ({error:true, errorString:"XML request failed. no responseXML"});
  679. }
  680. }
  681.  
  682. function validateWeatherLocation (location, callback)
  683. {
  684. var obj = {error:false, errorString:null, cities: new Array};
  685.  
  686. obj.cities[0] = {zip: location}; //Not very clever, are we?
  687.  
  688. callback (obj);
  689. }
  690.  
  691. </script>
  692.  
  693. <!---------------------------------------------------------------------------------------------------------------->
  694. <!-- Display All - Weather-Clock-Date -->
  695.  
  696. <body bgcolor="Transparent" onload="onLoad()">
  697.  
  698. <div id="WeatherContainer">
  699. <div id="TextContainer"> <p id="city"> </p>
  700. <p id="temp"> </p> <p id="desc">...</p> </div>
  701. <img id="weatherIcon" src=""/>
  702. </div>
  703.  
  704. <table style="position: absolute; top: 150px; left: 15px; width: 320x; height: 461px; z-index: 14;">
  705. <tr align="center" valign="top" border="0" cellpadding="0">
  706. <td height="0" valign="top" margin-left="0">
  707. <span id="clock">
  708. <script language="JavaScript">updateClock(); setInterval('updateClock()', 1000 )</script>
  709. </span>
  710. </td>
  711. </tr>
  712. </table>
  713.  
  714. <table style="position: absolute; top: 178px; left: -254px; width: 320px; height: 480px;">
  715. <tr>
  716. <td valign="top" td style="text-align: right" border="0" cellpadding="0">
  717. <span id="date">
  718. <script language="JavaScript">calendarDate(); setInterval('calendarDate()', 1000 )</script>
  719. </span>
  720. </td>
  721. </tr>
  722. </table>
  723.  
  724. <table style="position: absolute; left: 13px; top: 180px; width: 320px; height: 480px;">
  725. <td id=vweek width="254" height="12" align="center" valign="top" margin-left="20">
  726. <span id="calendar_weekday">
  727. <script language="JavaScript">calendarDate(); setInterval('calendarDate()', 1000 )</script>
  728. </span>
  729. </td>
  730. </tr>
  731. </table>
  732.  
  733. <table style="position: absolute; top: 181px; left: -78px; width: 320px; height: 480px;">
  734. <tr>
  735. <td id=vmonth width="254" height="12" align="center" valign="top" margin-left="20">
  736. <span id="calendar_month">
  737. <script language="JavaScript">calendarDate(); setInterval('calendarDate()', 1000 )</script>
  738. </span>
  739. </td>
  740. </tr>
  741. </table>
  742.  
  743. <table style="position: absolute; top: 105px; left: -25px; width: 320px; height: 480px">
  744. <tr>
  745. <td id=vyear width="254" height="12" align="center" valign="top" margin-left="20">
  746. <span id="calendar_year">
  747. <script language="JavaScript">calendarDate(); setInterval('calendarDate()', 1000 )</script>
  748. </span>
  749. </td>
  750. </tr>
  751. </table>
  752.  
  753. </body>
  754. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement