Skip to content

Instantly share code, notes, and snippets.

@jmbjorndalen
Last active August 29, 2015 14:22
Show Gist options
  • Save jmbjorndalen/fa96c23dc6ba4c473aad to your computer and use it in GitHub Desktop.
Save jmbjorndalen/fa96c23dc6ba4c473aad to your computer and use it in GitHub Desktop.
Quick and dirty tampermonkey hack to view some of the hidden information on the Pebble Time Kickstarter webpage
// ==UserScript==
// @name pebble kickstarter test
// @namespace http://your.homepage/
// @version 0.2
// @description Adds hidden tracking info to the kickstarter page (and logs it to the js console)
// @author John Markus Bjørndalen
// @match https://kickstarter.getpebble.com/pledges/*
// @grant none
// ==/UserScript==
var elms = document.getElementsByTagName("div");
var shipdiv = document.getElementsByClassName("shipping-info");
// TODO: hard coded offset to the relevant <div>. May fail.
function add_hdr(s) {
var para = document.createElement("h3");
var node = document.createTextNode(s);
para.appendChild(node);
shipdiv[3].appendChild(para);
}
function add_line(s) {
var para = document.createElement("p");
var node = document.createTextNode(s);
para.appendChild(node);
shipdiv[3].appendChild(para);
}
for (i = 0; i < elms.length; i++) {
var drp = elms[i].getAttribute("data-react-props");
if (drp == undefined) {
continue;
}
//console.log(shipdiv);
//console.log(drp);
var info = JSON.parse(drp);
console.log(info.order.shipping_service);
console.log("Time tracking " + info.order.time_tracking_number);
console.log("Shipped e-mail " + info.order.shipped_email_sent_at);
for (j = 0; j < info.order.line_items.length; j++) {
console.log("Pebble: " + info.order.line_items[j].model + " id " + info.order.line_items[j].id);
}
add_hdr("Extracted (hidden) info");
add_line("Backer#: " + info.pledge.backer_number);
add_line("Service: " + info.order.shipping_service);
add_line("Shipped e-mail: " + info.order.shipped_email_sent_at);
add_line("Time Tracking: " + info.order.time_tracking_number);
for (j = 0; j < info.order.line_items.length; j++) {
add_line("Pebble: " + info.order.line_items[j].model + " sku " + info.order.line_items[j].sku);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment