From 238d125adfbabb3bdb9671e5142f5128a1d31d44 Mon Sep 17 00:00:00 2001 From: anekos Date: Sun, 23 Nov 2008 00:51:13 +0000 Subject: succ する際に全てのフレームのURLを参考にするようにした。 git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@24679 d0d07461-0603-4401-acd4-de1884942a52 --- auto_detect_link.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'auto_detect_link.js') diff --git a/auto_detect_link.js b/auto_detect_link.js index 136878e..b6fdb8f 100644 --- a/auto_detect_link.js +++ b/auto_detect_link.js @@ -318,6 +318,18 @@ } + // 全フレームの URL を得る + function getAllLocations (content) { + let result = [content.location.href]; + if (content.frames) { + for (let i = 0, l = content.frames.length; i < l; i++) { + result = result.concat(getAllLocations(content.frames[i])); + } + } + return result; + } + + // 上書きした設定を返す。 function getCurrentSetting (setting) { if (!setting) @@ -410,7 +422,10 @@ } // succ - let succs = succURI(uri, next); + let succs = []; + getAllLocations(window.content).forEach(function (uri) { + succs = succs.concat(succURI(uri, next)); + }); if (setting.useSuccPattern) { let link; if (succs.some(function (succ) { @@ -421,13 +436,14 @@ } // force - if (setting.force && succs.length) + if (setting.force && succs.length) { return { type: 'force', uri: succs[0], text: '-force-', frame: window.content, }; + } } catch (e) { liberator.log(e); -- cgit v1.2.3