// ==UserScript== // @name schtobia's combined scripts for workflowy // @namespace https://www.schtobia.de/ // @version 0.1.1 // @description Combined (i.e., stolen) scripts from all over the interwebz // @author Tobias Schmidl and others // @match https://workflowy.com/* // @grant none // @downloadURL https://github.com/schtobia/greasemonkey/raw/master/workflowy.user.js // @updateURL https://github.com/schtobia/greasemonkey/raw/master/workflowy.user.js // ==/UserScript== /* jshint -W097 */ 'use strict'; // you can just use markdown images like // ![what](http://i.imgur.com/R72rW81.jpg) function do_parseImg() { $(this).nextAll(".content-img").remove(); var lines = $(this).text().split("\n"); var img_re = /^\!\[(.*)\]\((.+)\)$/; for (var i = 0; i < lines.length; i++) { var line = lines[i].trim(); var img = line.match(img_re); if (img === null) { continue; } // console.log(i, img[1]); // NOTE sure why this isn't working // if ($(this)[0] != document.activeElement) { return; } $(this).after('
' + img[1] + '
') } } function parseImg() { $("div.notes div.content").live("click keyup", do_parseImg); $("div.notes div.content").each(do_parseImg); }; $(window).bind("load hashchange", parseImg);