Tesla Order Status Page Enhancement

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

当前为 2022-06-28 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Tesla Order Status Page Enhancement
// @namespace    https://yibu.org/
// @version      0.2
// @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*
// @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.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);

})();