SyntaxHighlighter 2.0
dp.SyntaxHighlighter.HighlightAll ���g���āA�����ł�����
�R�[�h�̕ϊ����悤�Ƃ��Ă���ꍇ�AOpera �ł̓^�u�����������悤�ł��B
�����ŁAshLegacy.js ��ύX���āAOpera �̎����� SyntaxHighlighter.all() ��
�g�p����悤�ɂ��܂����B
������Ă�鎖�ɂȂ�܂����A���ɖ��͏o�Ă��܂���
����ƁA���̏ꍇ�ł� brush:�^�C�v �Ƃ����V�����������łȂ���
���f����Ȃ��̂Œ��ӂ��ĉ������B
HighlightAll: function(
name,
showGutter /* optional */,
showControls /* optional */,
collapseAll /* optional */,
firstLine /* optional */,
showColumns /* optional */
)
{
function findValue()
{
var a = arguments;
for (var i = 0; i < a.length; i++)
{
if (a[i] === null)
continue;
if (typeof(a[i]) == 'string' && a[i] != '')
return a[i] + '';
if (typeof(a[i]) == 'object' && a[i].value != '')
return a[i].value + '';
}
return null;
};
function findTagsByName(list, name, tagName)
{
var tags = document.getElementsByTagName(tagName);
for (var i = 0; i < tags.length; i++)
if (tags[i].getAttribute('name') == name)
list.push(tags[i]);
}
var userAgent = window.navigator.userAgent.toLowerCase();
var appVersion = window.navigator.appVersion.toLowerCase();
if (userAgent.indexOf("opera") > -1) {
SyntaxHighlighter.all();
return;
}
var elements = [],
highlighter = null,
registered = {},
propertyName = 'innerHTML'
;
// for some reason IE doesn't find <pre/> by name, however it does see them just fine by tag name...
findTagsByName(elements, name, 'pre');
findTagsByName(elements, name, 'textarea');
if (elements.length === 0)
return;
for (var i = 0; i < elements.length; i++)
{
var element = elements[i],
params = findValue(
element.attributes['class'], element.className,
element.attributes['language'], element.language
),
language = ''
;
if (params === null)
continue;
params = dp.SyntaxHighlighter.parseParams(
params,
showGutter,
showControls,
collapseAll,
firstLine,
showColumns
);
SyntaxHighlighter.highlight(params, element);
}
}
posted by night wálker at 19:59|
SyntaxHighlighter