Greasy Fork is available in English.

MCBProduction Employees data and utilities

Code library for MCB Production

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