// ==UserScript== // @id History Bastard // @name History Bastard // @version 1.92 // @namespace localhost // @author https://steamcommunity.com/id/_naknak_/ // @description Bastardize steam inventory history page // @description count repeated items // @description sort by item type // @description note properties // @description replace custom item names with canonical names // @description load 2 pages if on page 1 // @description highlight and summarize on-hold items // @description use full page width and fluid layout // @description add bp.tf links // @description v1.1, v1.2: work with https // @description v1.3: mark page 2, only load pg2 if page 1 lacks 72 hours of history; accumulate metal counts; SHOW_HELD_FIRST option // @description v1.4: include levels; given items are inline-block (to allow wrapping); sort by name if quality is equal; text-only trade log popups // @description v1.5: dedup everything; fix metal rounding so .99=1.00; text log aesthetics, show only held trades, fix 2nd page url when current page ends in # // @description v1.6: filter by keyword // @description v1.7: mention hours remaining on each held trade; include outgoing items in summary; bugfix warning on <72h of history available; readability tweaks // @description v1.8: bugfix trade hold ending next year // @description v1.9: page 2 properties work // @description v1.91: bugfix filter box // @description v1.92: more readable hold-timer countdowns; continuous update of timers // @include /^https?:\/\/steamcommunity\.com\/.*\/inventoryhistory.*/ // @run-at window-load // @require https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js // @grant GM_addStyle // ==/UserScript== LOAD_SECOND_PAGE=true; // or false; only loads if less than ESCROW_DURATION hours of history on page 1 SHOW_HELD_FIRST=false; // if true, put held trades first, then completed trades ESCROW_DURATION=72; // hours GM_addStyle(` .daybreak { border-top: 2px solid #555 } span.nx { color: cyan; vertical-align: top; padding-right: 2px; font-weight: bold; font-size: 16px; } span.nx::after { content: "ˣ"; } span.desc { vertical-align: super; font-size: 10px; } span.desc * { display: inline; } .held .tradehistory_content, #heldrow { background-color: #191500; } #heldrow { overflow:hidden; padding-bottom:6px; } #heldbanner { font-size: 18px; color: #999; margin-left: 20px; line-height: 22px; padding-bottom: 3px; } #heldbanner .warning { color:#f44; font-size:14px; } .held .tradehistory_event_description { color: #666; } .held .tradehistory_event_description > br, .held .tradehistory_event_description > .heldnotice, .profile_small_header_bg, .header_installsteam_btn_content, .header_installsteam_btn_leftcap, #account_pulldown, .tradehistory_items_received .tradehistory_items_plusminus { display: none; } .tradehistory_date.unique:not(.showall) { color: #457; font-size: 125%; text-align: left; } .tradehistory_date.dupe:not(.showall) { display:none; } .tradehistory_date.showall { display:block; } .maincontent, #mainContents { width: 100%!important; max-width: 100%!important; margin: 0!important; } .tradehistoryrow.hidden { display:none; } .tradehistoryrow { padding: 3px; margin: 0; } .tradehistory_event_description { margin-bottom: 2px; } .tradehistory_items_received { visibility: hidden; line-height: normal; margin-bottom: 1px; } .tradehistory_items_received > * { visibility: visible; line-height: normal; } .tradehistory_items_received * { vertical-align: top; display: inline-block; } .tradehistory_items_received img { margin-left: 0; vertical-align: top; width: 40px; height: 40px; } .tradehistory_items_received .history_item { min-height: 44px; max-height: 120px; overflow: hidden; } .tradehistory_items_given { border-top:1px solid rgba(66,66,66,0.1); } .history_item { counter-increment: n; margin-left: 4px; } .history_item::after { color: #ccc; border-radius: 4px; font-size: 10px; padding: 1px 2px 1px 2px; margin-left: 2px; vertical-align: top; } .history_item_name .desc span { color: #767676; } .history_item:not(:nth-child(-n+4)):last-child::after { background: #141; content: counter(n); } .tradehistory_items_received .history_item .history_item_name { display: inline-block; /* max-width: 132px; */ max-width: 150px; word-wrap: break-word; white-space: normal; line-height: normal; } .tradehistory_items_given .history_item { margin-left: 30px; display:inline-block; } .pagebreak { background-color: black; color: #999; font-size: 14px; font-weight: bold; line-height: 32px; border-top: 2px solid white; border-bottom: 2px solid white; padding-left: 20px; } .textbut:hover, .heldbut:hover { color:#ccc } .textbut, .heldbut { float:right; color: #444; margin-left:20px; line-height:normal; padding-left:2px; padding-right:2px; font-family: monospace; text-decoration:underline; } .textbut.closed::before { font-size: 11px; content:"text"; } .textbut.open::before { font-size: 11px; content:"hide"; } .heldbut.hidden::before { font-size: 11px; content:"show all trades"; } .heldbut.shown::before { font-size: 11px; content:"show only held trades"; } #heldrow.empty { display:none } .textpop { background-color: rgba(220,220,220,0.2); float:right; width:auto; z-index:99; position:relative; margin:6px 10px 4px 10px; } .textpop_content { padding:6px 20px 8px 6px; font-size:11px; width:auto; color: #111; } .textpop.open { display: inline-block; } .textpop.closed { display: none; } .textpop_close::before { content:"x"; } .textpop_close { position:absolute; top:-5px; right:-5px; cursor:pointer; color: #fff; border: 2px solid #AEAEAE; border-radius: 30px; background: #333; font-size: 31px; font-weight: bold; display: inline-block; line-height: 0px; padding: 8px 5px 10px 5px; } .filterrow { background-color:black; display:block; } .tradehistoryrow.filtered { display:none; } #filterbox { margin:-8px 6px 8px 10px; border-radius:3px; background-color:#333; border-color:#555; color:white; padding:3px 2px 3px 8px; } .filtercount { color:gold; font-style:italic; } ::-webkit-input-placeholder { color:#666; font-style:italic; } .inventory_history_pagingrow { margin-bottom:0; border-bottom:none; } .heldendtime.changed { transition: none; background-color:gold; } .heldendtime { transition: background-color 2s ease-in; background-color:inherit; } `); PROPS = propmap( "", g_rgHistoryInventory, $("script") ); String.prototype.isMatch = function(s){ return this.match(s)!==null ;}; if( window.location.href.isMatch(/inventoryhistory\/?(\?p=1)?#*$/) && LOAD_SECOND_PAGE && ESCROW_DURATION > age( $(".tradehistory_date").last().html(), $(".tradehistory_timestamp").last().html() ) ) { console.log("loading page 2"); $("
").load(window.location.href.replace(/\?.*/,'').replace(/#.*/,'') + '?p=2', function() { var scripts=$(this).find("script"); scripts.each(function() { var json=$(this).text().match(/\svar\s+g_rgHistoryInventory\s+=\s+(\{.*\});\s*\n/); if (json!==null) { var props=JSON.parse(json[1]); // console.log(prop); $.extend( PROPS, propmap( "page2_", props, scripts ) ); } }); $(this).find(".history_item").each( function() { this.id="page2_" + this.id; }); $(".tradehistoryrow").last().after( $("
").addClass("pagebreak").html("page 2") ); $(".pagebreak").last().after( $(this).find(".tradehistoryrow") ); console.log( "loaded" ); go(); $(".inventory_history_pagingrow").contents().filter(function() { return this.nodeType == 3; }).each(function(){ this.textContent = this.textContent.replace(/(1 - )\d+( of \d+ History Items)/,'$1' + $(".tradehistoryrow").length + '$2'); }); }); } else { go(); } function go() { describe(); findheld(); dedup(); bptflinks(); textevents(); dates(); filterrow(); } function propmap( prefix, props, maps ) { var rePropMap=new RegExp(/HistoryPageCreateItemHover\( '(trade\d+_\w+item\d+)', '?(\d+)'?, '?(\d+)'?, '?(\w+)'?, '?(\d+)'? \);/g); var propmap={}; var hit; $(maps).each( function() { /* jshint -W084 */ while(hit = rePropMap.exec( $(this).text() )) { /* jshint +W084 */ // console.log([ hit[2], hit[3], hit[4] ]); propmap[ prefix + hit[1] ] = props[ hit[2] ][ hit[3] ][ hit[4] ]; } }); // console.log(propmap); return propmap; } function age(date, time) { if (!date.isMatch(/\b20\d\d\b/)) date+=" "+ new Date().getFullYear(); var hours = (Date.now() - Date.parse(date)) / 3600 / 1000; //console.log("hours=" + hours); var hmampm = time.match(/(\d+):(\d\d)\s*(p?)/i); if (hmampm === null) return hours; hours -= parseInt(hmampm[2],10)/60; var h = parseInt(hmampm[1],10); if (h==12 && !hmampm[3]) h=0; else h += (h < 12 && hmampm[3]) ? 12 : 0; hours-=h; // console.log("date=" + date + "; time=" + time + "; hours=" + hours); return hours; } function dates() { var last=""; $(".tradehistory_date").each(function() { var txt=$(this).text(); if (last===txt) $(this).addClass("dupe"); else { $(this).parent().addClass("daybreak"); $(this).addClass("unique"); } last=txt; }); } function s(n,u) { return n + " " + u + (n===1 ? "":"s") + " "; } function hours2text(hours) { var sign=(hours<0 ? " from now" : " ago"); hours=Math.abs(hours); var days=parseInt((hours+.5)/24); hours-=days*24; var minutes=0; var seconds=0; if (hours<1.6 && days===0) { minutes=hours*60; hours=0; if(minutes<1.6) { seconds=Math.round(minutes*60 /10)*10; minutes=0; if(seconds<30) seconds=""; } else minutes=Math.round(minutes); } hours=Math.round(hours); return ( (days ? s(days,"day") + "and " : "") + (hours+days? s(hours,"hour") : (minutes?s(minutes,"minute") : seconds+" seconds ") ) + sign); } function endtimes() { var n=0; var c=0; var waith=0.5; $(".heldendtime").each(function() { n++; var d=$(this).data("date"); var t=$(this).data("time"); var h=age(d,t); if (waith > Math.abs(h)/60) waith=Math.abs(h)/60; var txt="— " + (h<0 ? "on hold until ":"completed ") + d + t + " (" + hours2text(h) + ")"; if ($(this).text() !== txt) { if ($(this).text().isMatch(/^—/)) $(this).addClass("changed"); $(this).text(txt); c++; } }); if (c) setTimeout(function() { $(".heldendtime.changed").removeClass("changed") }, 100); if (waith<2.5/3600) waith=2.5/3600; // console.log("waitsec=" + waith*3600); if (n) setTimeout(endtimes, Math.round(waith * 3600 * 1000)); return n; } function findheld() { $(".tradehistoryrow > .tradehistory_content > .tradehistory_event_description > span").filter(function() { return $(this).text() === "Trade on Hold"; }).addClass("heldnotice").parent().children('span:not([class])').each(function() { var c= $(this).text().match(/.*the trade hold period is over \(around (\d+ \w+[^@]*) @( \d+:\d+[ap]m)\)/); if (c !== null) { $(this).addClass("heldendtime"); $(this).data("date", c[1]); $(this).data("time", c[2]); } }).parent().parent().parent().addClass("held"); endtimes(); if(SHOW_HELD_FIRST) { var i=0; $("#mainContents").children().each( function() { $(this).data("held", 0+$(this).hasClass("held")); $(this).data("index", i++); }); $("#mainContents").html( $("#mainContents").children().sort( function(a,b) { return ( ( $(b).data("held")-$(a).data("held") ) || ( $(a).data("index")-$(b).data("index") ) ) } ) ) } var held=document.createElement("div"); held.id="heldrow"; held.appendChild( document.createElement("div") ); held.firstChild.id="heldbanner"; held.appendChild( document.createElement("div") ); held.lastChild.className="tradehistory_items tradehistory_items_received"; held.lastChild.id="heldrec"; held.appendChild( document.createElement("div") ); held.lastChild.className="tradehistory_items tradehistory_items_given"; held.lastChild.id="heldgiv"; var nheld=$(".held").length; var nheld_s = nheld==1 ? "" : "s"; var heldrec=$(".held .tradehistory_items_received .history_item"); var nheldrec=heldrec.length; var nheldrec_s = nheldrec==1 ? "" : "s"; var heldgiv=$(".held .tradehistory_items_given .history_item"); var nheldgiv=heldgiv.length; var nheldgiv_s = nheldgiv==1 ? "" : "s"; var hours=parseInt(age( $(".tradehistory_date").last().html(), $(".tradehistory_timestamp").last().html() )); if(nheld) { held.firstChild.innerText="" + nheld + " trade" + nheld_s + (nheldrec ? " and " + nheldrec + " incoming item" + nheldrec_s : "") + " held" + (nheldgiv ? "; " + nheldgiv + " outgoing held item"+nheldgiv_s : "") if (hours < ESCROW_DURATION) { held.firstChild.appendChild(document.createElement("br")); held.firstChild.appendChild(document.createElement("span")); held.firstChild.lastChild.className="warning"; held.firstChild.lastChild.innerText="More held trades may be on the next page: only " + hours + " hours of history was found here "; } } else held.className="empty"; var heldbut=document.createElement("a"); heldbut.href="#"; heldbut.className="heldbut shown"; heldbut.onclick=function(e) { e.preventDefault; var rows=document.querySelectorAll(".tradehistoryrow:not(.held)"); for (var i=0; i " + bt); var ret=0; [ /^Mann Co. Supply Crate Key/, /^Refined Metal/, /^Reclaimed Metal/, /^Scrap Metal/, /^Unusual /, /^Strange /, /^Genuine /, /^Vintage /, /^Haunted / ].forEach(function(thing){ ret=ret||(bt.isMatch(thing) - at.isMatch(thing)); }); return (ret || (bt>at ? -1:1) ); }) ); var seen = {}; var count = {}; var metal=0; $(this).find(".history_item").each( function() { var txt=$(this).text(); if ( [ "Refined Metal", "Reclaimed Metal", "Scrap Metal" ].indexOf(txt)>-1 ) { if(metal==0) { $(this).find(".history_item_name").text( "Metal" ); seen["metal"]=nx(this); } else { $(this).text(''); $(this).css('margin-left','0'); } if (txt==="Refined Metal") metal+=9; else if (txt==="Reclaimed Metal") metal+=3; else if (txt==="Scrap Metal") metal+=1; $( seen["metal"] ).text( Math.round(metal/9*10000).toString().replace(/(\d\d)\d\d$/,'.$1') ) } else if (seen[txt]) { $(this).text(''); $(this).css('margin-left','0'); // $(this).next().remove(); count[txt]++; if(count[txt]==2) seen[txt]=nx(seen[txt]); $(seen[txt]).text( count[txt] ); } else { // only uniques, CSGO whites, steam inv whites // var color=$(this).find(".history_item_name").first().css("color"); // if ( [ "rgb(125, 109, 0)", "rgb(210, 210, 210)", "rgb(180, 180, 180)"].indexOf(color)>-1 ) seen[txt]=this; seen[txt]=this; count[txt]=1; } }); }); } function nx(e) { var span=document.createElement("span"); span.className="nx"; $(e).prepend(span); return span; } function bptflinks() { $(".tradehistory_event_description a").each( function() { var a=$(this)[0]; var match= a.href.match(/^.*steamcommunity.com(\/profiles\/\d+|\/id\/[-\w]+)$/); if (match.length) { var bp=document.createElement("a"); bp.href='https://backpack.tf' + match[1]; var img=document.createElement('img'); img.src='data:image/x-icon;base64,AAABAAIAEBAAAAEAIABoBAAAJgAAACAgAAABACAAqBAAAI4EAAAoAAAAEAAAACAAAAABACAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wH///8BAAAAAAAAAAAAAAAAAAAAAOLc1DLi3NQy4tzUMuTf1zLk39cy5N/XMuPe1TLk39cy497WMePc0zba2tocAAAAANTY4AEAAAAAAAAAAAAAAACGbkz9hm5M/4ZuTP96YkD/d2A+/3lhP/9+Z0b/d2A//3tkQ/2Ib0v/fGtV2ktdexMAAAAASV19AQAAAAAAAAAAjXdX+453V/+FcFP/uK6h/+Pg3P/Hv7T/n5KA/+fj3/+7s6f/gWxO/JR7Vv97cWasAAAAAFVmhAIAAAAAAAAAAI96WvyEbEv/rKGR///////8/Pv/0czE/7Gnmf//////1dHJ/4BqSv+PeVv7kXdU/25tcXgAAAAAVWaEBAAAAACRe1z8gWtL/8S8sv//////vLOm/2xVM/+uo5P//////9LNxv+Ba0z/kXtc/o54Wf6QeFj9Y2t7RgAAAABWaIUEknxd/IRuT//Jwrj//////7iuoP9/Z0X/s6eY///////V0Mn/hW9R/5J8Xf+OeVr9kXpZ/4t4XuRbaoQcAAAAAJR/Yfx9Zkb/w7uw//////+zqZn/bVQw/6ufjv//////0czE/3dgQP+SfF3/kHtc/497XfyUfFn/gXZot1dqiQKLdlf8nI96/+nn4///////3NjR/7asnv/Y08z//////+zq5v+3rqD/jnxh/5F7Xf+RfF7/kXxe/JR9W/98dnCchm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3dhQ/+Relv/jXZX/412V/+Mdlf8kndT/3FubYoAAAAAVWWEAwAAAAAAAAAAAAAAAAAAAAAAAAAAjndX9453V/+PeFj/inNU/31sU//y8e////////39/f//////5+Pf/7euov++tqv/d2ZM/93Z0////////Pv7//////+vpZf/eGJC/5J7W/+Od1f/jndX/453V/+Nd1j8kHdV/2NreFgAAAAAVGeFAwAAAAAAAAAAAAAAAAAAAACOd1n3jndZ/5B5W/+DbU//j4Fs//39/f////////////39/f+Ke2b/blg5/3pmSv92ZEr/3trU///////8+/v//////6+ll/94YkP/kntd/453Wf+Od1n/jndZ/414Wf2QeFf/i3db6ltpgSsAAAAAVWeGAgAAAAAAAAAAAAAAAI54WfeOeFn/kXtc/4FrTP+XiHb///////7+/v//////8O7s/3pnTv+Relv/kXpb/3lmTP/d2dT///////z7+///////r6WY/3hiRP+SfF3/jnhZ/454Wf+OeFn/jnhZ/414WvySeVf/gnRjylZohgsAAAAAV2iFAQAAAAAAAAAAj3la9495Wv+SfF3/gWxN/5iLef///////v7+///////u7Or/fGpS/413WP+QeVv/emdN/93a1P///////Pv7//////+vppj/eWNF/5N9Xv+PeVr/j3la/495Wv+PeVr/j3la/455W/yTelf/eHJtmQAAAABXaYYDAAAAAAAAAACQeVv3kHlb/5N8Xv+CbE7/mYt5///////+/v7//////+/t6v99alL/jndZ/5F5W/97Z07/3trU///////8+/v//////7Cmmf96Y0b/lH1f/5B5W/+QeVv/kHlb/5B5W/+QeVv/kHlb/495W/yTeln/a295ZgAAAABYaYYDAAAAAJB6W/eQelv/k31e/4NuT/+ZjHr///////7+/v//////7+3q/31sU/+PeVr/kntd/3xpT//e2tT///////z7+///////sKeZ/3pmR/+Vf2D/kHpb/5B6W/+Qelv/kHpb/5B6W/+Qelv/kHpb/pF7W/+Pe1z0Y21/NgAAAABca4UDkHtd95B7Xf+Ufl//gGtM/5eLeP///////v7+///////v7er/e2pQ/4t2V/+OeFr/eWdM/93a1P///////Pv7//////+vppj/d2NE/5F8Xf+Qelz/kXtd/5B7Xf+Qe13/kHtd/5B7Xf+Qe13/kHte/ZN8Wv+IeGTWWmyIFQAAAACRfF33kXxd/4JwVP93Zk3/n5OC///////+/v7///////Du7P+Cclv/fm1V/39uVv99bVX/4d3Y///////8/Pv//////7atoP91Y0n/gHBY/4BuU/+Qe1z/kXxd/5F8Xf+RfF3/kXxd/5F8Xf+RfF3/kHxe/JZ9Wf99dm6nAAAAAJR/X/eMd1n/hnZg//Lw7v/7+vr//////////////////v7+//f29f/39vT/9/b0//f29f/9/f3/////////////////+vr5//f29f/18/H/jX5q/4l0Vv+Uf2D/kn1e/5J9Xv+SfV7/kn1e/5J9Xv+SfV7/kXxf/ZR9XP94dXSHlH9h94x3Wf+IeGL/+vn5//////////7///////////////////////////////////////////////////////////////////////z8/P+QgW3/iXRW/5R/Yf+SfV//kn1f/5J9X/+SfV//kn1f/5J9X/+RfWD8ln5c/4N4a76VfmH3jXda/4Z2Yf/y8O7/+/r6//////////////////7+/v/39vX/9/b1//f29f/39vX//f39//////////////////v6+v/39vX/9fPy/4x+av+KdFf/lX9i/5N9YP+TfWD/k31g/5N9YP+TfWD/kn1g+5h/XP+DeW25YG+JDJR+YfeUfmH/hXFY/3poUP+gk4P//v7+//79/P//////8O/s/4RzXv+Ab1j/gXBZ/4BvWf/h3dj///////z8+///////tq2h/3hmTv+Ecl3/hXJZ/5R+Yf+UfmH/lH5h/5R+Yf+UfmH/lH5h/5N+YvuXf1//h3trw2ZxhhIAAAAAlH9h95R/Yf+XgmT/g21Q/5yPfv///////v7+///////u7On/fm1U/455W/+RfF7/e2lP/9jTzf//////+/v6//////+8s6j/cl5B/496XP+Ic1b/kn1f/5R/Yf+Uf2H/lH9h/5R/Yf+Tf2L7l4Be/4x9aMtsdIIVAAAAAGNxiAOVf2L3lX9i/5eBZP+NeFz/intm/83Hv//t6+j///////Ty8f+DcVr/k31g/5qEaP9+aU7/vrar///////8+/v///////Px7/+ZjHr/gnFa/5WHdf+Fcln/lX9i/5V/Yv+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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/f38BP39/AT9/fwE/f38BP39/AT9/fwE/f38BP39/AT9/fwE/f38BP39/AT9/fwE/f38BP39/AT9/fwE/f38BP39/AT9/fwE/f38BP39/AT9/fwE/f38BP39/AIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////////////8AAAf/AAAD/wAAAf8AAAD/AAAAfwAAAH8AAAA/AAAAHwAAAA8AAAAPAAAABwAAAAMAAAABAAAAAAAAAAAAAAABAAAAAwAAAAcAAAAPAAAAHwAAAD8AAAB/AAAA/wAAAf//////////////////////'; img.height=img.width=12; bp.appendChild(img); a.parentNode.insertBefore(bp, a.nextSibling.nextSibling); } }); } function describe() { String.prototype.isMatch = function(s){ return this.match(s)!==null ;}; // add desriptions (paint/sheen/ks/1st part/effect) var reWhitelist=new RegExp(/^(?:Limited )?(L)e(v)e(l) (\d+) \S|^(?:Sheen|Paint Color|★ Unusual Effect|Killstreaker|Halloween): ([^(]*[^(\s]).*|^\((.*): [,\d]+\)$|^\s*(Gift) from: .*|^(?:Exterior: |.*Grade.*\()(Battle Scarred|Factory New|Minimal Wear|Field-Tested|Well-Worn)\)?$|^(?!This is a limited)(?!StatTrak™ Confirmed Kills)(.*): \d+$/); var strWhitelist=' $1$2$3$4$5$6$7$8$9'; var reLevel=new RegExp(/^(?:Limited )?Level (\d+) (?!Tool$|Special Taunt$|Craft Item$|Ticket$)\S.*$/); var rePunc=new RegExp(/\s*\((Battle Scarred|Factory New|Minimal Wear|Field-Tested|Well-Worn)\)$/g); var items=document.getElementsByClassName("history_item"); for(var i=0; i
"; for (var i=0; i"; text+=name.firstChild.textContent; var desc=name.querySelector(":scope .desc"); if (desc && desc.textContent.length) text+=": " + desc.textContent; text+="
" } } return text; } function selectElementContents(el) { var range = document.createRange(); range.selectNodeContents(el); var sel = window.getSelection(); sel.removeAllRanges(); sel.addRange(range); } var row=this.parentNode.parentNode.parentNode; var textpop=row.querySelector(":scope .textpop"); if(row.querySelector(":scope .textpop.open")) { row.querySelector(":scope .textpop.open").className="textpop closed"; this.className="textbut closed"; } else if (row.querySelector(":scope .textpop.closed")) { row.querySelector(":scope .textpop.closed").className="textpop open"; this.className="textbut open"; } else { textpop=document.createElement("div"); textpop.className="textpop closed"; var popcontent=document.createElement("div"); popcontent.className="textpop_content"; textpop.appendChild(popcontent); var closebut=document.createElement("a"); closebut.title="close text log"; closebut.href="#"; closebut.className="textpop_close"; closebut.onclick=function(e) { e.preventDefault; this.parentNode.className="textpop closed"; return false; } textpop.appendChild(closebut); var text=""; // console.log(row); var datetime=row.querySelector(":scope .tradehistory_date").textContent + " " + row.querySelector(":scope .tradehistory_timestamp").textContent; var prof=row.querySelector(":scope .tradehistory_event_description a").href; var who ="" + row.querySelector(":scope .tradehistory_event_description a").textContent.replace(/^\s+|\s+$/g, '') + ""; var desc=row.querySelector(":scope .tradehistory_event_description").firstChild.textContent.replace(/^\s*|\s*$/g, ' '); e.preventDefault; popcontent.innerHTML=datetime + desc + who + "
" + prof + sel2txt(row, "given") + sel2txt(row, "received"); textpop.className="textpop open"; this.className="textbut open"; textpop.onfocus = function(e) { var el = this; requestAnimationFrame(function() { selectElementContents(el); }); }; this.parentNode.appendChild(textpop); } textpop.focus(); return false; } $(this).find(".tradehistory_event_description").append(textbut); }); }