-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwidget1.html
63 lines (63 loc) · 3.56 KB
/
widget1.html
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
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
60
61
62
63
<html>
<script>
function getText(date,month,year) {
if(window.XMLHttpRequest){var req=new XMLHttpRequest();}
else {var req=new ActiveXObject("Microsoft.XMLHTTP");}
req.open("GET","http://prayer.forwardmovement.org/bare/bare_daily_readings.php?d="+date.toString()+"&m="+month.toString()+"&y="+year.toString(),true);
req.send();
req.onreadystatechange=function(){
if(req.readyState==4 && req.status==200){
console.log(req.responseText);
var passageList = req.responseText.match(/<h2>(.*?)<\/h2>/g);
var passages = "Today's readings:<br>"
for(var i = 0; i < passageList.length; i++){
passages = passages + "<br>" + passageList[i].replace("<h2>", "").replace("</h2>", "");
}
console.log(passages);
document.getElementById("today").innerHTML=passages;}}}
window.onload=function() {
var d = new Date();
var daynum = d.getDay();
var mon = d.getMonth();
var year = d.getFullYear();
var day = "";
if (daynum == 0) {day = "Sunday";}
if (daynum == 1) {day = "Monday";}
if (daynum == 2) {day = "Tuesday";}
if (daynum == 3) {day = "Wednesday";}
if (daynum == 4) {day = "Thursday";}
if (daynum == 5) {day = "Friday";}
if (daynum == 6) {day = "Saturday";}
var toDisp=day+", "+d.toLocaleDateString();
document.getElementById("date").innerHTML=toDisp;
if(daynum == 0) {
document.getElementById("sunday").innerHTML="To view today's readings click <a href='http://prayer.forwardmovement.org/the_daily_readings.php'>here</a>."
getText(d.getDate(),mon+1,year);
}
else {
var sundaydate=d.getDate()+(7-daynum);
if(mon==8||mon==3||mon==5||mon==10){
if(sundaydate>30){sundaydate=sundaydate-30;mon=mon+1;}
}
else if(mon==0||mon==2||mon==4||mon==6||mon==7||mon==9||mon==11){
if(sundaydate>31){sundaydate=sundaydate-31;mon=mon+1;}
}
else if(mon==1&& year%4==0){
if(sundaydate>29){sundaydate=sundaydate-29;mon=mon+1;}
}
else if(mon==1&& year%4!=0){
if(sundaydate>28){sundaydate=sundaydate-28;mon=mon+1;}
}
if(mon>11){mon=mon-12;year=year+1;}
document.getElementById("sundaylink").href="http://prayer.forwardmovement.org/the_daily_readings.php?d="+sundaydate.toString()+"&m="+(mon+1).toString()+"&y="+year.toString();
}
}
</script>
<link href='http://fonts.googleapis.com/css?family=Belleza' rel='stylesheet' type='text/css'>
<div style="width:300px;height:400px;">
<div style="max-width:300px;min-width:150px;width:80%;height:auto;max-height:400px;min-height:200px;background-color:#EBEBF3;text-align:center;border-radius:5px;border:solid black 2px;font-family:'Belleza',sans-serif;">
<div style="width:100%;height:auto;background-color:#022B4B;min-height:55px;"><image width="42px" height="50px" src="http://renewalworks.org/wp-content/uploads/2013/05/FM_7_a_LOres-258x300.jpg" style="display:inline-block;position:relative;vertical-align:bottom;left:5px;top:2px;float:left;"></image><h4 style="color:#FFFFFF;font-size:115%;display:inline;position:relative;text-shadow:2px 2px black;z-index:0;">Forward Movement<br>Day by Day</h4><br></div>
<h4 style="color:#09488B;display:inline;"><br><b>Today is:</b></h4><br>
<span id="date"></span><br><br>
<p id="today"> For today's readings, click <a href="http://prayer.forwardmovement.org/the_daily_readings.php" target="Today_Daily_Reading">here</a>.</p>
<p id="sunday"> For Sunday's readings, click <a id="sundaylink" target="Sunday_Daily_Reading">here</a>.</p></div></div></html>