added content and structured others
This commit is contained in:
15
src/Javascript/amazon-calculate-spending.js
Normal file
15
src/Javascript/amazon-calculate-spending.js
Normal file
@@ -0,0 +1,15 @@
|
||||
// Open the Orders page in Amazon.
|
||||
// Run the script for each page you wish to calculate total of.
|
||||
|
||||
elms = document.querySelectorAll("#ordersContainer")[0].querySelectorAll(".a-row .a-size-base");
|
||||
total = 0;
|
||||
|
||||
for (let i = 0; i < elms.length ; i++) {
|
||||
value = elms[i].innerText;
|
||||
if (value.includes("$")) {
|
||||
total += parseInt(value.replace("$", ""), 10);
|
||||
console.log(value);
|
||||
}
|
||||
}
|
||||
|
||||
console.log(total);
|
39
src/Javascript/bulk-delete-youtube-videos.js
Normal file
39
src/Javascript/bulk-delete-youtube-videos.js
Normal file
@@ -0,0 +1,39 @@
|
||||
pos = 7 // Position to delete from. Note: 0 is the 1st video of the list; 1 is the 2nd, etc.
|
||||
end = 5 // How many videos to delete?
|
||||
|
||||
// :: UI Timeouts :: (1000 equals 1 second.)
|
||||
// Note: Your computer is a toaster or potato? Can't render UI changes quickly?
|
||||
// Bump these up till the proper prompts show, then up the Interval Timer.
|
||||
t1 = 800
|
||||
t2 = 800
|
||||
t3 = 800
|
||||
|
||||
// :: Interval Timer :: (1000 equals 1 second.)
|
||||
// Note: Slow internet or bumped up the UI Timeouts?
|
||||
// If slow internet, incrimint this by 1 second till things delete.
|
||||
// If you bumped uo or down the UI Timeouts, add them up and add ~2000.
|
||||
wait = 4000
|
||||
|
||||
|
||||
i = 1 // Index to keep track of deletions. Don't change!
|
||||
interval = setInterval(function () {
|
||||
if (i == end)
|
||||
clearInterval(interval)
|
||||
|
||||
elm = document.getElementsByClassName('style-scope ytcp-video-list-cell-video open-menu-button')[pos];
|
||||
|
||||
elm.click();
|
||||
setTimeout(function () {
|
||||
document.getElementById('text-item-4').click();
|
||||
}, t1);
|
||||
|
||||
setTimeout(function () {
|
||||
document.getElementById('delete-confirm-checkbox').click();
|
||||
}, t2);
|
||||
|
||||
setTimeout(function () {
|
||||
document.getElementById('delete-confirm-button').click();
|
||||
}, t3);
|
||||
|
||||
i += 1
|
||||
}, wait);
|
39
src/Javascript/google-scripts-api-examples.js
Normal file
39
src/Javascript/google-scripts-api-examples.js
Normal file
@@ -0,0 +1,39 @@
|
||||
Reference Material:
|
||||
https://developers.google.com/apps-script
|
||||
|
||||
|
||||
|
||||
|
||||
# ---- Functions ---- #
|
||||
|
||||
function createSheetsFromRow() {
|
||||
// getActiveSpreadsheet actually returns the whole SpreadSheet object whereas getActiveSheet returns a single "Sheet" or null object.
|
||||
let spreadSheet = SpreadsheetApp.getActiveSpreadsheet(); // The "container" that holds all your Sheet objects
|
||||
let activeSheet = SpreadsheetApp.getActiveSheet(); // The Sheet that is active in your SpreadSheet object
|
||||
let sheetData = activeSheet.getDataRange().getValues(); // Get the active Sheet's data... aka Rows and Columns
|
||||
|
||||
for (var i in sheetData) {
|
||||
if (i == 0) { continue; } // Keep from adding first row as sheet
|
||||
let row = sheetData[i]; // Get row's data
|
||||
let newSheetName = row[2]; // New sheet name is derived from 3rd column (2nd index) which is Agency column
|
||||
let newSheet = spreadSheet.getSheetByName(newSheetName);
|
||||
if (newSheet === null) { // If sheet doesn't exists, we create it
|
||||
newSheet = spreadSheet.insertSheet(newSheetName);
|
||||
}
|
||||
newSheet.appendRow(row);
|
||||
}
|
||||
}
|
||||
|
||||
function deleteAllSheetsButForFirst() {
|
||||
let spreadSheet = SpreadsheetApp.getActiveSpreadsheet();
|
||||
let sheets = spreadSheet.getSheets();
|
||||
|
||||
for (var i in sheets) {
|
||||
if (i == 0) { continue; } // Keep from deleting first sheet
|
||||
let sheet = sheets[i];
|
||||
spreadSheet.deleteSheet(sheet);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user