Hi, I am using Internet Explorer and <<tiddler copytoClipboard with: “Some
text”>> to copy text from a hyperlink to the clipboard:
[[copytoClipboard]]
/%
!show
<html><nowiki><a href="javascript:;" title="$2"
onclick="
var holdtext = document.createElement('TEXTAREA');
holdtext.innerText='$1';
Copied = holdtext.createTextRange();
Copied.execCommand('Copy');
return false;
">$1</a></html>
!end
%/<<tiddler {{var src='copytoClipboard';
src+(tiddler&&tiddler.title==src?'##info':'##show')}}
with: {{'$1'!='$'+'1'?'$1':'copytoClipboard'}}
{{'$2'!='$'+'2'?'$2':'clicking this link
will copy this text into the clipboard'}}
{{'$3'!='$'+'3'?'$3':'copytoClipboard'}}
>>
----
However, now I have a need to use a clipboard icon instead of the text and
cant figure out how to do that. I tried creating a clipboard icon which I
created hijacking <<smiley :)>> and modifying the imageMap to create a tiny
little clipboard but cant get it into by copytoClipboard transclusion:
[[smiley]] tagged with systemConfig
config.macros.smiley = {}
config.macros.smiley.handler = function(place,macroName,params)
{
var palette =
["transparent","#000000","#ffff00","#00ff00","#ffffff","#666666","#a3141e","#b06b63","#cc9900","#dd9030","#dddddd","#e89d00","#edc32a","#f3cb3c","#fdf201","#fdf526","#ff3149","#ffac00","#ffbf06","#ffc846","#ffcc66","#ffd758","#ffdd01","#ffea7b","#ffed55","#ffffff"];
var data = params;
var imageMap = null;
if(data[0] == ":-)" || data[0] == ":)")
imageMap =
"aaaaaabbbaaaaaaaaabbbbebbbbaaaaabccbeeebccbaaaabccbbbbbccbaaaabcccccccccbaaaabcccdddcccbaaaabccdcccdccbaaaabcdcccccdcbaaaabcdcccccccbaaaabcdcccccccbaaaabcdcccccdcbaaaabccdcccdccbaaaabcccdddcccbaaaabcccccccccbaaaaabbbbbbbbbaaa";
else if(data[0] == ":-(" || data[0] == ":(")
imageMap =
"aaaaaaabaaaaaaaaaaaaabebaaaaaaaaaaabecebaaaaaaaaabecccebaaaaaaababecebabaaaaabebabebabebaaabecebababecebabecccebabecccebabecebababecebaaabebabebabebaaaaababecebabaaaaaaabecccebaaaaaaaaabecebaaaaaaaaaaabebaaaaaaaaaaaaabaaaaaaa";
else if(data[0] == ";-)" || data[0] == ";)")
imageMap =
"aaaaabbbbbaaaaaaaabdtyyvtdbaaaaabnyxxxxxujbaaabmyyxxxxxuujbaadyyyxxxeetttdabppphddyddpmmlbbwoooooooowsrlbbwwpooooowwmrlbbwwboooowwwbllbbwwwboooowbrllbacwwwbbbbbrllcaablswwwwsrrlibaaablsssrrllibaaaaabcrrlllcbaaaaaaaabbbbbaaaaa";
else if(data[0] == ":-|" || data[0] == ":|")
imageMap =
"aaaaabbbbbaaaaaaaabdtyyvtdbaaaaabnyxxxxxujbaaabmyyffyffuujbaadyyyeeyeetttdabppppddyddpmmlbbwoooooooowsrlbbwwpooooowwmrlbbwwoooooowwrllbbwwwwbbbbbsrllbacwwwwwwwsrllcaablswwwwsrrlibaaablsssrrllibaaaaabcrrlllcbaaaaaaaabbbbbaaaaa";
else if(data[0] == ":-D" || data[0] == ":D")
imageMap =
"aaaaabbbbbaaaaaaaabdtyyvtdbaaaaabnyxxxxxujbaaabmyyeeyeeuujbaadyyyeeyeetttdabppppyyyyypmmlbbwbbbbbbbbbbblbbwbkzzzzzzzkbwbbwbfzzzzzzzfbwbbwbkzzzzzzzkbwbacwbkzzzzzkblcaablsbkzzzkblibaaablsbbbbblibaaaaabcrrlllcbaaaaaaaabbbbbaaaaa";
else
createTiddlyElement(place,"span",null,"errorNoSuchMacro","unknown
smiley");
if(imageMap)
{
var box =
createTiddlyElement(place,"span",null,"smiley",String.fromCharCode(160));
box.style.position = "relative";
box.style.width = "15px";
box.style.height = "15px";
box.style.marginLeft = "1px";
box.style.marginRight = "1px";
box.style.paddingRight = "12px";
box.style.verticalAlign = "top";
//now divide into 15x15 grid and create each
pixel
// rows
for(r=0; r<15; r++)
{
// columns
for(c=0; c<15; c++)
{
//create
each pixel with the correct background
var pix =
document.createElement("img");
pix.className
= "smileyPixel";
pix.style.position
= "absolute";
pix.border =
0;
pix.style.top
= r + "px";
pix.style.left
= c + "px";
pix.style.width
= "1px";
pix.style.height
= "1px";
pix.style.backgroundColor
= palette[imageMap.charCodeAt((r*15)+c)-97];
pix.src =
"data:image/gif,GIF89a%01%00%01%00%91%FF%00%FF%FF%FF%00%00%00%C0%C0%C0%00%00%00!%F9%04%01%00%00%02%00%2C%00%00%00%00%01%00%01%00%40%02%02T%01%00%3B";
box.appendChild(pix);
}
}
}
}
----
Any help with this would be appreciated. Maybe I am going about it all the
wrong way but I have no way of including any external images due to system
admin restrictions.
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/tiddlywiki?hl=en.