[Libreoffice-commits] dev-tools.git: help3/xhpeditor
Olivier Hallot (via logerrit)
logerrit at kemper.freedesktop.org
Mon Dec 9 16:18:07 UTC 2019
help3/xhpeditor/DisplayArea.js | 67 ++++++++++++++++++++++++++++++++++++++---
help3/xhpeditor/index.php | 16 ++++++---
help3/xhpeditor/xhpeditor.css | 13 ++++++-
3 files changed, 84 insertions(+), 12 deletions(-)
New commits:
commit a8ca35cbeec21eec2b2eb9bab25b02a23b736f4d
Author: Olivier Hallot <olivier.hallot at libreoffice.org>
AuthorDate: Mon Dec 9 13:16:06 2019 -0300
Commit: Olivier Hallot <olivier.hallot at libreoffice.org>
CommitDate: Mon Dec 9 17:17:50 2019 +0100
Add appl switch selector
Change-Id: Ie412a4b391a444b1f68e750fd657c0a817e836f2
Reviewed-on: https://gerrit.libreoffice.org/84769
Reviewed-by: Olivier Hallot <olivier.hallot at libreoffice.org>
Tested-by: Olivier Hallot <olivier.hallot at libreoffice.org>
diff --git a/help3/xhpeditor/DisplayArea.js b/help3/xhpeditor/DisplayArea.js
index cd2d83f..c5ee48b 100644
--- a/help3/xhpeditor/DisplayArea.js
+++ b/help3/xhpeditor/DisplayArea.js
@@ -9,11 +9,10 @@
// scripts for rendered DisplayArea
-// Used to set system in case, caseinline=SYSTEM
-
+// Used to set system in case, caseinline=sys
function setSystemSpan(system) {
hideSystemSpan();
- var spans = document.querySelectorAll("[class^=switch]");
+ var spans = document.querySelectorAll("[class^=switch]");//this selector can be bounded to DisplayArea div
for (z = 0; z < spans.length; z++) {
var id = spans[z].getAttribute("id");
if (id === null) {
@@ -47,7 +46,7 @@ function setSystemSpan(system) {
}
}
function hideSystemSpan(){
- var spans = document.querySelectorAll("[class^=switch]");
+ var spans = document.querySelectorAll("[class^=switch]");//this selector can be bounded to DisplayArea div
for (z = 0; z < spans.length; z++) {
var id = spans[z].getAttribute("id");
if (id === null) {
@@ -67,3 +66,63 @@ function hideSystemSpan(){
}
}
}
+// Used to set application in case, caseinline=appl
+function setApplSpan(appl) {
+ hideApplSpan();
+ var spans = document.querySelectorAll("[class^=switch]");//this selector can be bounded to DisplayArea div
+ for (z = 0; z < spans.length; z++) {
+ var id = spans[z].getAttribute("id");
+ if (id === null) {
+ continue;
+ }
+ else if (id.startsWith("swlnappl")) {
+ var y = spans[z].getElementsByTagName("SPAN");
+ var n = y.length;
+ var foundSystem = false;
+ // unhide selectively
+ for (i = 0; i < n; i++) {
+ if (y[i].getAttribute("id") === null){
+ continue;
+ }
+ else if( y[i].getAttribute("id").startsWith(appl)){
+ y[i].removeAttribute("hidden");
+ foundSystem=true;
+ }
+ }
+ for (i = 0; i < n; i++) {
+ if (y[i].getAttribute("id") === null){
+ continue;
+ }
+ else if( y[i].getAttribute("id").startsWith("default")){
+ if(!foundSystem){
+ y[i].removeAttribute("hidden");
+ }
+ }
+ }
+ }
+ }
+}
+function hideApplSpan(){
+ var spans = document.querySelectorAll("[class^=switch]"); //this selector can be bounded to DisplayArea div
+ for (z = 0; z < spans.length; z++) {
+ var id = spans[z].getAttribute("id");
+ if (id === null) {
+ continue;
+ }else if(id.startsWith("swlnappl")) {
+ var y = spans[z].getElementsByTagName("SPAN");
+ var n = y.length;
+ for (i = 0; i < n; i++) {
+ if (y[i].getAttribute("id") === null){
+ continue;
+ }
+ else if( y[i].getAttribute("id").startsWith("WRITER")){y[i].setAttribute("hidden","true");}
+ else if( y[i].getAttribute("id").startsWith("CALC")){y[i].setAttribute("hidden","true");}
+ else if( y[i].getAttribute("id").startsWith("IMPRESS")){y[i].setAttribute("hidden","true");}
+ else if( y[i].getAttribute("id").startsWith("DRAW")){y[i].setAttribute("hidden","true");}
+ else if( y[i].getAttribute("id").startsWith("BASE")){y[i].setAttribute("hidden","true");}
+ else if( y[i].getAttribute("id").startsWith("MATH")){y[i].setAttribute("hidden","true");}
+ else if( y[i].getAttribute("id").startsWith("default")){y[i].setAttribute("hidden","true");}
+ }
+ }
+ }
+}
diff --git a/help3/xhpeditor/index.php b/help3/xhpeditor/index.php
index dd9e5bf..6be0b34 100644
--- a/help3/xhpeditor/index.php
+++ b/help3/xhpeditor/index.php
@@ -133,11 +133,17 @@ echo $xhp;
<?php
$xhp = $_POST["xhpdoc"];
if (isset($_POST["render_page"])) {
- echo '<h2>Rendered page</h2>';
- echo '<button onclick="setSystemSpan(\'MAC\')" class="snip_buttons">MAC</button>';
- echo '<button onclick="setSystemSpan(\'WIN\')" class="snip_buttons">WIN</button>';
- echo '<button onclick="setSystemSpan(\'UNIX\')" class="snip_buttons">UNIX</button>';
- echo '<div id="renderedpage">';
+ echo '<h2>Rendered page</h2><div class="buttonrow"><div class="systembuttons">';
+ $opSys = array("MAC", "WIN", "UNIX");
+ foreach ($opSys as $value) {
+ echo '<button onclick="setSystemSpan(\''.$value.'\')" class="snip_buttons">'.$value.'</button>';
+ }
+ echo '</div><div class="applbuttons">';
+ $appModule = array("WRITER", "CALC", "IMPRESS", "DRAW", "BASE", "MATH");
+ foreach ($appModule as $value){
+ echo '<button onclick="setApplSpan(\''.$value.'\')" class="snip_buttons">'.$value.'</button>';
+ }
+ echo '</div></div><div id="renderedpage">';
$xml = new DOMDocument();
$xml->loadXML($xhp);
$xsl = new DOMDocument;
diff --git a/help3/xhpeditor/xhpeditor.css b/help3/xhpeditor/xhpeditor.css
index 797b10b..658a237 100644
--- a/help3/xhpeditor/xhpeditor.css
+++ b/help3/xhpeditor/xhpeditor.css
@@ -44,15 +44,22 @@
overflow: scroll;
border:1px solid grey;
}
-
-/* Imported from default css for DisplayArea */
-
+.buttonrow{
+}
+.systembuttons{
+ float:left;
+}
+.applbuttons{
+ float:right;
+}
#renderedpage {
background-color: gray;
margin: 10px;
line-height: normal;
+ clear:left;
}
+/* Imported from default css for DisplayArea */
#DisplayArea {
background-color: white;
overflow: auto;
More information about the Libreoffice-commits
mailing list