您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
Code library for MCB Production
此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.greasyfork.icu/scripts/7042/31148/MCBProduction%20Employees%20data%20and%20utilities.js
GM_addStyle("\ [id^=\"POdata\"]{display:block;}\ [id^=\"POimage\"]{display:block;float:left;border:2px solid #fff;border-radius:30px;background-color:#fff;width:55px;height:55px;overflow:hidden;position:relative;}\ [id^=\"POimage\"] img {float:left;height:70px;max-width:inherit;position:absolute;left:-20px}\ [id^=\"POdetail\"]{float:left;width:60%;height:51px;padding:0 0 4px;margin-left:9px;}\ .link-button i, .quick-button i, .user i {margin:0 5px 0 0;}\ .red, .red:hover {color:red;}\ .vanish{display:none}\ .edit {padding-right:100px;padding-bottom:30px}\ .short {width:58% !important;}\ .dwarf {width:23% !important;}\ .rightControl{position:absolute;width:100px;height:30px;top:0;right:0;}\ .rightControl a {float:right;}\ #__tRowDesc {position:relative;}\ #__tDescription a {color:#0D96CC;}\ #projectDescription, #taskDescription, #activityDescription{width:90%;}\ #quickActionWrapper.stickyPanel {position:fixed; top:0px;}\ #quickActionPanel {display:block; width:250px; position:absolute; top:142px; right:350px; box-shadow:0px 0px 10px 3px #999}\ .stickyPanel #quickActionPanel { position:fixed; top:15px}\ #quickActionWrapper .sub-control-groups {margin-bottom:7px;}\ #quickActionWrapper select {height:25px; width:74px;}\ #quickActionWrapper .expanded {width:117px;}\ @media screen and (max-width:1366px){\ #quickActionPanel { right:60px;}\ }\ "); var $imageServer = "http://www.fotoagent.dk/single_picture/11612/20/small/"; var $noImage = "http://production.mcb.dk/images/employeeNoImage.png"; var $userList = [ {"UserID":"119","Initial":"ABL","Username":"Anne Bank Lindberg","Email":"[email protected]","Photo":"anne.jpg","Skype":"ablindberg"}, {"UserID":"142","Initial":"ADN","Username":"Anh Duong Ngoc","Email":"[email protected]","Photo":"Dang_Duong_Ng_c_Anh.jpg","Skype":"loaken8x"}, {"UserID":"118","Initial":"AJ","Username":"Anders Jonsson","Email":"[email protected]","Photo":"anders__2_.jpg","Skype":"anders.jonsson78"}, {"UserID":"143","Initial":"ALH","Username":"Anh Hoang Le","Email":"[email protected]","Photo":"Le_Hoang_Anh.jpg","Skype":"anhlh3"}, {"UserID":"117","Initial":"ALL","Username":"Allan Lund Lauridsen","Email":"[email protected]","Photo":"allan_l.jpg","Skype":"allan-mcb"}, {"UserID":"144","Initial":"ANV","Username":"Anh Nguyen Viet","Email":"[email protected]","Photo":"Nguyen_Viet_Anh.jpg","Skype":"cwc_nva"}, {"UserID":"116","Initial":"AWC","Username":"Allan Weyhe Cloos","Email":"[email protected]","Photo":"Allan_C.jpg","Skype":"allan.cloos"}, {"UserID":"190","Initial":"BB","Username":"Bo Bundgaard","Email":"[email protected]","Photo":"bo_b.jpg","Skype":"BB-MCB"}, {"UserID":"172","Initial":"BHK","Username":"Bo Hedegaard Kristensen","Email":"[email protected]","Photo":"bo.jpg","Skype":"bo-mcb"}, {"UserID":"145","Initial":"CLH","Username":"Cuong Le Hung","Email":"[email protected]","Photo":"Le_Hung_Cuong.jpg","Skype":"le.hung.cuong.89"}, {"UserID":"121","Initial":"CP","Username":"Costin Popescu","Email":"[email protected]","Photo":"costi.jpg","Skype":"ssj_costy"}, {"UserID":"176","Initial":"DBS","Username":"Dan Bastrup Sørensen","Email":"[email protected]","Photo":"dan.jpg","Skype":"danbastrupmcb"}, {"UserID":"4","Initial":"DHE","Username":"Daniel Esbersen","Email":"[email protected]","Photo":"daniel.jpg","Skype":"dhe.mcb"}, {"UserID":"147","Initial":"DHV","Username":"Dinh Ha Van","Email":"[email protected]","Photo":"Dinh.jpg","Skype":"hadinhhd"}, {"UserID":"162","Initial":"DXD","Username":"Dzung Dinh Xuan ","Email":"[email protected]","Photo":"Dinh_Xuan_Dzung.jpg","Skype":"scottdinh"}, {"UserID":"181","Initial":"FB","Username":"Finn Brose","Email":"[email protected]","Photo":"finn.jpg","Skype":"fbrose"}, {"UserID":"124","Initial":"FCL","Username":"Flemming Clausen Lund","Email":"[email protected]","Photo":"flemmeing.jpg","Skype":"flemmingclund"}, {"UserID":"159","Initial":"HD","Username":"Huong Do Lan","Email":"[email protected]","Photo":"Do_Lan_Huong.jpg","Skype":"wonkyass06"}, {"UserID":"125","Initial":"HK","Username":"Helle Krogh","Email":"[email protected]","Photo":"","Skype":""}, {"UserID":"183","Initial":"HKD","Username":"Heinrich Dalager","Email":"[email protected]","Photo":"heinrich_1_.jpg","Skype":"dalager1"}, {"UserID":"160","Initial":"HLD","Username":"Hoa Luu Duc","Email":"[email protected]","Photo":"Luu_Thi_Duc_Hoa.jpg","Skype":"luuduchoa8"}, {"UserID":"171","Initial":"HMF","Username":"Henrik Semback Much-Fals","Email":"[email protected]","Photo":"henrik.jpg","Skype":""}, {"UserID":"158","Initial":"HNH","Username":"Hoa Nguyen Hong","Email":"[email protected]","Photo":"Nguyen_Hong_Hoa(1).jpg","Skype":"nicekitty09"}, {"UserID":"149","Initial":"HTN","Username":"Hieu Nguyen Thanh","Email":"[email protected]","Photo":"","Skype":"sweet_boy0301"}, {"UserID":"154","Initial":"HTT","Username":"Ha Tran Thi","Email":"[email protected]","Photo":"","Skype":"tranthiha"}, {"UserID":"126","Initial":"ILF","Username":"Ignacio López Flores","Email":"","Photo":"","Skype":""}, {"UserID":"126","Initial":"JAC","Username":"Jacob Knutsson Sandhøj","Email":"[email protected]","Photo":"jacob_a.jpg","Skype":"quaserqual"}, {"UserID":"5","Initial":"JKL","Username":"Janus Klok Matthesen","Email":"[email protected]","Photo":"janus.jpg","Skype":"janusklok"}, {"UserID":"129","Initial":"JN","Username":"John Nielsen","Email":"[email protected]","Photo":"John.jpg","Skype":"john.nielsen30"}, {"UserID":"128","Initial":"JSP","Username":"Jesper Splidsboel","Email":"[email protected]","Photo":"Jesper.jpg","Skype":" jsplidsboel"}, {"UserID":"174","Initial":"KBJ","Username":"Kasper Brøndum Jensen","Email":"[email protected]","Photo":"Kasper_Br_ndum_Jensen.jpg","Skype":"kbjensen83"}, {"UserID":"180","Initial":"KD","Username":"Kasper Dorby","Email":"[email protected]","Photo":"KasperD.jpg","Skype":""}, {"UserID":"184","Initial":"KHT","Username":"Kristoffer Hauge Tarp","Email":"[email protected]","Photo":"kristoffer.jpg","Skype":"kristoffer_hauge_tarp"}, {"UserID":"131","Initial":"LBE","Username":"Lasse Bech Eiler","Email":"[email protected]","Photo":"lasse.jpg","Skype":"lasse_bech_eiler"}, {"UserID":"130","Initial":"LDS","Username":"Lars Duelund Sørensen","Email":"[email protected]","Photo":"lars.jpg","Skype":"lars.duelund.sorensen"}, {"UserID":"150","Initial":"LKD","Username":"Linh Dang Khanh","Email":"[email protected]","Photo":"Dang_Khanh_Linh.jpg","Skype":"linhdtk"}, {"UserID":"165","Initial":"LM","Username":"Line Meier Degnbol","Email":"[email protected]","Photo":"line.jpg","Skype":"line-mcb"}, {"UserID":"165","Initial":"LMD","Username":"Ly Mai Dao","Email":"[email protected]","Photo":"dao_mai_ly.jpg","Skype":"peachapricot89"}, {"UserID":"165","Initial":"LMN","Username":"Luan Nguyen Minh","Email":"[email protected]","Photo":"","Skype":"nm_luan"}, {"UserID":"132","Initial":"LP","Username":"Leif Pedersen","Email":"[email protected]","Photo":"Leif.jpg","Skype":"lp_mcb"}, {"UserID":"136","Initial":"MAP","Username":"Morten Arp Pedersen","Email":"[email protected]","Photo":"morten_arp.jpg","Skype":"mortenarp"}, {"UserID":"175","Initial":"MB","Username":"Michael Bille","Email":"[email protected]","Photo":"bille.jpg","Skype":"michael_bille107"}, {"UserID":"133","Initial":"MBH","Username":"Malte Bolvig Hansen","Email":"[email protected]","Photo":"malte__eb.jpg","Skype":"malte_mcb"}, {"UserID":"187","Initial":"MO","Username":"Marie Odgaard","Email":"[email protected]","Photo":"Marie_Odgaard.jpg","Skype":"marie.odgaard2"}, {"UserID":"187","Initial":"MOV","Username":"Morten Overgaard Mønsted","Email":"[email protected]","Photo":"mov.jpg","Skype":"djoike"}, {"UserID":"178","Initial":"MSK","Username":"Mie Sejer Kristensen","Email":"[email protected]","Photo":"mie__3_.jpg","Skype":""}, {"UserID":"188","Initial":"NHB","Username":"Nina Hildebrandt Birkmose","Email":"[email protected]","Photo":"","Skype":"nina.hildebrandt.birkmose"}, {"UserID":"137","Initial":"NJN","Username":"Nicolas Jægergaard Nielsen","Email":"[email protected]","Photo":"","Skype":"njn-mcb"}, {"UserID":"173","Initial":"PB","Username":"Peter Bjerregaard","Email":"[email protected]","Photo":"peter.jpg","Skype":"mrpeterbjerregaard"}, {"UserID":"200","Initial":"PER","Username":"Peter Engelst Rasmussen","Email":"[email protected]","Photo":"peter(1).jpg","Skype":"live:per_323"}, {"UserID":"186","Initial":"PTA","Username":"Preben Thrige Andersen","Email":"[email protected]","Photo":"preben.jpg","Skype":"preben.t.andersen"}, {"UserID":"185","Initial":"QVV","Username":"Quyet Vu Van","Email":"[email protected]","Photo":"Vu_Van_Quyet(1).jpg","Skype":"quyetvv"}, {"UserID":"195","Initial":"SH","Username":"Sara Hernes","Email":"[email protected]","Photo":"","Skype":""}, {"UserID":"177","Initial":"SHS","Username":"Shiela Smed","Email":"[email protected]","Photo":"","Skype":"shiela.smed"}, {"UserID":"139","Initial":"SP","Username":"Stine Pedersen","Email":"[email protected]","Photo":"stine.jpg","Skype":"stine_pedersen"}, {"UserID":"169","Initial":"THK","Username":"Thanh Hoang Kim","Email":"[email protected]","Photo":"Hoang_Kim_Thanh.jpg","Skype":"hkthanh2"}, {"UserID":"140","Initial":"TP","Username":"Thomas Pedersen","Email":"[email protected]","Photo":"tp__1_(1).jpg","Skype":""}, {"UserID":"202","Initial":"TTMT","Username":"Trieu Thi Mai Trang","Email":"[email protected]","Photo":"Trieu_Thi_Mai_Trang.jpg","Skype":"trieuthimaitrang"}, {"UserID":"164","Initial":"TVP","Username":"Truong Phan Van","Email":"[email protected]","Photo":"","Skype":"igooglevn"}, {"UserID":"157","Initial":"XNH","Username":"Xuan Nguyen Hong","Email":"[email protected]","Photo":"","Skype":"aht_xuannh87"}, {"UserID":"194","Initial":"AAS","Username":"Alex Asp Sørensen","Email":"[email protected]","Photo":"alex.jpg","Skype":"Alex.AspSorensenMCB"}]; (function($){ 'use strict'; /** * addEmployeeDetail plugin * * Transforms a simple username string into rich user information, * including Picture, Fullname, Email, and Skype ID. * * User data structure is organized as a JSON object named $userList. * * Option(s): {initial:false} * * Simple usage: * $('div').addEmployeeDetail(); * * With optional parameter: * $('div').addEmployeeDetail({initial:true}) * * Default parameter(s) can be changed anywhere by assigning value to: * $.fn.addEmployeeDetail.defaults * **/ $.fn.addEmployeeDetail = function(useOnlyInitial){ var settings = $.extend({}, $.fn.addEmployeeDetail.defaults, useOnlyInitial); var $data = $.trim(this.text()), $initial; if($data !== ''){ // Use user's initial as input if(settings.initial){ $initial = $data; } else{ // Use user's full name string as input (f.x.: JKL (Janus Klok Matthesen)) and take the leading characters as Initial $initial = $data.substr(0, $data.indexOf(' ')); } // Iterate the user object list to find a match of Initial var $POdata = $.grep($userList, function(i){ return i.Initial === $initial; }); if($POdata.length > 0){ var rnd = Math.floor(Math.random()*100000000000000000); if ($POdata[0].Username != null){ this.text('').prepend($('<div/>').attr({ 'id':'POdata' + rnd, 'data-userguid':$POdata[0].UserID, 'data-user-initial':$initial })); } $('<div class="user"><div id="POimage' + rnd + '" class="img"></div><div id="POdetail' + rnd + '" class="detail"></div></div>').appendTo($('#POdata'+rnd)); if($.trim($POdata[0].Photo) !== ""){ $('<img/>').attr('src',$imageServer + $POdata[0].Photo).appendTo($('#POimage'+rnd)); } else{ $('<img/>').attr('src',$noImage).appendTo($('#POimage'+rnd)); } $('<div/>').attr('id','POname'+rnd).text($POdata[0].Username).appendTo($('#POdetail'+rnd)); $('<div/>').attr('id','POemail'+rnd).html('<i class="icon-envelope"></i><a href="mailto:' + $POdata[0].Email + '">' + $POdata[0].Email + '</a>').appendTo($('#POdetail'+rnd)); if($.trim($POdata[0].Skype) !== ""){ $('<div/>').attr('id','POskype'+rnd).html('<i class="icon-bullhorn"></i><a href="skype:' + $POdata[0].Skype + '?chat">' + $POdata[0].Skype + '</a>').appendTo($('#POdetail'+rnd)); } return this; } } }; //Default configuration of addEmployeeDetail() $.fn.addEmployeeDetail.defaults = { //Parse data using only user's Initial or not initial : false }; /** * urlToLink plugin * * Transforms URLs in text into HTML <a> elements. * * Example: Lorem ipsum dolor sit amet consecter adpsim elit http://loremipsum.com * Result: Lorem ipsum dolor sit amet consecter adpsim elit <a href="http://loremipsum.com">http://loremipsum.com</a> * * HOW TO USE * * Assuming that you have already inserted jquery.js and jquery.urlToLink.js in your code * and that $ is your jQuery object reference. * * Simple usage: * $('p').urlToLink(); * * Changing the parameters: * $('p').urlToLink({target:'_blank'}); * * You can change the default parameters by calling * $.fn.urlToLink.defaults anywhere in your script. * * Optional parameters: * Allow long links to be compressed to a given length * by sampling the start and end of the link * and compressing them with a given string, * and, optionally, stripping the protocol prefix from the link first. * { * compressTo: 30, //The length that long links will be compressed to. * compressWith: '...' //The string that long links will be compressed with, '...' by default. * removeHttp: true //Remove the protocol prefix of the link. * } * * * LICENSE * * This plugin was inspired by John Gruber's regex at * http://daringfireball.net/2010/07/improved_regex_for_matching_urls * * Copyright (c) 2011 Gabriel Izaias (gabrielizaias.com) * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * * Source: https://github.com/gabrielizaias/urlToLink/blob/master/jquery.urlToLink.js * * Email address and domain matching functionalities added * 2014-03-19 by ALH * */ /*$.fn.urlToLink = function(options) { var options = $.extend({}, $.fn.urlToLink.defaults, options); return this.each(function(){ var element = $(this), expression = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig; // The magic return element.html(element.html().replace(expression, "<a href='$1' target='"+options.target+"'>$1</a>")); }); }; //Default configuration $.fn.urlToLink.defaults = { target : '_blank' // Link target };*/ var emailMatchingRegEx = /([a-z0-9_\.\-]+)@([\da-z\.\-]+)\.([a-z\.]{2,6})/ig, linkMatchingRegEx = /(\b(?:https?|ftp|file):\/\/[\-A-Z0-9+&@#\/%?=~_|!:,.;]*[\-A-Z0-9+&@#\/%=~_|])/ig, domainMatchingRegEx = /(?:^|\n|\s)(\w.?(?:[\w\-]+[^\W])+(?:[\.]+[\w\-]+)(?:[\.]+(?:[\w\-])*)*?(?:\s|$|\r))/ig; $.fn.urlToLink = function (options) { options = $.extend({}, $.fn.urlToLink.defaults, options); return this.each(function () { if(options.cleanupHTML){ $(this).HTMLCleanup({preserveLineBreak:options.preserveLineBreak}); } //Convert Email addresses to actual Links $(this).html($(this).html().replace(emailMatchingRegEx, function($0, $1){ return '<a href="mailto:' + $0 + '" title="' + $0 + '">' + $0 + '</a>'; })); //Convert URL to actual Links $(this).html($(this).html().replace( linkMatchingRegEx, function (match, contents, offset, s) { var href = match, linkText = '', lengthToSplit = 0; if (options.removeHttp) href = href.replace("http://", "").replace("https://", ""); linkText = href; if (options.compressTo) { if (href.length > options.compressTo) { lengthToSplit = (options.compressTo - options.compressWith.length) / 2; linkText = href.substring(0, lengthToSplit) + options.compressWith + href.slice(-lengthToSplit); } } return '<a href="' + match + '" title="' + match + '" target="' + options.target + '">' + linkText + '</a>'; } )); /* * Convert standalone domain names to actual links */ //Break the content using '<br>' as delimiter into an array of string var c = $(this).html().toString().split('<br>'), t = []; //iterate the content array $.each(c, function(index,value) { var k = $.trim(value); if(k.length > 0) { //break the string into words using ' ' as delimeter //to avoid matching unusual long string of continuos word characters var p = k.split(' '), q = []; $.each(p, function(x,y) { var s = y.toString(); if(y.length < 64) { s = s.replace(domainMatchingRegEx, function($0, $1) { var href= $.trim($0).toString().toLowerCase(); var ret = '<a href="http://' + href + '" title="http://' + href + '" target="' + options.target + '">' + $.trim($0) + '</a>'; return ret; }); } q.push(s); }); k = q.join(' '); //push the processed data into the temporary array t.push(k); } else t.push(k); k = null; }); //join the array members together using <br> as delimiter $(this).html(t.join('<br>')); }); }; /** * Default configuration of urlToLink() */ $.fn.urlToLink.defaults = { // Clean-up HTML tags cleanupHTML: true, // Preserve line breaks preserveLineBreak: false, // Link target target : '_blank', // Text to add when compressedTo is set, '...' by default compressWith: '…' }; /* * Clean-up HTML tags inside the processed element. * <br> tags are replaced with '\n' before stripping off HTML tags * and put back after stripping. */ $.fn.HTMLCleanup = function(preserveLineBreak){ var settings = $.extend({}, $.fn.HTMLCleanup.defaults, preserveLineBreak); var stripHTMLRegex = /(<([^>]+)>)/ig; var a = $.trim($(this).html()).replace(/(\<br\>)/ig,'\n').replace(stripHTMLRegex, ""); if(settings.preserveLineBreak){ a = a.replace(/(\n)/ig,'<br>'); } return $(this).html(a); }; $.fn.HTMLCleanup.defaults = { //Put back <br> tags after stripping off HTML tags preserveLineBreak: false }; }(jQuery));