Merge pull request #5240 from osmandapp/JsonContentsParser

Json contents parser
This commit is contained in:
Alexey 2018-04-15 14:46:34 +03:00 committed by GitHub
commit a7206a07f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -27,7 +27,9 @@ import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.wikivoyage.WikivoyageBaseDialogFragment;
import net.osmand.plus.wikivoyage.WikivoyageWebViewClient;
import net.osmand.plus.wikivoyage.data.WikivoyageArticle;
import net.osmand.plus.wikivoyage.data.WikivoyageLocalDataHelper;
import net.osmand.util.Algorithms;
@ -70,6 +72,21 @@ public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragmen
" doc.classList.toggle(\"active\");\n" +
" var content = doc.nextElementSibling;\n" +
" content.style.display = \"block\";\n" +
" collapseActive(doc);" +
"}" +
"function collapseActive(doc) {" +
" var coll = document.getElementsByTagName(\"H2\");" +
" var i;" +
" for (i = 0; i < coll.length; i++) {" +
" var item = coll[i];" +
" if (item != doc && item.classList.contains(\"active\")) {" +
" item.classList.toggle(\"active\");" +
" var content = item.nextElementSibling;" +
" if (content.style.display === \"block\") {" +
" content.style.display = \"none\";" +
" }" +
" }" +
" }" +
"}</script>"
+ "</body></html>";