// ==UserScript== // @name SGW Item Modification Fixer // @namespace greasyfork.org // @version 1.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 += "Item Title:
"); $('#itemTitleContainer').append($('#itemTitle')); $('#contentTD').append("Category:
"); $('#itemCategoryContainer').append($('#s1')); $('#contentTD').append("Description:
"); $('#itemDescriptionContainer').append($('#colourPalette').parent()); // TODO: Shipping calculator? $('#contentTD').append(""); $('#itemShippingDetailsContainer').append("Shipping Weight:
"); $('#itemShippingWeightContainer').append($('#itemWeight')); $('#itemShippingDetailsContainer').append("Display (Actual) Weight:
"); $('#itemDisplayWeightContainer').append($('#itemDisplayWeight')); $('#itemShippingDetailsContainer').append("Shipping Charge:
Shipping Method:
Item Shipment Combining:
Auto Include Insurance (USPS Only):
"); $('#itemAutoInsuranceContainer').append($('#itemAutoInsurance')); $('#contentTD').append("Seller Store:
"); $('#itemsellerstoreContainer').append($('#itemsellerstore')); $('#itemSellerInventoryLocationID').parent().attr('id', 'itemSellerInventoryLocationIDContainer').appendTo($('#contentTD')); $('#contentTD').append("Seller Private Description:
Show/hide hidden fields/etc.
"); $('#contentTD').parent().after(""); $('#hiddenJunkTD').append("Item Quantity:
"); $('#itemQuantityContainer').append($('#itemQuantity').parent()); $('#hiddenJunkTD').append("Minimum Bid:
"); $('#itemMinimumBidContainer').append($('#itemMinimumBid').parent()); $('#hiddenJunkTD').append("Bid Increment:
"); $('#itemBidIncrementContainer').append($('#itemBidIncrement').parent()); $('#hiddenJunkTD').append("Reserve Price:
"); $('#itemReserveContainer').append($('#itemReserve').parent()); $('#itemReserve').parent().children().first().remove(); $('#hiddenJunkTD').append("Buy Now Price:
"); $('#itemBuyNowPriceContainer').append($('#itemBuyNowPrice').parent()); $('#itemBuyNowPrice').parent().children().first().remove(); $('#hiddenJunkTD').append(""); $('#itemActualDimensionsContainer').append($('#itemLength').parent().parent().parent()); $('#hiddenJunkTD').append(""); $('#itemShippingDimensionsContainer').append('Shipping Dimension - Length x Width x Height in inches (optional):'); $('#itemShippingDimensionsContainer').append($('#itemShipLength')); $('#itemShippingDimensionsContainer').append(" (Numbers and decimal point '.' only) Used for shipping optimization and prevention of oversized charges."); $('#hiddenJunkTD').append("Shipping:
"); $('#itemShippingContainer').append($('#itemShipping')); $('#itemShippingContainer').append($('select[name="itemShipping"]')); $('#hiddenJunkTD').append("
Handling Charge:
"); $('#itemHandlingPriceContainer').append($('#itemHandlingPrice').parent()); $('#itemHandlingPrice').parent().children().first().remove(); $('#hiddenJunk').after("