diff --git a/readme.md b/readme.md index 7941c85..bda3cfb 100644 --- a/readme.md +++ b/readme.md @@ -1,53 +1,58 @@ # ServiceNow Userscripts August 9th, 2016 Laurent Indermühle This is a collection of userscripts for ServiceNow. Their purpose is to extend ServiceNow's functionnalities or enhance the agent's quality of life The userscripts are javascripts that are executed in the browser, usually when a specific page is displayed. Their names end in "user.js" You have to install Greasemonkey, Tampermonkey, Scriptish or other similar addon to run those scripts. ## Script: servicenow-toc.user.js Runs when a knowledge article is edited. Add a button in the Wysiwyg editor (TinyMCE) "Create or update table of contents". When pressed, creates unique ids on titles contained in the text editor and then insert a table of content with anchor links. The table of contents is either inserted inplace when it already exists or just above the first title except for the

one. Example : ``` Titre Level 1 Description lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Table of content <---- Titre level 2 <---- Titre level 2 <---- Titre level 3 <---- <---- Table of contents inserted above here Titre Level 2 Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim ``` ## Script: servicenow-inc-autostart-timer.user.js EDIT Feb. 2018: The timer is no longer mandatory and is started by default. You can remove this script from your tampermonkey. ~~Clicks for you on the start button of the "time_worked" timer of incidents each time you load one. You'll never have to start the timer yourself again!~~ ## Script: servicenow-reload-page.user.js Reload the page https://support.epfl.ch/epfl?id=epfl_services_status every 5 min. Useful for our monitoring screen. + +## Script: servicenow-darknow.user.js + +ServiceNow is much too white, it hurts your eyes. +So this script allows you to change the CSS to make the Service Now pages darker. diff --git a/servicenow-darknow.user.js b/servicenow-darknow.user.js new file mode 100644 index 0000000..9992d52 --- /dev/null +++ b/servicenow-darknow.user.js @@ -0,0 +1,495 @@ +// ==UserScript== +// @name DarkSNow +// @description This style is for the ServiceNow platform and will re-style the user interface with a dark theme. +// @author Jonathan Stocchetti +// @match https://support.epfl.ch/* +// @run-at document-start +// @version 0.1 +// ==/UserScript== +(function() {var css = [ + "/* Color Conversion values ", + " #343d47 -> #9cb7d5", + " white background -> #141920 (was 303a46)", + " e6f1fd -> 06111d", + " 485563 -> 90aac6", + "*/", + "iframe {", + " border-color: #111;", + "}", + "body {", + " background-color: #141920;", + " color: #90aac6 !important;", + "}", + "", + "body, iframe, table, input, ", + "body.section_header_body_no_scroll,", + "TD.bannerLeft,", + "TD.bannerCenter,", + "TD.bannerRight, ", + "TR#banner_row,", + "HTML[data-doctype=true] .nav-wrapper,", + "HTML[data-doctype=true] .drag_section_header,", + "HTML[data-doctype=true] BODY.non_standard_lists, .form-control,", + "HTML[data-doctype=true] TD.label,", + "HTML[data-doctype=true] TD.label_right,", + "HTML[data-doctype=true] TD.label_left,", + "HTML[data-doctype=true] TD.foreign,", + "HTML[data-doctype=true] DIV.popup {", + " background-color: #141920 !important;", + "}", + ".input-group-checkbox input.checkbox ~ label.checkbox-label:before, .input-group-checkbox input.checkbox ~ label.radio-label:before, .input-group-checkbox input.radio ~ label.checkbox-label:before, .input-group-checkbox input.radio ~ label.radio-label:before, .input-group-radio input.checkbox ~ label.checkbox-label:before, .input-group-radio input.checkbox ~ label.radio-label:before, .input-group-radio input.radio ~ label.checkbox-label:before,", + ".input-group-radio input.radio ~ label.radio-label:before {", + " background-color: #141920;", + "}", + "", + ".nav_edge,", + ".nav_edge_inner,", + ".edge_bottom_chevron {", + "/* was background: #e6e8ea; */", + " background: #06080a !important;", + "}", + "HTML[data-doctype=true] LABEL.nav_menu {", + " background: #06080a;", + "}", + "", + ".navbar-default {", + " background-color: #06080a;", + " border-color: #14171b;", + "}", + "", + ".modal-content {", + " background-color: #06080a;", + "}", + ".CodeMirror {", + " background-color: #ddd;", + "}", + "/* Text Color */", + "HTML[data-doctype=true] BODY,", + "HTML[data-doctype=true] tr.list_even td, HTML[data-doctype=true] tr.list_odd td, HTML[data-doctype=true] .drag_section_header, HTML[data-doctype=true] SELECT:not([readonly=\"readonly\"]),", + "HTML[data-doctype=true] LABEL.nav_menu,", + "HTML[data-doctype=true] A.menu,", + ".form-control,", + "p.header,", + "input.ui-widget-content,", + ".process-breadcrumb > li > a, .process-breadcrumb > li > a:visited, .process-breadcrumb > li > a:hover,", + "HTML[data-doctype=true] TD.label, HTML[data-doctype=true] TD.label_right, HTML[data-doctype=true] TD.label_left, HTML[data-doctype=true] TD.foreign {", + " color: #ddd;", + "}", + "", + "/* Field Message and info boxes */", + "HTML[data-doctype=true] .annotation[data-annotation-type=\"Info Box Blue\"] div,", + "HTML[data-doctype=true] .annotation[data-annotation-type=\"Section Details\"] div,", + "HTML[data-doctype=true] .annotation[data-annotation-type=\"Text\"] div,", + ".alert-info, .notification-info {", + "/* was background-color: #e6f1fd;", + "border-color: #beddfe;", + "color: #024fa1;*/", + " background-color: #06111d;", + " border-color: #278efc;", + " color: #278efc;", + "}", + "", + "/* Warning messages */", + ".alert-danger,", + ".notification-danger, .notification-error {", + "background-color: #2f100b;", + "border-color: #ffe0db;", + "color: #dfc0bb;", + "}", + "", + "", + "tr.list_odd td {", + "background-color: #141920;", + "color: white;", + "}", + "", + "tr.list_odd .list_hier.button, span label {", + "background-color: #141920;", + "}", + "", + " ", + "tr.list_even .list_decoration_cell {", + "background-color: #111;", + "}", + "", + "tr.list_odd .list_decoration_cell {", + "background-color: #141920;", + "}", + "tr.list_even td, tr.list_even .list_decoration_cell {", + " background-color: #111;", + "}", + "", + "HTML[data-doctype=true] .list_nav.list_nav_top {", + " background-color: #16181a;", + "}", + "/* line 361, sass/theme_doctype.scss */", + "HTML[data-doctype=true] .list_message_row {", + " background: #141920;", + "}", + "", + ".tabs2_list.list_v2 {", + " background-color: #141920;", + "}", + "", + ".list_hierarchical_hdr .tabs2_list.list_v2 {", + " border-color: #333;", + "}", + "", + ".table td a, .table th a {", + " color: #999999;", + "}", + "", + ".table.table-hover > tbody > tr:hover > td, .table.table-hover > tbody > tr:hover > th, .table.table-hover > tbody > tr.hover > td, .table.table-hover > tbody > tr.hover > th, .table.table-hover.table-striped.table-detail-row > tbody > tr:hover > td, .table.table-hover.table-striped.table-detail-row > tbody > tr:hover > th, .table.table-hover.table-striped.table-detail-row > tbody > tr.hover > td, .table.table-hover.table-striped.table-detail-row > tbody > tr.hover > th {", + " background-color: #222;", + "}", + "/* line 85, sass/custom/_tables.scss */", + ".table.table-striped.table-detail-row > tbody > tr:nth-child(4n + 1) > td, .table.table-striped.table-detail-row > tbody > tr:nth-child(4n + 1) > th,", + ".table.table-striped.table-detail-row > tbody > tr:nth-child(4n + 2) > td,", + ".table.table-striped.table-detail-row > tbody > tr:nth-child(4n + 2) > th {", + "background-color: #060606;", + "}", + "/* line 92, sass/custom/_tables.scss */", + ".table.table-striped.table-detail-row > tbody > tr:nth-child(4n + 3) > td, .table.table-striped.table-detail-row > tbody > tr:nth-child(4n + 3) > th,", + ".table.table-striped.table-detail-row > tbody > tr:nth-child(4n + 4) > td,", + ".table.table-striped.table-detail-row > tbody > tr:nth-child(4n + 4) > th {", + "background-color: #000000;", + "}", + "", + "/***************** Main Frame**************************/", + "a[style*=\"color: black\"] {", + " color: #eee !important;", + "}", + "", + "/***************** Record Producers *******************/", + "TR.io_label TD {", + " background-color: #06111d !important;", + "}", + "", + "", + "/***************** Popups *****************************/", + "tr.list_odd img.list_popup.list_decoration {", + "background-color: #141920;", + "}", + "HTML[data-doctype=true] DIV.popup {", + " -moz-box-shadow: rgba(255, 255, 255, 0.2) 0 4px 23px 5px;", + " -webkit-box-shadow: rgba(255, 255, 255, 0.2) 0 4px 23px 5px;", + " box-shadow: rgba(255, 255, 255, 0.2) 0 4px 23px 5px;", + "}", + "", + ".glide_pane_header {", + " background-color: #222;", + "}", + "", + "#settings_modal {", + " color: #9cb7d5;", + "}", + "", + "#settings_modal .settings-tabs .settings-tab {", + " color: #9cb7d5;", + "}", + "", + "/**************** Top Frame **************************/", + "img#show_loading_gif {", + " opacity: 0.5;", + "}", + "", + "/**************** Main frame Navbar ******************/", + "HTML[data-doctype=true] H2.form_header,", + ".navbar .navbar-title,", + ".navbar-default .navbar-text,", + "HTML[data-doctype=true] SPAN.list_row_number_input {", + " color: #9cb7d5;", + "}", + "/* Attachment */", + "LI.attachment_list_items A.content_editable {", + " color: #9cb7d5;", + "}", + "A.attachment {", + " color: #90aac6;", + "}", + "", + "/**************** Breadcrumbs and links **************/", + "SPAN.breadcrumb_separator, A.breadcrumb_separator {", + " color: #278efc;", + "}", + "", + "A.web {", + " color: #278efc;", + "}", + "A.web:hover {", + " color: blue;", + "}", + "", + "/* Related Links */", + "HTML[data-doctype=true] td.related_links,", + "HTML[data-doctype=true] H2.form_header {", + " color: #9cb7d5;", + "}", + "", + "/**************** Fields ******************/", + "/* Disabled Fields */", + ".form-control[disabled],", + ".form-control[readonly],", + "fieldset[disabled] .form-control,", + "HTML[data-doctype=true] .msie9 input[type=\"text\"]:disabled, HTML[data-doctype=true] .msie9 SELECT:disabled, HTML[data-doctype=true] .msie10 input[type=\"text\"]:disabled, HTML[data-doctype=true] .msie10 SELECT:disabled, HTML[data-doctype=true] .msie11 input[type=\"text\"]:disabled, HTML[data-doctype=true] .msie11 SELECT:disabled, HTML[data-doctype=true] .windows.chrome input[type=\"text\"]:disabled, HTML[data-doctype=true] .windows.chrome SELECT:disabled {", + " /* was color: #485563; */", + " color: #b8c5d3;", + " background-color: #16181a;", + "}", + "", + "/* Text boxes */", + "textarea,", + "textarea.sn-string-textarea,", + "input[type=\"submit\"],", + "select {", + " background-color: #272d35;", + " color: #b8c5d3;", + "}", + "", + "/* Labels */", + ".is-filled .required-marker:before {", + "color: #bdc0c4;", + "}", + ".is-prefilled .required-marker:before {", + "color: #bdc0c4;", + "}", + "", + ".has-success .control-label, .has-warning .control-label, .has-error .control-label, .is-required .control-label, .is-filled .control-label {", + "color: #9cb7d5;", + "}", + "", + "/* Activity History */", + "div.activity_field {", + " background-color: #06111d !important;", + "}", + "", + "HTML[data-doctype=true] .email-formatter {", + " background-color: #06111d;", + "}", + "", + "body:not([class]) {", + " background-color: #ddd;", + "}", + "", + "/* Date Picker */", + ".calText.calDayColumnHeader {", + " background-color: #222;", + "}", + ".calTodayText {", + " background-color: #111;", + "}", + "", + "/* Tags */", + "HTML[data-doctype=true] ul.tagit {", + " background-color: #90aac6;", + "}", + "", + "/**************** Catalog ******************/", + "h2 {", + " color: #9cb7d5;", + "}", + "", + "/**************** Lists ******************/", + ".list_nav {", + " background: #141920;", + "}", + "", + ".list_nav.list_nav_top {", + " background: #141920;", + "}", + "", + ".aggregate_value {", + " background-color: #141920;", + "}", + "HTML[data-doctype=true] TR.list_header th, HTML[data-doctype=true] TR.list_header.hierarchical th.hierarchical, HTML[data-doctype=true] TR.list_header td {", + " background-color: #90aac6;", + "}", + ".highlight_enabled .list_div tr.list_row,", + ".highlight_enabled .list_div tr.list_row td,", + ".highlight_enabled .list_div tr.list_row td img,", + ".highlight_enabled .list_div tr.list_row td div,", + ".highlight_enabled .list_div tr.list_row_detail td,", + ".highlight_enabled .list_div tr.list_hierarchical_hdr,", + ".highlight_enabled .list_div tr.list_hierarchical_hdr td.list_hierarchical_hdr {", + " background-color: #141920;", + "}", + "", + "", + "/**************** Buttons & Menus ******************/", + ".btn-default, .btn-destructive-subdued, .btn-success-subdued, .nav-segmented > li {", + " background-color: #eee;", + "}", + "", + ".btn-default:hover, .btn-destructive-subdued:hover, .btn-success-subdued:hover, .nav-segmented > li:hover, .btn-default.hover, .hover.btn-destructive-subdued, .hover.btn-success-subdued, .nav-segmented > li.hover {", + " background-color: #bbb;", + "}", + "", + "HTML[data-doctype=true] .context_menu {", + " background: #141920;", + " border-color: #888;", + "}", + "", + "BUTTON.edge {", + " color: #9cb7d5 !important;", + "}", + "", + "span.color-blue-dark {", + " color: #3e95f4;", + "}", + "", + "BUTTON.edge.active,", + "BUTTON.edge:hover, BUTTON.edge:focus,", + "BUTTON.edge:hover .icon.color-red, BUTTON.edge:hover .icon.color-blue, BUTTON.edge:hover .icon.color-orange, BUTTON.edge:hover .icon.color-green, BUTTON.edge:hover .icon.color-yellow, BUTTON.edge:hover .icon.color-gray, BUTTON.edge:focus .icon.color-red, BUTTON.edge:focus .icon.color-blue, BUTTON.edge:focus .icon.color-orange, BUTTON.edge:focus .icon.color-green, BUTTON.edge:focus .icon.color-yellow, BUTTON.edge:focus .icon.color-gray {", + " color: #3e95f4;", + "}", + "", + "/**************** Layout Resizer **********/", + "", + ".ui-layout-resizer-east,", + ".ui-layout-resizer-west,", + ".ui-layout-resizer-north,", + ".ui-layout-resizer-south {", + " background-color: #4e5b6a;", + " -webkit-box-shadow: inset 0 0 4px #9cb7d5;", + " background-image: none !important;", + "}", + "/**************** KB *****************/", + "table#toc {", + " background-color: #111;", + "}", + ".live_feed.selfie-lite {", + " background-color: #141920 !important;", + "}", + ".ng-scope body {", + " background-color: #303a46;", + "}", + "", + "/**************** Scrollbar ******************/", + "::-webkit-scrollbar {", + " width: 12px;", + "}", + " ", + "::-webkit-scrollbar-track {", + " background-color: #4e5b6a;", + " -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); ", + " border-radius: 10px;", + "}", + " ", + "::-webkit-scrollbar-thumb {", + " border-radius: 10px;", + " -webkit-box-shadow: inset 0 0 10px #9cb7d5;", + " background-color: #4e5b6a;", + "}", + "", + "/***************** Search & Filter **********/", + "A.quicknavlink,", + "A.searchgrouplink,", + "table.searchgroupheader tr,", + "input.form-control-search {", + " color: #eee !important;", + "}", + "", + "A.searchtablelink {", + " color: #90aac6;", + "}", + "", + "#searchgroups,", + "table.searchgroupheader tr,", + "#searchBoxAndPrefs table, #searchgroups table,", + "#searchBoxAndPrefs {", + " background-color: #111;", + "}", + "", + "li[style*=\"background-color: rgb(238, 238, 238);\"] {", + " background-color: #4e5b6a !important;", + "}", + "", + "/**************** Code Editor ******************/", + "", + "/* Colours swapped", + " Black black -> DDD", + " Red FF1717 -> F66", + " Green 170 -> 4A0", + " Blue 00C -> 27D", + " Grey 999 -> 666", + " White f7f7f7 -> 111 ", + " Blue 00F -> 38F", + " Green 164 -> 1A2", + " Maroon 7F0055-> BF0075", + "*/", + "", + ".CodeMirror {", + " background-color: #222;", + " color: #DDD;", + "}", + "", + ".CodeMirror-gutters {", + " background-color: #111;", + "}", + "", + ".cm-s-snc span.cm-meta {", + " color: #F66;", + "}", + "", + ".cm-s-snc span.cm-tag {", + " color: #4A0;", + "}", + "", + ".cm-s-snc span.cm-attribute, .cm-s-snc span.cm-string {", + " color: #27D;", + "}", + "", + ".CodeMirror-activeline-background {", + " background-color: #444;", + "}", + ".CodeMirror-matchingtag {", + " background-color: rgba(128, 75, 0, 0.298039);", + "}", + "", + ".CodeMirror-linenumber {", + " color: #666;", + "}", + "", + ".cm-s-snc span.cm-property, .cm-s-snc span.cm-variable, .cm-s-snc span.cm-operator {", + " color: #DDD;", + "}", + "", + ".cm-s-snc span.cm-variable-2 {", + " color: #38f;", + "}", + ".cm-s-snc span.cm-def {", + " color: #38f;", + "}", + "", + ".cm-s-snc span.cm-number {", + " color: #1A2;", + "}", + "", + ".cm-s-snc span.cm-keyword {", + " color: #BF0075;", + "}", + "", + "/* Debug output is directly styled, so set background to light */", + "div.debug_line {", + " background-color: #CCC;", + "}" +].join("\n"); +if (typeof GM_addStyle != "undefined") { + GM_addStyle(css); +} else if (typeof PRO_addStyle != "undefined") { + PRO_addStyle(css); +} else if (typeof addStyle != "undefined") { + addStyle(css); +} else { + var node = document.createElement("style"); + node.type = "text/css"; + node.appendChild(document.createTextNode(css)); + var heads = document.getElementsByTagName("head"); + if (heads.length > 0) { + heads[0].appendChild(node); + } else { + // no head yet, stick it whereever + document.documentElement.appendChild(node); + } +} +})();