Tesla Order Status Page Enhancement

Tesla Order Status Page Enhancement: Show more info hidden in the source code

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Tesla Order Status Page Enhancement
// @namespace    https://yibu.org/
// @version      0.3
// @description  Tesla Order Status Page Enhancement: Show more info hidden in the source code
// @author       yibum
// @match        https://www.tesla.com/*/teslaaccount/product-finalize?rn=RN*
// @match        https://www.tesla.com/teslaaccount/product-finalize?rn=RN*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';
    const cdata = unsafeWindow.Tesla.ProductF;
    const isNotMatchedToRa00Vin = cdata.Data.DeliveryDetails.isNotMatchedToRa00Vin;
    const vinFromSourceCode = cdata.Data.Insurance.vin;

    let infoDiv = document.createElement("div");
    infoDiv.setAttribute("id", "info-div-for-enhancement");
    infoDiv.setAttribute("class", "padding-bottom");
    let matchedToRa00vinNode = document.createElement("div");
    if (isNotMatchedToRa00Vin) {
        matchedToRa00vinNode.innerHTML = '<span style="font-weight:600;color:#32527b">matchedToRa00vin:</span> NOT Matched yet!';
    } else {
        matchedToRa00vinNode.innerHTML = '<span style="font-weight:600;color:#32527b">matchedToRa00vin:</span> MATCHED!';
    }
    let vinNode = document.createElement("div");
    if (vinFromSourceCode) {
        vinNode.innerHTML = '<span style="font-weight:600;color:#E82127">VIN Assigned:</span> ' + vinFromSourceCode;
    } else {
        vinNode.innerHTML = '<span style="font-weight:600;color:#E82127">VIN Assigned:</span> NOT Assigned yet!';
    }
    infoDiv.appendChild(matchedToRa00vinNode);
    infoDiv.appendChild(vinNode);

    const refNode = document.getElementById("prod-final-deliver-desk-model-name");
    refNode.parentNode.insertBefore(infoDiv, refNode.nextSibling);

})();