{"id":6553,"date":"2025-12-24T07:42:52","date_gmt":"2025-12-23T18:42:52","guid":{"rendered":"https:\/\/www.zoyinc.com\/?p=6553"},"modified":"2026-01-06T20:07:57","modified_gmt":"2026-01-06T07:07:57","slug":"trains-by-route","status":"publish","type":"post","link":"http:\/\/www.zoyinc.com\/?p=6553","title":{"rendered":"Trains By Route"},"content":{"rendered":"<p><script>\r\n\/\/ We need to run this function after the complete page has been loaded thus using \"window.addEventListener('load'...\"\r\nwindow.addEventListener('load', function () {\t\r\n\t\r\n\t\/\/ Grab a reference to the master WordPress group\r\n\tbyClassElementList = document.getElementsByClassName(\"zoyinc_location_select_form_master_group\");\r\n\tif ( byClassElementList.length != 1){ \r\n\t\talert(\"Could not find the master group element. Length = \" + byClassElementList.length); \r\n\t};\r\n\tmasterGroup = byClassElementList[0];\r\n\r\n\t\/\/ Create a location select form\r\n\tvar locationSelectForm = document.createElement(\"form\");\r\n\tlocationSelectForm.setAttribute(\"method\", \"get\");\r\n\tlocationSelectForm.setAttribute(\"id\", \"location_select_form_id\");\r\n\t\r\n\t\/\/ Wrap the location select form around the master group block\r\n\tmasterGroup.replaceWith(locationSelectForm);\r\n\tlocationSelectForm.appendChild(masterGroup);\r\n\t\r\n\t\/\/ Get the dummy submit button\r\n\t\/\/ In WordPress this is a \"Button\" block but in html it ends up as a div\r\n\tdivElementsList = document.getElementsByClassName(\"zoyinc_dummy_submit_button\");\r\n\tif ( divElementsList.length != 1){ \r\n\t\talert(\"Could not find the submit button. Length = \" + byClassElementList.length); \r\n\t};\r\n\tsubmitButtonDiv = divElementsList[0];\r\n\t\/\/ Get the anchor within the button\r\n\tanchorElements = submitButtonDiv.getElementsByTagName('a');\r\n\tif ( anchorElements.length != 1){ \r\n\t\talert(\"Could not find the anchor inside the dummy button. Length = \" + byClassElementList.length); \r\n\t};\r\n\tsubmitButtonAnchor = anchorElements[0];\r\n\t\/\/ Change the anchor so on click it submits the form\r\n\tsubmitButtonAnchor.setAttribute('href', '#');\r\n\tsubmitButtonAnchor.setAttribute('onclick','document.getElementById(\\'location_select_form_id\\').submit();');\r\n\t\t\r\n\t\/\/ Create a hidden \"input\" field\r\n\t\/\/ This will cause WordPress to return to this page\r\n\tvar locationPostNoInput = document.createElement(\"input\");\r\n\tlocationPostNoInput.setAttribute(\"type\", \"hidden\");\r\n\tlocationPostNoInput.setAttribute(\"id\", \"p\");\r\n\tlocationPostNoInput.setAttribute(\"name\", \"p\");\r\n\tlocationPostNoInput.setAttribute(\"value\", \"\");\r\n\r\n\t\r\n\t\/\/ We are using the button with class \"zoyinc_dummy_select_list_button\" as the\r\n\t\/\/ template for the dynamic select box\r\n\t\/\/ The button ends up in html as an anchor, and a div. The class ends up on the div\r\n\t\/\/ so we have to find the anchor and will assume there is only one\r\n\t \r\n\t\/\/ Get a reference to the div that surrounds the dummy select button\r\n\tbyClassElementList = document.getElementsByClassName(\"zoyinc_dummy_select_list\");\r\n\tif ( byClassElementList.length != 1){ \r\n\t\talert(\"Could not find \\\"div\\\" for dummy list box. Length = \" + byClassElementList.length); \r\n\t};\r\n\tdummyListDiv = byClassElementList[0];\r\n\t\r\n\t\/\/ Find the anchor inside the div\r\n\t\/\/ This is the element that contains the text for the dummy button. As such it contains the settings\r\n\t\/\/ for the font of the dummy button and so on.\r\n\tanchorElements = dummyListDiv.getElementsByTagName('a');\r\n\tif ( anchorElements.length != 1){ \r\n\t\talert(\"Could not find the anchor inside the dummy button. Length = \" + byClassElementList.length); \r\n\t};\r\n\tdummyButtonAnchor = anchorElements[0];\r\n\r\n\t\/\/ Create a select element for location number\r\n\tvar locationSelect = document.createElement(\"select\");\r\n\tlocationSelect.id = \"headsign_short_str\";\r\n\tlocationSelect.name = \"headsign_short_str\";\r\n\tlocationSelect.style.font = getComputedStyle(dummyListDiv, null).getPropertyValue(\"font\");\r\n\tlocationSelect.style.backgroundColor = getComputedStyle(byClassElementList[0], null).getPropertyValue(\"background-color\");\r\n\tlocationSelect.style.width = getComputedStyle(byClassElementList[0], null).getPropertyValue(\"width\");\r\n\tlocationSelect.style.height = getComputedStyle(dummyListDiv, null).getPropertyValue(\"height\");\r\n\tlocationSelect.style.color = getComputedStyle(byClassElementList[0], null).getPropertyValue(\"color\");\t\r\n\tlocationSelect.style.border  = getComputedStyle(dummyButtonAnchor, null).getPropertyValue(\"border\");\r\n\t\/\/ Align the height and font of the submit button with the details for the select dropdown\r\n\t\/\/ Its actually quite hard to get this working for both PC and mobile browsers\r\n\t\/\/ What we have done is the best we can\r\n\tsubmitButtonDiv.style.height = locationSelect.style.height;\r\n\tsubmitButtonDiv.style.font = locationSelect.style.font;\r\n\tsubmitButtonAnchor.style.height = locationSelect.style.height;\r\n\tsubmitButtonAnchor.style.font = locationSelect.style.font;\r\n\t\/\/Creating dropdown list; \n\tvar option = document.createElement(\"option\"); \n\toption.value = \"Manukau To Waitemata\";  \n\toption.text = \"Manukau To Waitemata\";  \n\toption.style.color = getComputedStyle(dummyButtonAnchor, null).getPropertyValue(\"color\"); \n\tlocationSelect.appendChild(option); \n\tvar option = document.createElement(\"option\"); \n\toption.value = \"Out Of Service\";  \n\toption.text = \"Out Of Service\";  \n\toption.style.color = getComputedStyle(dummyButtonAnchor, null).getPropertyValue(\"color\"); \n\tlocationSelect.appendChild(option); \n\tvar option = document.createElement(\"option\"); \n\toption.value = \"Pukekohe To Waitemata\";  \n\toption.text = \"Pukekohe To Waitemata\";  \n\toption.style.color = getComputedStyle(dummyButtonAnchor, null).getPropertyValue(\"color\"); \n\tlocationSelect.appendChild(option); \n\tvar option = document.createElement(\"option\"); \n\toption.value = \"Swanson To Waitemata\";  \n\toption.text = \"Swanson To Waitemata\";  \n\toption.style.color = getComputedStyle(dummyButtonAnchor, null).getPropertyValue(\"color\"); \n\tlocationSelect.appendChild(option); \n\tvar option = document.createElement(\"option\"); \n\toption.value = \"Waitemata To Manukau\";  \n\toption.text = \"Waitemata To Manukau\";  \n\toption.style.color = getComputedStyle(dummyButtonAnchor, null).getPropertyValue(\"color\"); \n\tlocationSelect.appendChild(option); \n\tvar option = document.createElement(\"option\"); \n\toption.value = \"Waitemata To Pukekohe\";  \n\toption.text = \"Waitemata To Pukekohe\";  \n\toption.style.color = getComputedStyle(dummyButtonAnchor, null).getPropertyValue(\"color\"); \n\tlocationSelect.appendChild(option); \n\tvar option = document.createElement(\"option\"); \n\toption.value = \"Waitemata To Swanson\";  \n\toption.text = \"Waitemata To Swanson\";  \n\toption.style.color = getComputedStyle(dummyButtonAnchor, null).getPropertyValue(\"color\"); \n\tlocationSelect.appendChild(option); \n    currTrip = \"Manukau To Waitemata\";\t\r\n\t\/\/ Append the various elements to the form\r\n\tdummyListDiv.replaceWith(locationSelect);\r\n\tlocationSelectForm.append(locationPostNoInput);\r\n\t\r\n});\t\r\n<\/script><!-- Trains By Route - Route Select Dropdown --><\/p>\n\n\n<p><script>\r\n\/\/\r\n\/\/ Trains On Route\r\n\/\/ ====================\r\n\/\/ \r\n\/\/ This shortcode takes a group with class:\r\n\/\/     zoyinc-trains_by_route_train_list_group\r\n\/\/     \r\n\/\/ It then hides this original group and replicates it for each train at the location\r\n\/\/ updating the various fields and image at the same time. \r\n\/\/\r\n\r\n\/\/ We need to run this function after the complete page has been loaded thus using \"window.addEventListener('load'...\"\r\nwindow.addEventListener('load', function () {\r\n\tdivElements = document.getElementsByTagName('div');\r\n\tstatusDivIndex = -1;\r\n\tfor (var i=0, im=divElements.length; im>i; i++) {\r\n\t\tif (divElements[i].classList.contains(\"zoyinc-trains_by_route_train_list_group\")){\r\n\t\t\tstatusDivIndex = i;\r\n\t\t};\r\n    };\r\n\tif (statusDivIndex == -1){\r\n\t\talert(\"Location info group element not found!\");\r\n\t};\t\r\n\tdefaultStatusGroup = divElements[statusDivIndex];\r\n\tdefaultStatusGroup.style.display = 'none'; \/\/ Hide the original WordPress group\t\r\n\tcurrStatusGroup = defaultStatusGroup;\r\n\t\r\ncurrStatusGroup.after(defaultStatusGroup.cloneNode(true)); \ncurrStatusGroup = currStatusGroup.nextSibling;  \/\/ Add After the default group \ncurrStatusGroup.style.display = ''; \/\/ Unhide the new group \nheadingElementList = currStatusGroup.getElementsByClassName(\"zoyinc_status_group_heading\"); \nif ( headingElementList.length != 1){ \n\talert(\"Status info heading not found\"); \n}; \nheadingElementList[0].textContent = \"AM524\"; \nfigureElementList = currStatusGroup.getElementsByClassName(\"zoyinc_status_group_table\"); \nif ( figureElementList.length != 1){ \n\talert(\"Status table surrounding figure element not found\"); \n}; \ntableElementList = figureElementList[0].getElementsByTagName(\"table\"); \nif ( tableElementList.length != 1){ \n\talert(\"Status table not found\"); \n}; \nstatusTableElement = tableElementList[0]; \nrouteFullName = \"Manukau To Waitemata\";statusTableElement.rows[0].cells[0].width = \"30%\"; \nstatusTableElement.rows[1].cells[0].width = \"30%\"; \nstatusTableElement.rows[2].cells[0].width = \"30%\"; \nstatusTableElement.rows[3].cells[0].width = \"30%\"; \nstatusTableElement.rows[0].cells[1].innerHTML = \"<a href='https:\/\/www.google.com\/maps\/search\/?api=1&query=-36.8622,174.808802777778'>Orakei Station<\/a>\"; \nstatusTableElement.rows[1].cells[1].innerHTML = routeFullName; \nstatusTableElement.rows[2].cells[1].innerHTML = \"456, 524+ (524,524,524,)\"; \nstatusTableElement.rows[3].cells[1].innerHTML = \"12\/05\/2026 - 7:23 am\"; \ntestElement = statusTableElement.rows[3].cells[1];figureElementList = currStatusGroup.getElementsByClassName(\"zoyinc_status_group_img\"); \nif ( figureElementList.length != 1){ \n\talert(\"Status table surrounding figure element not found\"); \n}; \ntableImgElementList = figureElementList[0].getElementsByTagName(\"img\"); \nif ( tableImgElementList.length != 1){ \n\talert(\"Status table image not found\"); \n}; \ntableImgElement = tableImgElementList[0];tableImgElement.src= \"\/wp-content\/uploads\/2023\/11\/FindMyTrainAMP000Small_01.jpg\"; \ntableImgElement.srcset= \"\/wp-content\/uploads\/2023\/11\/FindMyTrainAMP000Small_01.jpg\" + \" 600w\"; \ndelete tableImgElement.style.removeProperty('aspect-ratio'); \ntableAnchorElementList = figureElementList[0].getElementsByTagName(\"a\"); \nif ( tableAnchorElementList.length != 1){ \n\talert(\"Status table image link\/anchor not found\"); \n}; \ntableAnchorElement = tableAnchorElementList[0];tableAnchorElement.href= \"\/?p=5571&train_number=524\"; \ncurrStatusGroup.after(defaultStatusGroup.cloneNode(true)); \ncurrStatusGroup = currStatusGroup.nextSibling;  \/\/ Add After the default group \ncurrStatusGroup.style.display = ''; \/\/ Unhide the new group \nheadingElementList = currStatusGroup.getElementsByClassName(\"zoyinc_status_group_heading\"); \nif ( headingElementList.length != 1){ \n\talert(\"Status info heading not found\"); \n}; \nheadingElementList[0].textContent = \"AM456\"; \nfigureElementList = currStatusGroup.getElementsByClassName(\"zoyinc_status_group_table\"); \nif ( figureElementList.length != 1){ \n\talert(\"Status table surrounding figure element not found\"); \n}; \ntableElementList = figureElementList[0].getElementsByTagName(\"table\"); \nif ( tableElementList.length != 1){ \n\talert(\"Status table not found\"); \n}; \nstatusTableElement = tableElementList[0]; \nrouteFullName = \"Manukau To Waitemata\";statusTableElement.rows[0].cells[0].width = \"30%\"; \nstatusTableElement.rows[1].cells[0].width = \"30%\"; \nstatusTableElement.rows[2].cells[0].width = \"30%\"; \nstatusTableElement.rows[3].cells[0].width = \"30%\"; \nstatusTableElement.rows[0].cells[1].innerHTML = \"<a href='https:\/\/www.google.com\/maps\/search\/?api=1&query=-36.8625111111111,174.8095'>Orakei Station<\/a>\"; \nstatusTableElement.rows[1].cells[1].innerHTML = routeFullName; \nstatusTableElement.rows[2].cells[1].innerHTML = \"456, 524+ (524,524,524,)\"; \nstatusTableElement.rows[3].cells[1].innerHTML = \"12\/05\/2026 - 7:23 am\"; \ntestElement = statusTableElement.rows[3].cells[1];figureElementList = currStatusGroup.getElementsByClassName(\"zoyinc_status_group_img\"); \nif ( figureElementList.length != 1){ \n\talert(\"Status table surrounding figure element not found\"); \n}; \ntableImgElementList = figureElementList[0].getElementsByTagName(\"img\"); \nif ( tableImgElementList.length != 1){ \n\talert(\"Status table image not found\"); \n}; \ntableImgElement = tableImgElementList[0];tableImgElement.src= \"\/wp-content\/uploads\/2023\/11\/FindMyTrainAMP000Small_01.jpg\"; \ntableImgElement.srcset= \"\/wp-content\/uploads\/2023\/11\/FindMyTrainAMP000Small_01.jpg\" + \" 600w\"; \ndelete tableImgElement.style.removeProperty('aspect-ratio'); \ntableAnchorElementList = figureElementList[0].getElementsByTagName(\"a\"); \nif ( tableAnchorElementList.length != 1){ \n\talert(\"Status table image link\/anchor not found\"); \n}; \ntableAnchorElement = tableAnchorElementList[0];tableAnchorElement.href= \"\/?p=5571&train_number=456\"; \ncurrStatusGroup.after(defaultStatusGroup.cloneNode(true)); \ncurrStatusGroup = currStatusGroup.nextSibling;  \/\/ Add After the default group \ncurrStatusGroup.style.display = ''; \/\/ Unhide the new group \nheadingElementList = currStatusGroup.getElementsByClassName(\"zoyinc_status_group_heading\"); \nif ( headingElementList.length != 1){ \n\talert(\"Status info heading not found\"); \n}; \nheadingElementList[0].textContent = \"AM129\"; \nfigureElementList = currStatusGroup.getElementsByClassName(\"zoyinc_status_group_table\"); \nif ( figureElementList.length != 1){ \n\talert(\"Status table surrounding figure element not found\"); \n}; \ntableElementList = figureElementList[0].getElementsByTagName(\"table\"); \nif ( tableElementList.length != 1){ \n\talert(\"Status table not found\"); \n}; \nstatusTableElement = tableElementList[0]; \nrouteFullName = \"Manukau To Waitemata\";statusTableElement.rows[0].cells[0].width = \"30%\"; \nstatusTableElement.rows[1].cells[0].width = \"30%\"; \nstatusTableElement.rows[2].cells[0].width = \"30%\"; \nstatusTableElement.rows[3].cells[0].width = \"30%\"; \nstatusTableElement.rows[0].cells[1].innerHTML = \"<a href='https:\/\/www.google.com\/maps\/search\/?api=1&query=-36.8975111111111,174.849961111111'>Panmure Station<\/a>\"; \nstatusTableElement.rows[1].cells[1].innerHTML = routeFullName; \nstatusTableElement.rows[2].cells[1].innerHTML = \"129*, 1127 (129,129,129,129,129,129,1127,129,129,129)\"; \nstatusTableElement.rows[3].cells[1].innerHTML = \"12\/05\/2026 - 7:23 am\"; \ntestElement = statusTableElement.rows[3].cells[1];figureElementList = currStatusGroup.getElementsByClassName(\"zoyinc_status_group_img\"); \nif ( figureElementList.length != 1){ \n\talert(\"Status table surrounding figure element not found\"); \n}; \ntableImgElementList = figureElementList[0].getElementsByTagName(\"img\"); \nif ( tableImgElementList.length != 1){ \n\talert(\"Status table image not found\"); \n}; \ntableImgElement = tableImgElementList[0];tableImgElement.src= \"\/wp-content\/uploads\/2023\/11\/FindMyTrainAMP000Small_01.jpg\"; \ntableImgElement.srcset= \"\/wp-content\/uploads\/2023\/11\/FindMyTrainAMP000Small_01.jpg\" + \" 600w\"; \ndelete tableImgElement.style.removeProperty('aspect-ratio'); \ntableAnchorElementList = figureElementList[0].getElementsByTagName(\"a\"); \nif ( tableAnchorElementList.length != 1){ \n\talert(\"Status table image link\/anchor not found\"); \n}; \ntableAnchorElement = tableAnchorElementList[0];tableAnchorElement.href= \"\/?p=5571&train_number=129\"; \ncurrStatusGroup.after(defaultStatusGroup.cloneNode(true)); \ncurrStatusGroup = currStatusGroup.nextSibling;  \/\/ Add After the default group \ncurrStatusGroup.style.display = ''; \/\/ Unhide the new group \nheadingElementList = currStatusGroup.getElementsByClassName(\"zoyinc_status_group_heading\"); \nif ( headingElementList.length != 1){ \n\talert(\"Status info heading not found\"); \n}; \nheadingElementList[0].textContent = \"AM1127\"; \nfigureElementList = currStatusGroup.getElementsByClassName(\"zoyinc_status_group_table\"); \nif ( figureElementList.length != 1){ \n\talert(\"Status table surrounding figure element not found\"); \n}; \ntableElementList = figureElementList[0].getElementsByTagName(\"table\"); \nif ( tableElementList.length != 1){ \n\talert(\"Status table not found\"); \n}; \nstatusTableElement = tableElementList[0]; \nrouteFullName = \"Manukau To Waitemata\";statusTableElement.rows[0].cells[0].width = \"30%\"; \nstatusTableElement.rows[1].cells[0].width = \"30%\"; \nstatusTableElement.rows[2].cells[0].width = \"30%\"; \nstatusTableElement.rows[3].cells[0].width = \"30%\"; \nstatusTableElement.rows[0].cells[1].innerHTML = \"<a href='https:\/\/www.google.com\/maps\/search\/?api=1&query=-36.8978972222222,174.849494444444'>Panmure Station<\/a>\"; \nstatusTableElement.rows[1].cells[1].innerHTML = routeFullName; \nstatusTableElement.rows[2].cells[1].innerHTML = \"129*, 1127 (129,129,129,129,129,129,1127,129,129,129)\"; \nstatusTableElement.rows[3].cells[1].innerHTML = \"12\/05\/2026 - 7:23 am\"; \ntestElement = statusTableElement.rows[3].cells[1];figureElementList = currStatusGroup.getElementsByClassName(\"zoyinc_status_group_img\"); \nif ( figureElementList.length != 1){ \n\talert(\"Status table surrounding figure element not found\"); \n}; \ntableImgElementList = figureElementList[0].getElementsByTagName(\"img\"); \nif ( tableImgElementList.length != 1){ \n\talert(\"Status table image not found\"); \n}; \ntableImgElement = tableImgElementList[0];tableImgElement.src= \"\/wp-content\/uploads\/2023\/11\/FindMyTrainAMP000Small_01.jpg\"; \ntableImgElement.srcset= \"\/wp-content\/uploads\/2023\/11\/FindMyTrainAMP000Small_01.jpg\" + \" 600w\"; \ndelete tableImgElement.style.removeProperty('aspect-ratio'); \ntableAnchorElementList = figureElementList[0].getElementsByTagName(\"a\"); \nif ( tableAnchorElementList.length != 1){ \n\talert(\"Status table image link\/anchor not found\"); \n}; \ntableAnchorElement = tableAnchorElementList[0];tableAnchorElement.href= \"\/?p=5571&train_number=1127\"; \ncurrStatusGroup.after(defaultStatusGroup.cloneNode(true)); \ncurrStatusGroup = currStatusGroup.nextSibling;  \/\/ Add After the default group \ncurrStatusGroup.style.display = ''; \/\/ Unhide the new group \nheadingElementList = currStatusGroup.getElementsByClassName(\"zoyinc_status_group_heading\"); \nif ( headingElementList.length != 1){ \n\talert(\"Status info heading not found\"); \n}; \nheadingElementList[0].textContent = \"AM687\"; \nfigureElementList = currStatusGroup.getElementsByClassName(\"zoyinc_status_group_table\"); \nif ( figureElementList.length != 1){ \n\talert(\"Status table surrounding figure element not found\"); \n}; \ntableElementList = figureElementList[0].getElementsByTagName(\"table\"); \nif ( tableElementList.length != 1){ \n\talert(\"Status table not found\"); \n}; \nstatusTableElement = tableElementList[0]; \nrouteFullName = \"Manukau To Waitemata\";statusTableElement.rows[0].cells[0].width = \"30%\"; \nstatusTableElement.rows[1].cells[0].width = \"30%\"; \nstatusTableElement.rows[2].cells[0].width = \"30%\"; \nstatusTableElement.rows[3].cells[0].width = \"30%\"; \nstatusTableElement.rows[0].cells[1].innerHTML = \"<a href='https:\/\/www.google.com\/maps\/search\/?api=1&query=-36.9499694444444,174.833827777778'>Between Otahuhu and Middlemore<\/a>\"; \nstatusTableElement.rows[1].cells[1].innerHTML = routeFullName; \nstatusTableElement.rows[2].cells[1].innerHTML = \"687*, 714 (687,687,687,687,687,687,687,687,687,687)\"; \nstatusTableElement.rows[3].cells[1].innerHTML = \"12\/05\/2026 - 7:23 am\"; \ntestElement = statusTableElement.rows[3].cells[1];figureElementList = currStatusGroup.getElementsByClassName(\"zoyinc_status_group_img\"); \nif ( figureElementList.length != 1){ \n\talert(\"Status table surrounding figure element not found\"); \n}; \ntableImgElementList = figureElementList[0].getElementsByTagName(\"img\"); \nif ( tableImgElementList.length != 1){ \n\talert(\"Status table image not found\"); \n}; \ntableImgElement = tableImgElementList[0];tableImgElement.src= \"\/wp-content\/uploads\/2023\/11\/FindMyTrainAMP000Small_01.jpg\"; \ntableImgElement.srcset= \"\/wp-content\/uploads\/2023\/11\/FindMyTrainAMP000Small_01.jpg\" + \" 600w\"; \ndelete tableImgElement.style.removeProperty('aspect-ratio'); \ntableAnchorElementList = figureElementList[0].getElementsByTagName(\"a\"); \nif ( tableAnchorElementList.length != 1){ \n\talert(\"Status table image link\/anchor not found\"); \n}; \ntableAnchorElement = tableAnchorElementList[0];tableAnchorElement.href= \"\/?p=5571&train_number=687\"; \ncurrStatusGroup.after(defaultStatusGroup.cloneNode(true)); \ncurrStatusGroup = currStatusGroup.nextSibling;  \/\/ Add After the default group \ncurrStatusGroup.style.display = ''; \/\/ Unhide the new group \nheadingElementList = currStatusGroup.getElementsByClassName(\"zoyinc_status_group_heading\"); \nif ( headingElementList.length != 1){ \n\talert(\"Status info heading not found\"); \n}; \nheadingElementList[0].textContent = \"AM714 - Uber Eats\"; \nfigureElementList = currStatusGroup.getElementsByClassName(\"zoyinc_status_group_table\"); \nif ( figureElementList.length != 1){ \n\talert(\"Status table surrounding figure element not found\"); \n}; \ntableElementList = figureElementList[0].getElementsByTagName(\"table\"); \nif ( tableElementList.length != 1){ \n\talert(\"Status table not found\"); \n}; \nstatusTableElement = tableElementList[0]; \nrouteFullName = \"Manukau To Waitemata\";statusTableElement.rows[0].cells[0].width = \"30%\"; \nstatusTableElement.rows[1].cells[0].width = \"30%\"; \nstatusTableElement.rows[2].cells[0].width = \"30%\"; \nstatusTableElement.rows[3].cells[0].width = \"30%\"; \nstatusTableElement.rows[0].cells[1].innerHTML = \"<a href='https:\/\/www.google.com\/maps\/search\/?api=1&query=-36.9506,174.833925'>Between Otahuhu and Middlemore<\/a>\"; \nstatusTableElement.rows[1].cells[1].innerHTML = routeFullName; \nstatusTableElement.rows[2].cells[1].innerHTML = \"687*, 714 (687,687,687,687,687,687,687,687,687,687)\"; \nstatusTableElement.rows[3].cells[1].innerHTML = \"12\/05\/2026 - 7:23 am\"; \ntestElement = statusTableElement.rows[3].cells[1];figureElementList = currStatusGroup.getElementsByClassName(\"zoyinc_status_group_img\"); \nif ( figureElementList.length != 1){ \n\talert(\"Status table surrounding figure element not found\"); \n}; \ntableImgElementList = figureElementList[0].getElementsByTagName(\"img\"); \nif ( tableImgElementList.length != 1){ \n\talert(\"Status table image not found\"); \n}; \ntableImgElement = tableImgElementList[0];tableImgElement.src= \"\/wp-content\/uploads\/2025\/12\/FindMyTrainAMP714_UberEatsSmall_01.jpg\"; \ntableImgElement.srcset= \"\/wp-content\/uploads\/2025\/12\/FindMyTrainAMP714_UberEatsSmall_01.jpg\" + \" 600w\"; \ndelete tableImgElement.style.removeProperty('aspect-ratio'); \ntableAnchorElementList = figureElementList[0].getElementsByTagName(\"a\"); \nif ( tableAnchorElementList.length != 1){ \n\talert(\"Status table image link\/anchor not found\"); \n}; \ntableAnchorElement = tableAnchorElementList[0];tableAnchorElement.href= \"\/?p=5571&train_number=714\"; \ncurrStatusGroup.after(defaultStatusGroup.cloneNode(true)); \ncurrStatusGroup = currStatusGroup.nextSibling;  \/\/ Add After the default group \ncurrStatusGroup.style.display = ''; \/\/ Unhide the new group \nheadingElementList = currStatusGroup.getElementsByClassName(\"zoyinc_status_group_heading\"); \nif ( headingElementList.length != 1){ \n\talert(\"Status info heading not found\"); \n}; \nheadingElementList[0].textContent = \"AM212\"; \nfigureElementList = currStatusGroup.getElementsByClassName(\"zoyinc_status_group_table\"); \nif ( figureElementList.length != 1){ \n\talert(\"Status table surrounding figure element not found\"); \n}; \ntableElementList = figureElementList[0].getElementsByTagName(\"table\"); \nif ( tableElementList.length != 1){ \n\talert(\"Status table not found\"); \n}; \nstatusTableElement = tableElementList[0]; \nrouteFullName = \"Manukau To Waitemata\";statusTableElement.rows[0].cells[0].width = \"30%\"; \nstatusTableElement.rows[1].cells[0].width = \"30%\"; \nstatusTableElement.rows[2].cells[0].width = \"30%\"; \nstatusTableElement.rows[3].cells[0].width = \"30%\"; \nstatusTableElement.rows[0].cells[1].innerHTML = \"<a href='https:\/\/www.google.com\/maps\/search\/?api=1&query=-36.9926833333333,174.857794444444'>Between Puhinu and Puhinu Creek<\/a>\"; \nstatusTableElement.rows[1].cells[1].innerHTML = routeFullName; \nstatusTableElement.rows[2].cells[1].innerHTML = \"212, 580* (580,580,580,580,580,580,)\"; \nstatusTableElement.rows[3].cells[1].innerHTML = \"12\/05\/2026 - 7:23 am\"; \ntestElement = statusTableElement.rows[3].cells[1];figureElementList = currStatusGroup.getElementsByClassName(\"zoyinc_status_group_img\"); \nif ( figureElementList.length != 1){ \n\talert(\"Status table surrounding figure element not found\"); \n}; \ntableImgElementList = figureElementList[0].getElementsByTagName(\"img\"); \nif ( tableImgElementList.length != 1){ \n\talert(\"Status table image not found\"); \n}; \ntableImgElement = tableImgElementList[0];tableImgElement.src= \"\/wp-content\/uploads\/2023\/11\/FindMyTrainAMP000Small_01.jpg\"; \ntableImgElement.srcset= \"\/wp-content\/uploads\/2023\/11\/FindMyTrainAMP000Small_01.jpg\" + \" 600w\"; \ndelete tableImgElement.style.removeProperty('aspect-ratio'); \ntableAnchorElementList = figureElementList[0].getElementsByTagName(\"a\"); \nif ( tableAnchorElementList.length != 1){ \n\talert(\"Status table image link\/anchor not found\"); \n}; \ntableAnchorElement = tableAnchorElementList[0];tableAnchorElement.href= \"\/?p=5571&train_number=212\"; \ncurrStatusGroup.after(defaultStatusGroup.cloneNode(true)); \ncurrStatusGroup = currStatusGroup.nextSibling;  \/\/ Add After the default group \ncurrStatusGroup.style.display = ''; \/\/ Unhide the new group \nheadingElementList = currStatusGroup.getElementsByClassName(\"zoyinc_status_group_heading\"); \nif ( headingElementList.length != 1){ \n\talert(\"Status info heading not found\"); \n}; \nheadingElementList[0].textContent = \"AM580\"; \nfigureElementList = currStatusGroup.getElementsByClassName(\"zoyinc_status_group_table\"); \nif ( figureElementList.length != 1){ \n\talert(\"Status table surrounding figure element not found\"); \n}; \ntableElementList = figureElementList[0].getElementsByTagName(\"table\"); \nif ( tableElementList.length != 1){ \n\talert(\"Status table not found\"); \n}; \nstatusTableElement = tableElementList[0]; \nrouteFullName = \"Manukau To Waitemata\";statusTableElement.rows[0].cells[0].width = \"30%\"; \nstatusTableElement.rows[1].cells[0].width = \"30%\"; \nstatusTableElement.rows[2].cells[0].width = \"30%\"; \nstatusTableElement.rows[3].cells[0].width = \"30%\"; \nstatusTableElement.rows[0].cells[1].innerHTML = \"<a href='https:\/\/www.google.com\/maps\/search\/?api=1&query=-36.9912222222222,174.85685'>Between Puhinu and Puhinu Creek<\/a>\"; \nstatusTableElement.rows[1].cells[1].innerHTML = routeFullName; \nstatusTableElement.rows[2].cells[1].innerHTML = \"212, 580* (580,580,580,580,580,580,)\"; \nstatusTableElement.rows[3].cells[1].innerHTML = \"12\/05\/2026 - 7:23 am\"; \ntestElement = statusTableElement.rows[3].cells[1];figureElementList = currStatusGroup.getElementsByClassName(\"zoyinc_status_group_img\"); \nif ( figureElementList.length != 1){ \n\talert(\"Status table surrounding figure element not found\"); \n}; \ntableImgElementList = figureElementList[0].getElementsByTagName(\"img\"); \nif ( tableImgElementList.length != 1){ \n\talert(\"Status table image not found\"); \n}; \ntableImgElement = tableImgElementList[0];tableImgElement.src= \"\/wp-content\/uploads\/2023\/11\/FindMyTrainAMP000Small_01.jpg\"; \ntableImgElement.srcset= \"\/wp-content\/uploads\/2023\/11\/FindMyTrainAMP000Small_01.jpg\" + \" 600w\"; \ndelete tableImgElement.style.removeProperty('aspect-ratio'); \ntableAnchorElementList = figureElementList[0].getElementsByTagName(\"a\"); \nif ( tableAnchorElementList.length != 1){ \n\talert(\"Status table image link\/anchor not found\"); \n}; \ntableAnchorElement = tableAnchorElementList[0];tableAnchorElement.href= \"\/?p=5571&train_number=580\"; \n\t\r\n\r\n});\r\n<\/script><!-- Trains By Route - Trains On Route --><\/p>\n\n\n<p><script>\r\n\/\/\r\n\/\/ Update the details for the currently selected train\r\n\/\/\r\n\r\n\/\/ We need to wait until the entire page is loaded so use \"window.addEventListener('load'...\"\r\nwindow.addEventListener('load', function () {\r\n\t\r\n\t\/\/ Get reference to current train status heading\r\n\tcurrTrainStatusElement = document.getElementsByClassName(\"zoyinc-find_my_train-curr_train_status\")[0];\r\n\t\r\n\t\/\/ Get a reference to the title heading\r\n\tcurrTrainTitleElement = document.getElementsByClassName(\"zoyinc_post_title\")[0];\r\n\t\r\n\t\/\/ Get a reference to the current train group\r\n\tcurrTrainGroupElement = document.getElementsByClassName(\"zoyinc_curr_train_details\")[0];\r\n\t\r\n\t\/\/ Get references to the current train status\r\n\tcurrTrainCustomName = currTrainGroupElement.getElementsByClassName(\"zoyinc_curr_train_custom_name\")[0];\r\n\tcurrTrainDescription = currTrainGroupElement.getElementsByClassName(\"zoyinc_curr_train_description\")[0];\r\n\t\r\n\tcurrTrainCustomName.innerText = \"Manukau To Waitemata\";\r\n\t\t\r\n\t\/\/\r\n\t\/\/ The status details for the current train are in separate tables and\r\n\t\/\/ also using columns. This was primarily done so that it displayed correctly on phones\r\n\t\/\/ \r\n\t\r\n\t\/\/ Get a reference to the cell containing location details\r\n\tcurrTrainLocationTable = currTrainGroupElement.getElementsByClassName(\"zoyinc_curr_train_location\")[0].getElementsByTagName('table')[0];\r\n\tcurrTrainLocationTable.rows[0].cells[0].width = \"35%\";\r\n\tcurrTrainLocationStr = currTrainLocationTable.rows[0].cells[1];\r\n\t\r\n\t\/\/ Get a reference to the cell containing the list of trains in this set details\r\n\tcurrTrainConnectedTrainsTable = currTrainGroupElement.getElementsByClassName(\"zoyinc_curr_train_connected_trains\")[0].getElementsByTagName('table')[0];\r\n\tcurrTrainConnectedTrainsTable.rows[0].cells[0].width = \"35%\";\r\n\tcurrTrainConnectedTrainsStr = currTrainConnectedTrainsTable.rows[0].cells[1];\r\n\t\r\n\t\/\/ Get a reference to the cell containing service details\r\n\tcurrTrainServiceTable = currTrainGroupElement.getElementsByClassName(\"zoyinc_curr_train_service\")[0].getElementsByTagName('table')[0];\r\n\tcurrTrainServiceTable.rows[0].cells[0].width = \"35%\";\r\n\tcurrTrainServiceStr = currTrainServiceTable.rows[0].cells[1];\r\n\t\r\n\t\/\/ Get a reference to the cell containing updated time details\r\n\tcurrTrainUpdatedTable = currTrainGroupElement.getElementsByClassName(\"zoyinc_curr_train_updated_trains\")[0].getElementsByTagName('table')[0];\r\n\tcurrTrainUpdatedTable.rows[0].cells[0].width = \"35%\";\r\n\tcurrTrainUpdatedStr = currTrainUpdatedTable.rows[0].cells[1];\r\n\r\nheightLocationTable = currTrainLocationTable.rows[0].offsetHeight; \nheightConnectedTrainsTable = currTrainConnectedTrainsTable.rows[0].offsetHeight; \nif ( heightLocationTable > heightConnectedTrainsTable){  \n\tcurrTrainConnectedTrainsTable.setAttribute(\"height\", heightLocationTable);  \n} else { \n\tcurrTrainLocationTable.setAttribute(\"height\", heightConnectedTrainsTable);  \n}; \nheightTrainServiceTable = currTrainServiceTable.rows[0].offsetHeight; \nheightTrainUpdatedTable = currTrainUpdatedTable.rows[0].offsetHeight; \nif ( heightTrainServiceTable > heightTrainUpdatedTable){  \n\tcurrTrainUpdatedTable.setAttribute(\"height\", heightTrainServiceTable);  \n} else { \n\tcurrTrainServiceTable.setAttribute(\"height\", heightTrainUpdatedTable);  \n}; \n\t\r\n\t\/\/\r\n\t\/\/ Update the trip details table for the current train\r\n\t\/\/  \r\n\tfigureElement = document.getElementsByClassName(\"zoyinc-find_my_train-cur_train_trips\")[0]; \r\n\tcurTrainTripTable = figureElement.getElementsByTagName(\"table\")[0];\r\n});\t\r\n\r\n<\/script>\t <!-- Trains By Route - Update Current Route Details --><\/p>\n\n\n\n<div class=\"wp-block-group zoyinc_curr_train_details has-global-padding is-layout-constrained wp-container-core-group-is-layout-3 wp-block-group-is-layout-constrained\" style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0\">\n<div class=\"wp-block-group is-nowrap is-layout-flex wp-container-core-group-is-layout-1 wp-block-group-is-layout-flex\" style=\"padding-top:0;padding-bottom:0\">\n<h5 class=\"wp-block-heading zoyinc_curr_train_custom_name\" style=\"padding-bottom:1%;line-height:1.7\">Find which trains are running on your route<\/h5>\n<\/div>\n\n\n\n<div class=\"wp-block-group is-nowrap is-layout-flex wp-container-core-group-is-layout-2 wp-block-group-is-layout-flex\" style=\"margin-top:0%;margin-bottom:0%;padding-top:0;padding-bottom:0\">\n<p class=\"zoyinc_curr_train_description\" style=\"padding-top:0;padding-right:0;padding-bottom:0;padding-left:0\">Select the train route that you are interested in<\/p>\n<\/div>\n<\/div>\n\n\n\n<div style=\"margin-top:0;margin-bottom:0;height:0.5em\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div class=\"wp-block-group zoyinc_location_select_form_master_group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\" style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0\">\n<div class=\"wp-block-group is-nowrap is-layout-flex wp-container-core-group-is-layout-4 wp-block-group-is-layout-flex\">\n<div class=\"wp-block-columns is-not-stacked-on-mobile wp-container-content-1 is-layout-flex wp-container-core-columns-is-layout-1 wp-block-columns-is-layout-flex\" style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-right:var(--wp--preset--spacing--30);padding-bottom:0;padding-left:var(--wp--preset--spacing--30)\">\n<div class=\"wp-block-column is-vertically-aligned-center is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:80%\">\n<div class=\"wp-block-buttons is-layout-flex wp-container-core-buttons-is-layout-1 wp-block-buttons-is-layout-flex\" style=\"margin-top:0;margin-bottom:0\">\n<div class=\"wp-block-button has-custom-width wp-block-button__width-100 has-custom-font-size zoyinc_dummy_select_list has-medium-font-size\"><a class=\"wp-block-button__link has-contrast-color has-base-background-color has-text-color has-background wp-element-button\" style=\"border-width:1px;padding-top:2.5%;padding-right:10px;padding-bottom:2.5%;padding-left:10px\">List of trains that are running<\/a><\/div>\n<\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-vertically-aligned-center is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:20%\">\n<div class=\"wp-block-buttons is-content-justification-center is-nowrap is-layout-flex wp-container-core-buttons-is-layout-2 wp-block-buttons-is-layout-flex\" style=\"margin-top:0;margin-bottom:0\">\n<div class=\"wp-block-button has-custom-width wp-block-button__width-100 has-custom-font-size zoyinc_dummy_submit_button has-medium-font-size\"><a class=\"wp-block-button__link has-base-color has-custom-zoyinc-3-background-color has-text-color has-background wp-element-button\" style=\"border-style:none;border-width:0px;padding-top:4%;padding-right:0px;padding-bottom:4%;padding-left:0px\">Go<\/a><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n\n\n\n<div style=\"margin-top:0;margin-bottom:0;height:2rem\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\" style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0\">Trains<\/h3>\n\n\n\n<div style=\"margin-top:0;margin-bottom:0;height:21px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div class=\"wp-block-group zoyinc-trains_by_route_train_list_group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\" style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0\">\n<h5 class=\"wp-block-heading zoyinc_status_group_heading\" style=\"margin-bottom:1%;padding-right:2%;padding-left:2%\">AMP123 &#8211; A new wrapped train<\/h5>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-2 wp-block-columns-is-layout-flex\" style=\"margin-top:0%;margin-bottom:0;padding-top:0;padding-bottom:0\">\n<div class=\"wp-block-column is-layout-flow wp-container-core-column-is-layout-3 wp-block-column-is-layout-flow\" style=\"padding-top:0;padding-bottom:0;flex-basis:38%\">\n<figure class=\"wp-block-image size-full has-custom-border zoyinc_status_group_img\"><a  href=\"https:\/\/www.zoyinc.com\/?train_number=212&#038;p=5571\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"315\" src=\"http:\/\/www.zoyinc.com\/wp-content\/uploads\/2023\/11\/FindMyTrainAMP000Small_01.jpg\" alt=\"\" class=\"wp-image-5639\" style=\"border-style:none;border-width:0px;aspect-ratio:1.607717041800643;object-fit:cover\" srcset=\"http:\/\/www.zoyinc.com\/wp-content\/uploads\/2023\/11\/FindMyTrainAMP000Small_01.jpg 600w, http:\/\/www.zoyinc.com\/wp-content\/uploads\/2023\/11\/FindMyTrainAMP000Small_01-300x158.jpg 300w, http:\/\/www.zoyinc.com\/wp-content\/uploads\/2023\/11\/FindMyTrainAMP000Small_01-250x131.jpg 250w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/figure>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-container-core-column-is-layout-4 wp-block-column-is-layout-flow\" style=\"padding-top:0;padding-bottom:0\">\n<figure class=\"wp-block-table is-style-stripes zoyinc_status_group_table\" style=\"margin-top:0;margin-right:0;margin-bottom:0;margin-left:0;padding-top:0;padding-bottom:0;line-height:1\"><table><tbody><tr><td><strong>Location<\/strong><\/td><td>A New Train Station<\/td><\/tr><tr><td><strong>Service<\/strong><\/td><td>From Here To There<\/td><\/tr><tr><td><strong>Trains<\/strong><\/td><td>AMP00 and AMP01<\/td><\/tr><tr><td><strong>Updated<\/strong><\/td><td>01\/01\/1980 &#8211; 12:00am<\/td><\/tr><\/tbody><\/table><\/figure>\n<\/div>\n<\/div>\n\n\n\n<div style=\"margin-top:0;margin-bottom:0;height:66px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n<\/div>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Find which trains are running on your route Select the train route that you are interested in Trains AMP123 &#8211; A new wrapped train Location A New Train Station Service From Here To There Trains AMP00 and AMP01 Updated 01\/01\/1980 &#8211; 12:00am<\/p>\n","protected":false},"author":2,"featured_media":6555,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[761,837],"tags":[],"class_list":["post-6553","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-trains","category-yarpp-group-find-my-train"],"_links":{"self":[{"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=\/wp\/v2\/posts\/6553","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6553"}],"version-history":[{"count":4,"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=\/wp\/v2\/posts\/6553\/revisions"}],"predecessor-version":[{"id":6574,"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=\/wp\/v2\/posts\/6553\/revisions\/6574"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=\/wp\/v2\/media\/6555"}],"wp:attachment":[{"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6553"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6553"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6553"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}