Skip to content

Instantly share code, notes, and snippets.

@dc-nikolaev
dc-nikolaev / gist:6796613
Created October 2, 2013 16:39
Calculate Steam card drop remaining. Work on page http://steamcommunity.com/id/*profile_name*/badges/
var card_info_array = document.getElementsByClassName('progress_info_bold');
var result = 0;
for (var iterator = 0; iterator < card_info_array.length; iterator++) {
var current_result_array = card_info_array[iterator].innerHTML.split(' ');
for (var item = 0; item < current_result_array.length; item++) {
if (!isNaN(parseInt(current_result_array[item]))) {
result+= +current_result_array[item];
break;
}
}
var result_rub = 0;
var result_dollar = 0;
var result_euro = 0;
jQuery('.transactionRowPrice').each(function() {
var string_value = $(this).innerText;
if (string_value.indexOf('pуб.')!=-1) {
result_rub+= +(string_value.split(' ')[0]).replace(',','.');
}
if (string_value.indexOf('$')!=-1) {
result_dollar+= +string_value.replace('$','').replace('R','').replace(',','.');
@dc-nikolaev
dc-nikolaev / gist:6806044
Created October 3, 2013 06:50
On click from another guide in Steam he open in new page
jQuery('.workshopItemCollectionContainer').each(function() {
var link = jQuery(this).find('div[class=workshopItemCollection]').attr('onclick').split('href=')[1];
var old_inner_html = jQuery(this).html();
jQuery(this).html('<a href="'+link+'" target="_blank">'+old_inner_html+'</a>');
jQuery(this).find('div[class=workshopItemCollection]').attr('onclick','');
});
@dc-nikolaev
dc-nikolaev / ReactWindowScrollBars.tsx
Created October 1, 2019 18:14
ReactWindowScrollBars
import React, { FunctionComponent, useCallback } from 'react';
import ScrollBars from '../../../../../components/ScrollBars';
const ReactWindowScrollBars: FunctionComponent<any> = ({ onScroll, forwardedRef, style, children }) => {
const refSetter = useCallback((scrollbarsRef) => {
if (scrollbarsRef) {
forwardedRef(scrollbarsRef.view);
} else {
forwardedRef(null);
}