Changeset 136

Show
Ignore:
Timestamp:
01/27/08 20:31:29 (1 year ago)
Author:
Stuart Thiel
Message:

-Fixed #83
--Added a neat listener mechanism that lets the unsecured page send an event that bubbles up to the mediannotate object
--Cleaned out all the code to fancily set up the applet, it now uses a static html file
--We now use LiveConnect? javascript calls to set up the movie and to set the timestamps

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • MediAnnotateXPI/trunk/srcExtension/chrome/MediAnnotate/content/mediannotate.html

    r133 r136  
    1 <?xml version="1.0"?> 
    2  <window xmlns="http://www.w3.org/1999/xhtml"  
    3          title="mediannotate"> 
    4 <script type="application/x-javascript" src="chrome://mediannotate/content/file.js" /> 
    5           
    6 <center><p id="applet-holder" xmlns="http://www.w3.org/1999/xhtml"> 
    7 </p></center> 
     1<?xml version="1.0" encoding="ISO-8859-1" ?> 
     2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
     3<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 
     4<head> 
     5<title>MediAnnotate</title> 
     6<script type='text/javascript'> 
    87 
    9   <script> 
    10 <![CDATA[   
    11  
    12  
    13 function setUpApplet() { 
    14 var urlFindingRegexp = new RegExp( "[\\?&]url=([^&#]*)" ); 
    15 var myURL = window.location.href; 
    16 var results = urlFindingRegexp.exec( myURL ); 
    17 if(!results || !results[1]) { 
    18   alert("The url parameter passed in the url to this file is missing."); 
    19   return; 
    20 
    21 var url = results[1]; 
    22 if(location.href.match('^chrome.*$')) { 
    23         //alert(getFileFromChrome(location.href)); 
    24         location.href = getFileFromChrome(location.href); 
    25         return; 
     8function appletFinishedLoading() { 
     9  var evt = document.createEvent("Events"); 
     10  evt.initEvent("MyMediAnnotateExtensionEvent", true, false); 
     11  document.dispatchEvent(evt);   
    2612} 
    2713 
    28 var mediannotateFindingRegexp = new RegExp( "[\\?&]mediannotate=([^&#]*)" ); 
    29 results = mediannotateFindingRegexp.exec( myURL ); 
    30 if(results && results[1]) { 
    31         var mediannotate = results[1]; 
    32 }  
     14</script> 
    3315 
    34 var result = "<object id='MA-applet' type='application/x-java-applet' width='533' height='400'>\n" + 
    35 "  <param name='code' value='org.mediannotate.app.MediAnnotater'/>" + 
    36 "  <param name='archive' \n" + 
    37 "  value='SMediAnnotate.jar'/>\n" +  
    38 "  <param name='url' value='" + url + "'/>\n" + 
    39 (mediannotate?"  <param name='mediannotate' value='" + mediannotate + "'/>\n":"") + 
    40 "</object>"; 
     16</head> 
     17<body> 
     18<center> 
     19<object id='MA-applet' type='application/x-java-applet' width='533' height='400' > 
     20<param name='code' value='org.mediannotate.app.MediAnnotater'/> 
     21<param name='archive' value='SMediAnnotate.jar,netscape.jar'/>  
     22<param name='MAYSCRIPT' value='true' /> 
     23</object> 
     24</center> 
    4125 
    42 //props to http://textsnippets.com/tag/javascript for giving me the idea 
    43 document.getElementById('applet-holder').innerHTML = result; 
    44 
    45  
    46 setUpApplet(); 
    47  
    48 ]]> 
    49 </script> 
    50 </window> 
     26</body> 
     27</html> 
  • MediAnnotateXPI/trunk/srcExtension/chrome/MediAnnotate/content/overlay.js

    r127 r136  
    156156   
    157157  workItOut: function(event) { 
    158         var url = "chrome://mediannotate/content/mediannotate.xul?url=" + this.current_url; 
    159                 if(this.isMediaAnnotation) { 
    160                         var flatnote = this.item.getNote().replace('\n', ' '); 
    161                         var old_flatnote = this.item.getNote(); 
    162                         while(flatnote != old_flatnote) { 
    163                                 old_flatnote = flatnote; 
    164                                 flatnote = flatnote.replace('\n', ' '); 
    165                         } 
    166                         url += "&mediannotate=" + flatnote; 
    167                 }        
    168                 ZoteroPane.loadURI(url, event); 
    169    
    170                  
    171   }, 
     158        ZoteroPane.loadURI(getFileFromChrome("chrome://mediannotate/content/mediannotate.html"), event); 
     159  }, 
     160   
     161  myListener: function(event) { 
     162    if(!this.current_url) return; 
     163        var myApplet = content.document.getElementById('MA-applet'); 
     164        myApplet.wrappedJSObject.loadMovie(this.current_url); 
     165        if(this.isMediaAnnotation) myApplet.wrappedJSObject.setTime(this.item.getNote()); 
     166  },   
    172167   
    173168        /** 
     
    227222}; 
    228223 
    229 window.addEventListener("load", function(e) { mediannotate.onLoad(e); }, false);  
     224window.addEventListener("load", function(e) { mediannotate.onLoad(e); }, false); 
     225 
     226var mainWindow = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor) 
     227                  .getInterface(Components.interfaces.nsIWebNavigation) 
     228                  .QueryInterface(Components.interfaces.nsIDocShellTreeItem) 
     229                  .rootTreeItem 
     230                  .QueryInterface(Components.interfaces.nsIInterfaceRequestor) 
     231                  .getInterface(Components.interfaces.nsIDOMWindow); 
     232mainWindow.document.addEventListener("MyMediAnnotateExtensionEvent", function(e) { mediannotate.myListener(e); }, false, true); 
     233 
     234  
  • MediAnnotateXPI/trunk/srcExtension/chrome/MediAnnotate/content/overlay.xul

    r131 r136  
    55    <script src="chrome://mediannotate/content/tags.js"/> 
    66    <script src="chrome://mediannotate/content/IconFactory.js"/> 
    7     <script src="chrome://mediannotate/content/RelatedItems.js"/>     
     7    <script src="chrome://mediannotate/content/RelatedItems.js"/> 
     8    <script src="chrome://mediannotate/content/file.js"/>  
    89 
    910 
  • MediAnnotateXPI/trunk/srcExtension/install.rdf

    r127 r136  
    55    <em:id>videannotate@htmlweb.com</em:id> 
    66    <em:name>MediAnnotate</em:name> 
    7     <em:version>0.6.7.0</em:version> 
     7    <em:version>0.6.7.5</em:version> 
    88    <em:creator>Stuart Thiel Concordia University University</em:creator> 
    99    <em:developer>Stuart Thiel</em:developer> 
  • MediAnnotateXPI/trunk/update_mediannotate.rdf

    r127 r136  
    88      <RDF:li> 
    99        <RDF:Description> 
    10           <version>0.6.7.0</version> 
     10          <version>0.6.7.5</version> 
    1111          <targetApplication> 
    1212            <RDF:Description>