1

Thema: Rechte Maustaste - bitte mal prüfen :-)

... könnt Ihr mir bitte mal nen Gefallen tun, und das folgende Skript<BR> <A HREF="http://www.devshare.de/dload/menu.html" TARGET=_blank>http://www.devshare.de/dload/menu.html</A> <P>auf Kompatibilität zu den verschiedenen Browsern test. Bisher hab ichs erfolgreich unter NS 4.7 und IE 5.5 getestet. NS6 bin ich noch am Bugfixen ...<P>Das Skript deaktiviert die rechte Maustaste und zeichnet ein eigenes Menü. Ich arbeite grad im Rahmen eines bald erscheinenden Artikels daran ... das Skript und der Artikel wird hier dann natürliich veröffentlicht  [img]images/icons/smile.gif" border="0[/img]<P>Danke schon mal für Eure Hilfe.<P>Hannes

_______________________________________________________________

/-/annes (j|g) ... http://www.jg-webdesign.de

2

Re: Rechte Maustaste - bitte mal prüfen :-)

Mahlzeit Hannes!<P>Test mit Mozilla 0.9.3:<BR>Menu geht auf, bleibt aber nicht auf dem Schirm wenn man die rechte Maustaste losläßt oder über einen Link geht...<BR>außerdem erscheinen Deine Kommentare (Hallo, Ja, Nummer 3, 3) vor den eigentlichen Links...)<BR>und den Rahmen zerreißt´s ein wenig (wahrscheinlich wegen den Kommentaren  [img]images/icons/wink.gif" border="0[/img])<BR>Ansonsten: Funzt  [img]images/icons/wink.gif" border="0[/img] (von dem was übrigbleibt)<P>Aber: COOLES SCRIPT (ich glaub das speicher ich mir für späteren Bedarf  [img]images/icons/smile.gif" border="0[/img])<P>Bye, Tommy

Beleidigungen sind die Argumente derer, die keine Argumente haben

3

Re: Rechte Maustaste - bitte mal prüfen :-)

Nur mal auf die Schnelle:<BR>NN4.08 nimmt's nicht, opera5.02 nimmt's nicht, NN6.1 macht eher lustige Sachen, soll<BR>heißen: onmousedown und währenddessen rüberrutschen auf's menu, und das Ding bleibt erhalten. Einfach nur klicken und nicht gleichzeitig drübergehen, und das menu verschwindet sofort wieder. Auch bekomme ich manchmal - und manchmal auch wieder nicht - die Fehlermeldung:<P>Fehler: redeclaration of const kIOServiceProgID<BR>Quelldatei: chrome://communicator/content/utilityOverlay.js<P>Jedenfalls ist mir bisher unklar, von welchem<BR>Event das ausgelöst wird. Hier mal die Quelldatei:<P>/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-<BR> *<BR> * The contents of this file are subject to the Netscape Public<BR> * License Version 1.1 (the "License"); you may not use this file<BR> * except in compliance with the License. You may obtain a copy of<BR> * the License at <A HREF="http://www.mozilla.org/NPL/" TARGET=_blank>http://www.mozilla.org/NPL/</A> <BR> *<BR> * Software distributed under the License is distributed on an "AS<BR> * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or<BR> * implied. See the License for the specific language governing<BR> * rights and limitations under the License.<BR> *<BR> * The Original Code is mozilla.org code.<BR> *<BR> * The Initial Developer of the Original Code is Netscape<BR> * Communications Corporation.  Portions created by Netscape are<BR> * Copyright (C) 1998 Netscape Communications Corporation. All<BR> * Rights Reserved.<BR> *<BR> * Contributor(s):<BR> *   Alec Flett <alecf@netscape.com><BR>*/<P>/**<BR> * Communicator Shared Utility Library<BR> * for shared application glue for the Communicator suite of applications<BR> **/<P>/**<BR> * Go into online/offline mode<BR> **/<P>const kIOServiceProgID = "@mozilla.org/network/io-service;1";<BR>const kObserverServiceProgID = "@mozilla.org/observer-service;1";<P>function toggleOfflineStatus()<BR>{<BR>  var checkfunc;<BR>  try {<BR>    checkfunc = document.getElementById("offline-status").getAttribute('checkfunc');<BR>  }<BR>  catch (ex) {<BR>    checkfunc = null;<BR>  }<P>  var ioService = Components.classes[kIOServiceProgID]<BR>                            .getService(Components.interfaces.nsIIOService);<BR>  if (checkfunc) {<BR>    if (!eval(checkfunc)) {<BR>      // the pre-offline check function returned false, so don't go offline<BR>      return;<BR>    }<BR>  }<BR>  ioService.offline = !ioService.offline;<BR>}<P>function setOfflineUI(offline)<BR>{<BR>  var broadcaster = document.getElementById("Communicator:WorkMode");<BR>  if (!broadcaster) return;<P>  //Checking for a preference "network.online", if it's locked, disabling <BR>  // network icon and menu item<BR>  var prefService = Components.classes["@mozilla.org/preferences-service;1"];<BR>  prefService = prefService.getService();<BR>  prefService = prefService.QueryInterface(Components.interfaces.nsIPrefService);<BR>  <BR>  var prefBranch = prefService.getBranch(null);<BR>  <BR>  var offlineLocked = prefBranch.prefIsLocked("network.online"); <BR>  <BR>  if (offlineLocked ) {<BR>      broadcaster.setAttribute("disabled","true");<BR>  }<P>  var bundle = srGetStrBundle("chrome://communicator/locale/utilityOverlay.properties");<P>  if (offline)<BR>    {<BR>      broadcaster.setAttribute("offline", "true");<BR>      broadcaster.setAttribute("tooltiptext", bundle.GetStringFromName("offlineTooltip"));<BR>      broadcaster.setAttribute("label", bundle.GetStringFromName("goonline"));<BR>      FillInTooltip(broadcaster);<BR>    }<BR>  else<BR>    {<BR>      broadcaster.removeAttribute("offline");<BR>      broadcaster.setAttribute("tooltiptext", bundle.GetStringFromName("onlineTooltip"));<BR>      broadcaster.setAttribute("label", bundle.GetStringFromName("gooffline"));<BR>      FillInTooltip(broadcaster);<BR>    }<BR>}<P>var goPrefWindow = 0;<P>function getBrowserURL() {<P>  try {<BR>    var prefs = Components.classes["@mozilla.org/preferences;1"];<BR>    if (prefs) {<BR>      prefs = prefs.getService();<BR>      if (prefs)<BR>        prefs = prefs.QueryInterface(Components.interfaces.nsIPref);<BR>    }<BR>    if (prefs) {<BR>      var url = prefs.CopyCharPref("browser.chromeURL");<BR>      if (url)<BR>        return url;<BR>    }<BR>  } catch(e) {<BR>  }<BR>  return "chrome://navigator/content/navigator.xul";<BR>}<P>function goPageSetup()<BR>{<BR>}<P>function goEditCardDialog(abURI, card, okCallback, abCardURI)<BR>{<BR>  window.openDialog("chrome://messenger/content/addressbook/abEditCardDialog.xul",<BR>                      "",<BR>                      "chrome,resizeable=no,modal,titlebar",<BR>                      {abURI:abURI, card:card, okCallback [img]images/icons/blush.gif" border="0[/img]kCallback, abCardURI:abCardURI});<BR>}<P>function goPreferences(containerID, paneURL, itemID)<BR>{<BR>  var resizable;<BR>  var pref = Components.classes["@mozilla.org/preferences;1"].getService(Components.interfaces.nsIPref);<BR>  <BR>  try {<BR>    // We are resizable ONLY if in box debugging mode, because in<BR>    // this special debug mode it is often impossible to see the <BR>    // content of the debug panel in order to disable debug mode.<BR>    resizable = pref.GetBoolPref("xul.debug.box");<BR>  }<BR>  catch (e) {<BR>    resizable = false;<BR>  }<P>  var resizability = "yes"; // resizable ? "yes" : "no";<BR>  var features = "chrome,titlebar,resizable=" + resizability;<BR>  openDialog("chrome://communicator/content/pref/pref.xul","PrefWindow", <BR>             features, paneURL, containerID, itemID);<BR>}<P>function goToggleToolbar( id, elementID )<BR>{<BR>  var toolbar = document.getElementById( id );<BR>  var element = document.getElementById( elementID );<BR>  if ( toolbar )<BR>  {<BR>    var attribValue = toolbar.getAttribute("hidden") ;<P>    if ( attribValue == "true" )<BR>    {<BR>      toolbar.setAttribute("hidden", "false" );<BR>      if ( element )<BR>        element.setAttribute("checked","true")<BR>    }<BR>    else<BR>    {<BR>      toolbar.setAttribute("hidden", true );<BR>      if ( element )<BR>        element.setAttribute("checked","false")<BR>    }<BR>    document.persist(id, 'hidden');<BR>    document.persist(elementID, 'checked');<BR>  }<BR>}<P><BR>function goClickThrobber( urlPref )<BR>{<BR>  var url;<BR>  try {<BR>    var pref = Components.classes["@mozilla.org/preferences;1"].getService();<BR>    if( pref )<BR>    pref = pref.QueryInterface( Components.interfaces.nsIPref );<BR>    url = pref.getLocalizedUnicharPref(urlPref);<BR>  }<P>  catch(e) {<BR>    url = null;<BR>  }<P>  if ( url )<BR>    openTopWin(url);<BR>}<P><BR>//No longer needed.  Rip this out since we are using openTopWin<BR>function goHelpMenu( url )<BR>{<BR>  /* note that this chrome url should probably change to not have all of the navigator controls */<BR>  /* also, do we want to limit the number of help windows that can be spawned? */<BR>  window.openDialog( getBrowserURL(), "_blank", "chrome,all,dialog=no", url );<BR>}<P><BR>function openTopWin( url )<BR>{<BR>  /* note that this chrome url should probably change to not have all of the navigator controls,<BR>     but if we do this we need to have the option for chrome controls because goClickThrobber()<BR>     needs to use this function with chrome controls */<BR>  /* also, do we want to limit the number of help windows that can be spawned? */<BR>    if ((url == null) || (url == "")) return;<P>    // xlate the URL if necessary<BR>    if (url.indexOf("urn:") == 0)<BR>    {<BR>        url = xlateURL(url);        // does RDF urn expansion<BR>    }<P>    // avoid loading "", since this loads a directory listing<BR>    if (url == "") {<BR>        url = "about:blank";<BR>    }<P>    var windowManager = Components.classes['@mozilla.org/rdf/datasource;1?name=window-mediator'].getService();<BR>    var windowManagerInterface = windowManager.QueryInterface( Components.interfaces.nsIWindowMediator);<P>    var topWindowOfType = windowManagerInterface.getMostRecentWindow( "navigator:browser" );<BR>    if ( topWindowOfType )<BR>    {<BR>        topWindowOfType.focus();<BR>    topWindowOfType._content.location.href = url;<BR>    }<BR>    else<BR>    {<BR>        window.openDialog( getBrowserURL(), "_blank", "chrome,all,dialog=no", url );<BR>    }<BR>}<P>function goAboutDialog()<BR>{<BR>  var defaultAboutState = false;<BR>  try {<BR>    var pref = Components.classes["@mozilla.org/preferences;1"].getService();<BR>    if( pref )<BR>      pref = pref.QueryInterface( Components.interfaces.nsIPref );<BR>    defaultAboutState = pref.GetBoolPref("browser.show_about_as_stupid_modal_window");<BR>  }<BR>  catch(e) {<BR>    defaultAboutState = false;<BR>  }<BR>  if( defaultAboutState )<BR>    window.openDialog("chrome:global/content/about.xul", "About", "modal,chrome,resizable=yes,height=450,width=550");<BR>  else<BR>    window.openDialog( getBrowserURL(), "_blank", "chrome,all,dialog=no", 'about:' );<BR>}<P>// update menu items that rely on focus<BR>function goUpdateGlobalEditMenuItems()<BR>{<BR>  goUpdateCommand('cmd_undo');<BR>  goUpdateCommand('cmd_redo');<BR>  goUpdateCommand('cmd_cut');<BR>  goUpdateCommand('cmd_copy');<BR>  goUpdateCommand('cmd_paste');<BR>  goUpdateCommand('cmd_selectAll');<BR>  goUpdateCommand('cmd_delete');<BR>}<P>// update menu items that rely on the current selection<BR>function goUpdateSelectEditMenuItems()<BR>{<BR>  goUpdateCommand('cmd_cut');<BR>  goUpdateCommand('cmd_copy');<BR>  goUpdateCommand('cmd_delete');<BR>}<P>// update menu items that relate to undo/redo<BR>function goUpdateUndoEditMenuItems()<P>{<BR>  goUpdateCommand('cmd_undo');<BR>  goUpdateCommand('cmd_redo');<BR>}<P>// update menu items that depend on clipboard contents<BR>function goUpdatePasteMenuItems()<BR>{<BR>  goUpdateCommand('cmd_paste');<BR>}<P>// This used to be BrowserNewEditorWindow in navigator.js<BR>function NewEditorWindow(aPageURL)<BR>{<BR>  // Open editor window with blank page<BR>  // Kludge to leverage openDialog non-modal!<BR>  window.openDialog( "chrome://editor/content", "_blank", "chrome,all,dialog=no", "about:blank");<BR>}<P>function NewEditorFromTemplate()<BR>{<BR>  // XXX not implemented<BR>}<P>function NewEditorFromDraft()<BR>{<BR>  // XXX not implemented<BR>}<P>// Any non-editor window wanting to create an editor with a URL<BR>//   should use this instead of "window.openDialog..."<BR>//  We must always find an existing window with requested URL<BR>// (When calling from a dialog, "launchWindow" is dialog's "opener"<BR>//   and we need a delay to let dialog close)<BR>function editPage(url, launchWindow, delay)<BR>{<BR>  // User may not have supplied a window<BR>  if (!launchWindow)<BR>  {<BR>    if (window)<BR>    {<BR>      launchWindow = window;<BR>    }<BR>    else<BR>    {<BR>      dump("No window to launch an editor from!n");<BR>      return;<BR>    }<BR>  }<P>  var windowManager = Components.classes['@mozilla.org/rdf/datasource;1?name=window-mediator'].getService();<BR>  if (!windowManager) return;<BR>  var windowManagerInterface = windowManager.QueryInterface( Components.interfaces.nsIWindowMediator);<BR>  if ( !windowManagerInterface ) return;<BR>  var enumerator = windowManagerInterface.getEnumerator( "composer:html" );<BR>  if ( !enumerator ) return;<P>  while ( enumerator.hasMoreElements() )<BR>  {<BR>    var window = windowManagerInterface.convertISupportsToDOMWindow( enumerator.getNext() );<BR>    if ( window && window.editorShell)<BR>    {<BR>      if (window.editorShell.checkOpenWindowForURLMatch(url, window))<BR>      {<BR>        // We found an editor with our url<BR>        window.focus();<BR>        return;<BR>      }<BR>    }<BR>  }<P>  // Create new Composer window<BR>  if (delay)<BR>    launchWindow.delayedOpenWindow("chrome://editor/content", "chrome,all,dialog=no", url);<BR>  else<BR>    launchWindow.openDialog("chrome://editor/content", "_blank", "chrome,all,dialog=no", url);<BR>}<P>// function that extracts the filename from a url<BR>function extractFileNameFromUrl(urlstr)<BR>{<BR>  if (!urlstr) return null;<BR>  return urlstr.slice(urlstr.lastIndexOf( "/" )+1);<BR>}<P>var offlineObserver = {<BR>  Observe: function(subject, topic, state) {<BR>    // sanity checks<BR>    if (topic != "network [img]images/icons/blush.gif" border="0[/img]ffline-status-changed") return;<BR>    setOfflineUI(state == "offline");<BR>  }<BR>}<P>function utilityOnLoad(aEvent)<BR>{<BR>  var broadcaster = document.getElementById("Communicator:WorkMode");<BR>  if (!broadcaster) return;<P>  var observerService = Components.classes[kObserverServiceProgID]<BR>                  .getService(Components.interfaces.nsIObserverService);<P>  // crude way to prevent registering twice.<BR>  try {<BR>    observerService.RemoveObserver(offlineObserver, "network [img]images/icons/blush.gif" border="0[/img]ffline-status-changed");<BR>  }<BR>  catch (ex) {<BR>  }<BR>  observerService.AddObserver(offlineObserver, "network [img]images/icons/blush.gif" border="0[/img]ffline-status-changed");<BR>  // make sure we remove this observer later<BR>  addEventListener("unload",utilityOnUnload,false);<P>  // set the initial state<BR>  var ioService = Components.classes[kIOServiceProgID]<BR>              .getService(Components.interfaces.nsIIOService);<BR>  setOfflineUI(ioService.offline);<BR>}<P>function utilityOnUnload(aEvent) <BR>{<BR>  var observerService = Components.classes[kObserverServiceProgID]<BR>              .getService(Components.interfaces.nsIObserverService);<BR>  observerService.RemoveObserver(offlineObserver, "network [img]images/icons/blush.gif" border="0[/img]ffline-status-changed");<BR>}<P>addEventListener("load",utilityOnLoad,true);<P>Vielleicht kannst Du damit was anfangen, mir ist's momentan nebulös. Allerdings hatte ich diese Fehlermeldung auch schon bei andren Scripts, und zwar immer dann, wenn ich auf Quelltext anzeigen gegangen bin. Möglicherweise ist's ein Fehler netscapeseitig.<BR>Ich glaube auch, daß es das return false zum Unterdrücken nicht braucht.<P>gruß <P>matho

4

Re: Rechte Maustaste - bitte mal prüfen :-)

Im IE4 läuft alles, bis auf das Problem, dass zu dem eigenen Menü noch das Standartmenü gezeigt wird, welches das eigene überdeckt.

Ceterum censeo Ameriginem esse delendam.

5

Re: Rechte Maustaste - bitte mal prüfen :-)

BTW:<BR>@Dino:<BR>WER/WAS/WO ist eigentlich Kaltherberg???  [img]images/icons/smile.gif" border="0[/img]

Beleidigungen sind die Argumente derer, die keine Argumente haben

Re: Rechte Maustaste - bitte mal prüfen :-)

hij leutz...<P>also: Opera5.12 stört sich an den Script garnet und interpretiert es auch nicht also tut sich da dementsprechend auch nix in Richtung Menu<P>der Scaper4.78d mag das Script und zeigt das Menu auch vollständig an und alle Funktionen tun auch das was sie wollen...<P>so denn, viel Erfolg mit allen weiteren Projekten...

Man bemerkt erst wieviel ein Mensch einen bedeutet wenn er nicht mehr da ist.

7

Re: Rechte Maustaste - bitte mal prüfen :-)

Oki .. NS 6.1 ist gefixt, hab einfach den Focus auf den Menü-Layer gesetzt. Ähm .. was ist den der Scaper?

_______________________________________________________________

/-/annes (j|g) ... http://www.jg-webdesign.de

8

Re: Rechte Maustaste - bitte mal prüfen :-)

Ich denke damit meint er Netscape... [img]images/icons/smile.gif" border="0[/img]

Das Schwierigste am Diskutieren ist nicht, den eigenen Standpunkt zu verteidigen, sondern ihn zu kennen.
«André Maurois [1885-1967]; franz. Schriftsteller»

Re: Rechte Maustaste - bitte mal prüfen :-)

jup mein ich   [img]images/icons/grin.gif" border="0[/img]

Man bemerkt erst wieviel ein Mensch einen bedeutet wenn er nicht mehr da ist.

10

Re: Rechte Maustaste - bitte mal prüfen :-)

@Tink<P>Kaltherberg ist ein kleiner Ort von <A HREF="http://www.monschau.de" TARGET=_blank>Monschau</A> in der <A HREF="http://www.eifel.de" TARGET=_blank>Eifel</A>, aich Oxford gennant, aber von Oxe  [img]images/icons/wink.gif" border="0[/img]. In der Eifel ist es üblich, über Kalterherberger herzuziehen.

Ceterum censeo Ameriginem esse delendam.

11

Re: Rechte Maustaste - bitte mal prüfen :-)

@J|G<BR>Wenn Du mal keine Lust auf layer hast, geht's<BR>für IE5.5 und den NN6.1 auch so:<P><html><head><title>menurechts</title><BR><style>a{text-decoration:none}</style><BR><script><BR>src=['#','#','#','#'];<BR>href=['#','#','#','#'];<BR>at=[' func1',' func2',' func3',' func4'];<BR>var da=document.all,dg=A;<P>function A(a,aa){return document.getElementsByTagName(a)[aa]};<BR>function C(c,cc){c.appendChild(document.createElement(cc));};<BR>function V(){dv.visibility=dv.visibility=="hidden"?"visible":"hidden";};<BR>function H(){dv.visibility="hidden";};<P>function T(e) <BR>{dv=A("div",1).style;<BR> function X()<BR> {A("div",1).innerHTML="";<BR>  for(i=0;i<src.length;i++)<BR>   {C(A("div",1),"h2");<BR>     with(A("h2",i)){innerHTML='<img height=15px width=15px src="'+src[i]+'"><a href="'+href[i]+'">'+at[i]+'</a><br>';<BR>     with(style){position="relative";marginTop=-23+"px";backgroundColor="dadada";width="80px"};};<BR>  };};<BR> if(da&&event.button==2){X();V();with(dv){marginTop=event.clientY;marginLeft=event.clientX};};<BR> if(dg&&!da)if(e.which==3){X();V();with(dv){marginTop=e.pageY;marginLeft=e.pageX};};<BR>};<BR>function L(e){if(da&&event.button==0)H();if(dg&&!da)if(e.which==1)H();};<BR>if(!document.layers){document.onmousedown=T;document.onclick=L;};<BR></script><BR></head><BR><body oncontextmenu="return false"><BR><div>biddemallechtscricken</div><BR><div style="visibility:hidden"></div><BR></body><BR></html><P><BR>gruß<P>matho

12

Re: Rechte Maustaste - bitte mal prüfen :-)

@matho: <BR>ja, auch nicht schlecht Dein Menü ... die neuen Browser und deren Technik machen das Programmieren halt um ein vielfaches einfacher ... :-)

_______________________________________________________________

/-/annes (j|g) ... http://www.jg-webdesign.de

13

Re: Rechte Maustaste - bitte mal prüfen :-)

Hi<BR>Also mit IE6 funzts auch einwandfrei<BR>Respekt, da hast ja sauber gewerkelt  [img]images/icons/smile.gif" border="0[/img]

14

Re: Rechte Maustaste - bitte mal prüfen :-)

Danke für das Lob ... das Skript ist aber kaum der Rede wert  [img]images/icons/smile.gif" border="0[/img] Ist doch recht einfach *g*.

_______________________________________________________________

/-/annes (j|g) ... http://www.jg-webdesign.de

Re: Rechte Maustaste - bitte mal prüfen :-)

hm<BR>entweder mach ich was falsch oder dein skript...<BR>unter ie 6.0 öffnet es sich zwar aber du kannst nix anwählen, also net aktualisieren, net quellcode anzeigen usw!<BR>unter opera 5.0 läuft gar nix

---------------------------------
bLuEtooTh
bluetooth22@web.de
ICQ: 129663697

16

Re: Rechte Maustaste - bitte mal prüfen :-)

Hm ... unterm IE 6.x müßte es eigentlich laufen? Auf Opera nehme ich keine Rücksicht  [img]images/icons/smile.gif" border="0[/img]

_______________________________________________________________

/-/annes (j|g) ... http://www.jg-webdesign.de