Bob,

I'll work on a simple template page today.

The instructions for the more complex page

http://chemagic.com/notes/

are below.  The actual control commands are remarkably simple.

Instructions for above page:

1) Page loads with model kit showing while loading. Then model kit hides.
This is required by Firefox.

2) Show model kit.

3) Click Draw button to bring up JSME.

4) Draw something and click save link. Take default 1 save. Per the model
window note, this means your memory location for this drawing is DRAW1 -
actually case insensitive.

5) Hide model kit. Click somewhere in the notes editable div - maybe hit a
CR or two to get a left side cursor. LocalStorage command actions are at
the cursor of selection.

6) Click th IMG button and enter draw1 in the dialog - no http.

That should do it. Works on Mac Safari, Chrome, and FF. Although this all
started with MSIE and was subsequently incorporated into html5, MISE is now
considered the bad actor in all of this - yada yada.

Simple page later today.

Otis

On Friday, September 19, 2014, Robert Hanson <hans...@stolaf.edu> wrote:

> Otis, this is very cool but very complicated stuff for us file storage
> newbies. Could you create a few very simple demo pages and point them to
> us, please? If you would like, I can include those in the Jmol distribution.
>
> Bob
>
>
> On Thu, Sep 18, 2014 at 10:45 PM, Otis Rothenberger <osrot...@chemagic.com
> <javascript:_e(%7B%7D,'cvml','osrot...@chemagic.com');>> wrote:
>
>> If editable divs are going to go anywhere for chemists, you have to find
>> a user friendly way to include structure drawing. I've been using Resolver
>> Images - a very, very clunky process. There has to be a better way. Here ya
>> go...
>>
>> Code edited for conciseness:
>>
>> localStorage.setItem("myKey",
>> getElementById('drawFrame').contentWindow.jsmeApplet.jmeFile());
>>
>> The above save of JMEfile to LS code can be fired from your draw page.
>> Mine is in an iFrame on the same page as the editable div, but Local
>> Storage is by domain, so it could be one page (or tab) talking to another
>> (Think about that concept!) - e.g. draw app page to editable div app page.
>>
>> The function below, inserts an iFrame at the cursor in an editable div.
>> It can be fired by a dialog that asks for a LS key (myKey in this note).
>> What's being inserted is an iFrame containing Peter Ertl's simplest htm
>> page set to depict and with a bit of JS that extracts myKey from a query
>> string. Note that I really don't need the jmefile below, but I get it to
>> test myKey validity.
>>
>> function strIframe(myKey) {
>> var jmefile = localStorage.getItem(myKey);
>> if (jmefile == null || jmefile == "") {  return null;  }
>> var ifr = '<iframe name="drawFrame" src="JSME2.htm?lsJSME=myKey"
>> scrolling="yes"
>> style="width:220px;height:220px;border:0;padding:0;margin:auto"></iframe>';
>> document.execCommand("insertHTML",false,ifr);
>>         return null;
>> }
>>
>> Query String Extraction of myKey in Peter's page. The variable 
>> startingStructure
>> is, if I recall, the term that Peter included in his original code for this
>> page. Here the JME file is extracted and rendered in the iFrame "image" -
>> i.e. Peter's page set to depict.
>>
>> var srch = document.location.search;
>> var qsVal = "";
>> var startingStructure = "";
>> if (srch.indexOf("lsJSME=") >= 0) {
>> qsVal = srch.split("lsJSME=")[1].split("&")[0];
>> startingStructure = localStorage.getItem(qsVal);
>> }
>>
>> No AJAX. No remote server. It can all be run locally. JSME structures and
>> reactions are depicted.
>>
>> Otis
>>
>> --
>> Otis Rothenberger
>> o...@chemagic.com <javascript:_e(%7B%7D,'cvml','o...@chemagic.com');>
>>
>>
>> ------------------------------------------------------------------------------
>> Slashdot TV.  Video for Nerds.  Stuff that Matters.
>>
>> http://pubads.g.doubleclick.net/gampad/clk?id=160591471&iu=/4140/ostg.clktrk
>> _______________________________________________
>> Jmol-users mailing list
>> Jmol-users@lists.sourceforge.net
>> <javascript:_e(%7B%7D,'cvml','Jmol-users@lists.sourceforge.net');>
>> https://lists.sourceforge.net/lists/listinfo/jmol-users
>>
>>
>
>
> --
> Robert M. Hanson
> Larson-Anderson Professor of Chemistry
> Chair, Department of Chemistry
> St. Olaf College
> Northfield, MN
> http://www.stolaf.edu/people/hansonr
>
>
> If nature does not answer first what we want,
> it is better to take what answer we get.
>
> -- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
>
>

-- 
Otis Rothenberger
o...@chemagic.com
------------------------------------------------------------------------------
Slashdot TV.  Video for Nerds.  Stuff that Matters.
http://pubads.g.doubleclick.net/gampad/clk?id=160591471&iu=/4140/ostg.clktrk
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to