Further update.
I did some more testing on the Google Gadget and with similar code on a
normal web server.
It appears that Google uses Caja to inspect and substantially rewrite all
HTML and JavaScript before the page loads
https://developers.google.com/apps-script/guides/html/restrictions#javascript

All ex:*** tags become ex- when they should be data-ex-***
I have rewritten the code on the above referenced links and it is mostly
working
http://8g70vehon7uhaojqv0bshkq7honkrikq-a-sites-opensocial.googleusercontent.com/gadgets/ifr?url=http://www.hayriverti.org/seeds.xml&container=enterprise&view=default&lang=en&country=ALL&sanitize=0&v=4fd4b5b0d6da245a&libs=core&mid=65&parent=http://www.hayriverti.org/seed-library
Is a page where the iframe from http://www.hayriverti.org/seed-library It
is easier to get the Generated Source Code on this page.

The <html> tag for this iframe is generated by the Google Gadget. I needed
to add this code to populate the <html> tag so Exhibit would work with the
data-ex- tags
var html_label = document.getElementsByTagName("html")[0];
   html_label.setAttribute("xml:lang","en");
   html_label.setAttribute("lang","en");
   html_label.setAttribute("xmlns","http://www.w3.org/1999/xhtml";);
   html_label.setAttribute("xmlns:ex","
http://simile.mit.edu/2006/11/exhibit#";);

These were added as the first lines of the window.onload = function() {


I have one remaining problem. When you click on a link under a picture it
should display the picture and some text about it with a couple of links in
a pop up window. It totally misses using that "lens" code and just displays
the same image and link in the pop up window.
It is displaying the code here
<table data-ex-role="lens" class="itemThumbnail" style="display: none;">
when is should display
<div role="lens" class="item" style="display: none;">

The original unaltered code from the cartoon example looks like this
<table ex:role="lens" class="itemThumbnail" style="display: none;">

<div role="lens" class="item" style="display: none;">

I have tried all combinations of data-ex-role, ex-role, role, ex:role and
"lens", "lens-thumbnail". The results are mostly that the popup uses the
wrong code, the page won't load if ex: is used or both the viewPanel and
popup use the code for the popup.

Any ideas out there of what might be going on?

George Adams


On Tue, Aug 19, 2014 at 4:03 PM, George Adams <[email protected]> wrote:

> Update on this.
> There seems to be a whole series of problems with the code I posted in
> http://www.hayriverti.org/seeds.xml
> Here is what I have found out so far.
> The iframe in http://www.hayriverti.org/seed-library can be seen by
> itself here
> http://8g70vehon7uhaojqv0bshkq7honkrikq-a-sites-opensocial.googleusercontent.com/gadgets/ifr?url=http://www.hayriverti.org/seeds.xml&container=enterprise&view=default&lang=en&country=ALL&sanitize=0&v=4fd4b5b0d6da245a&libs=core&mid=65&parent=http://www.hayriverti.org/seed-library#
> It is a bit easier to see the generated HTML this way.
> Working with alert(); and the JavaScript error console I found out that
> //    window.SimileAjax_onLoad = loadExhibit; //this didn't run loadExhibit
> but this one does
>     poll(window, [ "includeData" ], loadExhibit);
>
> With the SimileAjax_onLoad in place both loadExhibit
> and onEverythingLoaded code was not being executed.
>
> In loadExhibit
> //    SimileAjax.includeJavascriptFiles(document, "", [ "
> http://api.simile-widgets.org/exhibit/3.1.0rc3/exhibit-api.js";
> ]);//throws an error
> but this does not
>     window.Exhibit.includeJavascriptFiles(document, "", [ "
> http://api.simile-widgets.org/exhibit/3.1.0rc3/exhibit-api.js"; ]);
> This line might not be needed as
> http://api.simile-widgets.org/exhibit/3.1.0rc3/exhibit-api.js should have
> already loaded with loadJS("
> http://api.simile-widgets.org/exhibit/3.1.0rc3/exhibit-api.js";);
>
> In onEverythingLoaded
>
> window.database = Exhibit.Database.create(); does not create a database or
> at one point I was getting a Javascript null value for window.database . In
> http://api.simile-widgets.org/exhibit/3.1.0rc3/scripts/data/database.js
> it looks like there should be a "type" parameter.
>
> Exhibit.Database.create = function(type) {
>     if (typeof Exhibit.Database[type] !== "undefined") {
>         return new Exhibit.Database[type]();
>     } else {
>         // warn?
>         return new Exhibit.Database._LocalImpl();
>     }
> };
>
> What should this type be?
>
>
>     //window.database.loadDataLinks();
> I get an error of window.database.loadDataLinks is not a function when it
> is not commented out.
>
> I could not find loadDataLinks in the Exhibit list of .js files. Has this
> been changed in the 3.x versions?
>
>
> George Adams
>
>
> On Fri, Aug 15, 2014 at 2:19 PM, George Adams <[email protected]>
> wrote:
>
>> I am getting back into Exhibit after a number of years.
>> My new Exhibit needs to run as a Goggle Gadget so it doesn't have access
>> to the <head> of the web page. With the help of this group I was able to do
>> this several years ago by adding a bunch of javascript which loaded the
>> needed items into the head of the page.
>> This page works with Exhibit 2
>> http://www.hayriverti.org/local-directory-map
>> It has the code for the Exhibit in this xml file
>> http://www.hayriverti.org/localDirectory.xml
>>
>> The new Exhibit can be seen here as a plain HTML page with stuff loaded
>> in the <head>
>> http://hayriv.com/seeds.html it works
>> Here is another version that does all the loading in the body and is
>> based on the Local Directory javascript.
>> http://hayriv.com/seedsxml.html This also works.
>>
>> This page takes the code of the body of the above page and wraps it in
>> the Google Gadget module XML.
>> http://www.hayriverti.org/seed-library
>> The XML file is at http://www.hayriverti.org/seeds.xml
>>
>> This page loads the html OK and seems to load the Exhibit .js and .css
>> files but the data file isn't loaded or is loaded after the data is moved
>> to the <head>
>>
>> There is a line in the javascript that polls to see if Exhibit is loaded.
>> poll(window, [ "Exhibit" ], onEverythingLoaded);
>> Is there a way to poll to see if the data is loaded?
>>
>> I tried this without success.
>> poll(window, [ "Exhibit","dataLink" ], onEverythingLoaded);
>>
>> Just as a note I was having similar trouble with the file at
>> http://hayriv.com/seedsxml.html which oddly would work when there was an
>> window.alert() added to the code after the includeData("
>> https://spreadsheets.google.com/feeds/list/0AkgOV8gxmgPadGV3bTVxREZvb05jNUhxaGNQZ2lFZ2c/od6/public/values?alt=json-in-script
>> ");
>> My guess was that this delayed the rest of the script enough to load the
>> data. After moving
>> includeData("
>> https://spreadsheets.google.com/feeds/list/0AkgOV8gxmgPadGV3bTVxREZvb05jNUhxaGNQZ2lFZ2c/od6/public/values?alt=json-in-script";);
>> earlier in the series of script steps it worked without fail and without
>> the alert() in the code.
>>
>> Any help would be appreciated.
>> George Adams
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"SIMILE Widgets" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/simile-widgets.
For more options, visit https://groups.google.com/d/optout.

Reply via email to