Benutzer:Dapete/previewSideBySide.js

aus Wikipedia, der freien Enzyklopädie

Hinweis: Leere nach dem Veröffentlichen den Browser-Cache, um die Änderungen sehen zu können.

  • Firefox/Safari: Umschalttaste drücken und gleichzeitig Aktualisieren anklicken oder entweder Strg+F5 oder Strg+R (⌘+R auf dem Mac) drücken
  • Google Chrome: Umschalttaste+Strg+R (⌘+Umschalttaste+R auf dem Mac) drücken
  • Internet Explorer/Edge: Strg+F5 drücken oder Strg drücken und gleichzeitig Aktualisieren anklicken
  • Opera: Strg+F5
 /* previewSideBySide()
  *
  * Function to use with addOnloadHook to display edit preview and edit
  * textbox side by side instead of one above the other. If
  * previewSideBySideDirection is true, the preview is shown on the
  * right, otherwise it's shown on the left.
  */
 
 function previewSideBySide() {
 
     // Get relevant elements from DOM
     var editform = document.getElementById("editform");
     var wikiPreview = document.getElementById("wikiPreview");
 
     // Check if elements were found to confirm user is actually editing at the
     // moment. If yes, also check that the preview is not empty, which is the
     // case when editing but not previewing (yet).
     if (editform && wikiPreview && wikiPreview.childNodes.length>0) {
 
         // Set elements' widths to 49% (50% does not fit, for some reason)
         wikiPreview.style.width = "49%";
         editform.style.width = "49%";
 
         // Set elements' float properties depending on chosen direction
         if (previewSideBySideDirection) {
             wikiPreview.style.cssFloat = "right";
             editform.style.cssFloat = "left";
         }
         else {
             wikiPreview.style.cssFloat = "left";
             editform.style.cssFloat = "right";
         }
 
         // Just to be sure, the elements should not "clear" any floats
         wikiPreview.style.clear = "none";
         editform.style.clear = "none";
     }
 } 

 // Add hook
 addOnloadHook (previewSideBySide);