On Mon, Sep 5, 2016 at 10:55 PM, Richard Hipp <d...@sqlite.org> wrote:
> Most of the world views the internet on their phone now, I am told,
> and websites are suppose to be "responsive",

Most of the changes work well as far as I've seen, but I have one
problem.  The page "http://sqlite.org/draft/docs.html"; gives links
inside sections you can fold or unfold.  If I view the page with
javascript disabled but CSS rules enabled in Firefox, then all but the
first section starts as closed, and there's no obvious way to open
them, so all the links are very hard to access.  I believe the code
for the page should behave in such a way that if the page is viewed
without javascript, then all the folds start as open, and it's only
the javascript that closes them.  (Alternately, if javascript is not
loaded, the fold headers should be links that go to other pages that
show the content under that particular fold.)

The rest of this mail tries to explain how you can make the folds
start as open, but make the javascript close them if they don't load,
in a way that I believe should work on most browsers.  You probably
already know how to do that, in which case you can skip the rest of
this mail.

The CSS embedded to the HTML contains this rule:

.showhide ul {
  display: none;
  list-style-type: disc;
}

Split this to two rules as follows:

.showhide ul {
  display: none;
}
.showhide ul {
  list-style-type: disc;
}

The second rule is irrelevant here.  The first rule is what hides
links under closed folds.  Remove that first rule from the CSS
embedded in the HTML page, and put it to a separate CSS file
accessible through the server, which I'll call "sqlitejs.css" for now.
Then put the following declaration to the HTML HEAD.

        <link id="style_js" rel="alternate stylesheet" disabled
href="sqlitejs.css" type="text/css" title="style_js">

This will tell the browser that this style sheet exists, but is not
used by default.  The title attribute is ignored by most browsers, but
it is needed for compatibility with some older browsers which would
enable the style sheet by default otherwise (I learned that the hard
way).

Now you want this stylesheet to be enabled if an only if the
javascript embedded in the page is loaded.  This is useful, because if
the javascript is loaded, then hopefully the user can open the folds
using it.  So append the following lines to the embedded javascript.

function initfolds() {
    var ssa = document.getElementById("style_js");
    ssa.disabled = false;
};
initfolds();

-- Ambrus
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to