Skip to content

Instantly share code, notes, and snippets.

@lamchau
Last active September 4, 2021 07:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lamchau/722f0c1694aa831687a893f76d10daad to your computer and use it in GitHub Desktop.
Save lamchau/722f0c1694aa831687a893f76d10daad to your computer and use it in GitHub Desktop.
Due to how smartsheet handles seat licensing when publishing 'read only' reports they add CSS/JS to prevent selection of text or right-clicking on the page. This seems too restrictive so using this script in conjunction with Tampermonkey should enable this behavior again.
// ==UserScript==
// @name Smartsheet - Enable text selection and context menu clicks
// @version 1.1
// @author lamchau
// @description Enables text selection and context menu clicks from published Smartsheets
// @updateUrl https://go/smartsheet-hack
// @match https://app.smartsheet.com/b/publish?*
// @icon https://www.google.com/s2/favicons?domain=smartsheet.com
// @run-at document-end
// ==/UserScript==
(function () {
// extracted from: https://alanhogan.com/code/text-selection-bookmarklet
'use strict';
const style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = `
*, p, div{
user-select:text !important;
-moz-user-select:text !important;
-webkit-user-select:text !important;
}`;
document.head.appendChild(style);
const enableRightClick = () => {
if (document.oncontextmenu) {
document.oncontextmenu = null;
clearInterval(pollForContextMenu);
}
};
const pollForContextMenu = setInterval(enableRightClick, 50);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment