// ==UserScript== // @name SGW Item Modification Helper // @namespace greasyfork.org // @version 1 // @grant none // @require https://greasyfork.org/scripts/10208-gm-api-script/code/GM%20API%20script.js?version=54964 // @include https://sellers.shopgoodwill.com/sellers/modifyItem.asp* // @description Keeps a log of edits // @downloadURL none // ==/UserScript== $('*[name]').not('[id]').each(function(){ $(this).attr('id', $(this).attr('name')); }); if ($('#itemSellerInfo').val().indexOf("[[<") < 0) { var labels = { // 'itemTitle' : 'Title', // 's1' : 'Cat', // 'table' : 'Description', 'itemWeight' : 'ShipWt', // 'itemDisplayWeight' : 'RealWt', 'itemShippingPrice' : 'Shipp$', 'itemShipMethod' : 'ShipBy', // 'itemsellerstore' : 'Store', 'itemSellerInventoryLocationID' : 'Loc', } var values = {}; $.each(labels, function(elementID, fieldLabel){ values[fieldLabel] = $('#'+elementID).val(); }); $('body').append("
"); $('#originalValues').data('originalValues', values); /* var labelsCB = { 'itemNoCombineShipping' : 'No combine shipping', 'itemAutoInsurance' : 'Automatic insurance (USPS)', } var valuesCB = {}; $.each(labelsCB, function(elementID, fieldLabel){ if ($('#'+elementID+":checked").length > 0) { valuesCB[fieldLabel] = 'Yes'; } else { valuesCB[fieldLabel] = 'No'; } }); $('body').append(""); $('#originalValuesCB').data('originalValuesCB', valuesCB); */ $('#submit1').bind("click", function(e){ e.preventDefault(); var labels = { // 'itemTitle' : 'Title', // 's1' : 'Cat', // 'table' : 'Description', 'itemWeight' : 'ShipWt', // 'itemDisplayWeight' : 'RealWt', 'itemShippingPrice' : 'Ship$', 'itemShipMethod' : 'ShipBy', // 'itemsellerstore' : 'Store', 'itemSellerInventoryLocationID' : 'Loc', } originalValues = $('#originalValues').data('originalValues'); // originalValuesCB = $('#originalValuesCB').data('originalValuesCB'); var changedValues = {}; var newValues = {}; // var changedValuesCB = {}; // var newValuesCB = {}; $.each(labels, function(elementID, fieldLabel) { if ($('#'+elementID).val() != originalValues[fieldLabel]){ changedValues[fieldLabel] = originalValues[fieldLabel]; newValues[fieldLabel] = $('#'+elementID).val(); } }); /* $.each(labelsCB, function(elementID, fieldLabel) { oldVal = originalValuesCB[fieldLabel]; if ($('#'+elementID+":checked").length > 0) { newVal = "Yes"; } else { newVal = "No"; } if (newVal != oldVal){ changedValuesCB[fieldLabel] = oldVal; newValuesCB[fieldLabel] = newVal; } });*/ var d = new Date(); if (!$.isEmptyObject(changedValues) || !$.isEmptyObject(changedValuesCB)) { myID = 'edit-' + d.getTime(); myTable = "[[<" + d.getMonth() + "/" + d.getDate() + ", " + (d.getHours() - 2) + ":" + ("0" + d.getMinutes()).slice(-2) + " PT- "; if (!$.isEmptyObject(changedValues)){ $.each(changedValues, function(fieldLabel, originalValue){ myTable += fieldLabel + ": "; myTable += originalValue; myTable += ";"; }); } /* if (!$.isEmptyObject(changedValuesCB)){ $.each(changedValuesCB, function(fieldLabel, originalValue){ myTable += fieldLabel + ": "; myTable += originalValue; myTable += "