2 % if ($clipboard_hack) {
3 <& init_overlib.html &>
5 <&| /elements/onload.js &>
6 var transform_text = function(str) {
7 var regexp = new RegExp('.*(..):(..):(..):(..):(..):(..).*');
8 return str.replace(regexp, '$1$2$3$4$5$6');
10 var span_onclick = function() {
11 var input = document.createElement('INPUT');
12 // IE8 doesn't support textContent
13 var str = this.textContent || this.innerText || '';
14 input.value = transform_text(str);
15 input.style.position = 'absolute';
16 input.style.top = '0px';
17 input.style.left = '0px';
18 input.onblur = function() { input.parentNode.removeChild(input) }
19 this.appendChild(input);
22 // set this on any ".mac_addr" object in the doc
24 // IE8 doesn't support getElementsByClassName
25 var els = document.getElementsByTagName('span');
26 for (var i = 0; i < els.length; i++) {
27 if (els[i].className = 'mac_addr') {
28 els[i].id = 'span_mac_addr' + i;
29 els[i].onclick = span_onclick;
34 <style type="text/css">
36 border-bottom: 1px dotted blue;
41 % } # if $clipboard_hack
44 %# the only part to be included in every instance
45 <SPAN CLASS="mac_addr"><% $value |h %></SPAN>
51 $FS::CurrentUser::CurrentUser->option('enable_mask_clipboard_hack');
52 my $value = shift; # no other params