Java Code Examples for org.jsoup.nodes.Element#after()
The following examples show how to use
org.jsoup.nodes.Element#after() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CukedoctorScriptExtension.java From cukedoctor with Apache License 2.0 | 5 votes |
private void addMinMaxScript(Element contentElement) { String minMaxScript = HIDE_FEATURES_SECTION ? getMinMaxScriptForDocWithoutFeaturesSection() : "<script type=\"text/javascript\">\n" + "\tfunction showFeatureScenarios(featureId){\n" + "\t\tvar element = document.getElementById(featureId).parentNode;\n" + "\t\tfor (var i = 0; i < element.childNodes.length; i++) {\n" + " \t\tif (element.childNodes[i].className == \"sect3\" || element.childNodes[i].className == \"fa fa-minus-square fa-fw\") {\n" + " \t\t element.childNodes[i].style.display = 'inline';\n" + " \t\t\t}\n" + " \t\tif (element.childNodes[i].className == \"sidebarblock\") {\n" + " \t\t element.childNodes[i].style.display = 'block';\n" + " \t\t\t}\t\t\t \n" + "\t\t}\n" + "\t\t \n" + " \t\tdocument.getElementById(featureId).children[0].click();\n" + "\t}\n" + "\n" + "\tfunction hideFeatureScenarios(featureId){\n" + "\t\tvar element = document.getElementById(featureId).parentNode;\n" + "\t\tfor (var i = 0; i < element.childNodes.length; i++) {\n" + " \t\tif (element.childNodes[i].className == \"sect3\" || element.childNodes[i].className == \"sidebarblock\") { \n" + " \t\t element.childNodes[i].style.display = 'none';\t \t\t \n" + " \t}\n" + "\t\t \n" + "\t\t}\n" + "\t document.getElementById(featureId).children[0].click();\n" + " \t}\n" + "\n" + "</script>"; contentElement.after(minMaxScript); }
Example 2
Source File: Elements.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Insert the supplied HTML after each matched element's outer HTML. * @param html HTML to insert after each element * @return this, for chaining * @see Element#after(String) */ public Elements after(String html) { for (Element element : this) { element.after(html); } return this; }
Example 3
Source File: Elements.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Insert the supplied HTML after each matched element's outer HTML. * @param html HTML to insert after each element * @return this, for chaining * @see Element#after(String) */ public Elements after(String html) { for (Element element : this) { element.after(html); } return this; }
Example 4
Source File: Elements.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Insert the supplied HTML after each matched element's outer HTML. * @param html HTML to insert after each element * @return this, for chaining * @see Element#after(String) */ public Elements after(String html) { for (Element element : this) { element.after(html); } return this; }
Example 5
Source File: Elements.java From jsoup-learning with MIT License | 5 votes |
/** * Insert the supplied HTML after each matched element's outer HTML. * @param html HTML to insert after each element * @return this, for chaining * @see Element#after(String) */ public Elements after(String html) { for (Element element : contents) { element.after(html); } return this; }
Example 6
Source File: CukedoctorScriptExtension.java From cukedoctor with Apache License 2.0 | 4 votes |
private void addThemeScript(Element contentElement) { String themeScript = " <script type=\"text/javascript\"> \n" + "\n" + "document.addEventListener(\"DOMContentLoaded\", function(event) { \n" + " themefy();\n" + "});\n" + "\tfunction themefy() {\n" + " \t\t\t\t\t\tvar theme = getThemeFromQueryParameters() || 'asciidoctor';\n" + " \t\t\t\t\t\tvar themeLink = document.createElement('link');\n" + "\t\t\t\t\t if('asciidoctor' !== theme) {" + " \t\t\t\t\t\tthemeLink.rel = 'stylesheet';\n" + " \t\t\t\t\t\tthemeLink.id = 'asciidoctor-style';\n" + " \t\t\t\t\t\tthemeLink.href = 'themes/' + theme + '.css';\n" + " \t\t\t\t\t\t document.head.appendChild(themeLink);\n" + "\t\t\t\t }" + "}\n" + "\n" + "\n" + "\tfunction getThemeFromQueryParameters() {\n" + "\t\tvar query = location.search.substr(1);\n" + "\t\tvar result = 'asciidoctor';\n" + "\tquery.split(\"&\").forEach(function (part) {\n" + "\t\t\t\t// part can be empty\n" + "\t\t\t\tif (part) {\n" + "\t\t\t\t\tvar item = part.split(\"=\");\n" + "\t\t\t\t\tvar key = item[0];\n" + "\t\t\t\tvar value = item[1];\n" + "\t\t\t\tif (typeof value !== 'undefined') {\n" + "\t\t\t\t\t\tif(key == 'theme'){\n" + "\t\t\t\t\t\t\t\tresult = value;\n" + "\t\t\t\t\t\t\t\t}\n" + "\t\t\t}\n" + "\t\t}\n" + " \t});\n" + "\tif(!result){\n" + "\t\tresult = 'asciidoctor';\n" + "\t\t\n\t}\n" + "\tdocument.getElementById('themes').value = result; \n" + "\tvar els = document.querySelector('select[name=\"select\"] option[value=\"' + result + '\"]'); \n" + "\tif(els){\n" + " els.selected = true;\n" + "\t}" + "\treturn result;\n" + "}\n" + " \n" + "</script> "; contentElement.after(themeScript); }
Example 7
Source File: CukedoctorStyleExtension.java From cukedoctor with Apache License 2.0 | 4 votes |
private void addFooterStyle(Element contentElement) { String styleClass = " <style> \n" + "\n" + "#content:padding:0!important;\n" + ".sidebarblock, .sectionbody, .content{\n" + "overflow:auto!important;\n" + "}\ndiv.sidebarblock {overflow-y:hidden;overflow-x:auto}\n body .exampleblock > .content{ background:#fff}"; contentElement.after(styleClass); }