From df3e98a4404997b7c7ebc7bc2fd2b1f2110d8971 Mon Sep 17 00:00:00 2001 From: anekos Date: Wed, 9 Feb 2011 02:41:52 +0900 Subject: やればできるやないか --- foxage2ch.js | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) (limited to 'foxage2ch.js') diff --git a/foxage2ch.js b/foxage2ch.js index 05d1d43..5586757 100644 --- a/foxage2ch.js +++ b/foxage2ch.js @@ -35,8 +35,8 @@ THE POSSIBILITY OF SUCH DAMAGE. // INFO {{{ let INFO = <> - @@ -54,8 +54,8 @@ let INFO = - @@ -118,13 +118,6 @@ let INFO = } return; }, - titleToId: function (title) { - for ([, thread] in Iterator(FA.threads)) { - if (thread.title === title) - return thread; - } - return; - }, findThread: function (threadId) { window.openDialog( 'chrome://foxage2ch/content/findThread.xul', @@ -132,7 +125,11 @@ let INFO = 'chrome,centerscreen,modal,all', threadId ); - } + }, + findThreadByURL: function (url) { + let [boardId, threadId] = FoxAge2chUtils.parseFromURL(FoxAge2chUtils.unwrapURL(url)); + return FA.findThread(threadId); + }, } __context__.utils = FA; @@ -216,13 +213,11 @@ let INFO = 'Find thread', function (args) { let threadId = args.literalArg; - if (!threadId) { - let thread = FA.titleToId(buffer.title); - if (!thread) - return; - threadId = thread.id; + if (threadId) { + FA.findThread(threadId); + } else { + FA.findThreadByURL(buffer.URL); } - FA.findThread(threadId); }, { literal: 0, -- cgit v1.2.3