Browse Source

garland: Add location fixer user script.

master
Bas Weelinck 7 years ago
parent
commit
ad28c4dba4
1 changed files with 30 additions and 0 deletions
  1. +30
    -0
      garland/garland-location-fixer.js

+ 30
- 0
garland/garland-location-fixer.js View File

@@ -0,0 +1,30 @@
// ==UserScript==
// @name Garland location fixer
// @version 1
// @include http://www.garlandtools.org/db/*
// @run-at document-end
// @grant none
// ==/UserScript==

/* Patch gathering material resolver */
function garlandLocationFixer() {
'use strict';
console.log('fixer: garlandLocationFixer, v1.0');
console.log('fixer: installing monkey patch');
let actual_resolve = gt.node.resolveCraftSource;
gt.node.resolveCraftSource = function(step, id) {
actual_resolve(step, id);
let view = step.sourceView;
console.log('fixer: Adding ' + view.name + ' to ' + view.longSourceName);
view.longSourceName = view.name + ', ' + view.longSourceName;
console.log('fixer: done.');
}
console.log('fixer: done.');
}

/* Add script to execute in page scope */
var script = document.createElement("script");
script.type = "application/javascript";
script.textContent = "(" + garlandLocationFixer + ")();";

document.body.appendChild(script);

Loading…
Cancel
Save