im Hauptfenster Kontextmenü erscheint mit dem Code der Eintrag "Send to Google Docs" - beim Klick darauf wird ein Dokument, PDF etc. automatisch bei GDocs gespeichert, allerdings öffnet sich dazu ein neues Fenster. (zu erkennen an window.open(..))
ich habe es bis dato noch nicht geschafft eine objektreferenz zu finden die einen neuen tab öffnet. auch eine selbstgebastelte Funktion hab ich nicht hinbekommen.
Hat jemand von euch eine Idee wie ich hier ein neues Tab öffnen kann?
Code
var sendtogoogledocs = {
onLoad: function() {
this.initialized = true;
this.strings = document.getElementById("sendtogoogledocs-strings");
document.getElementById("contentAreaContextMenu")
.addEventListener("popupshowing", function(e) { this.showContextMenu(e); }, false);
},
showContextMenu: function(event) {
document.getElementById("context-sendtogoogledocs").hidden = gContextMenu.onImage;
},
onMenuItemCommand: function(e) {
if (gContextMenu.onLink && !gContextMenu.onImage) {
var docurl = gContextMenu.getLinkURL();
if(docurl.match(/^http:.*\.(html|htm|pdf|xls|doc|ppt|csv|txt|rtf|odt|sxw|pps|ods)$/i)) {
var uploadURL = 'http://docs.google.com/?formsubmitted=true&action=updoc&uploadURL=' + docurl;
window.open(uploadURL);
}
}
},
};
window.addEventListener("load", function(e) { sendtogoogledocs.onLoad(e); }, false);
Alles anzeigen