From 413ce92546c8f106a9dcfc91cf7f869a804b5a93 Mon Sep 17 00:00:00 2001 From: Richard Date: Fri, 14 Nov 2014 12:11:35 +0200 Subject: [PATCH 1/2] Allow for dynamic number of columns Added option for adding an attribute to the body tag for customizing number of columns that are overlayed. Attribute is optional, fallback to 12 columns. --- grid.js | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/grid.js b/grid.js index 696fe64..afe11b3 100644 --- a/grid.js +++ b/grid.js @@ -1,26 +1,30 @@ if (document.getElementsByClassName('cb-grid-lines').length){ - + document.body.removeChild(document.getElementsByClassName('cb-grid-lines')[0]); } else { - document.body.innerHTML += '
\ + + var html = "", + numCols = 12, + dataNumCols = document.getElementsByTagName("body")[0].getAttribute("data-bootstrap-num-cols"); + + if(typeof dataNumCols === "string" && dataNumCols.length){ + numCols = parseInt(dataNumCols, 10); + } + + html += '
\
\ -
\ -
\ -
\ -
\ -
\ -
\ -
\ -
\ -
\ -
\ -
\ -
\ -
\ -
\ +
'; + + for (var i = 0; i < numCols; i += 1) { + html += '
'; + } + + html += '
\
\
'; - + + document.body.innerHTML += html; + } \ No newline at end of file From 7abd13ba1c69a3fa2fbcb001ff2bdc7d23983cc5 Mon Sep 17 00:00:00 2001 From: rkorebrits Date: Fri, 14 Nov 2014 12:15:02 +0200 Subject: [PATCH 2/2] Update README.md --- README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5ae5ebf..18b603d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,12 @@ -chrome-bootstrap +chrome-bootstrap-dynamic ================ A Chrome extension to overlay your Bootstrap grid + +Forked version of https://github.com/chuckhendo/chrome-bootstrap + +Added option for adding an attribute to the body tag for customizing +number of columns that are overlayed. +Attribute is optional, fallback to 12 columns. + +