Gern geschehen.
Das kleine Fenster verschwindet normalerweise nach einigen Sekunden von selbst, wenn man darin nichts tut.
Gern geschehen.
Das kleine Fenster verschwindet normalerweise nach einigen Sekunden von selbst, wenn man darin nichts tut.
Damit die Änderung dauerhaft ist, brauchen wir eine Erweiterung. Installiere userChromeJS v. 2.0 von der Seite http://userchromejs.mozdev.org/.
Dann starte neu. Im Profilordner befindet sich nun ein Ordner chrome und darin eine Datei userChrome.js.
Öffne sie mit einem Texteditor und füge am Ende hinzu:
setTimeout(function() {
var str = BookmarkingUI.onCommand.toString().replace('bookmarkCurrentPage(true', '$&, PlacesUtils.bookmarksMenuFolderId');
eval('BookmarkingUI.onCommand = ' + str);
}, 0);
Speichere die Änderung. Dann öffne die Browserkonsole und gib ein:
Firefox startet jetzt neu und der Ordner ist dauerhaft.
Das ist zunächst nur ein Test, ob sich der vorgegebene Ordner überhaupt ändert. Wenn, dann nur in der aktuellen Sitzung und nur in einem Fenster.
Geschieht das?
ganz zu unterst bei den zwei Pfeilen?
ja, genau dort.
Teste bitte:
Setze in about:config devtools.chrome.enabled auf true, dann rufe mit Strg+Umschalt+J die Browserkonsole auf, gib in die Eingabezeile unten folgenden Code ein und drücke die Enter-Taste.
Dann teste das Lesezeichen-Anlegen.
Alles Gute! ![]()
Alles Gute! ![]()
Hallo,
ist das auch im Abgesicherten Modus so?
Gern geschehen.
Wenn du die Tableiste ohnehin ausblendest, ist der Wert von browser.tabs.animate egal.
Es ist auch in diesem Fall dieses Skript besser:
Alles Gute! ![]()
Gibt es eine Lösung als userChrome.js script [...] ?
Setze browser.tabs.animate auf false und teste:
Version 2.0 stimmt schon, das stammt von mir. Vorher war 1.0, und die Änderung für e10s rechtfertigt ein 2.0. ![]()
Findbar und e10s gehen nun auch. Außerdem auch die Suchfelder in der Bibliothek, Browserkonsole und wahrscheinlich sonst noch einige.
Wenn es keine Einwände gibt, kann das Skript nach Github.
// ==UserScript==
// @name MCPasteAndGo.uc.js
// @description 中クリックであらゆるウェブページやブラウザの入力欄で貼り付けて検索を実行します。
// @version 2.0
// @author y2k
// @contributor aborix
// @namespace http://tabunfirefox.web.fc2.com/
// @note 中クリックの代わりにshift+クリックでも可
// ==/UserScript==
(function() {
// in a not-main chrome window these may be undefined
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
if (!window.Services) {
Cu.import("resource://gre/modules/Services.jsm");
};
function LOG(text) { Services.console.logStringMessage("[MCPasteAndGo] " + text); }
var PasteOnlyHtmlID = {
// "id": "url",
// "id": [ "url1", "url2", "url3" ],
// "lst-ib": "http://www.google.de/",
};
var PasteOnlyXulID = {
// browserHomePage: true,
};
var TagAction = {
input: {
paste: function(target, text) {
target.value = text;
},
go: function(target) {
var url = target.ownerDocument.defaultView.location.href;
var list = PasteOnlyHtmlID[target.id];
if (list) {
list = (list instanceof Array) ? list : [ list ];
for (var i = 0, l = list.length; i < l; i++) {
if (url.indexOf(list[i]) >= 0) {
return;
}
}
}
if (target.form) {
target.form.submit();
}
else {
var event = document.createEvent("KeyboardEvent");
event.initKeyEvent("keydown", true, true, null, false, false, false, false, 13, 0);
target.dispatchEvent(event);
}
},
},
textarea: {
paste: function(target, text) {
target.focus();
var value = target.value;
var pos = target.selectionStart;
var newpos = pos + text.length;
target.value = [ value.substr(0, pos), text, value.substr(pos) ].join("");
target.setSelectionRange(newpos, newpos);
},
go: function() {
// paste only
},
},
textbox: {
paste: function(target, text) {
target.value = text;
},
go: function(target) {
if (PasteOnlyXulID[target.id]) {
return;
};
if (target.id == "urlbar") {
document.getElementById("urlbar-go-button").click();
}
else {
var event = document.createEvent("KeyboardEvent");
event.initKeyEvent("keypress", true, true, null, false, false, false, false, 13, 0);
target.dispatchEvent(event);
}
},
},
searchbar: {
paste: function(target, text) {
if (target._textbox) {
target._textbox.value = text;
}
},
go: function(target) {
if (target.handleSearchCommand) {
document.getAnonymousElementByAttribute(target, "anonid", "search-go-button").click();
}
},
},
findbar: {
paste: function(target, text) {
if (target._findField) {
target._findField.value = text;
}
},
go: function(target) {
if (target.onFindAgainCommand) {
target.onFindAgainCommand(false);
}
},
},
};
function checkEvent(e) {
return (e.button == 1) || ((e.button == 0) && e.shiftKey);
};
function getClipboardText() {
var text = "";
var clip = Cc["@mozilla.org/widget/clipboard;1"].getService(Ci.nsIClipboard);
var trans = Cc["@mozilla.org/widget/transferable;1"].createInstance(Ci.nsITransferable);
if (clip && trans) {
var str = new Object();
var strLength = new Object();
trans.addDataFlavor("text/unicode");
clip.getData(trans, clip.kGlobalClipboard);
trans.getTransferData("text/unicode", str, strLength);
if (str) {
str = str.value.QueryInterface(Ci.nsISupportsString);
text = str.data.substring(0, strLength.value / 2);
}
}
return text;
};
function onClick(e) {
if (!checkEvent(e))
return;
var target = e.target;
if (target.ownerDocument.defaultView.top != window) {
// click in content and not e10s
return;
};
if (target.tagName == 'tabbrowser') {
var node = e.originalTarget;
if (node.tagName.endsWith('browser')) {
// click in content and e10s
return;
} else {
node = node.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;
if (node.tagName == 'findbar') {
target = node;
}
}
};
// LOG([ "tag: ", target.tagName, " id: ", target.id, " class: ", target.className ].join(""));
var text = getClipboardText();
var action = TagAction[target.tagName];
if (text && action) {
action.paste(target, text);
action.go(target);
};
};
window.addEventListener("click", onClick, true);
// if this is not a main window, we're done.
if (location != 'chrome://browser/content/browser.xul')
return;
// this is a main window, so we handle the content with a frame script.
var frameScript = function() {
const {classes: Cc, interfaces: Ci} = Components;
function LOG(text) { Services.console.logStringMessage("[MCPasteAndGo] " + text); }
var PasteOnlyHtmlID = {
/* "id": "url",
"id": [ "url1", "url2", "url3" ],
"lst-ib": "http://www.google.de/", */
};
var PasteOnlyXulID = {
/* browserHomePage: true, */
};
var TagAction = {
INPUT: {
paste: function(target, text) {
target.value = text;
},
go: function(target) {
var url = target.ownerDocument.defaultView.location.href;
var list = PasteOnlyHtmlID[target.id];
if (list) {
list = (list instanceof Array) ? list : [ list ];
for (var i = 0, l = list.length; i < l; i++) {
if (url.indexOf(list[i]) >= 0) {
return;
}
}
};
if (target.baseURI == 'about:home') {
content.document.getElementById('searchSubmit').click();
}
else if (target.form) {
target.form.submit();
}
else {
var event = content.document.createEvent("KeyboardEvent");
event.initKeyEvent("keydown", true, true, null, false, false, false, false, 13, 0);
target.dispatchEvent(event);
}
},
},
TEXTAREA: {
paste: function(target, text) {
target.focus();
var value = target.value;
var pos = target.selectionStart;
var newpos = pos + text.length;
target.value = [ value.substr(0, pos), text, value.substr(pos) ].join("");
target.setSelectionRange(newpos, newpos);
},
go: function() {
/* paste only */
},
},
TEXTBOX: {
paste: function(target, text) {
target.value = text;
},
go: function(target) {
if (PasteOnlyXulID[target.id]) {
return;
};
var event = content.document.createEvent("KeyboardEvent");
event.initKeyEvent("keypress", true, true, null, false, false, false, false, 13, 0);
target.dispatchEvent(event);
},
},
};
function checkEvent(e) {
return (e.button == 1) || ((e.button == 0) && e.shiftKey);
};
function getClipboardText() {
var text = "";
var clip = Cc["@mozilla.org/widget/clipboard;1"].getService(Ci.nsIClipboard);
var trans = Cc["@mozilla.org/widget/transferable;1"].createInstance(Ci.nsITransferable);
if (clip && trans) {
var str = new Object();
var strLength = new Object();
trans.addDataFlavor("text/unicode");
clip.getData(trans, clip.kGlobalClipboard);
trans.getTransferData("text/unicode", str, strLength);
if (str) {
str = str.value.QueryInterface(Ci.nsISupportsString);
text = str.data.substring(0, strLength.value / 2);
}
}
return text;
};
function onClick(e) {
if (!checkEvent(e))
return;
var target = e.target;
/* LOG([ "tag: ", target.tagName, " id: ", target.id, " class: ", target.className ].join("")); */
var text = getClipboardText();
var action = TagAction[target.tagName.toUpperCase()];
if (text && action) {
action.paste(target, text);
action.go(target);
};
};
addEventListener("click", onClick, true);
};
var frameScriptURI = 'data:,(' + frameScript.toString() + ')()';
window.messageManager.loadFrameScript(frameScriptURI, true);
})();
Alles anzeigen
Es hat noch die Einschränkungen von #651.
Wie loshombre will.
loshombre, damit geht es wieder:
// ==UserScript==
// @name MCPasteAndGo.uc.js
// @description 中クリックであらゆるウェブページやブラウザの入力欄で貼り付けて検索を実行します。
// @version 1.0
// @author y2k
// @include main
// @namespace http://tabunfirefox.web.fc2.com/
// @note 正確にはmousedownで貼り付け、mouseupで検索
// @note 中クリックの代わりにshift+クリックでも可
// ==/UserScript==
(function() {
function LOG(text) { Services.console.logStringMessage("[MCPasteAndGo] " + text); }
var PasteOnlyHtmlID = {
// "id": "url",
// "id": [ "url1", "url2", "url3" ],
// "lst-ib": "http://www.google.de/",
};
var PasteOnlyXulID = {
browserHomePage: true,
};
var TagAction = {
//HTMLのinput
INPUT: {
paste: function(target, text) {
target.value = text;
},
go: function(target) {
var url = target.ownerDocument.defaultView.location.href;
var list = PasteOnlyHtmlID[target.id];
if (list) {
list = (list instanceof Array) ? list : [ list ];
for (var i = 0, l = list.length; i < l; i++) {
if (url.indexOf(list[i]) >= 0) {
return;
}
}
}
if (target.form) {
target.form.submit();
}
else {
var event = document.createEvent("KeyboardEvent");
event.initKeyEvent("keydown", true, true, null, false, false, false, false, 13, 0);
target.dispatchEvent(event);
}
},
},
//HTMLのtextarea
TEXTAREA: {
paste: function(target, text) {
target.focus();
var value = target.value;
var pos = target.selectionStart;
var newpos = pos + text.length;
target.value = [ value.substr(0, pos), text, value.substr(pos) ].join("");
target.setSelectionRange(newpos, newpos);
},
go: function() {
//paste only
},
},
//ブラウザのtextbox
textbox: {
paste: function(target, text) {
target.value = text;
},
go: function(target) {
if (PasteOnlyXulID[target.id]) {
return;
};
if (target.id == "urlbar") {
document.getElementById("urlbar-go-button").click();
}
else {
var event = document.createEvent("KeyboardEvent");
event.initKeyEvent("keypress", true, true, null, false, false, false, false, 13, 0);
target.dispatchEvent(event);
}
},
},
//検索バー
searchbar: {
paste: function(target, text) {
if (target._textbox) {
target._textbox.value = text;
}
},
go: function(target) {
if (target.handleSearchCommand) {
document.getAnonymousElementByAttribute(target, "anonid", "search-go-button").click();
}
},
},
//ページ内検索バー
findbar: {
paste: function(target, text) {
if (target._findField) {
target._findField.value = text;
}
},
go: function(target) {
if (target.onFindAgainCommand) {
target.onFindAgainCommand(false);
}
},
},
};
function checkEvent(e) {
//中クリック or shift+クリック
return (e.button == 1) || ((e.button == 0) && e.shiftKey);
};
function getClipboardText() {
var text = "";
var clip = Cc["@mozilla.org/widget/clipboard;1"].getService(Ci.nsIClipboard);
var trans = Cc["@mozilla.org/widget/transferable;1"].createInstance(Ci.nsITransferable);
if (clip && trans) {
var str = new Object();
var strLength = new Object();
trans.addDataFlavor("text/unicode");
clip.getData(trans, clip.kGlobalClipboard);
trans.getTransferData("text/unicode", str, strLength);
if (str) {
str = str.value.QueryInterface(Ci.nsISupportsString);
text = str.data.substring(0, strLength.value / 2);
}
}
return text;
};
var clickTarget = false;
function mousedown(e) {
var target = e.target;
clickTarget = null;
if (checkEvent(e)) {
LOG([ "tag: ", target.tagName, " id: ", target.id, " class: ", target.className ].join(""));
var text = getClipboardText();
var action = TagAction[target.tagName];
if (text && action) {
action.paste(target, text);
clickTarget = target;
}
}
};
function mouseup(e) {
var target = e.target;
if ((clickTarget === target) && checkEvent(e)) {
var action = TagAction[target.tagName];
if (action) {
action.go(target);
}
}
clickTarget = null;
};
window.addEventListener("mousedown", mousedown, false);
window.addEventListener("mouseup", mouseup, false);
})();
Alles anzeigen
Soll sowohl bei Umschalt+Linksklick als auch bei Mittelklick ein neuer Tab geöffnet werden? Oder im einen Fall so, im anderen anders?
[...] sich hier mal 2 Klamotten anzugucken, die leider nicht mehr funktionieren wollen.
[...]
MCPasteAndGo
Bitte testet mal das folgende Skript.
Es funktioniert noch nicht
- in der Findbar
- und mit e10s bei Eingabefeldern auf Webseiten.
// ==UserScript==
// @name MCPasteAndGo.uc.js
// @description 中クリックであらゆるウェブページやブラウザの入力欄で貼り付けて検索を実行します。
// @version 1.0
// @author y2k
// @include main
// @namespace http://tabunfirefox.web.fc2.com/
// @note 正確にはmousedownで貼り付け、mouseupで検索
// @note 中クリックの代わりにshift+クリックでも可
// ==/UserScript==
(function() {
function LOG(text) { Services.console.logStringMessage("[MCPasteAndGo] " + text); }
var PasteOnlyHtmlID = {
// "id": "url",
// "id": [ "url1", "url2", "url3" ],
// "lst-ib": "http://www.google.de/",
};
var PasteOnlyXulID = {
browserHomePage: true,
};
var TagAction = {
//HTMLのinput
INPUT: {
paste: function(target, text) {
target.value = text;
},
go: function(target) {
var url = target.ownerDocument.defaultView.location.href;
var list = PasteOnlyHtmlID[target.id];
if (list) {
list = (list instanceof Array) ? list : [ list ];
for (var i = 0, l = list.length; i < l; i++) {
if (url.indexOf(list[i]) >= 0) {
return;
}
}
}
if (target.form) {
target.form.submit();
}
else {
var event = document.createEvent("KeyboardEvent");
event.initKeyEvent("keydown", true, true, null, false, false, false, false, 13, 0);
target.dispatchEvent(event);
}
},
},
//HTMLのtextarea
TEXTAREA: {
paste: function(target, text) {
target.focus();
var value = target.value;
var pos = target.selectionStart;
var newpos = pos + text.length;
target.value = [ value.substr(0, pos), text, value.substr(pos) ].join("");
target.setSelectionRange(newpos, newpos);
},
go: function() {
//paste only
},
},
//ブラウザのtextbox
textbox: {
paste: function(target, text) {
target.value = text;
},
go: function(target) {
if (PasteOnlyXulID[target.id]) {
return;
};
if (target.id == "urlbar") {
document.getElementById("urlbar-go-button").click();
}
else {
var event = document.createEvent("KeyboardEvent");
event.initKeyEvent("keypress", true, true, null, false, false, false, false, 13, 0);
target.dispatchEvent(event);
}
},
},
//検索バー
searchbar: {
paste: function(target, text) {
if (target._textbox) {
target._textbox.value = text;
}
},
go: function(target, e) {
if (target.handleSearchCommand) {
target.handleSearchCommandWhere(e, null, "current", null);
}
},
},
//ページ内検索バー
findbar: {
paste: function(target, text) {
if (target._findField) {
target._findField.value = text;
}
},
go: function(target) {
if (target.onFindAgainCommand) {
target.onFindAgainCommand(false);
}
},
},
};
function checkEvent(e) {
//中クリック or shift+クリック
return (e.button == 1) || ((e.button == 0) && e.shiftKey);
};
function getClipboardText() {
var text = "";
var clip = Cc["@mozilla.org/widget/clipboard;1"].getService(Ci.nsIClipboard);
var trans = Cc["@mozilla.org/widget/transferable;1"].createInstance(Ci.nsITransferable);
if (clip && trans) {
var str = new Object();
var strLength = new Object();
trans.addDataFlavor("text/unicode");
clip.getData(trans, clip.kGlobalClipboard);
trans.getTransferData("text/unicode", str, strLength);
if (str) {
str = str.value.QueryInterface(Ci.nsISupportsString);
text = str.data.substring(0, strLength.value / 2);
}
}
return text;
};
var clickTarget = false;
function mousedown(e) {
var target = e.target;
clickTarget = null;
if (checkEvent(e)) {
LOG([ "tag: ", target.tagName, " id: ", target.id, " class: ", target.className ].join(""));
var text = getClipboardText();
var action = TagAction[target.tagName];
if (text && action) {
action.paste(target, text);
clickTarget = target;
}
}
};
function mouseup(e) {
var target = e.target;
if ((clickTarget === target) && checkEvent(e)) {
var action = TagAction[target.tagName];
if (action) {
action.go(target, e);
}
}
clickTarget = null;
};
window.addEventListener("mousedown", mousedown, false);
window.addEventListener("mouseup", mouseup, false);
})();
Alles anzeigen
Alles Gute! ![]()
Der UserscriptLoader funktioniert mit e10s nicht und darum wird kein .user.js-Skript ausgeführt.
Zu #3: Hast du einen, möglichst einfachen, reproduzierbaren Testfall?
Der UserScriptLoader funktioniert nicht mit e10s.
Er müsste umgeschrieben werden. Ich kann das leider nicht.