有没有可能将此Chrome插件转换为在Firefox中工作?
https://github.com/chuckhendo/showModalDialog-shim
该插件需要用window.open替换window.showModalDialog
'use strict';
var shim = '(' + function() {
if(typeof window.showModalDialog !== 'function') {
window.showModalDialog = function() {
var opts = arguments[2];
opts = opts
.replace(/;/g, ',')
.replace(/:/g, '=')
.replace(/dialogWidth/g, 'width')
.replace(/dialogHeight/g, 'height')
.replace(/center/g, 'centerScreen');
return window.open.call(this, arguments[0], '_blank', opts );
};
}
} + ')();';
var scriptEl = document.createElement('script');
scriptEl.textContent = shim;
(document.head||document.documentElement).appendChild(scriptEl);发布于 2016-11-02 13:53:57
您可以在GreaseMonkey中运行此命令。安装GreaseMonkey扩展,然后将上面的代码添加为用户脚本。
下面是为GreaseMoney重写的代码:
// ==UserScript==
// @name AddShowModal
// @namespace http://www.weirdies.net
// @version 1
// @grant none
// @include *
// ==/UserScript==
(function () {
var shim = '(' + function() {
if(typeof window.showModalDialog !== 'function') {
window.showModalDialog = function() {
var opts = arguments[2];
opts = opts
.replace(/;/g, ',')
.replace(/:/g, '=')
.replace(/dialogWidth/g, 'width')
.replace(/dialogHeight/g, 'height')
.replace(/center/g, 'centerScreen');
return window.open.call(this, arguments[0], '_blank', opts );
};
}
} + ')();';
var scriptEl = document.createElement('script');
scriptEl.textContent = shim;
(document.head||document.documentElement).appendChild(scriptEl);
})();我确认它可以与OWA10一起工作,可以弹出附加对话框等,而不必将dom.disable_window_showModalDialog设置为false并禁用电泳。它看起来有点笨拙,而且似乎不能正确地转换宽度和高度(它会全屏打开,我现在没有时间调试它),但它可以工作。
https://stackoverflow.com/questions/40068839
复制相似问题