/usr/share/tdiary/contrib/plugin/bigpresen.rb is in tdiary-contrib 3.2.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | # bigpresen.rb $Revision: 1.03 $
#
# bigpresen : ¥¯¥ê¥Ã¥¯¤Ç¿Ê¹Ô¤¹¤ë¡Ö¹â¶¶¥á¥½¥Ã¥É¡×É÷µðÂçʸ»ú¥×¥ì¥¼¥ó¥Æ¡¼¥·¥ç¥ó¤òÁÞÆþ
#
# ¥Ñ¥é¥á¥¿ :
# str : ËÜʸ¡£"|"¤Ï¥¹¥é¥¤¥É¤Î¶èÀڤꡢ"/"¤Ï¥¹¥é¥¤¥ÉÆâ¤Î²þ¹Ô¤È¤Ê¤ë¡£
# "|"¤È"|"¤òɽ¼¨¤¹¤ë¾ì¹ç¤Ë¤Ï¡¢Á°¤Ë"\"¤ò¤Ä¤±¤Æ¥¨¥¹¥±¡¼¥×¡£
# width : ¥¹¥é¥¤¥É¤ÎÉý¡£¥Ô¥¯¥»¥ë¤Ç»ØÄê¡£(¥Ç¥Õ¥©¥ë¥È : 480)
# height : ¥¹¥é¥¤¥É¤Î¹â¤µ¡£¥Ô¥¯¥»¥ë¤Ç»ØÄê¡£(¥Ç¥Õ¥©¥ë¥È : 320)
#
# ÆüµËÜʸ¤Ë¡¢<%= bigpresen 'str','width','height' %> ¤Î·Á¼°¤Çµ½Ò¤·¤Þ¤¹¡£
# ʸ»ú¤Î¥µ¥¤¥º¤Ï¡¢É½¼¨¥Æ¥¥¹¥È¤È¥¹¥é¥¤¥É¤Î¥µ¥¤¥º¤Ë¹ç¤¦¤è¤¦¼«Æ°Åª¤ËÄ´À°¤µ¤ì¤Þ¤¹¡£
# JavaScript¤ÈDHTML¤òÍѤ¤¤ÆÆ°¤«¤¹¤Î¤Ç¡¢±ÜÍ÷´Ä¶¤Ë¤è¤Ã¤Æ¤Ïɽ¼¨¤µ¤ì¤Ê¤¤¤³¤È¤â¤¢¤ê¤Þ¤¹¡£
#
# Copyright (c) 2006 Maripo Goda
# mailto:madin@madin.jp
# Document URL http://www.madin.jp/works/plugin.html
# You can redistribute it and/or modify it under GPL2.
@bigPresenID = 0;
def bigpresen (str='', width='480',height='320')
scriptID = 'bp' + @bigPresenID.to_s
@bigPresenID += 1;
presen_ary = str.gsub("\\/",'⁄').gsub("\\|","&\#65073").split(/\|/);
presen_ary.collect!{|s|
s = '"' + s.gsub('/','<br>') + '"'
}
presen_str = presen_ary.join(',')
return <<HTML
<script type="text/javascript">
<!--
t#{scriptID} = 0;
w#{scriptID}=#{width};
h#{scriptID}="#{height}";
msg#{scriptID} = new Array(#{presen_str});
function #{scriptID} () {
if (t#{scriptID} < msg#{scriptID}.length) {
msgArr = msg#{scriptID}[t#{scriptID}].split('<br>');
maxPx = h#{scriptID} * 0.8;
for (t = 0; t < msgArr.length; t ++) {
maxPx = Math.min(maxPx, w#{scriptID} * 2 * 0.9 / countLength(msgArr[t]));
}
maxPx = Math.min(maxPx, Math.floor(h#{scriptID} * 0.8 / msgArr.length));
with (document.getElementById("#{scriptID}")) {
innerHTML = msg#{scriptID}[t#{scriptID}];
style.fontSize = maxPx+"px";
style.top = ((h#{scriptID}-(maxPx * msgArr.length)) / 2) + "px";
}
t#{scriptID} ++;
}
else {
t#{scriptID} = 0;
with (document.getElementById("#{scriptID}")) {
innerHTML = "¡ÔREPLAY¡Õ";
style.fontSize = '100%';
style.top = '50%';
}
}
}
function countLength (str)
{
len = 0;
for (i = 0; i < str.length; i++) {
len ++;
if (escape(str.charAt(i)).length > 3) {
len ++
}
}
return Math.max(len, 1);
}
-->
</script>
<noscript><p>JavaScript Required.</p></noscript>
<div class="bigpresen" style="text-align:center; position:relative; width:#{width}px; height:#{height}px; background:#fff;border:ridge 4px #ccc;" onclick="#{scriptID}()">
<span id="#{scriptID}" style="width:100%; position:absolute; top:50%; left:0; line-height:100%; color:black; font-family:'£Í£Ó £Ð¥´¥·¥Ã¥¯', sans-serif;">¡ÔSTART¡Õ</span>
</div>
HTML
end
|