Skip to content
Browse files

Added the InfoToolTip to Firebug

  • Loading branch information...
1 parent d313b76 commit 96c04ac08652537819b88fb73e9650ea7dc67e94 bharath committed Aug 20, 2012
Showing with 90 additions and 0 deletions.
  1. +27 −0 extension/content/firebug/cookies/cookiePanel.js
  2. +63 −0 extension/content/firebug/cookies/cookieReps.js
View
27 extension/content/firebug/cookies/cookiePanel.js
@@ -481,6 +481,33 @@ CookiePanel.prototype = Obj.extend(Firebug.ActivablePanel,
Firebug.Console.removeListener(Firebug.CookieModule.ConsoleListener);
}
},
+
+ // Support for info tips.
+ showInfoTip: function(infoTip, target, x, y)
+ {
+ var row = Dom.getAncestorByClass(target, "cookieRow");
+ if (row && row.repObject)
+ {
+ if (Dom.getAncestorByClass(target, "cookieSizeCol"))
+ {
+ var infoTipCookieId = "cookiesize";
+ if (infoTipCookieId == this.infoTipCookieId && row.repObject == this.infoTipFile)
+ return true;
+
+ this.infoTipCookieId = infoTipCookieId;
+ this.infoTipFile = row.repObject;
+ return this.populateSizeInfoTip(infoTip, row.repObject);
+ }
+ }
+
+ delete this.infoTipURL;
+ return false;
+ },
+ populateSizeInfoTip: function(infoTip, cookie)
+ {
+ CookieReps.SizeInfoTip.render(cookie, infoTip);
+ return true;
+ },
});
// ********************************************************************************************* //
View
63 extension/content/firebug/cookies/cookieReps.js
@@ -928,6 +928,69 @@ CookieReps.CookieCleared = domplate(CookieReps.Rep,
}
});
+
+CookieReps.SizeInfoTip = domplate(Firebug.Rep,
+{
+ tag:
+ TABLE({"class": "sizeInfoTip", "id": "fbNetSizeInfoTip", role:"presentation"},
+ TBODY(
+ FOR("size", "$sizeInfo",
+ TAG("$size|getRowTag", {size: "$size"})
+ )
+ )
+ ),
+
+ sizeTag:
+ TR({"class": "sizeInfoRow", $collapsed: "$size|hideRow"},
+ TD({"class": "sizeInfoLabelCol"}, "$size.label"+" :"),
+ TD({"class": "sizeInfoSizeCol"}, "$size|formatNumber")
+ ),
+
+ separatorTag:
+ TR(
+ TD({"colspan": 3, "height": "7px"})
+ ),
+
+ descTag:
+ TR(
+ TD({"colspan": 3, "class": "sizeInfoDescCol"}, "$size.label")
+ ),
+
+ getRowTag: function(size)
+ {
+ if (size.size == -2)
+ return this.descTag;
+
+ return (size.label == "-") ? this.separatorTag : this.sizeTag;
+ },
+
+ hideRow: function(size)
+ {
+ return size.size < 0;
+ },
+
+ formatSize: function(size)
+ {
+ return Str.formatSize(size.size);
+ },
+
+ formatNumber: function(size)
+ {
+ return size.size ? (Str.formatNumber(size.size)) : "";
+ },
+
+ render: function(cookie, parentNode)
+ {
+ var size = cookie.cookie.name.length + cookie.cookie.value.length;
+ size = Str.formatSize(size);
+ var sizeInfo = [];
+ sizeInfo.push({label: Locale.$STR("cookie.sizeinfo.Cookie_Size"), size: size});
+ //sizeInfo.push({label: Locale.$STR("net.sizeinfo.Post Body"), size: postText.length});
+
+ this.tag.replace({sizeInfo: sizeInfo}, parentNode);
+ },
+});
+
// ********************************************************************************************* //
// Header Template (domplate)

0 comments on commit 96c04ac

Please sign in to comment.
Something went wrong with that request. Please try again.