🏠 

Greasy Fork is available in English.

MCBProduction Employees data and utilities

Code library for MCB Production

此脚本不应直接安装,它是一个供其他脚本使用的外部库。如果您需要使用该库,请在脚本元属性加入:// @require https://update.greasyfork.org/scripts/7042/31148/MCBProduction%20Employees%20data%20and%20utilities.js

  1. GM_addStyle("\
  2. [id^=\"POdata\"]{display:block;}\
  3. [id^=\"POimage\"]{display:block;float:left;border:2px solid #fff;border-radius:30px;background-color:#fff;width:55px;height:55px;overflow:hidden;position:relative;}\
  4. [id^=\"POimage\"] img {float:left;height:70px;max-width:inherit;position:absolute;left:-20px}\
  5. [id^=\"POdetail\"]{float:left;width:60%;height:51px;padding:0 0 4px;margin-left:9px;}\
  6. .link-button i, .quick-button i, .user i {margin:0 5px 0 0;}\
  7. .red, .red:hover {color:red;}\
  8. .vanish{display:none}\
  9. .edit {padding-right:100px;padding-bottom:30px}\
  10. .short {width:58% !important;}\
  11. .dwarf {width:23% !important;}\
  12. .rightControl{position:absolute;width:100px;height:30px;top:0;right:0;}\
  13. .rightControl a {float:right;}\
  14. #__tRowDesc {position:relative;}\
  15. #__tDescription a {color:#0D96CC;}\
  16. #projectDescription, #taskDescription, #activityDescription{width:90%;}\
  17. #quickActionWrapper.stickyPanel {position:fixed; top:0px;}\
  18. #quickActionPanel {display:block; width:250px; position:absolute; top:142px; right:350px; box-shadow:0px 0px 10px 3px #999}\
  19. .stickyPanel #quickActionPanel { position:fixed; top:15px}\
  20. #quickActionWrapper .sub-control-groups {margin-bottom:7px;}\
  21. #quickActionWrapper select {height:25px; width:74px;}\
  22. #quickActionWrapper .expanded {width:117px;}\
  23. @media screen and (max-width:1366px){\
  24. #quickActionPanel { right:60px;}\
  25. }\
  26. ");
  27. var $imageServer = "http://www.fotoagent.dk/single_picture/11612/20/small/";
  28. var $noImage = "http://production.mcb.dk/images/employeeNoImage.png";
  29. var $userList = [
  30. {"UserID":"119","Initial":"ABL","Username":"Anne Bank Lindberg","Email":"anne@mcb.dk","Photo":"anne.jpg","Skype":"ablindberg"},
  31. {"UserID":"142","Initial":"ADN","Username":"Anh Duong Ngoc","Email":"anhdn@mcb.vn","Photo":"Dang_Duong_Ng_c_Anh.jpg","Skype":"loaken8x"},
  32. {"UserID":"118","Initial":"AJ","Username":"Anders Jonsson","Email":"aj@mcb.dk","Photo":"anders__2_.jpg","Skype":"anders.jonsson78"},
  33. {"UserID":"143","Initial":"ALH","Username":"Anh Hoang Le","Email":"anhlh@mcb.vn","Photo":"Le_Hoang_Anh.jpg","Skype":"anhlh3"},
  34. {"UserID":"117","Initial":"ALL","Username":"Allan Lund Lauridsen","Email":"all@mcb.dk","Photo":"allan_l.jpg","Skype":"allan-mcb"},
  35. {"UserID":"144","Initial":"ANV","Username":"Anh Nguyen Viet","Email":"anv@mcb.vn","Photo":"Nguyen_Viet_Anh.jpg","Skype":"cwc_nva"},
  36. {"UserID":"116","Initial":"AWC","Username":"Allan Weyhe Cloos","Email":"awc@mcb.dk","Photo":"Allan_C.jpg","Skype":"allan.cloos"},
  37. {"UserID":"190","Initial":"BB","Username":"Bo Bundgaard","Email":"bb@mcb.dk","Photo":"bo_b.jpg","Skype":"BB-MCB"},
  38. {"UserID":"172","Initial":"BHK","Username":"Bo Hedegaard Kristensen","Email":"bo@mcb.dk","Photo":"bo.jpg","Skype":"bo-mcb"},
  39. {"UserID":"145","Initial":"CLH","Username":"Cuong Le Hung","Email":"cuong@mcb.vn","Photo":"Le_Hung_Cuong.jpg","Skype":"le.hung.cuong.89"},
  40. {"UserID":"121","Initial":"CP","Username":"Costin Popescu","Email":"costy@mcb.dk","Photo":"costi.jpg","Skype":"ssj_costy"},
  41. {"UserID":"176","Initial":"DBS","Username":"Dan Bastrup Sørensen","Email":"dbs@mcb.dk","Photo":"dan.jpg","Skype":"danbastrupmcb"},
  42. {"UserID":"4","Initial":"DHE","Username":"Daniel Esbersen","Email":"dhe@mcb.dk","Photo":"daniel.jpg","Skype":"dhe.mcb"},
  43. {"UserID":"147","Initial":"DHV","Username":"Dinh Ha Van","Email":"dinh@mcb.vn","Photo":"Dinh.jpg","Skype":"hadinhhd"},
  44. {"UserID":"162","Initial":"DXD","Username":"Dzung Dinh Xuan ","Email":"dzung@mcb.vn","Photo":"Dinh_Xuan_Dzung.jpg","Skype":"scottdinh"},
  45. {"UserID":"181","Initial":"FB","Username":"Finn Brose","Email":"fb@mcb.dk","Photo":"finn.jpg","Skype":"fbrose"},
  46. {"UserID":"124","Initial":"FCL","Username":"Flemming Clausen Lund","Email":"fcl@mcb.dk","Photo":"flemmeing.jpg","Skype":"flemmingclund"},
  47. {"UserID":"159","Initial":"HD","Username":"Huong Do Lan","Email":"huong@mcb.vn","Photo":"Do_Lan_Huong.jpg","Skype":"wonkyass06"},
  48. {"UserID":"125","Initial":"HK","Username":"Helle Krogh","Email":"hk@mcb.dk","Photo":"","Skype":""},
  49. {"UserID":"183","Initial":"HKD","Username":"Heinrich Dalager","Email":"hkd@mcb.dk","Photo":"heinrich_1_.jpg","Skype":"dalager1"},
  50. {"UserID":"160","Initial":"HLD","Username":"Hoa Luu Duc","Email":"hoald@mcb.vn","Photo":"Luu_Thi_Duc_Hoa.jpg","Skype":"luuduchoa8"},
  51. {"UserID":"171","Initial":"HMF","Username":"Henrik Semback Much-Fals","Email":"hmf@mcb.dk","Photo":"henrik.jpg","Skype":""},
  52. {"UserID":"158","Initial":"HNH","Username":"Hoa Nguyen Hong","Email":"hoa@mcb.vn","Photo":"Nguyen_Hong_Hoa(1).jpg","Skype":"nicekitty09"},
  53. {"UserID":"149","Initial":"HTN","Username":"Hieu Nguyen Thanh","Email":"hieu@mcb.vn","Photo":"","Skype":"sweet_boy0301"},
  54. {"UserID":"154","Initial":"HTT","Username":"Ha Tran Thi","Email":"ha@mcb.vn","Photo":"","Skype":"tranthiha"},
  55. {"UserID":"126","Initial":"ILF","Username":"Ignacio López Flores","Email":"","Photo":"","Skype":""},
  56. {"UserID":"126","Initial":"JAC","Username":"Jacob Knutsson Sandhøj","Email":"jacob@mcb.dk","Photo":"jacob_a.jpg","Skype":"quaserqual"},
  57. {"UserID":"5","Initial":"JKL","Username":"Janus Klok Matthesen","Email":"janus@mcb.dk","Photo":"janus.jpg","Skype":"janusklok"},
  58. {"UserID":"129","Initial":"JN","Username":"John Nielsen","Email":"jn@mcb.dk","Photo":"John.jpg","Skype":"john.nielsen30"},
  59. {"UserID":"128","Initial":"JSP","Username":"Jesper Splidsboel","Email":"jsp@mcb.dk","Photo":"Jesper.jpg","Skype":" jsplidsboel"},
  60. {"UserID":"174","Initial":"KBJ","Username":"Kasper Brøndum Jensen","Email":"kbj@mcb.dk","Photo":"Kasper_Br_ndum_Jensen.jpg","Skype":"kbjensen83"},
  61. {"UserID":"180","Initial":"KD","Username":"Kasper Dorby","Email":"kd@mcb.dk","Photo":"KasperD.jpg","Skype":""},
  62. {"UserID":"184","Initial":"KHT","Username":"Kristoffer Hauge Tarp","Email":"kht@mcb.dk","Photo":"kristoffer.jpg","Skype":"kristoffer_hauge_tarp"},
  63. {"UserID":"131","Initial":"LBE","Username":"Lasse Bech Eiler","Email":"lasse@mcb.dk","Photo":"lasse.jpg","Skype":"lasse_bech_eiler"},
  64. {"UserID":"130","Initial":"LDS","Username":"Lars Duelund Sørensen","Email":"lds@mcb.dk","Photo":"lars.jpg","Skype":"lars.duelund.sorensen"},
  65. {"UserID":"150","Initial":"LKD","Username":"Linh Dang Khanh","Email":"linhdk@mcb.vn","Photo":"Dang_Khanh_Linh.jpg","Skype":"linhdtk"},
  66. {"UserID":"165","Initial":"LM","Username":"Line Meier Degnbol","Email":"lm@mcb.dk","Photo":"line.jpg","Skype":"line-mcb"},
  67. {"UserID":"165","Initial":"LMD","Username":"Ly Mai Dao","Email":"ly@mcb.vn","Photo":"dao_mai_ly.jpg","Skype":"peachapricot89"},
  68. {"UserID":"165","Initial":"LMN","Username":"Luan Nguyen Minh","Email":"luan@mcb.vn","Photo":"","Skype":"nm_luan"},
  69. {"UserID":"132","Initial":"LP","Username":"Leif Pedersen","Email":"lp@mcb.dk","Photo":"Leif.jpg","Skype":"lp_mcb"},
  70. {"UserID":"136","Initial":"MAP","Username":"Morten Arp Pedersen","Email":"map@mcb.dk","Photo":"morten_arp.jpg","Skype":"mortenarp"},
  71. {"UserID":"175","Initial":"MB","Username":"Michael Bille","Email":"mb@mcb.dk","Photo":"bille.jpg","Skype":"michael_bille107"},
  72. {"UserID":"133","Initial":"MBH","Username":"Malte Bolvig Hansen","Email":"mbh@mcb.dk","Photo":"malte__eb.jpg","Skype":"malte_mcb"},
  73. {"UserID":"187","Initial":"MO","Username":"Marie Odgaard","Email":"mo@mcb.dk","Photo":"Marie_Odgaard.jpg","Skype":"marie.odgaard2"},
  74. {"UserID":"187","Initial":"MOV","Username":"Morten Overgaard Mønsted","Email":"mov@mcb.dk","Photo":"mov.jpg","Skype":"djoike"},
  75. {"UserID":"178","Initial":"MSK","Username":"Mie Sejer Kristensen","Email":"mie@mcb.dk","Photo":"mie__3_.jpg","Skype":""},
  76. {"UserID":"188","Initial":"NHB","Username":"Nina Hildebrandt Birkmose","Email":"nhb@mcb.dk","Photo":"","Skype":"nina.hildebrandt.birkmose"},
  77. {"UserID":"137","Initial":"NJN","Username":"Nicolas Jægergaard Nielsen","Email":"njn@mcb.dk","Photo":"","Skype":"njn-mcb"},
  78. {"UserID":"173","Initial":"PB","Username":"Peter Bjerregaard","Email":"pb@mcb.dk","Photo":"peter.jpg","Skype":"mrpeterbjerregaard"},
  79. {"UserID":"200","Initial":"PER","Username":"Peter Engelst Rasmussen","Email":"per@mcb.dk","Photo":"peter(1).jpg","Skype":"live:per_323"},
  80. {"UserID":"186","Initial":"PTA","Username":"Preben Thrige Andersen","Email":"pta@mcb.dk","Photo":"preben.jpg","Skype":"preben.t.andersen"},
  81. {"UserID":"185","Initial":"QVV","Username":"Quyet Vu Van","Email":"quyetvv@mcb.vn","Photo":"Vu_Van_Quyet(1).jpg","Skype":"quyetvv"},
  82. {"UserID":"195","Initial":"SH","Username":"Sara Hernes","Email":"sh@mcb.dk","Photo":"","Skype":""},
  83. {"UserID":"177","Initial":"SHS","Username":"Shiela Smed","Email":"shs@mcb.dk","Photo":"","Skype":"shiela.smed"},
  84. {"UserID":"139","Initial":"SP","Username":"Stine Pedersen","Email":"sp@mcb.dk","Photo":"stine.jpg","Skype":"stine_pedersen"},
  85. {"UserID":"169","Initial":"THK","Username":"Thanh Hoang Kim","Email":"thanh@mcb.vn","Photo":"Hoang_Kim_Thanh.jpg","Skype":"hkthanh2"},
  86. {"UserID":"140","Initial":"TP","Username":"Thomas Pedersen","Email":"tp@mcb.dk","Photo":"tp__1_(1).jpg","Skype":""},
  87. {"UserID":"202","Initial":"TTMT","Username":"Trieu Thi Mai Trang","Email":"trang@mcb.vn","Photo":"Trieu_Thi_Mai_Trang.jpg","Skype":"trieuthimaitrang"},
  88. {"UserID":"164","Initial":"TVP","Username":"Truong Phan Van","Email":"truong@mcb.vn","Photo":"","Skype":"igooglevn"},
  89. {"UserID":"157","Initial":"XNH","Username":"Xuan Nguyen Hong","Email":"xuan@mcb.vn","Photo":"","Skype":"aht_xuannh87"},
  90. {"UserID":"194","Initial":"AAS","Username":"Alex Asp Sørensen","Email":"aas@mcb.dk","Photo":"alex.jpg","Skype":"Alex.AspSorensenMCB"}];
  91. (function($){
  92. 'use strict';
  93. /**
  94. * addEmployeeDetail plugin
  95. *
  96. * Transforms a simple username string into rich user information,
  97. * including Picture, Fullname, Email, and Skype ID.
  98. *
  99. * User data structure is organized as a JSON object named $userList.
  100. *
  101. * Option(s): {initial:false}
  102. *
  103. * Simple usage:
  104. * $('div').addEmployeeDetail();
  105. *
  106. * With optional parameter:
  107. * $('div').addEmployeeDetail({initial:true})
  108. *
  109. * Default parameter(s) can be changed anywhere by assigning value to:
  110. * $.fn.addEmployeeDetail.defaults
  111. *
  112. **/
  113. $.fn.addEmployeeDetail = function(useOnlyInitial){
  114. var settings = $.extend({}, $.fn.addEmployeeDetail.defaults, useOnlyInitial);
  115. var $data = $.trim(this.text()), $initial;
  116. if($data !== ''){
  117. // Use user's initial as input
  118. if(settings.initial){
  119. $initial = $data;
  120. }
  121. else{
  122. // Use user's full name string as input (f.x.: JKL (Janus Klok Matthesen)) and take the leading characters as Initial
  123. $initial = $data.substr(0, $data.indexOf(' '));
  124. }
  125. // Iterate the user object list to find a match of Initial
  126. var $POdata = $.grep($userList, function(i){
  127. return i.Initial === $initial;
  128. });
  129. if($POdata.length > 0){
  130. var rnd = Math.floor(Math.random()*100000000000000000);
  131. if ($POdata[0].Username != null){
  132. this.text('').prepend($('<div/>').attr({
  133. 'id':'POdata' + rnd,
  134. 'data-userguid':$POdata[0].UserID,
  135. 'data-user-initial':$initial
  136. }));
  137. }
  138. $('<div class="user"><div id="POimage' + rnd + '" class="img"></div><div id="POdetail' + rnd + '" class="detail"></div></div>').appendTo($('#POdata'+rnd));
  139. if($.trim($POdata[0].Photo) !== ""){
  140. $('<img/>').attr('src',$imageServer + $POdata[0].Photo).appendTo($('#POimage'+rnd));
  141. }
  142. else{
  143. $('<img/>').attr('src',$noImage).appendTo($('#POimage'+rnd));
  144. }
  145. $('<div/>').attr('id','POname'+rnd).text($POdata[0].Username).appendTo($('#POdetail'+rnd));
  146. $('<div/>').attr('id','POemail'+rnd).html('<i class="icon-envelope"></i><a href="mailto:' + $POdata[0].Email + '">' + $POdata[0].Email + '</a>').appendTo($('#POdetail'+rnd));
  147. if($.trim($POdata[0].Skype) !== ""){
  148. $('<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));
  149. }
  150. return this;
  151. }
  152. }
  153. };
  154. //Default configuration of addEmployeeDetail()
  155. $.fn.addEmployeeDetail.defaults = {
  156. //Parse data using only user's Initial or not
  157. initial : false
  158. };
  159. /**
  160. * urlToLink plugin
  161. *
  162. * Transforms URLs in text into HTML <a> elements.
  163. *
  164. * Example: Lorem ipsum dolor sit amet consecter adpsim elit http://loremipsum.com
  165. * Result: Lorem ipsum dolor sit amet consecter adpsim elit <a href="http://loremipsum.com">http://loremipsum.com</a>
  166. *
  167. * HOW TO USE
  168. *
  169. * Assuming that you have already inserted jquery.js and jquery.urlToLink.js in your code
  170. * and that $ is your jQuery object reference.
  171. *
  172. * Simple usage:
  173. * $('p').urlToLink();
  174. *
  175. * Changing the parameters:
  176. * $('p').urlToLink({target:'_blank'});
  177. *
  178. * You can change the default parameters by calling
  179. * $.fn.urlToLink.defaults anywhere in your script.
  180. *
  181. * Optional parameters:
  182. * Allow long links to be compressed to a given length
  183. * by sampling the start and end of the link
  184. * and compressing them with a given string,
  185. * and, optionally, stripping the protocol prefix from the link first.
  186. * {
  187. * compressTo: 30, //The length that long links will be compressed to.
  188. * compressWith: '...' //The string that long links will be compressed with, '...' by default.
  189. * removeHttp: true //Remove the protocol prefix of the link.
  190. * }
  191. *
  192. *
  193. * LICENSE
  194. *
  195. * This plugin was inspired by John Gruber's regex at
  196. * http://daringfireball.net/2010/07/improved_regex_for_matching_urls
  197. *
  198. * Copyright (c) 2011 Gabriel Izaias (gabrielizaias.com)
  199. * Dual licensed under the MIT and GPL licenses:
  200. * http://www.opensource.org/licenses/mit-license.php
  201. * http://www.gnu.org/licenses/gpl.html
  202. *
  203. * Source: https://github.com/gabrielizaias/urlToLink/blob/master/jquery.urlToLink.js
  204. *
  205. * Email address and domain matching functionalities added
  206. * 2014-03-19 by ALH
  207. *
  208. */
  209. /*$.fn.urlToLink = function(options) {
  210. var options = $.extend({}, $.fn.urlToLink.defaults, options);
  211. return this.each(function(){
  212. var element = $(this),
  213. expression = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
  214. // The magic
  215. return element.html(element.html().replace(expression, "<a href='$1' target='"+options.target+"'>$1</a>"));
  216. });
  217. };
  218. //Default configuration
  219. $.fn.urlToLink.defaults = {
  220. target : '_blank' // Link target
  221. };*/
  222. var emailMatchingRegEx = /([a-z0-9_\.\-]+)@([\da-z\.\-]+)\.([a-z\.]{2,6})/ig,
  223. linkMatchingRegEx = /(\b(?:https?|ftp|file):\/\/[\-A-Z0-9+&@#\/%?=~_|!:,.;]*[\-A-Z0-9+&@#\/%=~_|])/ig,
  224. domainMatchingRegEx = /(?:^|\n|\s)(\w.?(?:[\w\-]+[^\W])+(?:[\.]+[\w\-]+)(?:[\.]+(?:[\w\-])*)*?(?:\s|$|\r))/ig;
  225. $.fn.urlToLink = function (options) {
  226. options = $.extend({}, $.fn.urlToLink.defaults, options);
  227. return this.each(function () {
  228. if(options.cleanupHTML){
  229. $(this).HTMLCleanup({preserveLineBreak:options.preserveLineBreak});
  230. }
  231. //Convert Email addresses to actual Links
  232. $(this).html($(this).html().replace(emailMatchingRegEx, function($0, $1){
  233. return '<a href="mailto:' + $0 + '" title="' + $0 + '">' + $0 + '</a>';
  234. }));
  235. //Convert URL to actual Links
  236. $(this).html($(this).html().replace(
  237. linkMatchingRegEx,
  238. function (match, contents, offset, s) {
  239. var href = match,
  240. linkText = '',
  241. lengthToSplit = 0;
  242. if (options.removeHttp)
  243. href = href.replace("http://", "").replace("https://", "");
  244. linkText = href;
  245. if (options.compressTo) {
  246. if (href.length > options.compressTo) {
  247. lengthToSplit = (options.compressTo - options.compressWith.length) / 2;
  248. linkText = href.substring(0, lengthToSplit) +
  249. options.compressWith +
  250. href.slice(-lengthToSplit);
  251. }
  252. }
  253. return '<a href="' + match + '" title="' + match + '" target="' + options.target + '">' + linkText + '</a>';
  254. }
  255. ));
  256. /*
  257. * Convert standalone domain names to actual links
  258. */
  259. //Break the content using '<br>' as delimiter into an array of string
  260. var c = $(this).html().toString().split('<br>'),
  261. t = [];
  262. //iterate the content array
  263. $.each(c, function(index,value) {
  264. var k = $.trim(value);
  265. if(k.length > 0) {
  266. //break the string into words using ' ' as delimeter
  267. //to avoid matching unusual long string of continuos word characters
  268. var p = k.split(' '), q = [];
  269. $.each(p, function(x,y) {
  270. var s = y.toString();
  271. if(y.length < 64) {
  272. s = s.replace(domainMatchingRegEx, function($0, $1) {
  273. var href= $.trim($0).toString().toLowerCase();
  274. var ret = '<a href="http://' + href + '" title="http://' + href + '" target="' + options.target + '">' + $.trim($0) + '</a>';
  275. return ret;
  276. });
  277. }
  278. q.push(s);
  279. });
  280. k = q.join(' ');
  281. //push the processed data into the temporary array
  282. t.push(k);
  283. }
  284. else
  285. t.push(k);
  286. k = null;
  287. });
  288. //join the array members together using <br> as delimiter
  289. $(this).html(t.join('<br>'));
  290. });
  291. };
  292. /**
  293. * Default configuration of urlToLink()
  294. */
  295. $.fn.urlToLink.defaults = {
  296. // Clean-up HTML tags
  297. cleanupHTML: true,
  298. // Preserve line breaks
  299. preserveLineBreak: false,
  300. // Link target
  301. target : '_blank',
  302. // Text to add when compressedTo is set, '...' by default
  303. compressWith: '&hellip;'
  304. };
  305. /*
  306. * Clean-up HTML tags inside the processed element.
  307. * <br> tags are replaced with '\n' before stripping off HTML tags
  308. * and put back after stripping.
  309. */
  310. $.fn.HTMLCleanup = function(preserveLineBreak){
  311. var settings = $.extend({}, $.fn.HTMLCleanup.defaults, preserveLineBreak);
  312. var stripHTMLRegex = /(<([^>]+)>)/ig;
  313. var a = $.trim($(this).html()).replace(/(\<br\>)/ig,'\n').replace(stripHTMLRegex, "");
  314. if(settings.preserveLineBreak){
  315. a = a.replace(/(\n)/ig,'<br>');
  316. }
  317. return $(this).html(a);
  318. };
  319. $.fn.HTMLCleanup.defaults = {
  320. //Put back <br> tags after stripping off HTML tags
  321. preserveLineBreak: false
  322. };
  323. }(jQuery));