Last active
September 4, 2021 07:17
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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