Skip to content

Instantly share code, notes, and snippets.

View faurehu's full-sized avatar
🎯
Focusing

Matias Faure faurehu

🎯
Focusing
View GitHub Profile
@faurehu
faurehu / roamAliasPlugin.js
Created January 23, 2021 01:34
Roam Alias Plugin
window.onhashchange = function () {
var isPage = window.location.hash.split('/')[3] == 'page'
if (isPage) {
setTimeout(function () {
var topBlock = document.getElementsByClassName("roam-block")[0].children[0]
var blockValue = topBlock.innerText.split(':')
if (blockValue.length == 2 && blockValue[0] == 'forward') {
var attrs = topBlock.children[1].attributes[1]
if (attrs.name == 'data-link-uid') {
var newUrl = window.location.href.slice(0, -9) + attrs.value