This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(async () => { | |
const domain = window.location.host; | |
const [RAD, itemID] = window.location.href.match(/\d+/g); | |
const itemDOMDescription = document.querySelector('.description') | |
const getItemMatrix = await fetch(`https://${domain}/API/Account/${RAD}/Item/${itemID}.json?load_relations=["ItemAttributes"]`, { | |
credentials: "same-origin" | |
}); | |
const itemMatrixData = await getItemMatrix.json(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.addEventListener('DOMContentLoaded', async () => { | |
const domain = window.location.host; | |
const [RAD, orderID] = window.location.href.match(/\d+/g); | |
const orderTableLines = document.querySelectorAll('body .document:nth-of-type(3) tbody tr > td:nth-child(2)') | |
document.querySelector("body > table:nth-child(8) > thead > tr > th:nth-child(2)").insertAdjacentHTML('afterend', '<th>Category Name</th>') | |
const getOrder = await fetch(`https://${domain}/API/Account/${RAD}/DisplayTemplate/Order/${orderID}.json`, { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log("lol") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const requestBuilder = async (domain, RAD, endpoint, ID, parameters, isDisplay) => { | |
let url = `https://${domain}/API/Account/${RAD}`; | |
if (isDisplay) { | |
url = url + `DisplayTemplate` | |
} | |
if (endpoint == "Label") { | |
url = `${url}/ItemAs${endpoint}` | |
} else { | |
url = `${url}/${endpoint}` | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Gets the custom fields for the label template in Lightspeed Retail: | |
// Function to get custon field values | |
const requestBuilder = async (domain, RAD, endpoint, ID, parameters, isDisplay) => { | |
const url = isDisplay | |
? endpoint == "Label" | |
?`https://${domain}/API/Account/${RAD}/DisplayTemplate/ItemAs${endpoint}/${ID}.json?${parameters}` | |
:`https://${domain}/API/Account/${RAD}/DisplayTemplate/${endpoint}/${ID}.json?${parameters}` | |
:`https://${domain}/API/Account/${RAD}/${endpoint}/${ID}.json?${parameters}` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Make sure you wrap the script in a script tag | |
// Insert this after the <h1 class="receiptTypeTitle"> in the Sales template | |
document.addEventListener("DOMContentLoaded", () => { | |
const lines_with_notes = document.querySelectorAll('.line_note'); | |
lines_with_notes.forEach(line => { | |
const line_content = line.innerText; | |
if (/Work order/gi.test(line_content)) { | |
const firstLine = line_content.split(/\n/g)[0]; | |
line.innerHTML = line_content.replace(line_content, firstLine); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Purpose of this task was to be able to scrape the list of prices onto | |
the console and sum them. This automates the manual copy and pasting work one would have to do | |
Website scraped: https://www.mtlblog.com/lifestyle/cost-of-living-montreal | |
*/ | |
// Target all the content on the page | |
let it = document.querySelectorAll('#article-text *'); | |
// initialise a string | |
let words = ""; | |
// cycle through each piece of content on the page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let str = window.location.href; | |
let new_num = str.replace(/[\s\S]+?([\d]+)\.html[\s\S]+/ig, "$1"); | |
let apiSale = fetch(`https://us.merchantos.com/API/Account/127704/DisplayTemplate/Sale/${new_num}.json`, { | |
credentials: "same-origin" | |
}).then((response) => response.json()); | |
let apiCategory = fetch("https://us.merchantos.com/API/Account/127704/Category.json", { | |
credentials: "same-origin" | |
}).then((response) => response.json()); | |
let saleData = { | |
"apiSale": {}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
table | |
tr | |
td | |
td | |
td | |
td | |
td | |
tr | |
td | |
td |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Pixel Art Maker!</title> | |
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Monoton"> | |
<link rel="stylesheet" href="styles.css"> | |
</head> | |
<body> | |
<h1>Lab: Pixel Art Maker</h1> | |
<h2>Choose Grid Size</h2> |
NewerOlder