Merge "upd: Reduce Boilerplate in translated SprintfCommands"
authorFelix Dörre <felix@dogcraft.de>
Sun, 19 Jun 2016 17:10:00 +0000 (19:10 +0200)
committerGerrit Code Review <gigi-system@dogcraft.de>
Sun, 19 Jun 2016 17:10:00 +0000 (19:10 +0200)
src/org/cacert/gigi/Gigi.templ
src/org/cacert/gigi/output/template/Template.java
static/static/js/expert.js [moved from static/static/expert.js with 100% similarity]
static/static/js/localDate.js [new file with mode: 0644]
static/static/menu.js [deleted file]

index 26ce9206e4c3c73e4d7fed2fe7d569726c5f5bd1..a163c7d532f74f74bdb5f3f9500b33c9e6a29e6c 100644 (file)
@@ -8,14 +8,14 @@
         <meta name="description" content="">
         <link rel="stylesheet" href="<?=$static?>/css/jquery-ui-timepicker-addon.css">
         <meta name="viewport" content="width=device-width, initial-scale=1">
-        <link rel="apple-touch-icon" href="<?=$static?>/apple-touch-icon.png">
 
         <link rel="stylesheet" href="<?=$static?>/css/bootstrap.min.css">
         <link rel="stylesheet" href="<?=$static?>/css/cacert.css">
-        
+
         <script src="<?=$static?>/js/jquery.min.js"></script>
         <script src="<?=$static?>/js/bootstrap.min.js"></script>
-        <script src="<?=$static?>/expert.js"></script>
+        <script src="<?=$static?>/js/expert.js"></script>
+        <script src="<?=$static?>/js/localDate.js"></script>
     </head>
 <body>
 <nav class="navbar navbar-default">
index cc56baf813b8e731c855c71cf0213de912f0651c..15f3408d28ce41d10d55b4f9491fdaf223cb0d84 100644 (file)
@@ -213,9 +213,11 @@ public class Template implements Outputable {
         } else if (s instanceof DayDate) {
             out.print(DateSelector.getDateFormat().format(((DayDate) s).toDate()));
         } else if (s instanceof Date) {
-            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-            out.print(sdf.format(s));
-            out.print(" UTC");
+            SimpleDateFormat sdfUI = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
+            out.print("<time datetime=\"" + sdf.format(s) + "\">");
+            out.print(sdfUI.format(s));
+            out.print(" UTC</time>");
         } else {
             out.print(s == null ? "null" : (unescaped ? s.toString() : HTMLEncoder.encodeHTML(s.toString())));
         }
diff --git a/static/static/js/localDate.js b/static/static/js/localDate.js
new file mode 100644 (file)
index 0000000..0935810
--- /dev/null
@@ -0,0 +1,29 @@
+(function() {
+       function init(){
+               var elems = document.getElementsByTagName("time");
+               for(var i = 0; i < elems.length; i++){
+                       elems[i].setAttribute("title", elems[i].textContent);
+                       elems[i].removeChild(elems[i].firstChild);
+                       var t = elems[i].getAttribute("datetime");
+                       elems[i].appendChild(document.createTextNode(new Date(t).toLocaleString(undefined, {timeZoneName: "short",
+                               year: "numeric",
+                               month: "2-digit",
+                               day: "2-digit",
+                               hour: "2-digit",
+                               minute: "2-digit",
+                               second: "2-digit"})
+                               ));
+               }
+       }
+       (function(oldLoad) {
+               if (oldLoad == undefined) {
+                       window.onload = init;
+               } else {
+                       window.onload = function() {
+                               init();
+                               oldLoad();
+                       }
+               }
+       })(window.onload);
+
+})();
diff --git a/static/static/menu.js b/static/static/menu.js
deleted file mode 100644 (file)
index bcaee0d..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-(function() {
-       function explodeMenu(e) {
-               if (e.className == 'menu hidden') {
-                       e.className = 'menu';
-               } else {
-                       e.className = 'menu hidden';
-               }
-       }
-
-       function initMenu() {
-               var Nodes = document.getElementsByTagName('ul');
-               var max = Nodes.length;
-               for (var i = 0; i < max; i++) {
-                       var nodeObj = Nodes.item(i);
-                       if (nodeObj.className.indexOf("menu") > -1 && nodeObj.id != "recom") {
-                               nodeObj.previousSibling.previousSibling.onclick = (function(node) {
-                                       return function() {
-                                               explodeMenu(node);
-                                       };
-                               })(nodeObj);
-                       }
-               }
-       }
-
-       (function(oldLoad) {
-               if (oldLoad == undefined) {
-                       window.onload = init;
-               } else {
-                       window.onload = function() {
-                               initMenu();
-                               oldLoad();
-                       }
-               }
-       })(window.onload);
-
-})();