朔用拡張機能開発スレ

0ef09d05 anonymous 2011-03-10 02:49
[[新月の開発/9feaf239]]

色が変わるところまでは出来た。どんなタグにするかな。

shingetsu.addInitializer(function () {

    var regCM = /(^|<br>)@@color/mi;
    var regR = /(^|<br>)(@r)/mig;
    var regB = /(^|<br>)(@b)/mig;
    var cWhite = '<font color="white">';
    var cBlack = '<font color="black">';
    var cRed = '<font color="red">';
    var cEnd = '</font>';

    var dd = document.getElementsByTagName('dd');
    for (var i=0; i<dd.length; i++) {
        if (dd[i].innerHTML.match(regCM)) {

            dd[i].style.backgroundColor = 'white';
            var s = dd[i].innerHTML;
            s = s.replace(regB,function(d,p1,p2){return p1+cEnd+cBlack+p2});
            s = s.replace(regR,function(d,p1,p2){return p1+cEnd+cRed+p2});
            dd[i].innerHTML = cBlack + s + cEnd;

        }
    }
});

Top of this page. | <<last 0 1

limit: 15360KB

(朔用拡張機能開発スレ/146/0.3MB)


Powered by shinGETsu.