You are viewing a plain text version of this content. The canonical link for it is here.
Posted to svn@forrest.apache.org by cd...@apache.org on 2005/10/28 11:08:49 UTC

svn commit: r329165 - in /forrest/trunk/tools/forrestbar/xpi/chrome/content: forrestbarOverlay.js forrestbarOverlay.xul

Author: cdupoirieux
Date: Fri Oct 28 02:08:41 2005
New Revision: 329165

URL: http://svn.apache.org/viewcvs?rev=329165&view=rev
Log:
This version of the forrestbar adds a Devs. menu where it is possible to display internal format of a page (if forrest run) :
At the moment you can display :
The Intermediate format = page.source.rewritten.xml
The Body                      = page.body.xml
The ToC                       = page.toc.xml
The Abstract                 = page.abstract.xml
The Authors                  = page.authors.xml
The Navigation              = page.navigation.xml
The Title                       = page.title.xml
This is essentially for costomizers working with Dispatcher (Views v2...)

Modified:
    forrest/trunk/tools/forrestbar/xpi/chrome/content/forrestbarOverlay.js
    forrest/trunk/tools/forrestbar/xpi/chrome/content/forrestbarOverlay.xul

Modified: forrest/trunk/tools/forrestbar/xpi/chrome/content/forrestbarOverlay.js
URL: http://svn.apache.org/viewcvs/forrest/trunk/tools/forrestbar/xpi/chrome/content/forrestbarOverlay.js?rev=329165&r1=329164&r2=329165&view=diff
==============================================================================
--- forrest/trunk/tools/forrestbar/xpi/chrome/content/forrestbarOverlay.js (original)
+++ forrest/trunk/tools/forrestbar/xpi/chrome/content/forrestbarOverlay.js Fri Oct 28 02:08:41 2005
@@ -44,3 +44,28 @@
   navigate(searchItem.selectedItem.value);
 }
 
+function viewXML(xmltype)
+{
+  var href = gBrowser.currentURI.spec;
+  if( ! isLocalUrl())
+  {
+    alert("This action is only available on Local Forrest (jetty) site...");
+    return(false);
+  }
+  navigate(href.substring(0, href.lastIndexOf('.') ) + xmltype);
+}
+
+function isLocalUrl ()
+{
+  var href = gBrowser.currentURI.spec;
+
+  return( (typeof(href) != 'undefined') &&
+          (href.substr) &&
+          (startsWith(href, 'http://127.0.0.1:8888/') )
+        );
+}
+
+function startsWith(st, pref)
+{
+  return( (pref.length > 0) && (st.substring(0, pref.length) == pref) );
+}
\ No newline at end of file

Modified: forrest/trunk/tools/forrestbar/xpi/chrome/content/forrestbarOverlay.xul
URL: http://svn.apache.org/viewcvs/forrest/trunk/tools/forrestbar/xpi/chrome/content/forrestbarOverlay.xul?rev=329165&r1=329164&r2=329165&view=diff
==============================================================================
--- forrest/trunk/tools/forrestbar/xpi/chrome/content/forrestbarOverlay.xul (original)
+++ forrest/trunk/tools/forrestbar/xpi/chrome/content/forrestbarOverlay.xul Fri Oct 28 02:08:41 2005
@@ -73,6 +73,18 @@
         </menupopup>
       </toolbarbutton>
 
+      <toolbarbutton class="forrestbar" label="Devs." id="forrestbar-devs" hidden="false" type="menu">
+        <menupopup>
+          <menuitem label="Intermediate format" onclick="viewXML('.source.rewritten.xml');" />
+          <menuitem label="Body" onclick="viewXML('.body.xml');" />
+          <menuitem label="Table of Content" onclick="viewXML('.toc.xml');" />
+          <menuitem label="Abstract" onclick="viewXML('.abstract.xml');" />
+          <menuitem label="Authors" onclick="viewXML('.authors.xml');" />
+          <menuitem label="Navigation" onclick="viewXML('.navigation.xml');" />
+          <menuitem label="Title" onclick="viewXML('.title.xml');" />
+        </menupopup>
+      </toolbarbutton>
+var href = gBrowser.currentURI.spec
       <toolbarseparator/>
 
       <toolbaritem class="forrestbar" id="forrestbar-search">