Skip to content

Instantly share code, notes, and snippets.

@oak-tree
Last active August 29, 2015 14:14
Show Gist options
  • Select an option

  • Save oak-tree/d300e882a54b9de428b2 to your computer and use it in GitHub Desktop.

Select an option

Save oak-tree/d300e882a54b9de428b2 to your computer and use it in GitHub Desktop.
mark all border in page
//add javascript line into your bookmark and click on a page
//known bug: if jquery is not loaded this will only work on the 2nd click
javascript: (function() { if (!window.jQuery) { var script = document.createElement('script'); script.src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js";
document.body.appendChild(script); } if (window.markAllElementsBackground) { $('*').each(function() { $(this).css('background-color',$(this).data('save-background-color-data')) }); window.markAllElementsBackground = false; } else { $('*').each(function() { $(this).data('save-background-color-data', $(this).css('background-color')); var color = "#" + Math.floor(Math.random() * 0xFFFFFF).toString(16);$(this).css('background-color', color )}); window.markAllElementsBackground = true ; }})();
//add javascript line into your bookmark and click on a page
//known bug: if jquery is not loaded this will only work on the 2nd click
javascript: (function() { if (!window.jQuery) { var script = document.createElement('script'); script.src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js";
document.body.appendChild(script); } if (window.markAllElements) { $('*').each(function() { $(this).css('border',$(this).data('save-border-data')) }); window.markAllElements = false; } else { $('*').each(function() { $(this).data('save-border-data', $(this).css('border')); var color = "#" + Math.floor(Math.random() * 0xFFFFFF).toString(16);$(this).css('border','1px solid ' + color )}); window.markAllElements = true ; }})();
@oak-tree
Copy link
Author

oak-tree commented Feb 6, 2015

using border can effects the elements because it added pixel to the border. it easy to replace the code to use background color instead of border

@oak-tree
Copy link
Author

oak-tree commented Feb 8, 2015

an example of the result:
in one click you get
https://www.dropbox.com/s/ohzr4nvavupmgb8/mark%20elements%20on%20page.PNG?dl=0
and in 2nd click you can return to regular state

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment