Sundays of Pleroma: Difference between revisions

From Cor ad Cor
Jump to navigation Jump to search
Line 53: Line 53:
== Next ten years ==
== Next ten years ==


find the current year
<html>
<div id="SundayTable"></div>


find day of the week of Christmas this year
<div id="DebugDiv"></div>


create output string
<script type="text/javascript">
:: start table
:: start line
:: header line one
:: start line
:: header line two
:: start line


Call AddLine to output row for one year
//----------------------------------------------------------
//
//  Global variables
//
//
// 11 elements in each row.
//
// First pattern to add to table: PleromaPattern[7] -- Eucharist Prayers
//        Second pattern to add: PleromaPattern[8] -- headings
const FixedPattern = [
["9 Oct","16 Oct","23 Oct","30 Oct", "6 Nov","13 Nov","20 Nov","Sunday"  ],
["15 Oct","22 Oct","29 Oct", "5 Nov","12 Nov","19 Nov","26 Nov","Monday"  ],
["14 Oct","21 Oct","28 Oct", "4 Nov","11 Nov","18 Nov","25 Nov","Tuesday"  ],
["13 Oct","20 Oct","27 Oct", "3 Nov","10 Nov","17 Nov","24 Nov","Wednesday"],
["12 Oct","19 Oct","26 Oct", "2 Nov", "9 Nov","16 Nov","23 Nov","Thursday" ],
["11 Oct","18 Oct","25 Oct", "1 Nov", "8 Nov","15 Nov","22 Nov","Friday"  ],
["10 Oct","17 Oct","24 Oct","31 Oct", "7 Nov","14 Nov","21 Nov","Saturday" ]
]
const Headings = [
["    ","    ","III"    ,  "IV"  ,    "I"  ,    "II",    "III",    "IV",    "I"        ,"Xmas"],
["year","cycle","Week 28","Week 29","Week 39","Week 31","Week 32","Week 33","Christ the King",  "DoW"]
];


const DerivedArray = [];


var TodayDate = new Date();
var ThisYear = TodayDate.getFullYear();
var DbgDv = document.getElementById("DebugDiv");
var SundayTable = document.getElementById("SundayTable");
  // create elements <table> and a <tbody>
var tbl = document.createElement("table");
var tblBody = document.createElement("tbody");


repeat nine times


: increment year by one
//------------------------------------------------
: AddLine(nextYear)
function DebugLine(msg){
var tmpstr = DbgDv.innerHTML + "<br>" + msg;
DbgDv.innerHTML = tmpstr;
}


//-------------------------------------------
function CompletePatternFor(aYear){
  var Scaffold = [];
  var XmasStr = "December 25, "+aYear;
  const XmasInYear = new Date(XmasStr);
  var DoWx = XmasInYear.getDay();
  // copy pattern from fixed array to derived array


<html>
Scaffold.push(aYear.toString()); 
<!-- coded this on 2024-11-09 -->
  const cycle = ["A","B","C"];
<div id="SundaysTable"></div>
  // year A = 2023
  firstremainder = aYear % 2023;
  ABCindex = firstremainder % 3;
  Scaffold.push(cycle[ABCindex]);
 
  for (var j = 0; j<=7; j++) {
  Scaffold.push(FixedPattern[DoWx][j]);
  }
  console.log(Scaffold);
  DerivedArray.push(Scaffold);
  console.log(DerivedArray);
}


<script type="text/javascript">
//-------------------------------------------
function MakeHeadings() {
for (var j = 0; j <= 1; j++) {
      var row = document.createElement("tr");
for (var k = 0; k <= 9; k++) {
var cell = document.createElement("td");
    var cellText = document.createTextNode("\u00A0" + Headings[j][k] + "\u00A0");
    cell.appendChild(cellText);
    row.appendChild(cell);
row.setAttribute("align","center");
    row.setAttribute("style","font-weight:bold");
}
    tblBody.appendChild(row);
}
}


function getNumberOfDays() {
//-------------------------------------------
    const date1 = new Date("4/24/1981");
function AddDataRows(){
    const date2 = new Date();
for (var j = 0; j <= 9; j++) {
  var row = document.createElement("tr");
for (var k = 0; k <= 9; k++) {
var cell = document.createElement("td");
    var cellText = document.createTextNode(DerivedArray[j][k]);
    cell.appendChild(cellText);
    row.appendChild(cell);
}
row.setAttribute("align","center");
tblBody.appendChild(row);
}
// console.log(row);
}


    // One day in milliseconds
//-------------------------------------------
    const oneDay = 1000 * 60 * 60 * 24;
function CreateSundayTable() {
MakeHeadings();
AddDataRows();
// append the <tbody> inside the <table>
  tbl.appendChild(tblBody);
  // put <table> in the <body>
  SundayTable.appendChild(tbl);
  tbl.setAttribute("border", "1");
  tbl.setAttribute("style", "padding:5px; border-collapse:collapse; border-spacing:0px; border-width:1px")
}


    // Calculating the time difference between two dates
//------------------------- Main script -----------------------------------
    const diffInTime = date2.getTime() - date1.getTime();
//


    // Calculating the no. of days between two dates
// Calculate three vital pieces of information: year, cycle, Xmas DoW
    const diffInDays = Math.round(diffInTime / oneDay);


    return diffInDays;
//
}
//


function AddLine(numstr){
for (var x = 0; x <= 9; x++){
var NextYear = Number(numstr) + 1;
var SetYear = ThisYear + x;
return "<p><b>"+NextYear.toString()+"</b></p>";
CompletePatternFor(SetYear);
}
}


function ConstructTable(x){
CreateSundayTable();
var ReturnStr;
const TableLines = [];
TableLines["TopRows"] = "<tbody><tr> III</tr><tr> Week 28</tr>";
TableLines["EndTable"] = "</tbody>";
ReturnStr = TableLines["TopRows"] + TableLines["EndTable"];
return ReturnStr;
}


var OutputTable = document.getElementById("SundaysTable");
//  
// var withComma = new String("");
// var totalDays = new String("");
// totalDays = getNumberOfDays();
// totalDays = totalDays.toString();
// withComma = totalDays.substring(0,2) + "," + totalDays.substring(2);


    const TodayDate = new Date();
    var ThisYear = TodayDate.getFullYear();
    var OutputStr = ThisYear;
OutputStr = ConstructTable(0);
OutputTable.innerHTML = OutputStr;
</script>
</script>
</html>
</html>
[[Category:Pleroma]]
[[Category:Pleroma]]

Revision as of 00:09, 12 November 2024

Seven patterns

P1 Xt King Advent I Christmas Day
9 Oct 20 Nov 27 Nov Sunday
15 Oct 26 Nov 3 Dec Monday
14 Oct 25 Nov 2 Dec Tuesday
13 Oct 24 Nov 1 Dec Wednesday
12 Oct 23 Nov 30 Nov Thursday
11 Oct 22 Nov 29 Nov Friday
10 Oct 21 Nov 28 Nov Saturday

Next ten years