feat: Add new calculator batches (6-10) and associated deployment/verification scripts, and update the calculator list.
This commit is contained in:
52
fix_g_mg.py
Normal file
52
fix_g_mg.py
Normal file
@@ -0,0 +1,52 @@
|
||||
import urllib.request
|
||||
import json
|
||||
import base64
|
||||
|
||||
url_base_kadence = "https://howdoyouconvert.com/wp-json/wp/v2/kadence_element/"
|
||||
creds = base64.b64encode(b"ben:6YGf wVxu gBpz pkqx BGZO lfVP").decode("utf-8")
|
||||
headers = {
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": "Basic " + creds,
|
||||
"User-Agent": "Mozilla/5.0"
|
||||
}
|
||||
|
||||
js_logic = """<script>
|
||||
(function() {
|
||||
function init() {
|
||||
var i1 = document.getElementById("input-1");
|
||||
var i2 = document.getElementById("input-2");
|
||||
if (!i1 || !i2) {
|
||||
if (window.initRetries === undefined) window.initRetries = 0;
|
||||
if (window.initRetries < 50) {
|
||||
window.initRetries++;
|
||||
setTimeout(init, 100);
|
||||
}
|
||||
return;
|
||||
}
|
||||
i1.oninput = function() {
|
||||
var v = parseFloat(i1.value);
|
||||
if (isNaN(v)) { i2.value = ""; return; }
|
||||
i2.value = parseFloat((v * 1000.0).toFixed(8));
|
||||
};
|
||||
i2.oninput = function() {
|
||||
var v = parseFloat(i2.value);
|
||||
if (isNaN(v)) { i1.value = ""; return; }
|
||||
i1.value = parseFloat((v / 1000.0).toFixed(8));
|
||||
};
|
||||
var p = new URLSearchParams(window.location.search);
|
||||
if (p.has('v1')) { i1.value = p.get('v1'); i1.oninput(); }
|
||||
else if (p.has('v2')) { i2.value = p.get('v2'); i2.oninput(); }
|
||||
}
|
||||
init();
|
||||
})();
|
||||
</script>"""
|
||||
|
||||
eid = 225
|
||||
print(f"Patching EID {eid}...")
|
||||
data = {"content": js_logic}
|
||||
req = urllib.request.Request(f"{url_base_kadence}{eid}", data=json.dumps(data).encode("utf-8"), headers=headers, method="PUT")
|
||||
try:
|
||||
urllib.request.urlopen(req, timeout=30)
|
||||
print("--> Done")
|
||||
except Exception as e:
|
||||
print(f"--> Error: {e}")
|
||||
Reference in New Issue
Block a user