diff --git a/tools/grid-bookmarklet/README.md b/tools/grid-bookmarklet/README.md deleted file mode 100644 index 205b087d5acb..000000000000 --- a/tools/grid-bookmarklet/README.md +++ /dev/null @@ -1,14 +0,0 @@ -## Gridlet - -![grid view](screenshot.png) - -The gridlet bookmarklet overlays the NextGen grid over the current page. It can be dragged around and can also be controlled by keyboard. - -- **G**: Hide/Show grid -- **D**: Desaturate content area -- **Arrow keys**: precise positioning - -Copy the code below to the bookmarks bar: -``` -javascript:(function()%7Bdocument.body.appendChild(document.createElement('script')).src='https://rawgithub.com/guardian/frontend/master/tools/grid-bookmarklet/grid.js?'+(new Date()).getTime();%7D)(); -``` diff --git a/tools/grid-bookmarklet/grid.css b/tools/grid-bookmarklet/grid.css deleted file mode 100644 index 6ddbad14a807..000000000000 --- a/tools/grid-bookmarklet/grid.css +++ /dev/null @@ -1,71 +0,0 @@ -/* - $gs-gutter: 20px; - $gs-baseline: 12px; - $gs-column-width: 60px; - $gs-row-height: 36px; - $gs-max-columns: 16; -*/ - -.grid-overlay, -.grid-column, -.grid-row { - box-sizing: border-box; -} - -.grid-overlay { - position: absolute; - top: 0px; - left: 0px; - width: 100%; - height: 400px; - z-index: 10000; - overflow: hidden; - cursor: move; -} - -.grid-overlay.is-hidden { - display: none; -} - - -.grid-cols, -.grid-rows { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - pointer-events: none; -} - -.grid-column { - position: absolute; - width: 60px; - height: 100%; - border-left: 1px solid cyan; - border-right: 1px solid cyan; -} - - -.grid-row { - width: 100%; - height: 36px; - border-top: 1px solid #cccccc; - border-bottom: 1px solid #cccccc; - position: absolute; - margin: 12px 0; -} - - -#header, -#preloads, -.footer { - -webkit-transition: 1s -webkit-filter ease-out, 1s opacity ease-out; -} - -.is-desaturated #header, -.is-desaturated #preloads, -.is-desaturated .footer { - -webkit-filter: grayscale(100%); - opacity: 0.5; -} \ No newline at end of file diff --git a/tools/grid-bookmarklet/grid.js b/tools/grid-bookmarklet/grid.js deleted file mode 100644 index 20b893bccbfa..000000000000 --- a/tools/grid-bookmarklet/grid.js +++ /dev/null @@ -1,163 +0,0 @@ -//javascript:(function()%7Bdocument.body.appendChild(document.createElement('script')).src='https://raw.github.com/guardian/frontend/master/tools/grid-bookmarklet/grid.js?'+(new Date()).getTime();%7D)(); - -require([ - 'common', - 'bonzo', - 'bean' -], function ( - common, - bonzo, - bean -) { - - var scriptBase = document.querySelector('script[src*="grid.js"]').src.split('grid.js?')[0], - cssUrl = scriptBase + 'grid.css', - colWidth = 80, // 60 + 20 - rowHeight = 48, // 36 + 12 - docW, - docH, - gridIsVisible = true, - $gridEl; - - - function init() { - // Clean up and load stylesheet - common.$g('.grid-overlay, link[href*="grid.css"], script[src*="grid.js"]').remove(); - bonzo(document.querySelector('head')).append(''); - } - - - function buildGrid() { - // Build grid template - var gridTemplate = '
' + - '
' + - '
' + - '
'; - - if (!$gridEl) { - $gridEl = bonzo(bonzo.create(gridTemplate)); - bonzo(document.body).append($gridEl); - } - - layout(); - - var $colsEl = bonzo($gridEl[0].querySelector('.grid-cols')), - $rowsEl = bonzo($gridEl[0].querySelector('.grid-rows')); - - // First came the columns... - $colsEl.empty(); - for (var i=0; i<(docW/colWidth); i++) { - leftPos = i * colWidth; - $colsEl.append('
'); - } - - // ...and then the rows - $rowsEl.empty(); - for (var i=0; i<(docH/rowHeight); i++) { - topPos = i * rowHeight; - $rowsEl.append('
'); - } - } - - - function layout() { - // Get document dimensions - var $doc = bonzo(document); - docW = $doc.dim().width, - docH = $doc.dim().height; - - $gridEl.css({ - width: docW+'px', - height: docH+'px' - }); - - // Set these again, in case they've changed - docW = $doc.dim().width, - docH = $doc.dim().height; - } - - - function bindEvents() { - // Event handlers - var startingX, - startingY, - startingGridTop, - staringGridLeft, - dragging; - - bean.on(window, 'resize', common.debounce(function(e){ - buildGrid(); - }, 500)); - - bean.on(document.body, 'keydown', function(e) { - startingGridTop = parseInt($gridEl.css('top'), 10); - startingGridLeft = parseInt($gridEl.css('left'), 10); - var moveBy = e.shiftKey ? 5 : 1; // Move faster when shift key is down - - if (e.keyCode === 71) { - // g key - toggle grid visiblity - $gridEl.toggleClass('is-hidden'); - gridIsVisible = gridIsVisible ? false : true; - } else if (e.keyCode === 68) { - // d key - desaturate content area - bonzo(document.body).toggleClass('is-desaturated'); - } else if (e.keyCode === 38) { - // Up - $gridEl[0].style.top = (startingGridTop - moveBy) + 'px'; - } else if (e.keyCode === 40) { - // Down - $gridEl[0].style.top = (startingGridTop + moveBy) + 'px'; - } else if (e.keyCode === 37) { - // Left - $gridEl[0].style.left = (startingGridLeft - moveBy) + 'px'; - } else if (e.keyCode === 39) { - // Right - $gridEl[0].style.left = (startingGridLeft + moveBy) + 'px'; - } - - if ([71,68,38,40,37,39].indexOf(e.keyCode) != -1 && gridIsVisible) { - e.preventDefault(); - } - }); - - bean.on(document.querySelector('.grid-overlay'), { - mousedown: function(e) { - dragging = true; - startingX = e.pageX; - startingY = e.pageY; - startingGridTop = parseInt($gridEl.css('top'), 10); - startingGridLeft = parseInt($gridEl.css('left'), 10); - }, - - mousemove: function(e) { - if (dragging == true) { - var offsetX = e.pageX - startingX, - offsetY = e.pageY - startingY; - - $gridEl[0].style.left = (startingGridLeft + offsetX) + 'px'; - $gridEl[0].style.top = (startingGridTop + offsetY) + 'px'; - } - }, - - 'mouseup mouseout': function(e) { - dragging = false; - } - }); - - - // Check for document size changes, and repaint the grid if needed - setInterval(function() { - var $doc = bonzo(document); - if (docW !== $doc.dim().width || docH !== $doc.dim().height) { - buildGrid(); - } - }, 2000); - } - - - - init(); - buildGrid(); - bindEvents(); - -}); diff --git a/tools/grid-bookmarklet/screenshot.png b/tools/grid-bookmarklet/screenshot.png deleted file mode 100644 index dca0b64e072f..000000000000 Binary files a/tools/grid-bookmarklet/screenshot.png and /dev/null differ