<commit_before>// ==UserScript==
// @name       Better Buy Orders
// @author     <NAME>, Step7750
// @namespace
// @version    1.0
// @description  Improves Steam market buy orders (hot-swap view currency changing and extended listings)
// @match      http://steamcommunity.com/market/listings/*
// @copyright  2015+, <NAME>
// @grant      none
// ==/UserScript==


/**
 * Created by Step7750-Workstation on 7/2/2015.
 */
// Execute after full page load (ensure the original function is loaded)
window.addEventListener ("load", main_execute, false);


function main_execute() {
  // global variables toggling the state of the extended orders
  window.bbo_buy_enable = 0;
  window.bbo_sell_enable = 0;

  // Injects the hot-swap currency selector
  $J(".market_commodity_order_block").children().eq(1).after('<select id="currency_buyorder" style="margin-left: 10px; margin-bottom: 5px;"><option value="1" selected>USD</option><option value="2">GBP</option><option value="3">EUR</option><option value="5">RUB</option><option value="7">BRL</option><option value="8">JPY</option><option value="9">NOK</option><option value="10">IDR</option><option value="11">MYR</option><option value="12">PHP</option><option value="13">SGD</option><option value="14">THB</option><option value="15">VND</option><option value="16">KRW</option><option value="17">TRY</option><option value="18">UAH</option><option value="19">MXN</option><option value="20">CAD</option><option value="21">AUD</option><option value="22">NZD</option></select>');
  $J("#currency_buyorder").val(typeof( g_rgWalletInfo ) != 'undefined' && g_rgWalletInfo['wallet_currency'] != 0 ? g_rgWalletInfo['wallet_currency'] : 1);

  $J('#currency_buyorder').on('change', function() {
    clearTimeout(buyordertimeout);
    if (ItemActivityTicker.m_llItemNameID != null) {
      Market_LoadOrderSpread(ItemActivityTicker.m_llItemNameID);
    }
  });


  // Overwrites Valve's function here: http://steamcommunity-a.akamaihd.net/public/javascript/market.js
  function Market_LoadOrderSpread( item_nameid )
  {
    $J.ajax( {
      url: 'http://steamcommunity.com/market/itemordershistogram',
      type: 'GET',
      data: {
        country: g_strCountryCode,
        language: g_strLanguage,
        currency: $J("#currency_buyorder").val(),
        item_nameid: item_nameid
      }
    } ).error( function ( ) {
      window.buyordertimeout = setTimeout( function() { Market_LoadOrderSpread( item_nameid ); }, 5000 );
    } ).success( function( data ) {
      window.buyordertimeout = setTimeout( function() { Market_LoadOrderSpread( item_nameid ); }, 5000 );
      if ( data.success == 1 )
      {
        // Better Buy Orders
        var buy_order_build_html = '<table class="market_commodity_orders_table"><tr><th align="right">Price</th><th align="right">Quantity</th></tr>';
        var sell_order_build_html = '<table class="market_commodity_orders_table"><tr><th align="right">Price</th><th align="right">Quantity</th></tr>';

        // Make an deep copy object that stores the quantity at each amount
        var quantity_buy_order = $J.extend(true, [], data.buy_order_graph);
        for (var i = 0; i < quantity_buy_order.length; i++) {
          var sum = 0
          for (var x = 0; x < i; x++) {
            sum += quantity_buy_order[x][1];
          }
          quantity_buy_order[i][1] -= sum;
        }<commit_msg>Added HTTPS support<commit_after>// ==UserScript==
// @name       Better Buy Orders
// @author     <NAME>, Step7750
// @namespace
// @version    1.0
// @description  Improves Steam market buy orders (hot-swap view currency changing and extended listings)
// @match      http://steamcommunity.com/market/listings/*
// @match      https://steamcommunity.com/market/listings/*
// @copyright  2015+, <NAME>
// @grant      none
// ==/UserScript==


/**
 * Created by Step7750-Workstation on 7/2/2015.
 */
// Execute after full page load (ensure the original function is loaded)
window.addEventListener ("load", main_execute, false);


function main_execute() {
  // global variables toggling the state of the extended orders
  window.bbo_buy_enable = 0;
  window.bbo_sell_enable = 0;

  // Injects the hot-swap currency selector
  $J(".market_commodity_order_block").children().eq(1).after('<select id="currency_buyorder" style="margin-left: 10px; margin-bottom: 5px;"><option value="1" selected>USD</option><option value="2">GBP</option><option value="3">EUR</option><option value="5">RUB</option><option value="7">BRL</option><option value="8">JPY</option><option value="9">NOK</option><option value="10">IDR</option><option value="11">MYR</option><option value="12">PHP</option><option value="13">SGD</option><option value="14">THB</option><option value="15">VND</option><option value="16">KRW</option><option value="17">TRY</option><option value="18">UAH</option><option value="19">MXN</option><option value="20">CAD</option><option value="21">AUD</option><option value="22">NZD</option></select>');
  $J("#currency_buyorder").val(typeof( g_rgWalletInfo ) != 'undefined' && g_rgWalletInfo['wallet_currency'] != 0 ? g_rgWalletInfo['wallet_currency'] : 1);

  $J('#currency_buyorder').on('change', function() {
    clearTimeout(buyordertimeout);
    if (ItemActivityTicker.m_llItemNameID != null) {
      Market_LoadOrderSpread(ItemActivityTicker.m_llItemNameID);
    }
  });


  // Overwrites Valve's function here: http://steamcommunity-a.akamaihd.net/public/javascript/market.js
  function Market_LoadOrderSpread( item_nameid )
  {
    $J.ajax( {
      url: window.location.protocol + '//steamcommunity.com/market/itemordershistogram',
      type: 'GET',
      data: {
        country: g_strCountryCode,
        language: g_strLanguage,
        currency: $J("#currency_buyorder").val(),
        item_nameid: item_nameid
      }
    } ).error( function ( ) {
      window.buyordertimeout = setTimeout( function() { Market_LoadOrderSpread( item_nameid ); }, 5000 );
    } ).success( function( data ) {
      window.buyordertimeout = setTimeout( function() { Market_LoadOrderSpread( item_nameid ); }, 5000 );
      if ( data.success == 1 )
      {
        // Better Buy Orders
        var buy_order_build_html = '<table class="market_commodity_orders_table"><tr><th align="right">Price</th><th align="right">Quantity</th></tr>';
        var sell_order_build_html = '<table class="market_commodity_orders_table"><tr><th align="right">Price</th><th align="right">Quantity</th></tr>';

        // Make an deep copy object that stores the quantity at each amount
        var quantity_buy_order = $J.extend(true, [], data.buy_order_graph);
        for (var i = 0; i < quantity_buy_order.length; i++) {
          var sum = 0
          for (var x = 0; x < i; x++) {
            sum += quantity_buy_order[x][1];
          }
          quantity_buy_order[i][1] -= sum;
        }
{'fraction_non_alphanumeric': 0.16617947968430283, 'fraction_numerical': 0.021923414206372407, 'mean_word_length': 4.027920646583395, 'pattern_counts': {'":': 0, '<': 123, '<?xml version=': 0, '>': 119, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '294869', 'n_tokens_mistral': 2270, 'n_tokens_neox': 2115, 'n_words': 421}