// ==UserScript==
// @name Localhost de essay
// @namespace COMDSPDSA
// @version 3
// @description Personal tweaks for localhost
// @author Dan Overlander
// @include *http://localhost:36865*
// @include *http://localhost:36158*
// @require https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// @require https://greasyfork.org/scripts/23115-tampermonkey-support-library/code/Tampermonkey%20Support%20Library.js?version=156109
// @require https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js
// ==/UserScript==
// Since v02: updating tm support library. Changing the elements the script waits for on initialization
// Since v01: homepage search fields right-aligned in title rows
// : doesn't swap col-4 for col-6 except on homepage
// : COMMENTED OUT : customer ribbon compressed
/*
* tm is an object included via @require from DorkForce's Tampermonkey Assist script
*/
(function() {
'use strict';
var TIMEOUT = 750,
thisScript = 'Localhost de essay',
toggle = {
isResetting: undefined,
hpCompressed: false
},
page = {
initialize: function () {
setTimeout(function () {
page.addClasses();
page.setTamperIcon();
page.addHighlights();
page.compression();
}, TIMEOUT);
},
addClasses: function () {
if (!toggle.areClassesAdded) {
toggle.areClassesAdded = true;
tm.addGlobalStyle('.cust-list-blk:hover {background-color: cornsilk}');
tm.addGlobalStyle('.home-sections .dotted {margin-top:3px; margin-bottom:3px;');
tm.addGlobalStyle('.home-sections .actv-block {padding-bottom:0;');
tm.addGlobalStyle('.singleActivity:hover {background-color: cornsilk;}');
tm.addGlobalStyle('.usertag {background-color: greenyellow;}');
// customer ribbon
//tm.addGlobalStyle('.icon-c360-lg {margin-top: 0;}');
}
},
setTamperIcon: function () {
// Add Tampermonkey Icon with label to identify this script
if (!toggle.isResetting) {
$('.tamperlabel').remove();
toggle.isResetting = setTimeout(function() {
if($('.tamperlabel').length > 0) {
$('.tamperlabel').prop('title', $('.tamperlabel').prop('title') + ' | ' + thisScript);
} else {
$('.brand-title').append('<span class="icon-ui-dell tamperlabel" title="Tampermonkey scripts: ' + thisScript + '"></span>');
}
toggle.isResetting = undefined;
}, TIMEOUT);
}
},
addHighlights: function () {
$('.cust-list-blk a:contains("IVANA")').css('color', 'red');
$('.cust-list-blk a:contains("UMBRELLA")').css('color', 'red');
$('.cust-list-blk a:contains("TYRELL")').css('color', 'red');
$('.cust-list-blk a:contains("BOB")').css('color', 'red');
if ($('.cust-list-blk a:contains("BOB")').text().indexOf('DOMS') <= 0) {
$('.cust-list-blk a:contains("BOB")').append(' <span class="usertag">DOMS</span>');
}
},
compression: function () {
if (!toggle.hpCompressed) {
//toggle.hpCompressed = true;
// Column: Your Customers
$('.cust-list-blk').css({'height': '22px', 'font-size': '.8em', 'overflow': 'hidden'});
$('.icon-c360-sm').css({'height': '8px', 'width': '9px'});
$('.icon-small-favorite-100').css({'height': '9px', 'width': '9px', 'background-position': '-287px -46px'});
$('.icon-small-favorite-0').css({'height': '9px', 'width': '9px', 'background-position': '-286px -137px'});
$('.remove-record').css({'top': '-3px', 'position': 'relative', 'height': '20px'});
$('.cust-list-blk a:nth-child(3)').parent().next().css({'position': 'relative', 'float': 'right', 'top': '-13px'}).html('<span class="remove-record leQuote" style="background-position:-46px -144px;"> </span>');
$('.input-search').prev().hide();
$('.input-search').css({'position': 'absolute', 'top': '0', 'left': '56%', 'width': '40%'});
// recent activity
$('.actv-type span:first-child').css('display', 'none');
$('.actv-type span:nth-child(2)').css('float', 'right');
$('#recentActivity_sortBy').parent().css({'position': 'absolute', 'top': '0', 'left': '57%', 'width': '40%'});
// hide last col
/*
if($('.remove-record').length > 0) {
if ($('#main .col-md-4:nth-child(4)').length > 0) {
$('#main .col-md-4:nth-child(4)').remove();
$('#main .col-md-4').toggleClass("col-md-4").toggleClass("col-md-6");
}
}
*/
// hide title
$('#home_recentActivity').parent().parent().hide();
// compress title bar
$('.top-nav').css({'padding': '3px 0 0 0'});
$('.icon-ui-dell').css({'font-size': '35px', 'height': '35px'});
$('.main-nav').css({'min-height': '40px', 'margin-bottom': '10px', 'height': '40px'});
$('.view-nav-withoutribbon').css({'margin-top': '30px'});
$('.brand-title').css({'line-height': '35px'});
$('.content-shell .view-nav').css({'top': '40px'});
$('.brand').next().next().css({'position': 'relative', 'top': '-8px'});
if($('.remove-record').length === 0) {
if($('.view-nav-withoutribbon').length > 0) {
$('.content-area').css({'margin-top': '10px'});
} else {
$('.content-area').css({'margin-top': '100px'}); // customer ribbon = 60px
}
}
/* customer ribbon
$('.content-shell .view-nav').css({'height': '40px'});
$('#currentCustomer_customerNumber').parent().css({'position': 'absolute', 'top': '0', 'left': '100%', 'min-width': '200px', 'font-size': '.8em'});
$('.app-controls').parent().css({'top': '-13px'});
$('.smry-ctnr').css('top', '95px');
*/
}
}
};
/*
* Global functions
*/
function initScript () {
// breaking into getContainers so that this page MIGHT initialize multiple times, but only because things load in at various times. SLIGHTLY sloppy.
tm.getContainer({
'el': '.remove-record',
'max': 100,
'spd': 1000
}).then(function($container){
page.initialize();
});
tm.getContainer({
'el': '#main',
'max': 100,
'spd': 1000
}).then(function($container){
page.initialize();
});
tm.getContainer({
'el': '.cust-list-blk',
'max': 100,
'spd': 1000
}).then(function($container){
page.initialize();
});
}
setTimeout(initScript, TIMEOUT);
$(document).mouseup(function(e) {
initScript();
});
})();