Module: QueryDiet::Widget
- Defined in:
- lib/query_diet/widget.rb,
lib/query_diet/widget/helper.rb
Defined Under Namespace
Modules: Helper
Class Method Summary collapse
Class Method Details
.css(nonce_attribute) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/query_diet/widget.rb', line 5 def css(nonce_attribute) " <style type=\"text/css\"\#{nonce_attribute}><!--\n div#query_diet {\n position: absolute;\n top: 0;\n right: 0;\n background-color: black;\n color: white;\n z-index: 99999;\n padding: 4px 6px;\n font: normal bold 12px/12px Arial, sans-serif;\n cursor: pointer;\n }\n div#query_diet.good {\n filter:alpha(opacity=30);\n -moz-opacity:0.3;\n -khtml-opacity: 0.3;\n opacity: 0.3;\n }\n div#query_diet.bad {\n background-color: red;\n font-size: 16px;\n line-height: 16px;\n }\n --></style>\n EOF\nend\n" |
.html(options) ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/query_diet/widget.rb', line 44 def html() " <div id=\"query_diet\" class=\"\#{QueryDiet::Logger.bad?(options) ? 'bad' : 'good' }\">\n \#{QueryDiet::Logger.count} / \#{QueryDiet::Logger.time}ms\n </div>\n EOF\nend\n" |
.js(nonce_attribute) ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/query_diet/widget.rb', line 34 def js(nonce_attribute) " <script type=\"text/javascript\"\#{nonce_attribute}>\n document.getElementById(\"query_diet\").addEventListener(\"click\", function() {\n this.parentNode.removeChild(this);\n });\n </script>\n EOF\nend\n" |