Lokaler Editor von Heribert

Heribert hat für den schnellen Zugriff in seinem Browser das Firefox-Plugin ViewSourceWith installiert.

Funktionsweise

Seit v5 (2008) ist die Homepage dynamisch, zum lokalen Anzeigen kann man also nicht einfach eine Datei öffnen, sondern muss sie durch einen Webserver betrachten. Daher muss auf jedem Computer, auf dem man die Website bearbeiten will, ein richtig konfigurierter Webserver installiert sein.

Dieser Umstand sorgte dafür, dass das Bearbeiten für Heribert schwierig wurde. Das ViewSourceWith-Plugin sorgt dafür, dass aus URLs wie

http://www.technikum29.de/de/ http://www.technikum29.de/en/devices/anything.shtm http://localhost/de/kommunikationstechnik/bla.php

lokale Dateien gefunden werden. Früher (v5.0 bis v5.7) ging das mit wilden Zeichenkettenersetzungen. Mittlerweile wird einfach sehr elegant ein <meta>-Tag ausgelesen, der mittels PHP gesetzt wird und der den lokalen Dateinamen enthält.

Bevor Heribert Firefox verwendet hat, hat er ein Internet Explorer-Plugin (Defakto eine Explorer-Shell-Erweiterung für Windows) genutzt, welches ich ebenfalls geschrieben habe (2005-2008).

Screenshots der Konfiguration

Screenshot des Hauptkonfig-Fensters Editor-Reiter

Konfigurationsscript (Mapping)

Konfiguration für Server pages mapping list:

// You receive the object data containing the following elements
// data.uri         the URI data
//                  see nsIURL at http://www.xulplanet.com/references/xpcomref/comps/c_networkstandardurl1.html
// data.localPath   the localPath defined in urlMapper dialog (should be empty or null)
// data.domainFilter the domainFilter defined in urlMapper dialog
// data.pageSourcePath the path to page source retrieved by browser
// data.line        the line number, useful when called from JS console
// data.column      the column number, useful when called from JS console
var localPath = data.localPath;
var uri = data.uri.spec;
var dirSep = top.window.navigator.platform.indexOf("Win") < 0 ? "/" : "\\";
// Contains the file name(s) to open
var arFiles = new Array();

// t29v6: Lokalen Pfad aus Metaelement rauslesen
try {
  doc = gBrowser.contentDocument;
//  localfile = doc.defaultView.jQuery("meta[name='t29.localfile']").attr("content");
  localfile = doc.getElementById("localFileSource").getAttribute("content");
  arFiles.push(localfile);
  return arFiles;
} catch(e) {
 // alert("Konnte Quelltext nicht lokalisieren, versuche Standardverfahren");
} // end try catch

var re = new RegExp(data.domainFilter, "g");
var fileName = re.exec(uri);
// Try to append extra paths
if (fileName) {
    fileName = uri.substring(re.lastIndex);
    // remove the text following query (?), ref (#), param (;)
    fileName = fileName.replace(/[#?;].*$/, "");
    // Under Windows adjust path separators
    if (dirSep == "\\") {
        fileName = fileName.replace(/\//g, dirSep);
    }
} else {
    fileName = data.uri.fileName;
}
// You can open more than one file simply returning
// their full pathnames in array shown below
// By default only two files are returned having the same name to requested one
// Suppose your localPath points to ~/vsw/htdocs/vsw
// The browser points to:
// http://dafizilla.sourceforge.net/viewsourcewith/faq.php
// The file name in URL is faq.php so the local file is:
// ~/vsw/htdocs/vsw/faq.php

// comment line below if you don't want to open the temporary file
//arFiles.push(data.pageSourcePath);
if(fileName.substr(-1) == "\\") {
    fileName += "index.shtml";
}


arFiles.push(localPath + dirSep + fileName);

return arFiles;
 
Last modified 10 years ago Last modified on May 30, 2014, 4:15:31 AM

Attachments (2)

Download all attachments as: .zip

© 2008 - 2013 technikum29 • Sven Köppel • Some rights reserved
Powered by Trac
Expect where otherwise noted, content on this site is licensed under a Creative Commons 3.0 License