forked from auipga/bootstrap-xxs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bsdebug_bookmarklet.min.js
4 lines (4 loc) · 3.27 KB
/
bsdebug_bookmarklet.min.js
1
2
3
4
/**
* Created by auipga on 18.08.14.
*/
var runBsDebug=function(){$("head").append('<style type="text/css">#bsdebug{position:fixed;top:10px;left:10px;background-color:rgba(255, 255, 255, 0.80);color:#00000;z-index:9999;}#bsdebug table{border:1px;}#bsdebug td,#bsdebug th{border:1px solid black;padding:2px;}#bsdebug td{text-align:center;}#bsdebug .bold{font-weight:bold;}#bsdebug .highlighted{background-color:rgba(15, 230, 0, 0.67);}</style>');$("body").append('<div id="bsdebug"><table><tr id="bsdebug-size"><td colspan="7" style="text-align:left"><span class="bold hidden-tn hidden-xxs"><a href="https://github.com/auipga/bootstrap-xxs/">BS-Debug</a></span>| w<span class="hidden-tn">idth</span>:<span class="bold" id="bsdebug-width">?</span>px<span title="ScrollbarWidth" class="small" style="border-bottom:1px black dotted; cursor:help;">(-'+getScrollbarWidth()+'px)</span>| h<span class="hidden-tn">eigth</span>:<span class="bold" id="bsdebug-height">?</span>px</td></tr><tr id="bsdebug-breakpoint"><th></th><td><span class="visible-tn-blockhighlighted">TN</span><span class="hidden-tn">TN</span></td><td><span class="visible-xxs-block highlighted">XXS</span><span class="hidden-xxs">XXS</span></td><td><span class="visible-xs-blockhighlighted">XS</span><span class="hidden-xs">XS</span></td><td class="hidden-tn"><span class="visible-sm-blockhighlighted">SM</span><span class="hidden-sm">SM</span></td><td class="hidden-tn hidden-xxs"><span class="visible-md-blockhighlighted">MD</span><span class="hidden-md">MD</span></td><td class="hidden-tn hidden-xxs"><span class="visible-lg-blockhighlighted">LG</span><span class="hidden-lg">LG</span></td></tr><tr id="bsdebug-min" class="small"><th>Min</th><td>0px</td><td>≥384px</td><td>≥480px</td><td class="hidden-tn">≥768px</td><td class="hidden-tn hidden-xxs">≥992px</td><td class="hidden-tn hidden-xxs">≥1200px</td></tr><tr id="bsdebug-max" class="small"><th>Max</th><td><383px</td><td><479px</td><td><767px</td><td class="hidden-tn"><991px</td><td class="hidden-tn hidden-xxs"><1199px</td><td class="hidden-tn hidden-xxs">∞</td></tr><tr id="bsdebug-diff"><th>Diff</th><td></td><td></td><td></td><td class="hidden-tn"></td><td class="hidden-tn hidden-xxs"></td><td class="hidden-tn hidden-xxs"></td></tr></table></div>');var a=getScrollbarWidth();$(window).on("resize",function(f){var g=$(window);var c=g.width()+a;var b=g.height();$("#bsdebug-width").text(c);$("#bsdebug-height").text(b);var d=[0,384,480,768,992,1200,9999];$("#bsdebug-diff>td").each(function(e){var h=c-d[e];if(h>=0){$("#bsdebug-min td").eq(e).css({"background-color":"rgba(127, 219, 124, 0.67)","font-weight":"bold"})}else{$("#bsdebug-min td").eq(e).css({"background-color":"","font-weight":""})}if(d[e+1]>c){$("#bsdebug-max td").eq(e).css({"background-color":"rgba(127, 219, 124, 0.67)","font-weight":"bold"})}else{$("#bsdebug-max td").eq(e).css({"background-color":"","font-weight":""})}if(h>0){h="+"+h}$(this).text(h)})});$(window).trigger("resize")};runBsDebug();function getScrollbarWidth(){var d=document.createElement("div");d.style.visibility="hidden";d.style.width="100px";document.body.appendChild(d);var b=d.offsetWidth;d.style.overflow="scroll";var a=document.createElement("div");a.style.width="100%";d.appendChild(a);var c=a.offsetWidth;d.parentNode.removeChild(d);return b-c};