您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Personal tweaks for localhost
当前为
// ==UserScript== // @name DSA Interface // @namespace COMDSPDSA // @version 15 // @description Personal tweaks for localhost // @author Dan Overlander // @include http://sales.dell.com/* // @include *preol.dell.com* // @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 // @require https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js // @grant GM_setValue // @grant GM_getValue // ==/UserScript== // Since v14: bugfix: Adjusted customer-ribbon button y-position on orderReview and orderDetails. Created localStorage prefs // Since v13: Fixed a smry-ctnr CSS bug // Since v12: Modernized trigger elements. fixed the customer ribbon compression // Since v11: Hid the walkme stuff // Since v10: Re-added group alternating background colors // Since v09: activates compression on scroll // Since v08: Renamed // Since v07: Includes G1, Prod // Since v06: Tweaks to homepage // Since v05: Fixes (again) the create-quote icon // Adds customer-dashboard icon // Since v04: Added more of my own customers to the highlight-in-red list // Since v03: Tweaking homepage column title area // 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, global = { scriptName: 'DSA Interface', triggerElement: '.icon-ui-dell', isMouseMoved: false, areClassesAdded: false, areAlertsAdded: false, isResetting: undefined, hpCompressed: false, prefs: GM_getValue('uiPrefs') != null ? JSON.parse(GM_getValue('uiPrefs')) : { hitliteInYourCustomers: ['AEROSPACE', 'BIOTECH', 'LARGE', '[04]', 'DATADYNE', 'DEAD', 'HARGREAVE', 'IVANA', 'LEXCORP', 'PRIMATECH', 'TYRELL', 'UMBRELLA', 'ZORG'], hiliteColor: 'red', compressUi: 'true' } }, page = { initialize: function () { setTimeout(function () { page.addClasses(); page.setTamperIcon(); page.addHighlights(); page.addMenuLinks(); page.compression(); page.alternatingColors(); }, TIMEOUT); }, addClasses: function () { if (!global.areClassesAdded) { global.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;}'); // homepage column headers tm.addGlobalStyle('.home-col-hdr h3 { font-size:1.3em; font-weight:bold; padding-top:3px; }'); // homepage search section tm.addGlobalStyle('#home_search_container { margin-bottom: 0px; }'); tm.addGlobalStyle('#home_search_value { height: 30px; }'); tm.addGlobalStyle('#duplicate-po h3 { float: left; width: 200px; }'); tm.addGlobalStyle('#search_type_label { float: left; width: 110px; position: relative; top: 5px !important; }'); tm.addGlobalStyle('#search { float: left; width: 480px; padding: 0px !important; margin: 0px !important; }'); tm.addGlobalStyle('#search .input-search { position: initial !important; width: 100% !important; }'); // customer ribbon tm.addGlobalStyle('.app-nav {margin-top: 0;}'); tm.addGlobalStyle('.app-nav .app-title { padding-top:0; font-size:16px; line-height:1.1; }'); // hide Walk Me Through crap tm.addGlobalStyle('#walkme-player, .walkme-custom-icon-outer-div { display: none !important; }'); } }, setTamperIcon: function () { // Add Tampermonkey Icon with label to identify this script if($('.tamperlabel').length > 0) { if ($('.tamperlabel').prop('title').indexOf(global.scriptName) === -1) { $('.tamperlabel').prop('title', $('.tamperlabel').prop('title') + ' | ' + global.scriptName); } } else { $('body').append('<span class="icon icon-tfs-build-status-header icon-ui-dell tamperlabel" title="Tampermonkey scripts: ' + global.scriptName + '"></span>'); } }, addHighlights: function () { _.each(global.prefs.hitliteInYourCustomers, function(hilite) { $('.cust-list-blk a:contains("' + hilite + '")').css('color', global.prefs.hiliteColor); }); }, compression: function () { if (!global.hpCompressed && global.prefs.compressUi === 'true') { //global.hpCompressed = true; // Column: Your Customers $('.cust-list-blk').css({'height': '22px', 'font-size': '.8em', 'overflow': 'hidden'}); $('.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:contains(Create Quote)').css({'position': 'relative', 'float': 'right', 'top': '-13px'}).html('<span class="remove-record leQuote" style="background-position:-46px -144px;"> </span>'); $('.cust-list-blk a:contains(View Dashboard)').css({'position': 'relative', 'float': 'right', 'top': '-13px'}).html('<span class="remove-record leDashboard" style="background-position:-47px -288px;"> </span>'); $('.input-search').prev().hide(); $('.input-search').css({'position': 'absolute', 'top': '0', 'left': '56%', 'width': '40%'}); $('#yourCustomersSection a').eq(0).prop('innerText', 'All'); // recent activity $('#homepageController_recentActivity_h').prop('innerText', 'Recent Activity'); $('#homepageController_recentActivity_h').parent().find('a').eq(0).prop('innerText', 'All'); $('.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(5)').length > 0) { $('#main .col-md-4:nth-child(5)').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'}); $('#dellBrandLogo_goHomePage').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': '80px'}); // customer ribbon = 60px } } // customer ribbon $('.content-shell .view-nav').css({'height': '40px'}); if ($('#orderReview_createOrder').length === 0 && $('#orderDetails_moreActions').length === 0) { $('.app-controls').parent().css({'top': '-6px'}); } else { $('.app-controls').parent().css({'top': '4px'}); } } }, alternatingColors: function () { $('.line-group:odd').css('background-color', 'rgba(0, 0, 0, 0.1)'); }, addMenuLinks: function() { if ($('.uiMenu').length === 0) { $('#menu_versionToggle').parent().find('ul').eq(3).append('<li><a href="#" class="uiMenu" title="Preferences">DSA Plugin</a></li>'); $('.uiMenu').mouseup(function clickIdLink (e) { var modalId = 'myUiPrefs', modalBody = ''; _.each(global.prefs, function (value, key) { if (Array.isArray(value) || typeof value === 'string') { modalBody += ' <div class="popupDetailTitle">' + key + '</div><div class="popupDetailContent"><input style="width:100%" id="' + key + '" type="text" value="' + value + '"></input></div>'; } else { _.each(value, function (value2, key2) { modalBody += ' <div class="popupDetailTitle">' + key2 + '</div><div class="popupDetailContent"><input style="width:100%" id="' + key2 + '" type="text" value="' + value2 + '"></input></div>'; }); } }); modalBody += '<div class="popupDetailTitle"> </div><div class="popupDetailContent" style="text-align:right;">' + ' <button class="uiSavery">Save</button>' + '</div>'; modalBody += '<div class="popupDetailTitle"> </div><div class="popupDetailContent" style="text-align:right;">' + ' <button class="uiResetery">Reset</button>' + '</div>'; tm.showModal(modalId, modalBody); $('.uiSavery').on('click', function() { global.prefs = { hitliteInYourCustomers: $('#hitliteInYourCustomers').val().split(','), hiliteColor: $('#hiliteColor').val(), compressUi: $('#compressUi').val() }; GM_setValue('uiPrefs', JSON.stringify(global.prefs)); alert('Refresh to see new values.'); }); $('.uiResetery').on('click', function() { GM_setValue('uiPrefs', null); alert('Refresh to see default values.'); }); }); } } }; /* * Global functions */ function initScript () { tm.getContainer({ 'el': global.triggerElement, 'max': 100, 'spd': 1000 }).then(function($container){ page.initialize(); }); } initScript(); $(document).mousemove(function(e) { if (!global.isMouseMoved) { global.isMouseMoved = true; setTimeout(function() { global.isMouseMoved = false; }, TIMEOUT * 2); initScript(); } }); window.onresize = function(event) { initScript(); }; $(document).scroll(function() { page.compression(); page.alternatingColors(); }); })();