Skip to content

Instantly share code, notes, and snippets.

@takasek
Last active August 28, 2015 13:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save takasek/03d77898bbef686ed189 to your computer and use it in GitHub Desktop.
Save takasek/03d77898bbef686ed189 to your computer and use it in GitHub Desktop.
WorkFlowyのコンテキストメニューに、トピックのURLをコピペできるテキストボックスを追加
// ==UserScript==
// @name wf_contexual_topic_url.user.js
// @namespace https://gist.github.com/takasek/03d77898bbef686ed189
// @description WorkFlowyのコンテキストメニューに、トピックのURLをコピペできるテキストボックスを追加
// @include https://workflowy.com/*
// @version 2
// @grant none
// ==/UserScript==
(function() {
if (!jQuery.fn.showControls) {
setTimeout(arguments.callee,500);
return;
}
var func = jQuery.fn.showControls;
if (func.isFixed) {
return;
}
jQuery.fn.showControls = function(){
func.apply(this);
var text = content_text.getHtml(projecttree.getProjectReferenceFromDomProject($(this)).getName());
var href = $(this).getName().find(".bullet")[0].href;
$('#nameAndUrl').attr("value", text+ ' ' +href);
$('#onlyUrl').attr("value", href);
};
$urlContainer = $(`<div><hr/><input id="nameAndUrl"><br><input id="onlyUrl"></div>`);
$urlContainer.appendTo($("#moreControls"));
$urlContainer.find("input").focus(function(){
$(this).select();
});
jQuery.fn.showControls.isFixed = true;
})();
@takasek
Copy link
Author

takasek commented Aug 28, 2015

なにこれ

アウトラインプロセッサ WorkFlowyで、トピックのURLを簡単に取得する機能を追加するJavaScriptです。
WorkFlowyをブラウザから使うことを前提としています。
ブラウザで使う理由は、彩郎さんのブログ「単純作業に愛をこめて」の記事参照。
「WorkFlowy専用Firefox」によって、パソコンからのWorkFlowyを、さらに強力なツールに育て上げる(Windows&Mac)

どう使うの

WorkFlowyでは、トピックのbulletにマウスオーバーすると表示されるコンテキストメニューが出ます。
このスクリプトを実行すると、このコンテキストメニューに、ふたつのテキストボックスが追加されます。
テキストボックスをクリックして Ctrl+C すれば、さくっと 当該トピック名+URL あるいは 当該トピックのURL がコピペできます。
要はこんなかんじです。

2015-08-28 21 46 01

インストール方法

このスクリプトはGreasemonkeyユーザースクリプトに準拠しています。
Firefoxにアドオン Greasemonkey :: Add-ons for Firefox をインストールしている場合、ソース右上の Raw をクリックするとインストールできます。

FAQ

Greasemonkey使えないからブックマークレットにしたいんだけど

http://www.eonet.ne.jp/~wdf/software/bookmarklet_creator.html
などのサイトで上のコードをコピペすればブックマークレット化もできます。
実行したタイミングで機能追加されます。

コンテキストメニューにテキストボックス増えるの見た目良くない…

類似スクリプトあります。
WorkFlowyのShare機能に、トピックのURLをコピペできるテキストボックスを追加

他、なにかあれば

https://twitter.com/takasek まで。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment