You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2015/05/06 19:05:38 UTC

svn commit: r1678045 - in /myfaces/tobago/branches/tobago-3.0.x: ./ tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-console.js

Author: lofwyr
Date: Wed May  6 17:05:37 2015
New Revision: 1678045

URL: http://svn.apache.org/r1678045
Log:
Merged from trunk
console debug window (only if the browser console is not supported)
* implement: "hide for session"
* smaller window, to prevent autoreload on resize [from revision 1656502]

Modified:
    myfaces/tobago/branches/tobago-3.0.x/   (props changed)
    myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-console.js

Propchange: myfaces/tobago/branches/tobago-3.0.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed May  6 17:05:37 2015
@@ -1,3 +1,3 @@
 /myfaces/tobago/branches/tobago-1.5.x:1356585,1357124
 /myfaces/tobago/branches/tobago-tree-table:1226794-1341423
-/myfaces/tobago/trunk:1571193,1571804,1571816,1571941,1571945,1571962,1571966,1576730,1589960,1591854,1600239,1600818,1601860,1602151,1602154,1602343,1604224,1606201,1607642,1609696-1609697,1609718,1610942,1610948,1610970,1610989,1611011,1611259,1611264,1611276,1611329,1611338-1611339,1611571,1613015,1613032,1614827,1614853,1615053,1615114,1615121,1617310,1619789,1621101,1621107,1621134,1621156,1621264,1621282,1621332,1622222,1622243,1622508,1623934,1624033,1625968,1625972,1626270,1628899,1628953,1636842,1636911,1640117,1640147,1640541,1640548,1640638,1640761,1640917,1641575,1641635,1641772,1641775,1641777,1657180,1657269,1657276,1657279,1658909,1658912,1659026,1659031,1660696,1660699,1660708,1660714,1665569,1666464,1668147,1668153,1668249,1675330,1675565,1675584,1675588-1675589,1675636
+/myfaces/tobago/trunk:1571193,1571804,1571816,1571941,1571945,1571962,1571966,1576730,1589960,1591854,1600239,1600818,1601860,1602151,1602154,1602343,1604224,1606201,1607642,1609696-1609697,1609718,1610942,1610948,1610970,1610989,1611011,1611259,1611264,1611276,1611329,1611338-1611339,1611571,1613015,1613032,1614827,1614853,1615053,1615114,1615121,1617310,1619789,1621101,1621107,1621134,1621156,1621264,1621282,1621332,1622222,1622243,1622508,1623934,1624033,1625968,1625972,1626270,1628899,1628953,1636842,1636911,1640117,1640147,1640541,1640548,1640638,1640761,1640917,1641575,1641635,1641772,1641775,1641777,1656502,1657180,1657269,1657276,1657279,1658909,1658912,1659026,1659031,1660696,1660699,1660708,1660714,1665569,1666464,1668147,1668153,1668249,1675330,1675565,1675584,1675588-1675589,1675636

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-console.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-console.js?rev=1678045&r1=1678044&r2=1678045&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-console.js (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-console.js Wed May  6 17:05:37 2015
@@ -68,9 +68,11 @@ if (!window.console) {
 
 if (!console.log) {
   console.log = function (message, other) {
-    var console = jQuery(".tobago-console");
-    console.show();
-    var body = console.children(":last");
+    var div = jQuery(".tobago-console");
+    if (! console.isConsoleHidden()) {
+      div.show();
+    }
+    var body = div.children(":last");
     var parameters = Array.prototype.slice.call(arguments).join(", ");
     parameters.substr(0, parameters.length - 2);
 
@@ -83,40 +85,53 @@ if (!console.log) {
   };
 
   jQuery(document).ready(function () {
-    var console = jQuery("<div>").appendTo("body");
-    console.addClass("tobago-console");
-    console.css({
-      border: "5px solid red",
+    var div = jQuery("<div>").appendTo("body");
+    div.addClass("tobago-console");
+    div.css({
+      border: "2px solid red",
       padding: "10px",
       position: "absolute",
-      left: "200px",
-      top: "200px",
+      left: "50px",
+      top: "50px",
+      width: "500px",
+      height: "200px",
       backgroundColor: "#ffffff",
       filter: "alpha(opacity=70)",
-      opacity: 0.7
+      opacity: 0.7,
+      overflow: "auto"
     });
-    console.hide();
-    var header = jQuery("<div>").appendTo(console);
+    div.hide();
+    var header = jQuery("<div>").appendTo(div);
     header.css({
-      border: "1px solid red",
-      marginBottom: "5px"
-    });
-    var body = jQuery("<div>").appendTo(console);
-    body.css({
-      overflow: "auto"
+//      border: "1px solid red",
+      padding: "0 15px 5px 0"
     });
-    header.css("background-color", "red");
+    var body = jQuery("<div>").appendTo(div);
     var title = jQuery("<span>simple console replacement</span>").appendTo(header);
+    title.css({fontWeight: "bolder"});
     var close = jQuery("<button>").appendTo(header);
     close.attr("type", "button");
     close.append("Hide");
-    close.click(function () {
-      console.hide();
+    close.click(function (event) {
+      event.preventDefault();
+      event.stopPropagation();
+      div.hide();
+    });
+    var closeForSession = jQuery("<button>").appendTo(header);
+    closeForSession.attr("type", "button");
+    closeForSession.append("Hide for this Session");
+    closeForSession.click(function (event) {
+      event.preventDefault();
+      event.stopPropagation();
+      div.hide();
+      console.hideConsoleForThisSession();
     });
     var clear = jQuery("<button>").appendTo(header);
     clear.attr("type", "button");
     clear.append("Clear");
-    clear.click(function () {
+    clear.click(function (event) {
+      event.preventDefault();
+      event.stopPropagation();
       body.children("p").detach();
     });
   });
@@ -275,3 +290,17 @@ if (!console.trace) {
     console.log("STACK TRACE: " + console.util_stack_trace());
   };
 }
+
+console.hideConsoleForThisSession = function() {
+  document.cookie = "tobagoHideConsole";
+};
+
+console.isConsoleHidden = function () {
+  var part = document.cookie.split(';');
+  for (var i = 0; i < part.length; i++) {
+    if ("tobagoHideConsole" == part[i]) {
+      return true;
+    }
+  }
+  return false;
+};