ページのソースをタブで開く機能の実装を開始
git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@1292 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
parent
1abfa2032b
commit
1062e53bfc
@ -1,6 +1,7 @@
|
|||||||
content treestyletab jar:chrome/treestyletab.jar!/content/treestyletab/
|
content treestyletab jar:chrome/treestyletab.jar!/content/treestyletab/
|
||||||
|
|
||||||
overlay chrome://browser/content/browser.xul chrome://treestyletab/content/treestyletab.xul
|
overlay chrome://browser/content/browser.xul chrome://treestyletab/content/treestyletab.xul
|
||||||
|
overlay chrome://global/content/viewSource.xul chrome://treestyletab/content/viewSourceOverlay.xul
|
||||||
overlay chrome://multipletab/content/config.xul chrome://treestyletab/content/multipletabConfigOverlay.xul
|
overlay chrome://multipletab/content/config.xul chrome://treestyletab/content/multipletabConfigOverlay.xul
|
||||||
|
|
||||||
locale treestyletab en-US jar:chrome/treestyletab.jar!/locale/en-US/treestyletab/
|
locale treestyletab en-US jar:chrome/treestyletab.jar!/locale/en-US/treestyletab/
|
||||||
|
@ -800,6 +800,69 @@ catch(e) {
|
|||||||
openUILinkIn(]]></>
|
openUILinkIn(]]></>
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
eval('nsContextMenu.prototype.viewPartialSource = '+
|
||||||
|
nsContextMenu.prototype.viewPartialSource.toSource().replace(
|
||||||
|
'window.openDialog(',
|
||||||
|
<><![CDATA[
|
||||||
|
if (TreeStyleTabService.getPref('extensions.treestyletab.viewSourceInTab')) {
|
||||||
|
TreeStyleTabService.viewSource.clear();
|
||||||
|
TreeStyleTabService.viewSource.frame = focusedWindow;
|
||||||
|
TreeStyleTabService.viewSource.uri = docUrl;
|
||||||
|
TreeStyleTabService.viewSource.charset = docCharset;
|
||||||
|
TreeStyleTabService.viewSource.reference = reference;
|
||||||
|
TreeStyleTabService.viewSource.context = context;
|
||||||
|
var b = ('SplitBrowser' in window) ? TreeStyleTabService.getTabBrowserFromChildren(SplitBrowser.getSubBrowserAndBrowserFromFrame(frame.top).browser) : gBrowser ;
|
||||||
|
b.selectedTab = b.addTab('chrome://global/content/viewPartialSource.xul');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
window.openDialog(]]></>
|
||||||
|
)
|
||||||
|
);
|
||||||
|
eval('nsContextMenu.prototype.viewFrameSource = '+
|
||||||
|
nsContextMenu.prototype.viewFrameSource.toSource().replace(
|
||||||
|
'{',
|
||||||
|
<><![CDATA[
|
||||||
|
{
|
||||||
|
TreeStyleTabService.viewSource.clear();
|
||||||
|
TreeStyleTabService.viewSource.frame = this.target.ownerDocument.defaultView;
|
||||||
|
]]></>
|
||||||
|
)
|
||||||
|
);
|
||||||
|
eval('window.BrowserViewSourceOfDocument = '+
|
||||||
|
window.BrowserViewSourceOfDocument.toSource().replace(
|
||||||
|
'ViewSourceOfURL(',
|
||||||
|
<><![CDATA[
|
||||||
|
if (!TreeStyleTabService.viewSource.frame) {
|
||||||
|
TreeStyleTabService.viewSource.clear();
|
||||||
|
TreeStyleTabService.viewSource.frame = TreeStyleTabService.browser.contentWindow;
|
||||||
|
}
|
||||||
|
ViewSourceOfURL(]]></>
|
||||||
|
)
|
||||||
|
);
|
||||||
|
eval('window.ViewSourceOfURL = '+
|
||||||
|
window.ViewSourceOfURL.toSource().replace(
|
||||||
|
'gViewSourceUtils.openInExternalEditor(',
|
||||||
|
<><![CDATA[
|
||||||
|
TreeStyleTabService.viewSource.clear();
|
||||||
|
gViewSourceUtils.openInExternalEditor(]]></>
|
||||||
|
)
|
||||||
|
);
|
||||||
|
eval('gViewSourceUtils.openInInternalViewer = '+
|
||||||
|
gViewSourceUtils.openInInternalViewer.toSource().replace(
|
||||||
|
/(openDialog\([^\)]+\))/,
|
||||||
|
<><![CDATA[
|
||||||
|
if (TreeStyleTabService.getPref('extensions.treestyletab.viewSourceInTab')) {
|
||||||
|
TreeStyleTabService.readyToOpenChildTab(TreeStyleTabService.viewSource.target);
|
||||||
|
var b = ('SplitBrowser' in window) ? TreeStyleTabService.getTabBrowserFromChildren(SplitBrowser.getSubBrowserAndBrowserFromFrame(TreeStyleTabService.viewSource.frame.top).browser) : gBrowser ;
|
||||||
|
b.selectedTab = b.addTab('chrome://global/content/viewSource.xul');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
TreeStyleTabService.viewSource.clear();
|
||||||
|
$1;
|
||||||
|
}
|
||||||
|
]]></>
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
funcs = 'handleLinkClick __splitbrowser__handleLinkClick __ctxextensions__handleLinkClick'.split(' ');
|
funcs = 'handleLinkClick __splitbrowser__handleLinkClick __ctxextensions__handleLinkClick'.split(' ');
|
||||||
for (var i in funcs)
|
for (var i in funcs)
|
||||||
@ -839,8 +902,8 @@ catch(e) {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
eval('window.nsBrowserAccess.prototype.openURI = '+
|
eval('nsBrowserAccess.prototype.openURI = '+
|
||||||
window.nsBrowserAccess.prototype.openURI.toSource().replace(
|
nsBrowserAccess.prototype.openURI.toSource().replace(
|
||||||
/switch\s*\(aWhere\)/,
|
/switch\s*\(aWhere\)/,
|
||||||
<><![CDATA[
|
<><![CDATA[
|
||||||
if (aOpener &&
|
if (aOpener &&
|
||||||
@ -1287,7 +1350,7 @@ catch(e) {
|
|||||||
sep.setAttribute('hidden', true);
|
sep.setAttribute('hidden', true);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/* Tab Utilities */
|
/* Tab Utilities */
|
||||||
|
|
||||||
getTabValue : function(aTab, aKey)
|
getTabValue : function(aTab, aKey)
|
||||||
@ -1640,7 +1703,7 @@ catch(e) {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/* Commands */
|
/* Commands */
|
||||||
|
|
||||||
initTabbar : function(aTabBrowser, aPosition)
|
initTabbar : function(aTabBrowser, aPosition)
|
||||||
{
|
{
|
||||||
if (!aPosition) aPosition = this.getPref('extensions.treestyletab.tabbar.position');
|
if (!aPosition) aPosition = this.getPref('extensions.treestyletab.tabbar.position');
|
||||||
@ -2386,6 +2449,24 @@ catch(e) {
|
|||||||
return node.href ? node : null ;
|
return node.href ? node : null ;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/* view source */
|
||||||
|
|
||||||
|
viewSource : {
|
||||||
|
clear : function()
|
||||||
|
{
|
||||||
|
this.frame = null;
|
||||||
|
this.uri = null;
|
||||||
|
this.charset = null;
|
||||||
|
this.reference = null;
|
||||||
|
this.context = null;
|
||||||
|
},
|
||||||
|
frame : null,
|
||||||
|
uri : null,
|
||||||
|
charset : null,
|
||||||
|
reference : null,
|
||||||
|
context : null
|
||||||
|
},
|
||||||
|
|
||||||
/* Pref Listener */
|
/* Pref Listener */
|
||||||
|
|
||||||
domain : 'extensions.treestyletab',
|
domain : 'extensions.treestyletab',
|
||||||
|
65
content/treestyletab/viewSourceOverlay.xul
Normal file
65
content/treestyletab/viewSourceOverlay.xul
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||||
|
|
||||||
|
<script type="application/x-javascript"><![CDATA[
|
||||||
|
|
||||||
|
function getParentBrowserWindow()
|
||||||
|
{
|
||||||
|
if (gParentBrowserWindow === void(0)) {
|
||||||
|
try {
|
||||||
|
gParentBrowserWindow = window
|
||||||
|
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||||
|
.getInterface(Components.interfaces.nsIWebNavigation)
|
||||||
|
.QueryInterface(Components.interfaces.nsIDocShell)
|
||||||
|
.QueryInterface(Components.interfaces.nsIDocShellTreeItem)
|
||||||
|
.parent
|
||||||
|
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||||
|
.getInterface(Components.interfaces.nsIWebNavigation)
|
||||||
|
.document.defaultView
|
||||||
|
.wrappedJSObject;
|
||||||
|
if (gParentBrowserWindow.location.href != 'chrome://browser/content/browser.xul')
|
||||||
|
gParentBrowserWindow = null;
|
||||||
|
}
|
||||||
|
catch(e) {
|
||||||
|
gParentBrowserWindow = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return gParentBrowserWindow;
|
||||||
|
}
|
||||||
|
var gParentBrowserWindow;
|
||||||
|
|
||||||
|
function getParentBrowserViewSourceInfo()
|
||||||
|
{
|
||||||
|
if (!getParentBrowserWindow()) return {};
|
||||||
|
|
||||||
|
return getParentBrowserWindow().TreeStyleTabService.viewSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ('onLoadViewSource' in window) {
|
||||||
|
eval('window.onLoadViewSource = '+
|
||||||
|
window.onLoadViewSource.toSource().replace(
|
||||||
|
'window.arguments[0]',
|
||||||
|
'window.arguments.length ? window.arguments[0] : getParentBrowserViewSourceInfo().frame.location.href'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ('viewSource' in window) {
|
||||||
|
eval('window.viewSource = '+
|
||||||
|
window.viewSource.toSource().replace(
|
||||||
|
'window.arguments.length >= 2',
|
||||||
|
'window.arguments.length >= 2 || getParentBrowserViewSourceInfo().charset'
|
||||||
|
).replace(
|
||||||
|
'window.arguments[1]',
|
||||||
|
'window.arguments.length >= 2 ? window.arguments[1] : getParentBrowserViewSourceInfo().charset'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!window.arguments) window.arguments = [];
|
||||||
|
|
||||||
|
]]></script>
|
||||||
|
|
||||||
|
</overlay>
|
@ -11,6 +11,7 @@ pref("extensions.treestyletab.show.openSelectionLinks", true);
|
|||||||
|
|
||||||
pref("extensions.treestyletab.openGroupBookmarkAsTabSubTree", true);
|
pref("extensions.treestyletab.openGroupBookmarkAsTabSubTree", true);
|
||||||
pref("extensions.treestyletab.loadDroppedLinkToNewChildTab", false);
|
pref("extensions.treestyletab.loadDroppedLinkToNewChildTab", false);
|
||||||
|
pref("extensions.treestyletab.viewSourceInTab", true);
|
||||||
|
|
||||||
pref("extensions.treestyletab.autoCollapseExpandSubTreeOnSelect", true);
|
pref("extensions.treestyletab.autoCollapseExpandSubTreeOnSelect", true);
|
||||||
pref("extensions.treestyletab.collapseExpandSubTree.dblclick", false);
|
pref("extensions.treestyletab.collapseExpandSubTree.dblclick", false);
|
||||||
|
Loading…
Reference in New Issue
Block a user