Last active
June 7, 2019 14:23
-
-
Save peruihkxt/564d300617c3ce81956bb3e060a2934f to your computer and use it in GitHub Desktop.
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 Make Freshdesk Compact | |
// @namespace http://tampermonkey.net/ | |
// @version 0.5 | |
// @description try to take over the world! | |
// @author You | |
// @match https://*.freshdesk.com/a/* | |
// @grant none | |
// @updateURL https://gist.github.com/JeremyLee/564d300617c3ce81956bb3e060a2934f/raw/MakeFreshdeskCompact.user.js | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
function addGlobalStyle(css) { | |
var head, style; | |
head = document.getElementsByTagName('head')[0]; | |
if (!head) { return; } | |
style = document.createElement('style'); | |
style.type = 'text/css'; | |
style.innerHTML = css.replace(/;/g, ' !important;'); | |
head.appendChild(style); | |
} | |
addGlobalStyle(` | |
.ticket-details__item__header { | |
padding: 5px; | |
} | |
.ticket-details__requestor .ticket-details__item__content { | |
padding: 10px 5px; | |
} | |
.ticket-details__item__content { | |
padding: 10px 5px; | |
} | |
.ticket-info > .clearfix { | |
display: inline-block; | |
} | |
.ticket-info { | |
padding-bottom: 13px; | |
} | |
.ticket-header-container { | |
display: inline-block; | |
} | |
.ticket-details-wrapper { | |
padding: 10px; | |
} | |
.page-actions__left, .page-actions__right { | |
margin-top: unset; | |
} | |
.header-secondary { | |
height: unset; | |
} | |
.breadcrumb__item--arrow { | |
padding-top: unset; | |
} | |
.breadcrumb__item { | |
padding-top: unset; | |
} | |
.header-primary__user__item { | |
margin-top: 5px; | |
} | |
.header-primary__free__trial{ | |
margin-top: 3px; | |
} | |
.header-primary { | |
height: unset; | |
} | |
.content-widget, .page-content { | |
top: 70px; | |
} | |
.__module-search__app-search > .page-search > .page-search__results { | |
top: 80px; | |
} | |
.ticket-properties { | |
top: 86px; | |
} | |
.ticket-properties-wrapper { | |
overflow-y: auto; | |
} | |
.page-sidebar { | |
top: 86px; | |
} | |
.ticket-created-info { | |
margin-top: 0px; | |
} | |
.header-secondary .input { | |
margin-bottom: unset; | |
} | |
.collab-selectable div { | |
padding-bottom: 10px; | |
} | |
.page-search__controls > .modal-search.clearfix.ember-view { | |
position: fixed; | |
top: -10px; | |
} | |
.page-search__controls > .modal-search.clearfix.ember-view input.default-search-input { | |
height: 30px; | |
} | |
.page-search__controls > .modal-search.clearfix.ember-view svg.modal-search-icon { | |
z-index: 1; | |
top: 18px; | |
height: 18px; | |
left: 10px; | |
} | |
.__ui-components__nav-tabs .nav-secondary { | |
margin-top: unset; | |
} | |
.page-search__controls.page-actions { | |
height: unset; | |
} | |
.page-search__actions > .__ui-components__fresh-pagination { | |
position: relative; | |
top: -42px; | |
} | |
.page-search__actions > span.text-spacing, .page-search__actions > .page-search__actions__sort { | |
position: relative; | |
left: 402px; | |
top: -46px; | |
} | |
.page-search__actions { | |
position: fixed; | |
} | |
`); | |
//debugger; | |
$.expr[':'].blank = function(obj){ | |
var html = obj.innerHTML; | |
if(html.indexOf("<img") !== -1) { | |
return false; | |
} | |
html = html.replace(/(<br>|\s)/,"");//\u200B | |
if(html.length === 0) { | |
return true; | |
} | |
var text = obj.textContent; | |
text = text.replace(/\s/,""); | |
return text.length === 0; | |
}; | |
var aoeu = window.setInterval(function(){ | |
if(window.stopDelete){ // set window.stopDelete = true to stop the timer for debugging. | |
window.clearInterval(aoeu); | |
} | |
$("div:blank", $(".ticket_note")).remove(); | |
$("br", $(".ticket_note")).filter(function(i,x){return x.nextSibling !== null && x.nextSibling.nodeName === "BR"}).remove(); | |
$("div:blank", $("#ticket_original_request")).remove(); | |
}, 1000); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment