<commit_before>// ==UserScript==
// @name        ipage+
// @namespace   http://www.haslams.com/
// @version     0.5
// @description Ingram ipage usability tweaks for Haslam's Book Store, Inc.
// @author      <NAME>
// @downloadURL https://raw.githubusercontent.com/GeneralAntilles/special-order-plus/master/ipage-plus.js
// @include     http*://ipage.ingramcontent.com/ipage/servlet/ibg.common.titledetail.*
// @run-at      document-end
// @require     https://code.jquery.com/jquery-latest.js
// @require     https://raw.githubusercontent.com/jackmoore/colorbox/master/jquery.colorbox-min.js
// @require     https://thousandsparrows.com/js/jquery.csv-0.71.js
// @require     https://raw.githubusercontent.com/digitalBush/jquery.maskedinput/1.4.0/dist/jquery.maskedinput.min.js
// @require     https://thousandsparrows.com/js/special-order-plus.js
// @resource    https://thousandsparrows.com/js/colorbox/colorbox.css
// @resource    https://thousandsparrows.com/jquery.form.min.js
// @resource    https://raw.githubusercontent.com/GeneralAntilles/special-order-plus/master/form.css
// @grant       GM_addStyle
// @grant       GM_getResourceText
// @grant       GM_xmlhttpRequest
// ==/UserScript==

//////////////////////////
//      Settings        //
//////////////////////////

// Remote web server URL
var remoteServerUrl = "https://example.com/";

//////////////////////////
//      Variables       //
//////////////////////////

// Index for the CSV we're getting from Ingram
var $csvIndex = [ "isbn", "ean13", "title", "author", "middleInitial", "publisher", "date", "price" ];
var $orderInfo = {};

// Check to see if the discount is a normal, wholesale discount and set the variable.
var $discountReg = $( 'div:contains("REG")' ).length > 0 || $( 'div:contains("45%")' ).length > 0 ? true : false;

// Check to see if it's available
var $availableUS = $( 'p:contains("Available in some countries but not the United States.")' ).length > 0 || $( 'p:contains("Restricted:  Not available to all customers.")' ).length > 0 ? false : true;

// Check to see if it's returnable
var $returnable = $( 'p:contains("This item is Not Returnable")' ).length > 0 ? false : true;

// Grab the ISBN from the table
var $orderInfo.isbn = $( ".productDetailElements" ).first().contents().filter(function() {
	return this.nodeType == 3;
}).text().substring( 1,11 );

// Grab Ingram's ttlid for the entry from the HTML
var $orderInfo.ttlid = $( "[name='ttlid']" ).attr( "value" );

// Get the binding information
var $orderInfo.binding = $.trim( $( ".productDetailElements:contains('Binding')" ).contents().filter(function() {
	return this.nodeType == 3;
}).text());

$(document).ready(function() {
	$( "#binding" ).val( $orderInfo[ binding ] );
});

// Get the BISAC categories from the page
var $orderInfo.bisacCategories = $.trim( $( ".productDetailSmallElements:contains('BISAC')" ).text().replace( /BISAC.*\s*/, "" ).replace( /\s*\|\s*/g, "\n" ) );

// Get the LC subject categories from the page
var $orderInfo.lcSubjects = $.trim( $( "strong:contains('LC Subjects:')" ).next().next().text() ).replace( /\s*-/g, "\n" ).substr( 1 );

// Get the physical attributes from the page
var $orderInfo.physical = $.trim( $( '.productDetailSmallElements:contains("Physical Info")' ).text().replace( /Physical Info: /, "" ) );

// Get the carton quantity from the page
var $orderInfo.cartonQuantity = $.trim( $( '.productDetailSmallElements:contains("Carton")' ).text().replace( /Carton Quantity: /, "" ) );

// Get the long description from the page<commit_msg>Separate category names by comma<commit_after>// ==UserScript==
// @name        ipage+
// @namespace   http://www.haslams.com/
// @version     0.5
// @description Ingram ipage usability tweaks for Haslam's Book Store, Inc.
// @author      <NAME>
// @downloadURL https://raw.githubusercontent.com/GeneralAntilles/special-order-plus/master/ipage-plus.js
// @include     http*://ipage.ingramcontent.com/ipage/servlet/ibg.common.titledetail.*
// @run-at      document-end
// @require     https://code.jquery.com/jquery-latest.js
// @require     https://raw.githubusercontent.com/jackmoore/colorbox/master/jquery.colorbox-min.js
// @require     https://thousandsparrows.com/js/jquery.csv-0.71.js
// @require     https://raw.githubusercontent.com/digitalBush/jquery.maskedinput/1.4.0/dist/jquery.maskedinput.min.js
// @require     https://thousandsparrows.com/js/special-order-plus.js
// @resource    https://thousandsparrows.com/js/colorbox/colorbox.css
// @resource    https://thousandsparrows.com/jquery.form.min.js
// @resource    https://raw.githubusercontent.com/GeneralAntilles/special-order-plus/master/form.css
// @grant       GM_addStyle
// @grant       GM_getResourceText
// @grant       GM_xmlhttpRequest
// ==/UserScript==

//////////////////////////
//      Settings        //
//////////////////////////

// Remote web server URL
var remoteServerUrl = "https://example.com/";

//////////////////////////
//      Variables       //
//////////////////////////

// Index for the CSV we're getting from Ingram
var $csvIndex = [ "isbn", "ean13", "title", "author", "middleInitial", "publisher", "date", "price" ];
var $orderInfo = {};

// Check to see if the discount is a normal, wholesale discount and set the variable.
var $discountReg = $( 'div:contains("REG")' ).length > 0 || $( 'div:contains("45%")' ).length > 0 ? true : false;

// Check to see if it's available
var $availableUS = $( 'p:contains("Available in some countries but not the United States.")' ).length > 0 || $( 'p:contains("Restricted:  Not available to all customers.")' ).length > 0 ? false : true;

// Check to see if it's returnable
var $returnable = $( 'p:contains("This item is Not Returnable")' ).length > 0 ? false : true;

// Grab the ISBN from the table
var $orderInfo.isbn = $( ".productDetailElements" ).first().contents().filter(function() {
	return this.nodeType == 3;
}).text().substring( 1,11 );

// Grab Ingram's ttlid for the entry from the HTML
var $orderInfo.ttlid = $( "[name='ttlid']" ).attr( "value" );

// Get the binding information
var $orderInfo.binding = $.trim( $( ".productDetailElements:contains('Binding')" ).contents().filter(function() {
	return this.nodeType == 3;
}).text());

$(document).ready(function() {
	$( "#binding" ).val( $orderInfo[ binding ] );
});

// Get the BISAC categories from the page
var $orderInfo.bisacCategories = $.trim( $( ".productDetailSmallElements:contains('BISAC')" ).text().replace( /BISAC.*\s*/, "" ).replace( /\s*\|\s*/g, ", " ) );

// Get the LC subject categories from the page
var $orderInfo.lcSubjects = $.trim( $( "strong:contains('LC Subjects:')" ).next().next().text() ).replace( /\s*-/g, ", " ).substr( 1 );

// Get the physical attributes from the page
var $orderInfo.physical = $.trim( $( '.productDetailSmallElements:contains("Physical Info")' ).text().replace( /Physical Info: /, "" ) );

// Get the carton quantity from the page
var $orderInfo.cartonQuantity = $.trim( $( '.productDetailSmallElements:contains("Carton")' ).text().replace( /Carton Quantity: /, "" ) );

// Get the long description from the page
{'fraction_non_alphanumeric': 0.20615947124173814, 'fraction_numerical': 0.006468851075798059, 'mean_word_length': 3.1810699588477367, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, 'https://': 20, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1400688', 'n_tokens_mistral': 2240, 'n_tokens_neox': 2155, 'n_words': 535}