Skip to content

Instantly share code, notes, and snippets.

View fnlctrl's full-sized avatar

宋铄运 (Alan Song) fnlctrl

View GitHub Profile
@fnlctrl
fnlctrl / steamcalc.js
Last active January 9, 2018 15:02
Calculate steam purchases
var currencies = ['USD', 'pуб.', '¥']
Array.prototype.reduce.call(
document.body.querySelectorAll(".wht_total"),
(acc, x) => {
const rawPrice = x.textContent.trim();
let number = 0;
let currency = '';
for (let i = 0; i < currencies.length; i++) {
@fnlctrl
fnlctrl / vue-route-data.js
Last active July 21, 2020 21:30
VueRouteData plugin for vue-router@2.0 and vue@1or2
/**
* VueRouteData plugin for vue-router@2.0 and vue@1or2,
* implemented according to https://github.com/vuejs/vue-router/issues/296#issuecomment-235481643
*
* This plugin looks for `$options.fetchRouteData`,
* and watches `$route` using `$options.fetchRouteData` as handler.
*
* Before `fetchRouteData` executes, this plugin sets 'loadingRouteData' to true,
* and when it finishes executing, the plugin sets 'loadingRouteData' to false,
* so `fetchRouteData` can either be normal functions or async functions.